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

otSerialThread Class Reference
[Serial Handler - Management of a serial port protocolSerial Handler - Management of a serial port protocol]

Management of a serial port protocol.

#include <otSerialThread.h>


Public Member Functions

 otSerialThread ()
void init (U8 comPort, S32 baud=115200, U32 bufferSize=256, U8 eotChar=13, bool console=true)
void close ()
void clear ()
U32 count ()
bool ready ()
void read (U8 *dstBuffer)
U8 waitChar (S32 timeOut=-1)
bool getString (U8 *dstBuffer, U32 maxChars, S32 timeOut=-1)
U8 charAt (U32 pos)
void callBack (U8 rxedChar)


Constructor & Destructor Documentation

otSerialThread.otSerialThread  ) 
 

Library that manages a serial line under interrupt. Once the buffer size and the terminator character value are established, the library manages the received messages by returning them as a string.


Member Function Documentation

void otSerialThread.callBack U8  rxedChar  ) 
 

U8 otSerialThread.charAt U32  pos  ) 
 

Read a byte from the buffer

Parameters:
pos Index for the buffer
Returns:
Contents at specified address

void otSerialThread.clear  ) 
 

Clear ready flag

void otSerialThread.close  ) 
 

Close the library and free all allocated memory

U32 otSerialThread.count  ) 
 

Read received characters

Returns:
The number of received characters

bool otSerialThread.getString U8 dstBuffer,
U32  maxChars,
S32  timeOut = -1
 

Wait until a string as been received

Parameters:
dstBuffer Destination buffer
maxChars Size of the destination buffer
timeOut Timeout as ms, wait a maximum time or wait forever if -1
Returns:
True on success

void otSerialThread.init U8  comPort,
S32  baud = 115200,
U32  bufferSize = 256,
U8  eotChar = 13,
bool  console = true
 

Init the library

Parameters:
comPort Uart channell, UART0 or UART1
baud Desidered communicatio speed as baud rate. -1 don't change it.
bufferSize Buffer size used to store received messages
eotChar Used char for terminating a received string
console True if character correction is allowed

void otSerialThread.read U8 dstBuffer  ) 
 

Read a message

Parameters:
dstBuffer Destination buffer

bool otSerialThread.ready  ) 
 

Check if a new message is available

Returns:
True if a new message is available

U8 otSerialThread.waitChar S32  timeOut = -1  ) 
 

Wait until a character as been received

Parameters:
timeOut Timeout as ms, wait a maximum time or wait forever if -1
Returns:
Received char


The documentation for this class was generated from the following file: footer
otStudio - Library Reference - (C) 2020-25 Officina Turini, All Rights Reserved
Document built with Doxygen 1.4.0