void XBeeInitialise(void) { // Reset XBee module. Why don't XBee settings revert to defaults here? RESET_PIN_LOW(); DelayMs(1); // wait at least 200 ns RESET_PIN_HIGH(); // Put XBee in command mode Uart1Initialise(9600, TRUE); // init UART for 9600 DelayMs(1050); Uart1PutString("+++"); DelayMs(1050); // Configure XBee Uart1PutString("ATSM1\r"); // set sleep mode DelayMs(10); Uart1PutString("ATBD3D090\r"); // set baud rate to 250000 DelayMs(10); Uart1PutString("ATAP1\r"); // set API mode DelayMs(10); Uart1PutString("ATCN\r"); // exit command mode DelayMs(10); Uart1Initialise(250000, TRUE); // Clear receive buffer DelayMs(10); Uart1ClearRxBuffer(); }
/** * @brief Firmware entry point. * @return This function should never return. */ int main(void) { // Initialise oscillator and I/O Initialise(); // Initialise drivers and middleware modules // TimerInitialise(); // ImuInitialise(); const UartSettings uartSettings = DEFAULT_UART_SETTINGS; Uart1Initialise(&uartSettings); Uart2Initialise(&uartSettings); // Start up application tasks // SendReset(); // SendFirmwareVersion(); // Main loop while (true) { // Application tasks //SendDoTasks(); //ReceiveDoTasks(); //__delay_ms(500); //LED2_LAT = ~LED2_LAT; } }