// If we are in the middle of building a packet, send it. void radioComTxControlSignals(uint8 controlSignals) { if(controlSignals != radioComTxSignals) { radioComTxSignals = controlSignals; sendSignalsSoon = 1; radioComTxService(); } }
void main() { systemInit(); setDigitalOutput(param_arduino_DTR_pin, LOW); ioTxSignals(0); usbInit(); uart1Init(); uart1SetBaudRate(param_baud_rate); if (param_serial_mode != SERIAL_MODE_USB_UART) { radioComRxEnforceOrdering = 1; radioComInit(); } // Set up P1_5 to be the radio's TX debug signal. P1DIR |= (1<<5); IOCFG0 = 0b011011; // P1_5 = PA_PD (TX mode) while(1) { updateSerialMode(); boardService(); updateLeds(); errorService(); /* toggle_led();*/ if (param_serial_mode != SERIAL_MODE_USB_UART) { radioComTxService(); } usbComService(); switch(currentSerialMode) { case SERIAL_MODE_USB_RADIO: usbToRadioService(); break; case SERIAL_MODE_UART_RADIO: uartToRadioService(); break; case SERIAL_MODE_USB_UART: usbToUartService(); break; } } }
void main() { int8 SPI_SEND = 0; int8 prev_send = 0; systemInit(); setDigitalOutput(param_arduino_DTR_pin, LOW); ioTxSignals(0); usbInit(); spi0MasterInit(); spi0MasterSetFrequency(38400); // uart1Init(); // uart1SetBaudRate(param_baud_rate); if (param_serial_mode != SERIAL_MODE_USB_SPI) { radioComRxEnforceOrdering = 1; radioComInit(); } // Set up P1_5 to be the radio's TX debug signal. //P1DIR |= (1<<5); //IOCFG0 = 0b011011; // P1_5 = PA_PD (TX mode) while(1) { updateSerialMode(); boardService(); updateLeds(); //errorService(); if(!spi0MasterBusy() && SPI_SEND != prev_send){ spi0MasterSendByte(SPI_SEND); prev_send = SPI_SEND; } if (param_serial_mode != SERIAL_MODE_USB_SPI) { radioComTxService(); } usbComService(); // switch(currentSerialMode) // { // case SERIAL_MODE_USB_RADIO: usbToRadioService(); break; // case SERIAL_MODE_SPI_RADIO: uartToRadioService(); break; // case SERIAL_MODE_USB_SPI: usbToUartService(); break; // } switch(usbComRxReceiveByte()){ case 0: // STOP SPI_SEND += 15; SPI_SEND = (SPI_SEND%255); break; case 1: // Initialize SPI_SEND -= 15; SPI_SEND = (SPI_SEND%255); break; } } }