ArmSys Support
ArmsysApi  0.12.18

#include <BUart.h>

Inheritance diagram for BUart:
BComms

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 BUartdevs []
 

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
 
BEventQueueoeventQueue
 
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]

BError BUart::init ( BUInt8  dev,
int  baudRate = 9600,
int  bits = 8,
int  stopBits = 2 
)

Initialise device: 1 to 3.

◆ interrupt()

void BUart::interrupt ( )

◆ read()

BError BUart::read ( void *  data,
BUInt32  nBytes,
BUInt32 nRead 
)
virtual

Read nBytes, will wait for hardware.

Implements BComms.

◆ readAvailable()

BUInt BUart::readAvailable ( )
virtual

Check if data is available, returns 0 or 1.

Reimplemented from BComms.

◆ readLine()

BError BUart::readLine ( void *  data,
BUInt32  nBytes,
BUInt32 nRead 
)

Read a line (to NL char) or nBytes, will wait for hardware.

◆ setBaudrate()

BError BUart::setBaudrate ( int  baudRate)

◆ setMode485()

BError BUart::setMode485 ( Pin  txEnablePin,
Bool  rxDisable = 1,
BUInt  rxToTxGapUs = 0 
)

Sets the UART to 485 mode with a TX enable pin.

◆ setRtsCts()

BError BUart::setRtsCts ( Pin  pinRts,
Pin  pinCts,
Bool  soft 
)

Sets the UART to use the RTS and CTS lines in hardware or software.

◆ wait()

BError BUart::wait ( BUInt32  eventSet,
BTimeout  timeoutUs = BTimeoutForever,
BUInt32  num = 1 
)
virtual

Reimplemented from BComms.

◆ write()

BError BUart::write ( const void *  data,
BUInt32  nBytes,
BUInt32 nWritten 
)
virtual

Write nBytes, will wait for hardware.

Implements BComms.

◆ writeAvailable()

BUInt BUart::writeAvailable ( )
virtual

Check if can write, returns 0 or 1.

Reimplemented from BComms.

Member Data Documentation

◆ devs

BUart * BUart::devs
static

◆ odev

int BUart::odev
protected

◆ olastRxTime

BUInt32 BUart::olastRxTime
protected

◆ opinCts

Pin BUart::opinCts
protected

◆ opinRts

Pin BUart::opinRts
protected

◆ orx

Bool BUart::orx
protected

◆ orxDisable

Bool BUart::orxDisable
protected

◆ orxFifo

BFifo<char> BUart::orxFifo
protected

◆ orxToTxGap

BUInt BUart::orxToTxGap
protected

RX to RX gap in us for RS485 mode.

◆ otxEnablePin

Pin BUart::otxEnablePin
protected

◆ otxFifo

BFifo<char> BUart::otxFifo
protected

◆ ouart

USART_TypeDef* BUart::ouart
protected

◆ owait

BSemaphore BUart::owait
protected

◆ owaitReadNum

BUInt BUart::owaitReadNum
protected

The documentation for this class was generated from the following files: