Account
ArmsysApi 0.12.18 |
BUart Class Reference
#include <BUart.h>
Inheritance diagram for BUart:
Public Member Functions | |
BUart (BUInt fifoSize=64) | |
BError | init (BUInt8 dev, Pin pinTx, Pin pinRx, int baudRate=9600, int bits=8, int stopBits=2) |
Initialise device: 1 to 3. More... | |
BError | init (BUInt8 dev, int baudRate=9600, int bits=8, int stopBits=2) |
Initialise device: 1 to 3. More... | |
BError | setBaudrate (int baudRate) |
BError | setMode485 (Pin txEnablePin, Bool rxDisable=1, BUInt rxToTxGapUs=0) |
Sets the UART to 485 mode with a TX enable pin. More... | |
BError | setRtsCts (Pin pinRts, Pin pinCts, Bool soft) |
Sets the UART to use the RTS and CTS lines in hardware or software. More... | |
void | hold (Bool hold) |
Stop input via CTS. More... | |
BUInt | writeAvailable () |
Check if can write, returns 0 or 1. More... | |
BError | write (const void *data, BUInt32 nBytes, BUInt32 &nWritten) |
Write nBytes, will wait for hardware. More... | |
BUInt | readAvailable () |
Check if data is available, returns 0 or 1. More... | |
BError | read (void *data, BUInt32 nBytes, BUInt32 &nRead) |
Read nBytes, will wait for hardware. More... | |
BError | readLine (void *data, BUInt32 nBytes, BUInt32 &nRead) |
Read a line (to NL char) or nBytes, will wait for hardware. More... | |
BError | wait (BUInt32 eventSet, BTimeout timeoutUs=BTimeoutForever, BUInt32 num=1) |
void | flushRx () |
void | interrupt () |
Public Member Functions inherited from BComms | |
BComms () | |
virtual | ~BComms () |
virtual BError | init () |
virtual void | close () |
virtual const char * | name () |
The name of this interface. More... | |
virtual BUInt32 | byteRate () |
The byte rate of this interface. More... | |
virtual BError | setPacketMode (Bool packetMode) |
Set packet mode. More... | |
virtual Bool | packetMode () |
Device is in packet mode. More... | |
virtual BError | setTimeout (BTimeout timeoutUs) |
Set communication timeout. More... | |
virtual BError | connect (const char *resource) |
Create a connection. More... | |
virtual Bool | isConnected () |
virtual BError | disconnect () |
Disconnect. More... | |
virtual void | flush (Flush flush) |
virtual BError | writeChunks (const BDataChunk *chunks, BUInt nChunks, BUInt32 &nTrans) |
virtual void | eventQueue (BEventQueue *eventQueue, BUInt32 event, BUInt32 eventSet, BUInt num=1) |
virtual void | eventEnable (Bool on) |
Enable events to be sent. More... | |
Static Public Attributes | |
static BUart * | devs [] |
Protected Attributes | |
BFifo< char > | otxFifo |
BFifo< char > | orxFifo |
int | odev |
USART_TypeDef * | ouart |
Pin | otxEnablePin |
Bool | orxDisable |
BUInt | orxToTxGap |
RX to RX gap in us for RS485 mode. More... | |
BSemaphore | owait |
BUInt | owaitReadNum |
Bool | orx |
BUInt32 | olastRxTime |
Pin | opinCts |
Pin | opinRts |
Protected Attributes inherited from BComms | |
Bool | oconnected |
Bool | opacketMode |
BTimeout | otimeout |
BEventQueue * | oeventQueue |
Bool | oeventEnabled |
BUInt32 | oevent |
BUInt32 | oeventSet |
BUInt | oeventNum |
Additional Inherited Members | |
Public Types inherited from BComms | |
enum | Flush { FlushRead, FlushWrite, FlushReadWrite } |
Constructor & Destructor Documentation
◆ BUart()
BUart::BUart | ( | BUInt | fifoSize = 64 | ) |
Member Function Documentation
◆ flushRx()
void BUart::flushRx | ( | ) |
◆ hold()
void BUart::hold | ( | Bool | hold | ) |
Stop input via CTS.
◆ init() [1/2]
BError BUart::init | ( | BUInt8 | dev, |
Pin | pinTx, | ||
Pin | pinRx, | ||
int | baudRate = 9600 , | ||
int | bits = 8 , | ||
int | stopBits = 2 | ||
) |
Initialise device: 1 to 3.
◆ init() [2/2]
Initialise device: 1 to 3.
◆ interrupt()
void BUart::interrupt | ( | ) |
◆ read()
Read nBytes, will wait for hardware.
Implements BComms.
◆ readAvailable()
| virtual |
Check if data is available, returns 0 or 1.
Reimplemented from BComms.
◆ readLine()
Read a line (to NL char) or nBytes, will wait for hardware.
◆ setBaudrate()
BError BUart::setBaudrate | ( | int | baudRate | ) |
◆ setMode485()
Sets the UART to 485 mode with a TX enable pin.
◆ setRtsCts()
Sets the UART to use the RTS and CTS lines in hardware or software.
◆ wait()
| virtual |
Reimplemented from BComms.
◆ write()
Write nBytes, will wait for hardware.
Implements BComms.
◆ writeAvailable()
| virtual |
Check if can write, returns 0 or 1.
Reimplemented from BComms.
Member Data Documentation
◆ devs
| static |
◆ odev
| protected |
◆ olastRxTime
| protected |
◆ opinCts
| protected |
◆ opinRts
| protected |
◆ orx
| protected |
◆ orxDisable
| protected |
◆ orxFifo
| protected |
◆ orxToTxGap
| protected |
RX to RX gap in us for RS485 mode.
◆ otxEnablePin
| protected |
◆ otxFifo
| protected |
◆ ouart
| protected |
◆ owait
| protected |
◆ owaitReadNum
| protected |
The documentation for this class was generated from the following files:
Generated by 1.8.15