Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

Serial - Code example
[SERIAL - Procedure for serial usage]

 #include <otSerial.h>

 // For all interrupts service routine you MUST specify FAST_CODE_1 or 
 // FAST_CODE_2 as locator attribute!
 FAST_CODE_2 void _serialCallBack()
 {
   // Get received char
   U8  rx = UartChar(UART0);
   // Echo the received char plus LF
   UartPutChar(UART0, 10);
   UartPutChar(UART0, rx);
   UartPutChar(UART0, 10);
 }

 void setup()
 {
   // Enable UART signal on related ports
   UartEnableSignals(UART0);
   // Set baud rate and specify interrupt callback
   UartReceiveService(UART0, 115200, _serialCallBack);
 }

 void loop()
 {
 }
footer
otStudio - Library Reference - (C) 2020-23 Officina Turini, All Rights Reserved
Document built with Doxygen 1.4.0