MAV'RIC
Classes | Public Member Functions | Static Public Member Functions
Serial_usb_stm32 Class Reference

Implementation of serial peripheral for stm32. More...

#include <serial_usb_stm32.hpp>

Inheritance diagram for Serial_usb_stm32:
Inheritance graph
[legend]
Collaboration diagram for Serial_usb_stm32:
Collaboration graph
[legend]

List of all members.

Classes

struct  conf_t
 Configuration structure. More...

Public Member Functions

 Serial_usb_stm32 (const conf_t config=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.

Static Public Member Functions

static conf_t default_config (void)
 Default Configuration structure.
static void irq (void)
 Interrupt function for the incoming usb data.

Detailed Description

Implementation of serial peripheral for stm32.


Constructor & Destructor Documentation

Initialises the peripheral.

Parameters:
configDevice configuration

Member Function Documentation

bool Serial_usb_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

Parameters:
funcPointer to the callback function
Returns:
true Success
false Failed

Implements Serial.

void Serial_usb_stm32::flush ( void  ) [virtual]

Sends instantaneously all outgoing bytes.

Returns:
Number of bytes available for writing

Implements Serial.

Here is the call graph for this function:

Here is the caller graph for this function:

bool Serial_usb_stm32::init ( void  ) [virtual]

Hardware initialization.

Returns:
true Success
false Error

Implements Serial.

Here is the caller graph for this function:

bool Serial_usb_stm32::read ( uint8_t *  bytes,
const uint32_t  size = 1 
) [virtual]

Read bytes from the serial line.

Parameters:
bytesIncoming bytes
sizeNumber of bytes to read
Returns:
true Data successfully read
false Data not read

Implements Serial.

Here is the call graph for this function:

uint32_t Serial_usb_stm32::readable ( void  ) [virtual]

Test if there are bytes available to read.

Returns:
Number of incoming bytes available

Implements Serial.

Here is the call graph for this function:

bool Serial_usb_stm32::write ( const uint8_t *  bytes,
const uint32_t  size = 1 
) [virtual]

Write bytes on the serial line.

Parameters:
byteOutgoing bytes
sizeNumber of bytes to write
Returns:
true Data successfully written
false Data not written

Implements Serial.

Here is the call graph for this function:

uint32_t Serial_usb_stm32::writeable ( void  ) [virtual]

Test if there is space available to write bytes.

Returns:
Number of bytes available for writing

Implements Serial.

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines