APM:Libraries
Public Member Functions | Private Member Functions | Private Attributes | List of all members
VRBRAIN::VRBRAINUARTDriver Class Reference

#include <UARTDriver.h>

Inheritance diagram for VRBRAIN::VRBRAINUARTDriver:
[legend]
Collaboration diagram for VRBRAIN::VRBRAINUARTDriver:
[legend]

Public Member Functions

 VRBRAINUARTDriver (const char *devpath, const char *perf_name)
 
void begin (uint32_t b)
 
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 ()
 
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 set_device_path (const char *path)
 
void _timer_tick (void)
 
int _get_fd (void)
 
void set_flow_control (enum flow_control flow_control)
 
enum flow_control get_flow_control (void)
 
void configure_parity (uint8_t v)
 
void set_stop_bits (int n)
 
bool set_unbuffered_writes (bool on)
 
- 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 bool wait_timeout (uint16_t n, uint32_t timeout_ms)
 
virtual uint64_t receive_time_constraint_us (uint16_t nbytes)
 
- 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 Member Functions

int _write_fd (const uint8_t *buf, uint16_t n)
 
int _read_fd (uint8_t *buf, uint16_t n)
 
void try_initialise (void)
 

Private Attributes

const char * _devpath
 
int _fd
 
uint32_t _baudrate
 
volatile bool _initialised
 
volatile bool _in_timer
 
bool _nonblocking_writes
 
bool _unbuffered_writes
 
ByteBuffer _readbuf {0}
 
ByteBuffer _writebuf {0}
 
perf_counter_t _perf_uart
 
uint64_t _first_write_time
 
uint64_t _last_write_time
 
uint32_t _last_initialise_attempt_ms
 
uint32_t _os_start_auto_space
 
uint32_t _total_read
 
uint32_t _total_written
 
enum flow_control _flow_control
 
Semaphore _semaphore
 

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 9 of file UARTDriver.h.

Constructor & Destructor Documentation

◆ VRBRAINUARTDriver()

VRBRAINUARTDriver::VRBRAINUARTDriver ( const char *  devpath,
const char *  perf_name 
)

Definition at line 23 of file UARTDriver.cpp.

Member Function Documentation

◆ _get_fd()

int VRBRAIN::VRBRAINUARTDriver::_get_fd ( void  )
inline

Definition at line 36 of file UARTDriver.h.

Referenced by VRBRAIN::VRBRAINUtil::run_debug_shell().

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

◆ _read_fd()

int VRBRAINUARTDriver::_read_fd ( uint8_t *  buf,
uint16_t  n 
)
private

Definition at line 443 of file UARTDriver.cpp.

Referenced by _timer_tick().

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

◆ _timer_tick()

void VRBRAINUARTDriver::_timer_tick ( void  )
virtual

Reimplemented from AP_HAL::UARTDriver.

Definition at line 470 of file UARTDriver.cpp.

Referenced by set_device_path().

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

◆ _write_fd()

int VRBRAINUARTDriver::_write_fd ( const uint8_t *  buf,
uint16_t  n 
)
private

Definition at line 375 of file UARTDriver.cpp.

Referenced by _timer_tick(), and write().

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

◆ available()

uint32_t VRBRAINUARTDriver::available ( void  )
overridevirtual

Implements AP_HAL::BetterStream.

Definition at line 252 of file UARTDriver.cpp.

Here is the call graph for this function:

◆ begin() [1/2]

void VRBRAINUARTDriver::begin ( uint32_t  b)
virtual

Implements AP_HAL::UARTDriver.

Definition at line 194 of file UARTDriver.cpp.

Referenced by try_initialise().

Here is the caller graph for this function:

◆ begin() [2/2]

void VRBRAINUARTDriver::begin ( uint32_t  baud,
uint16_t  rxSpace,
uint16_t  txSpace 
)
virtual

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 43 of file UARTDriver.cpp.

Here is the call graph for this function:

◆ configure_parity()

void VRBRAINUARTDriver::configure_parity ( uint8_t  v)
virtual

Reimplemented from AP_HAL::UARTDriver.

Definition at line 156 of file UARTDriver.cpp.

Referenced by get_flow_control().

Here is the caller graph for this function:

◆ end()

void VRBRAINUARTDriver::end ( )
virtual

Implements AP_HAL::UARTDriver.

Definition at line 221 of file UARTDriver.cpp.

Here is the call graph for this function:

◆ flush()

void VRBRAINUARTDriver::flush ( void  )
virtual

Implements AP_HAL::UARTDriver.

Definition at line 234 of file UARTDriver.cpp.

◆ get_flow_control()

enum flow_control VRBRAIN::VRBRAINUARTDriver::get_flow_control ( void  )
inlinevirtual

Reimplemented from AP_HAL::UARTDriver.

Definition at line 41 of file UARTDriver.h.

Here is the call graph for this function:

◆ is_initialized()

bool VRBRAINUARTDriver::is_initialized ( )
virtual

Implements AP_HAL::UARTDriver.

Definition at line 236 of file UARTDriver.cpp.

Here is the call graph for this function:

◆ read()

int16_t VRBRAINUARTDriver::read ( void  )
overridevirtual

Implements AP_HAL::BetterStream.

Definition at line 278 of file UARTDriver.cpp.

Referenced by _read_fd().

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

◆ set_blocking_writes()

void VRBRAINUARTDriver::set_blocking_writes ( bool  blocking)
virtual

Implements AP_HAL::UARTDriver.

Definition at line 242 of file UARTDriver.cpp.

◆ set_device_path()

void VRBRAIN::VRBRAINUARTDriver::set_device_path ( const char *  path)
inline

Definition at line 30 of file UARTDriver.h.

Referenced by HAL_VRBRAIN::run().

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

◆ set_flow_control()

void VRBRAINUARTDriver::set_flow_control ( enum flow_control flow_control  )

Definition at line 134 of file UARTDriver.cpp.

Referenced by _get_fd(), and _write_fd().

Here is the caller graph for this function:

◆ set_stop_bits()

void VRBRAINUARTDriver::set_stop_bits ( int  n)
virtual

Reimplemented from AP_HAL::UARTDriver.

Definition at line 178 of file UARTDriver.cpp.

Referenced by get_flow_control().

Here is the caller graph for this function:

◆ set_unbuffered_writes()

bool VRBRAINUARTDriver::set_unbuffered_writes ( bool  on)
virtual

Reimplemented from AP_HAL::UARTDriver.

Definition at line 189 of file UARTDriver.cpp.

Referenced by get_flow_control().

Here is the caller graph for this function:

◆ try_initialise()

void VRBRAINUARTDriver::try_initialise ( void  )
private

Definition at line 206 of file UARTDriver.cpp.

Referenced by available(), is_initialized(), read(), txspace(), and write().

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

◆ tx_pending()

bool VRBRAINUARTDriver::tx_pending ( )
virtual

Implements AP_HAL::UARTDriver.

Definition at line 247 of file UARTDriver.cpp.

◆ txspace()

uint32_t VRBRAINUARTDriver::txspace ( void  )
overridevirtual

Implements AP_HAL::BetterStream.

Definition at line 265 of file UARTDriver.cpp.

Here is the call graph for this function:

◆ write() [1/2]

size_t VRBRAINUARTDriver::write ( uint8_t  c)
virtual

Implements AP_HAL::BetterStream.

Definition at line 302 of file UARTDriver.cpp.

Referenced by _write_fd(), and write().

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

◆ write() [2/2]

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

Reimplemented from AP_HAL::BetterStream.

Definition at line 337 of file UARTDriver.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ _baudrate

uint32_t VRBRAIN::VRBRAINUARTDriver::_baudrate
private

Definition at line 50 of file UARTDriver.h.

Referenced by begin().

◆ _devpath

const char* VRBRAIN::VRBRAINUARTDriver::_devpath
private

Definition at line 48 of file UARTDriver.h.

Referenced by _timer_tick(), _write_fd(), begin(), and set_device_path().

◆ _fd

int VRBRAIN::VRBRAINUARTDriver::_fd
private

◆ _first_write_time

uint64_t VRBRAIN::VRBRAINUARTDriver::_first_write_time
private

Definition at line 65 of file UARTDriver.h.

Referenced by _write_fd(), and set_flow_control().

◆ _flow_control

enum flow_control VRBRAIN::VRBRAINUARTDriver::_flow_control
private

Definition at line 74 of file UARTDriver.h.

Referenced by _write_fd(), get_flow_control(), and set_flow_control().

◆ _in_timer

volatile bool VRBRAIN::VRBRAINUARTDriver::_in_timer
private

Definition at line 52 of file UARTDriver.h.

Referenced by _timer_tick(), begin(), and end().

◆ _initialised

volatile bool VRBRAIN::VRBRAINUARTDriver::_initialised
private

◆ _last_initialise_attempt_ms

uint32_t VRBRAIN::VRBRAINUARTDriver::_last_initialise_attempt_ms
private

Definition at line 69 of file UARTDriver.h.

Referenced by try_initialise().

◆ _last_write_time

uint64_t VRBRAIN::VRBRAINUARTDriver::_last_write_time
private

Definition at line 66 of file UARTDriver.h.

Referenced by _write_fd().

◆ _nonblocking_writes

bool VRBRAIN::VRBRAINUARTDriver::_nonblocking_writes
private

Definition at line 54 of file UARTDriver.h.

Referenced by set_blocking_writes(), and write().

◆ _os_start_auto_space

uint32_t VRBRAIN::VRBRAINUARTDriver::_os_start_auto_space
private

Definition at line 71 of file UARTDriver.h.

Referenced by _write_fd().

◆ _perf_uart

perf_counter_t VRBRAIN::VRBRAINUARTDriver::_perf_uart
private

Definition at line 61 of file UARTDriver.h.

Referenced by _timer_tick().

◆ _readbuf

ByteBuffer VRBRAIN::VRBRAINUARTDriver::_readbuf {0}
private

Definition at line 59 of file UARTDriver.h.

Referenced by _timer_tick(), available(), begin(), end(), and read().

◆ _semaphore

Semaphore VRBRAIN::VRBRAINUARTDriver::_semaphore
private

Definition at line 76 of file UARTDriver.h.

Referenced by read(), and write().

◆ _total_read

uint32_t VRBRAIN::VRBRAINUARTDriver::_total_read
private

Definition at line 72 of file UARTDriver.h.

Referenced by _read_fd().

◆ _total_written

uint32_t VRBRAIN::VRBRAINUARTDriver::_total_written
private

Definition at line 73 of file UARTDriver.h.

Referenced by _write_fd(), and set_flow_control().

◆ _unbuffered_writes

bool VRBRAIN::VRBRAINUARTDriver::_unbuffered_writes
private

Definition at line 55 of file UARTDriver.h.

Referenced by set_unbuffered_writes(), and write().

◆ _writebuf

ByteBuffer VRBRAIN::VRBRAINUARTDriver::_writebuf {0}
private

Definition at line 60 of file UARTDriver.h.

Referenced by _timer_tick(), begin(), end(), txspace(), and write().


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