Calduino  1.0
EMSSerial Class Reference

#include <Calduino.h>

Inheritance diagram for EMSSerial:

Public Member Functions

 EMSSerial (volatile uint8_t *ubrrh, volatile uint8_t *ubrrl, volatile uint8_t *ucsra, volatile uint8_t *ucsrb, volatile uint8_t *ucsrc, volatile uint8_t *udr, uint8_t rxen, uint8_t txen, uint8_t rxcie)
 
 EMSSerial ()
 
bool begin (unsigned long baud)
 
void end ()
 
void writeEOF ()
 
virtual int available (void)
 
bool frameError ()
 
virtual int peek (void)
 
virtual int read (void)
 
virtual void flush (void)
 
virtual size_t write (uint8_t)
 
size_t write (unsigned long n)
 
size_t write (long n)
 
size_t write (unsigned int n)
 
size_t write (int n)
 
 operator bool ()
 

Public Attributes

volatile uint8_t _rx_buffer_head
 
volatile uint8_t _rx_buffer_tail
 
unsigned char _rx_buffer [SERIAL_BUFFER_SIZE]
 
bool _error_flag [SERIAL_BUFFER_SIZE]
 

Protected Attributes

volatile uint8_t * _ubrrh
 
volatile uint8_t * _ubrrl
 
volatile uint8_t * _ucsra
 
volatile uint8_t * _ucsrb
 
volatile uint8_t * _ucsrc
 
volatile uint8_t * _udr
 
uint8_t _rxen
 
uint8_t _txen
 
uint8_t _rxcie
 
uint8_t _error
 
bool _written
 

Detailed Description

Hardware Serial class adapted to EMS Buffer characteristics. There is only a reception buffer. WriteEOF will disable reception and change UART parity to send without errors an 11 bits 0 chain. Flush operation will disable and enable reception to erase the buffer.

Definition at line 82 of file Calduino.h.

Constructor & Destructor Documentation

◆ EMSSerial() [1/2]

EMSSerial::EMSSerial ( volatile uint8_t *  ubrrh,
volatile uint8_t *  ubrrl,
volatile uint8_t *  ucsra,
volatile uint8_t *  ucsrb,
volatile uint8_t *  ucsrc,
volatile uint8_t *  udr,
uint8_t  rxen,
uint8_t  txen,
uint8_t  rxcie 
)

EMS Serial Constructor

Parameters
[in]ubrrhUSART Baud Rate Register.
[in]ubrrlUBRRL contains the eight least significant bits of the USART baud rate.
[in]ucsraUSART Control and Status Register A.
[in]ucsrbUSART Control and Status Register B.
[in]ucsrcUSART Control and Status Register C.
[in]udrThe transmit buffer.
rxenReceiver Enable.
txenTransmitter Enable.
rxcieRX Complete Interrupt Enable.

Definition at line 271 of file Calduino.cpp.

◆ EMSSerial() [2/2]

EMSSerial::EMSSerial ( )

Default constructor

Definition at line 294 of file Calduino.cpp.

Member Function Documentation

◆ available()

int EMSSerial::available ( void  )
virtual

Gets the bytes pending to be read

Returns
Available bytes in the EMS Serial Buffer.

Definition at line 347 of file Calduino.cpp.

◆ begin()

bool EMSSerial::begin ( unsigned long  baud)

Start the communication with the EMS Bus – UART Interface Circuit

Parameters
baud- baud rate of the UART port.
Returns
True if it succeeds, false if it fails.

Definition at line 305 of file Calduino.cpp.

◆ end()

void EMSSerial::end ( )

Ends the EMS Serial communication

Definition at line 330 of file Calduino.cpp.

◆ flush()

void EMSSerial::flush ( void  )
virtual

Flushes the EMS Serial by clearing the buffer contents

Definition at line 393 of file Calduino.cpp.

◆ operator bool()

EMSSerial::operator bool ( )

Cast that converts the given to a bool

Returns
The result of the operation.

Definition at line 456 of file Calduino.cpp.

◆ peek()

int EMSSerial::peek ( void  )
virtual

Returns the top-of-stack object without removing it, or -1 otherwise.

Returns
The current top-of-stack object. If there is no object, return -1.

Definition at line 359 of file Calduino.cpp.

◆ read()

int EMSSerial::read ( void  )
virtual

Returns the top-of-stack object removing it.

Returns
The current top-of-stack object, if any. Return -1 otherwise.

Definition at line 376 of file Calduino.cpp.

◆ write()

size_t EMSSerial::write ( uint8_t  c)
virtual

Writes the given character in the EMS Serial

Parameters
cThe char to write.
Returns
The number of bytes written.

Definition at line 413 of file Calduino.cpp.

◆ writeEOF()

void EMSSerial::writeEOF ( )

Write a EMS end-of-frame character to the port First halt temporarily reception, change parity to even and then send a break-character. Then restore the settings and re-enable reception

Definition at line 435 of file Calduino.cpp.


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