Byggern
|
An interface for communicating through UART. More...
#include <uart.h>
Public Member Functions | |
void | Write (uint8_t *string, uint16_t size) |
void | Init (uint16_t baud_rate) |
UART (const UART &)=delete | |
void | operator= (const UART &)=delete |
![]() | |
Stream (uint16_t input_stream_size, uint16_t output_stream_size) | |
virtual uint16_t | Read (uint8_t *string, uint16_t size) |
virtual bool | ReadByte (uint8_t &byte) |
virtual void | WriteByte (uint8_t byte) |
virtual uint8_t | GetAvailableWriteBytes () |
virtual uint8_t | GetAvailableReadBytes () |
virtual bool | CheckInputOverflowFlag () |
virtual bool | CheckOutputOverflowFlag () |
virtual uint16_t | GetInputBufferLength () |
virtual uint16_t | GetOutputBufferLength () |
virtual void | FlushInputBuffer () |
virtual void | FlushOutputBuffer () |
Static Public Member Functions | |
static UART & | GetInstance () |
Private Member Functions | |
UART () | |
void | StartTransmission () |
Private Attributes | |
bool | ongoing_transmission = false |
Friends | |
void | USART0_UDRE_vect () |
Additional Inherited Members | |
![]() | |
virtual uint16_t | ReadFromBuffer (uint8_t *buffer, uint16_t &start_index, uint16_t &stop_index, uint16_t &buffer_size, bool &empty, uint8_t *string, uint16_t &string_size) |
virtual void | WriteToBuffer (uint8_t *buffer, uint16_t &start_index, uint16_t &stop_index, uint16_t &buffer_size, bool &empty, bool &overflow_flag, uint8_t *string, uint16_t &string_size, void(*cb)(Stream *stream)) |
virtual bool | ReadByteFromBuffer (uint8_t &byte, uint8_t *buffer, uint16_t &start_index, uint16_t &stop_index, uint16_t &buffer_size, bool &empty) |
virtual void | WriteByteToBuffer (uint8_t *buffer, uint16_t &start_index, uint16_t &stop_index, uint16_t &buffer_size, bool &empty, bool &overflow_flag, uint8_t &byte, void(*cb)(Stream *stream)) |
virtual void | WriteByteToInputStream (uint8_t &byte) |
virtual bool | ReadByteFromOutputStream (uint8_t &byte) |
virtual void | WriteToInputStream (uint8_t *string, uint16_t size) |
virtual uint16_t | ReadFromOutputStream (uint8_t *string, uint16_t size) |
virtual uint16_t | CalculateLength (uint16_t &start_index, uint16_t &stop_index, uint16_t &buffer_size, bool &empty) |
virtual void | FlushStream (uint16_t &start_index, uint16_t &stop_index, uint16_t &buffer_size, bool &empty) |
![]() | |
uint8_t * | input_buffer |
uint8_t * | output_buffer |
uint16_t | input_buffer_start_index = 0 |
uint16_t | output_buffer_start_index = 0 |
uint16_t | input_buffer_stop_index |
uint16_t | output_buffer_stop_index |
uint16_t | input_buffer_size |
uint16_t | output_buffer_size |
void(* | event_input_buffer_not_empty )(Stream *stream) = nullptr |
void(* | event_output_buffer_not_empty )(Stream *stream) = nullptr |
bool | input_buffer_empty = true |
bool | output_buffer_empty = true |
bool | input_buffer_overflowed = false |
bool | output_buffer_overflowed = false |
An interface for communicating through UART.
|
private |
A constructor that initializes the UART to a certain size
|
delete |
Beacause of singleton - makes sure its not copied etc.
|
inlinestatic |
A Singleton implementation of this class
void UART::Init | ( | uint16_t | baud_rate | ) |
Initializer because of the singleton implementation.
baud_rate | The baud rate of the uart |
|
delete |
Beacause of singleton - makes sure its not copied etc.
|
inlineprivate |
Starts the transmission. Just a void-void function to modulize
|
virtual |
Write the inserted string to output (i.e. write to computer)
string | The "data string" that shall be written to the output |
size | the size of the data string |
Reimplemented from Stream.
|
friend |
The interrupt handler vector. To be run on each DRE interrupt
|
private |
A bool to indicate whether or not a transmission is going on