semf
|
UartHardware
implemenation for STM32.
More...
#include <stm32uart.h>
Public Member Functions | |
Stm32Uart (UART_HandleTypeDef &hwHandle) | |
Constructor. More... | |
Stm32Uart (const Stm32Uart &other)=delete | |
virtual | ~Stm32Uart ()=default |
void | init () override |
void | deinit () override |
void | stopWrite () override |
void | stopRead () override |
void | setFormat (uint8_t bits, WireMode wire, Parity par, StopBits stop, FlowControl flow) override |
Sets the format for the spi slave device. More... | |
void | setBaud (uint32_t baud) override |
Sets the baud rate. More... | |
uint32_t | baud () override |
Returns the currently used baud rate. More... | |
void | isrRead (UART_HandleTypeDef &uart) |
Interrupt service routine for uart object receive. More... | |
void | isrWritten (UART_HandleTypeDef &uart) |
Interrupt service routine for uart object transmit. More... | |
Public Member Functions inherited from semf::UartHardware | |
virtual | ~UartHardware ()=default |
void | write (const uint8_t data[], size_t dataSize) override |
For writing data, dataWritten signal will be emitted after successful write. More... | |
void | read (uint8_t buffer[], size_t bufferSize) override |
For reading data, dataAvailable signal will be emitted after successful read. More... | |
bool | isBusyReading () const override |
Communication hardware is busy reading at the moment. More... | |
bool | isBusyWriting () const override |
Communication hardware is busy writing at the moment. More... | |
Public Member Functions inherited from semf::Uart | |
virtual | ~Uart ()=default |
virtual void | setFormat (uint8_t bits, WireMode wire, Parity par, StopBits stop, FlowControl flow)=0 |
Sets the format for the spi slave device. More... | |
virtual void | setBaud (uint32_t baud)=0 |
Sets the baud rate. More... | |
virtual uint32_t | baud ()=0 |
Returns the currently used baud rate. More... | |
Public Member Functions inherited from semf::CommunicationHardwareAsynchronous | |
virtual | ~CommunicationHardwareAsynchronous ()=default |
Type | type () const override |
Returns the hardware type. More... | |
void | setFrame (Frame frame) final |
Sets the selected usage of start and stop condition. More... | |
Public Member Functions inherited from semf::CommunicationHardware | |
virtual | ~CommunicationHardware ()=default |
virtual void | init ()=0 |
virtual void | deinit ()=0 |
virtual Type | type () const =0 |
Returns the hardware type. More... | |
virtual void | setFrame (Frame frame)=0 |
Sets the selected usage of start and stop condition. More... | |
Public Member Functions inherited from semf::app::Communication | |
virtual | ~Communication ()=default |
virtual void | write (const uint8_t data[], size_t dataSize)=0 |
For writing data, dataWritten signal will be emitted after successful write. More... | |
virtual void | read (uint8_t buffer[], size_t bufferSize)=0 |
For reading data, dataAvailable signal will be emitted after successful read. More... | |
virtual void | stopRead ()=0 |
virtual void | stopWrite ()=0 |
virtual bool | isBusyReading () const =0 |
Communication hardware is busy reading at the moment. More... | |
virtual bool | isBusyWriting () const =0 |
Communication hardware is busy writing at the moment. More... | |
Public Member Functions inherited from semf::LinkedQueue< T >::Node | |
virtual | ~Node ()=default |
T * | next () const |
Returns a pointer to the next element in a queue. More... | |
void | setNext (T *next) |
Sets a pointer to the next element in a list. More... | |
bool | isInQueue (LinkedQueue &queue) |
Returns if a node is part of this LinkedQueue . More... | |
Static Public Member Functions | |
static LinkedQueue< Stm32Uart > * | queue () |
Get the list with all uarts. More... | |
static void | systemIsrRead (UART_HandleTypeDef &uart) |
System-wide interrupt service routine for uart receive. More... | |
static void | systemIsrWritten (UART_HandleTypeDef &uart) |
System-wide interrupt service routine for uart transmit. More... | |
Protected Member Functions | |
void | writeHardware (const uint8_t data[], size_t dataSize) override |
Hardware will write data in interrupt mode. More... | |
void | readHardware (uint8_t buffer[], size_t bufferSize) override |
Hardware will read data in interrupt mode. More... | |
Protected Member Functions inherited from semf::UartHardware | |
void | setBusyReading (bool isBusy) |
Sets the busy flag for reading. More... | |
void | setBusyWriting (bool isBusy) |
Sets the busy flag for writing. More... | |
virtual void | writeHardware (const uint8_t data[], size_t dataSize)=0 |
Hardware will write data in interrupt mode. More... | |
virtual void | readHardware (uint8_t buffer[], size_t bufferSize)=0 |
Hardware will read data in interrupt mode. More... | |
void | onDataWritten () |
void | onDataAvailable () |
void | onError (Error thrown) |
Is called if an error occurred by hardware read or write access. Will throw error signal. More... | |
Additional Inherited Members | |
Public Attributes inherited from semf::app::Communication | |
Signal | dataWritten |
Signal | dataAvailable |
Signal | writeStopped |
Signal | readStopped |
Signal< Error > | error |
UartHardware
implemenation for STM32.
Definition at line 23 of file stm32uart.h.
|
strong |
Error codes for this class. Error ID identify a unique error() / onError call (excluding transferring).
Definition at line 27 of file stm32uart.h.
|
explicit |
Constructor.
hwHandle | uart hardware interface |
Definition at line 26 of file stm32uart.cpp.
|
explicitdelete |
|
virtualdefault |
|
overridevirtual |
Returns the currently used baud rate.
Implements semf::Uart.
Definition at line 269 of file stm32uart.cpp.
|
overridevirtual |
Deinitializes the hardware
Deinit_HalError | If the ST-HAL returns a hal error. |
Deinit_HalBusy | If the ST-HAL returns a hal bussy. |
Deinit_HalTimeout | If the ST-HAL returns a hal timeout. |
Implements semf::CommunicationHardware.
Definition at line 57 of file stm32uart.cpp.
|
overridevirtual |
Initializes the hardware.
Init_HalError | If the ST-HAL returns a hal error. |
Init_HalBusy | If the ST-HAL returns a hal bussy. |
Init_HalTimeout | If the ST-HAL returns a hal timeout. |
Implements semf::CommunicationHardware.
Definition at line 32 of file stm32uart.cpp.
void semf::Stm32Uart::isrRead | ( | UART_HandleTypeDef & | uart | ) |
Interrupt service routine for uart object receive.
uart | Hardware handler. |
Definition at line 292 of file stm32uart.cpp.
void semf::Stm32Uart::isrWritten | ( | UART_HandleTypeDef & | uart | ) |
Interrupt service routine for uart object transmit.
uart | Hardware handler. |
Definition at line 300 of file stm32uart.cpp.
|
static |
Get the list with all uarts.
Definition at line 274 of file stm32uart.cpp.
|
overrideprotectedvirtual |
Hardware will read data in interrupt mode.
buffer | data array. |
bufferSize | data array size. |
ReadHardware_HalError | If the ST-HAL returns a hal error. |
ReadHardware_HalBusy | If the ST-HAL returns a hal bussy. |
ReadHardware_HalTimeout | If the ST-HAL returns a hal timeout. |
Implements semf::UartHardware.
Definition at line 333 of file stm32uart.cpp.
|
overridevirtual |
Sets the baud rate.
baud | Baud rate. |
Implements semf::Uart.
Definition at line 261 of file stm32uart.cpp.
|
overridevirtual |
Sets the format for the spi slave device.
bits | Number of data bits (without parity) per frame. |
wire | Full duplex mode or half duplex mode. |
par | Parity. |
stop | Stop bits. |
flow | Flow control. |
SetFormat_WordLengthInvalid | If bits is invalid (7, 8 and 9 are possible). |
SetFormat_WireInvalid | If wire is invalid. |
SetFormat_ParityInvalid | If par is invalid. |
SetFormat_StopBitsInvalid | If stop is invalid. |
SetFormat_FlowInvalid | If flow is invalid. |
Implements semf::Uart.
Definition at line 134 of file stm32uart.cpp.
|
overridevirtual |
Stops the read process as fast as possible without destroying anything. The readStopped
Signal gets emitted if the call was successful.
StopRead_HalError | If the ST-HAL returns a hal error. |
StopRead_HalBusy | If the ST-HAL returns a hal bussy. |
StopRead_HalTimeout | If the ST-HAL returns a hal timeout. |
readStopped
without stack overflow protection Implements semf::app::Communication.
Definition at line 108 of file stm32uart.cpp.
|
overridevirtual |
Stops the write process as fast as possible without destroying anything. The writeStopped
Signal gets emitted if the call was successful.
StopWrite_HalError | If the ST-HAL returns a hal error. |
StopWrite_HalBusy | If the ST-HAL returns a hal bussy. |
StopWrite_HalTimeout | If the ST-HAL returns a hal timeout. |
writeStopped
without stack overflow protection Implements semf::app::Communication.
Definition at line 82 of file stm32uart.cpp.
|
static |
System-wide interrupt service routine for uart receive.
uart | Hardware handler. |
Definition at line 280 of file stm32uart.cpp.
|
static |
System-wide interrupt service routine for uart transmit.
uart | Hardware handler. |
Definition at line 286 of file stm32uart.cpp.
|
overrideprotectedvirtual |
Hardware will write data in interrupt mode.
data | data array. |
dataSize | data array size. |
WriteHardware_HalError | If the ST-HAL returns a hal error. |
WriteHardware_HalBusy | If the ST-HAL returns a hal bussy. |
WriteHardware_HalTimeout | If the ST-HAL returns a hal timeout. |
Implements semf::UartHardware.
Definition at line 308 of file stm32uart.cpp.