MAV'RIC
|
Implementation of serial peripheral for avr32. More...
#include <serial_stm32.hpp>
Public Member Functions | |
Serial_stm32 (serial_stm32_conf_t config=serial_stm32_default_config()) | |
Initialises the peripheral. | |
bool | init (void) |
Hardware initialization. | |
uint32_t | readable (void) |
Test if there are bytes available to read. | |
uint32_t | writeable (void) |
Test if there is space available to write bytes. | |
void | flush (void) |
Sends instantaneously all outgoing bytes. | |
bool | attach (serial_interrupt_callback_t func) |
Attach a function to call after a receive interrupt is generated. | |
bool | write (const uint8_t *bytes, const uint32_t size=1) |
Write bytes on the serial line. | |
bool | read (uint8_t *bytes, const uint32_t size=1) |
Read bytes from the serial line. | |
void | irq_handler (void) |
Default interrupt-handling function. |
Implementation of serial peripheral for avr32.
Serial_stm32::Serial_stm32 | ( | serial_stm32_conf_t | config = serial_stm32_default_config() | ) |
Initialises the peripheral.
config | Device configuration |
bool Serial_stm32::attach | ( | serial_interrupt_callback_t | func | ) | [virtual] |
Attach a function to call after a receive interrupt is generated.
A default handler should be provided by the implementation to add the incoming data in a buffer, so is not mandatory to call this method. The function callback will be called after the interrupt handler
func | Pointer to the callback function |
Implements Serial.
void Serial_stm32::flush | ( | void | ) | [virtual] |
Sends instantaneously all outgoing bytes.
Implements Serial.
bool Serial_stm32::init | ( | void | ) | [virtual] |
Hardware initialization.
Implements Serial.
void Serial_stm32::irq_handler | ( | void | ) |
Default interrupt-handling function.
This function is called by usartX_isr(), it is not static, thus has access to object members
bool Serial_stm32::read | ( | uint8_t * | bytes, |
const uint32_t | size = 1 |
||
) | [virtual] |
Read bytes from the serial line.
bytes | Incoming bytes |
size | Number of bytes to read |
Implements Serial.
uint32_t Serial_stm32::readable | ( | void | ) | [virtual] |
Test if there are bytes available to read.
Implements Serial.
bool Serial_stm32::write | ( | const uint8_t * | bytes, |
const uint32_t | size = 1 |
||
) | [virtual] |
Write bytes on the serial line.
byte | Outgoing bytes |
size | Number of bytes to write |
Implements Serial.
uint32_t Serial_stm32::writeable | ( | void | ) | [virtual] |
Test if there is space available to write bytes.
Implements Serial.