Advertisement
silver2row

UART2 TX and RX for XBee fprintf, fopen, fclose

Oct 9th, 2019
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. //iniitializes uart 2 for the XBEE
  2. int initializeXbee() {
  3.         //set pin 21 to uart 2 TX - output
  4.         FILE* file = fopen("/sys/kernel/debug/omap_mux/spi0_d0", "w+");
  5.         fprintf(file, "1");
  6.         fclose(file);
  7.  
  8.         //set pin 22 to uart 2 RX - input
  9.         file = fopen("/sys/kernel/debug/omap_mux/spi0_sclk", "w+");
  10.         fprintf(file, "21");
  11.         fclose(file);
  12.         return 0;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement