// // main task // int main(void) { /************************************************************************* * * your setup code here * **************************************************************************/ // // LED Demo (can be removed) // DBG("Hello I'm in debug mode\n"); CBus leds(LED1, LED2, LED3, LED4, END); leds.output(); // set all pins as output usbCDC usb; usb.enable(); // enable USB core CSerial uart; uart.enable(115200); // enable serial port int i = 0; uint8_t ch; while(1) { /********************************************************************** * * your loop code here * **********************************************************************/ // // check uart input // if ( uart.readable() ) { // // // show led scripts leds = led_scripts[i]; i = (i+1) < (int)sizeof(led_scripts) ? i+1 : 0; usb << uart; // use CStream operator << } // // check usb input // if ( usb.readable() ) { ch = usb; // use CStream operator uint8_t uart << ch; // use CStream operator << } } return 0 ; }
virtual void run() { while (1) { if (m_serial) { if (m_serial->readable()) { pxMBFrameCBByteReceived(); } if (m_serial->writeable()) { pxMBFrameCBTransmitterEmpty(); } } } }