APM:Libraries
Public Member Functions | Private Attributes | List of all members
F4Light::UARTDriver Class Reference

#include <UARTDriver.h>

Inheritance diagram for F4Light::UARTDriver:
[legend]
Collaboration diagram for F4Light::UARTDriver:
[legend]

Public Member Functions

 UARTDriver (const struct usart_dev *usart)
 
void begin (uint32_t b)
 
void begin (uint32_t b, uint32_t mode)
 
void begin (uint32_t b, uint16_t rxS, uint16_t txS)
 
void end ()
 
void flush ()
 
bool is_initialized ()
 
void set_blocking_writes (bool blocking)
 
bool tx_pending ()
 
void setCallback (Handler cb)
 
uint32_t available () override
 
uint32_t txspace () override
 
int16_t read () override
 
size_t write (uint8_t c)
 
size_t write (const uint8_t *buffer, size_t size)
 
void disable ()
 
uint64_t receive_time_constraint_us (uint16_t nbytes) override
 
void update_timestamp ()
 
- Public Member Functions inherited from AP_HAL::UARTDriver
 UARTDriver ()
 
virtual bool lock_port (uint32_t key)
 
virtual size_t write_locked (const uint8_t *buffer, size_t size, uint32_t key)
 
virtual void set_flow_control (enum flow_control flow_control_setting)
 
virtual enum flow_control get_flow_control (void)
 
virtual void configure_parity (uint8_t v)
 
virtual void set_stop_bits (int n)
 
virtual bool set_unbuffered_writes (bool on)
 
virtual bool wait_timeout (uint16_t n, uint32_t timeout_ms)
 
virtual void _timer_tick (void)
 
- Public Member Functions inherited from AP_HAL::BetterStream
virtual void printf (const char *,...) FMT_PRINTF(2
 
virtual void virtual void vprintf (const char *, va_list)
 
void print (const char *str)
 
void println (const char *str)
 
size_t write (const char *str)
 

Private Attributes

const struct usart_dev_usart_device
 
bool _initialized
 
bool _blocking
 
uint32_t _baudrate
 
uint32_t _receive_timestamp [2]
 
uint8_t _time_idx
 

Additional Inherited Members

- Public Types inherited from AP_HAL::UARTDriver
enum  flow_control { FLOW_CONTROL_DISABLE =0, FLOW_CONTROL_ENABLE =1, FLOW_CONTROL_AUTO =2 }
 

Detailed Description

Definition at line 27 of file UARTDriver.h.

Constructor & Destructor Documentation

◆ UARTDriver()

UARTDriver::UARTDriver ( const struct usart_dev usart)

Definition at line 36 of file UARTDriver.cpp.

Member Function Documentation

◆ available()

uint32_t UARTDriver::available ( void  )
overridevirtual

Implements AP_HAL::BetterStream.

Definition at line 94 of file UARTDriver.cpp.

Referenced by F4Light::DSM_parser::init(), read(), receive_time_constraint_us(), and setCallback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ begin() [1/3]

void UARTDriver::begin ( uint32_t  b)
inlinevirtual

Implements AP_HAL::UARTDriver.

Definition at line 31 of file UARTDriver.h.

Referenced by F4Light::DSM_parser::init().

Here is the caller graph for this function:

◆ begin() [2/3]

void UARTDriver::begin ( uint32_t  b,
uint32_t  mode 
)

Definition at line 44 of file UARTDriver.cpp.

Here is the call graph for this function:

◆ begin() [3/3]

void UARTDriver::begin ( uint32_t  baud,
uint16_t  rxSpace,
uint16_t  txSpace 
)
inlinevirtual

Extended port open method

Allows for both opening with specified buffer sizes, and re-opening to adjust a subset of the port's settings.

Note
Buffer sizes greater than ::_max_buffer_size will be rounded down.
Parameters
baudSelects the speed that the port will be configured to. If zero, the port speed is left unchanged.
rxSpaceSets the receive buffer size for the port. If zero then the buffer size is left unchanged if the port is open, or set to ::_default_rx_buffer_size if it is currently closed.
txSpaceSets the transmit buffer size for the port. If zero then the buffer size is left unchanged if the port is open, or set to ::_default_tx_buffer_size if it is currently closed.

Implements AP_HAL::UARTDriver.

Definition at line 36 of file UARTDriver.h.

Referenced by begin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ disable()

void F4Light::UARTDriver::disable ( )
inline

Definition at line 54 of file UARTDriver.h.

Here is the call graph for this function:

◆ end()

void UARTDriver::end ( )
inlinevirtual

Implements AP_HAL::UARTDriver.

Definition at line 37 of file UARTDriver.h.

Referenced by F4Light::DSM_parser::init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ flush()

void UARTDriver::flush ( void  )
virtual

Implements AP_HAL::UARTDriver.

Definition at line 85 of file UARTDriver.cpp.

Referenced by end().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_initialized()

bool UARTDriver::is_initialized ( )
inlinevirtual

Implements AP_HAL::UARTDriver.

Definition at line 39 of file UARTDriver.h.

◆ read()

int16_t UARTDriver::read ( void  )
overridevirtual

Implements AP_HAL::BetterStream.

Definition at line 103 of file UARTDriver.cpp.

Referenced by F4Light::DSM_parser::init(), and txspace().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ receive_time_constraint_us()

uint64_t UARTDriver::receive_time_constraint_us ( uint16_t  nbytes)
overridevirtual

Reimplemented from AP_HAL::UARTDriver.

Definition at line 152 of file UARTDriver.cpp.

Referenced by disable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_blocking_writes()

void UARTDriver::set_blocking_writes ( bool  blocking)
inlinevirtual

Implements AP_HAL::UARTDriver.

Definition at line 41 of file UARTDriver.h.

◆ setCallback()

void F4Light::UARTDriver::setCallback ( Handler  cb)
inline

Definition at line 45 of file UARTDriver.h.

Referenced by F4Light::DSM_parser::init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tx_pending()

bool UARTDriver::tx_pending ( )
inlinevirtual

Implements AP_HAL::UARTDriver.

Definition at line 43 of file UARTDriver.h.

Here is the call graph for this function:

◆ txspace()

uint32_t UARTDriver::txspace ( void  )
inlineoverridevirtual

Implements AP_HAL::BetterStream.

Definition at line 48 of file UARTDriver.h.

Here is the call graph for this function:

◆ update_timestamp()

void UARTDriver::update_timestamp ( )

Definition at line 146 of file UARTDriver.cpp.

Referenced by begin(), and disable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write() [1/2]

size_t UARTDriver::write ( uint8_t  c)
virtual

Implements AP_HAL::BetterStream.

Definition at line 110 of file UARTDriver.cpp.

Referenced by txspace().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write() [2/2]

size_t UARTDriver::write ( const uint8_t *  buffer,
size_t  size 
)
virtual

Reimplemented from AP_HAL::BetterStream.

Definition at line 127 of file UARTDriver.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ _baudrate

uint32_t F4Light::UARTDriver::_baudrate
private

Definition at line 65 of file UARTDriver.h.

Referenced by begin(), and receive_time_constraint_us().

◆ _blocking

bool F4Light::UARTDriver::_blocking
private

Definition at line 64 of file UARTDriver.h.

Referenced by set_blocking_writes(), and write().

◆ _initialized

bool F4Light::UARTDriver::_initialized
private

Definition at line 63 of file UARTDriver.h.

Referenced by available(), begin(), end(), flush(), is_initialized(), and write().

◆ _receive_timestamp

uint32_t F4Light::UARTDriver::_receive_timestamp[2]
private

Definition at line 66 of file UARTDriver.h.

Referenced by receive_time_constraint_us(), and update_timestamp().

◆ _time_idx

uint8_t F4Light::UARTDriver::_time_idx
private

Definition at line 67 of file UARTDriver.h.

Referenced by receive_time_constraint_us(), and update_timestamp().

◆ _usart_device

const struct usart_dev* F4Light::UARTDriver::_usart_device
private

Definition at line 62 of file UARTDriver.h.

Referenced by available(), begin(), disable(), end(), flush(), read(), setCallback(), tx_pending(), txspace(), and write().


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