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

#include <UARTDriver.h>

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

Public Member Functions

 UARTDriver (bool default_console)
 
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)
 
bool _write_pending_bytes (void)
 
virtual void _timer_tick (void) override
 
virtual enum flow_control get_flow_control (void) override
 
virtual void set_flow_control (enum flow_control flow_control_setting) override
 
uint64_t receive_time_constraint_us (uint16_t nbytes) override
 
- 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 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)
 
- 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)
 

Static Public Member Functions

static UARTDriverfrom (AP_HAL::UARTDriver *uart)
 

Protected Member Functions

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

Protected Attributes

const char * device_path
 
volatile bool _initialised
 
ByteBuffer _readbuf {0}
 
ByteBuffer _writebuf {0}
 

Private Member Functions

void _allocate_buffers (uint16_t rxS, uint16_t txS)
 
void _deallocate_buffers ()
 
AP_HAL::OwnPtr< SerialDevice_parseDevicePath (const char *arg)
 

Private Attributes

AP_HAL::OwnPtr< SerialDevice_device
 
bool _nonblocking_writes
 
bool _console
 
volatile bool _in_timer
 
uint16_t _base_port
 
uint32_t _baudrate
 
char * _ip
 
char * _flag
 
bool _connected
 
bool _packetise
 
uint64_t _last_write_time
 
uint64_t _receive_timestamp [2]
 
uint8_t _receive_timestamp_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 11 of file UARTDriver.h.

Constructor & Destructor Documentation

◆ UARTDriver()

UARTDriver::UARTDriver ( bool  default_console)

Definition at line 33 of file UARTDriver.cpp.

Member Function Documentation

◆ _allocate_buffers()

void UARTDriver::_allocate_buffers ( uint16_t  rxS,
uint16_t  txS 
)
private

Definition at line 94 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:

◆ _deallocate_buffers()

void UARTDriver::_deallocate_buffers ( )
private

Definition at line 113 of file UARTDriver.cpp.

Referenced by _parseDevicePath().

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

◆ _parseDevicePath()

AP_HAL::OwnPtr< SerialDevice > UARTDriver::_parseDevicePath ( const char *  arg)
private

Definition at line 125 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:

◆ _read_fd()

int UARTDriver::_read_fd ( uint8_t *  buf,
uint16_t  n 
)
protectedvirtual

Reimplemented in Linux::SPIUARTDriver.

Definition at line 343 of file UARTDriver.cpp.

Referenced by Linux::SPIUARTDriver::_read_fd(), and HALSITL::UARTDriver::_timer_tick().

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

◆ _timer_tick()

virtual void Linux::UARTDriver::_timer_tick ( void  )
overridevirtual

Reimplemented from AP_HAL::UARTDriver.

Reimplemented in Linux::SPIUARTDriver.

Referenced by Linux::SPIUARTDriver::_timer_tick(), and from().

Here is the caller graph for this function:

◆ _write_fd()

int UARTDriver::_write_fd ( const uint8_t *  buf,
uint16_t  n 
)
protectedvirtual

Reimplemented in Linux::SPIUARTDriver.

Definition at line 324 of file UARTDriver.cpp.

Referenced by Linux::SPIUARTDriver::_write_fd(), and _write_pending_bytes().

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

◆ _write_pending_bytes()

bool UARTDriver::_write_pending_bytes ( void  )

Definition at line 353 of file UARTDriver.cpp.

Referenced by HALSITL::UARTDriver::_timer_tick(), and from().

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

◆ available()

uint32_t Linux::UARTDriver::available ( )
overridevirtual

Implements AP_HAL::BetterStream.

Referenced by _parseDevicePath(), HALSITL::UARTDriver::_timer_tick(), and from().

Here is the caller graph for this function:

◆ begin() [1/2]

void Linux::UARTDriver::begin ( uint32_t  b)
virtual

Implements AP_HAL::UARTDriver.

Referenced by Linux::SPIUARTDriver::begin(), from(), and set_device_path().

Here is the caller graph for this function:

◆ begin() [2/2]

void Linux::UARTDriver::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.

◆ end()

void Linux::UARTDriver::end ( )
virtual

Implements AP_HAL::UARTDriver.

Referenced by _parseDevicePath(), and from().

Here is the caller graph for this function:

◆ flush()

void Linux::UARTDriver::flush ( )
virtual

Implements AP_HAL::UARTDriver.

Referenced by _parseDevicePath(), and from().

Here is the caller graph for this function:

◆ from()

static UARTDriver* Linux::UARTDriver::from ( AP_HAL::UARTDriver uart)
inlinestatic

Definition at line 15 of file UARTDriver.h.

Here is the call graph for this function:

◆ get_flow_control()

virtual enum flow_control Linux::UARTDriver::get_flow_control ( void  )
inlineoverridevirtual

Reimplemented from AP_HAL::UARTDriver.

Definition at line 42 of file UARTDriver.h.

Here is the call graph for this function:

◆ is_initialized()

bool Linux::UARTDriver::is_initialized ( )
virtual

Implements AP_HAL::UARTDriver.

Referenced by _parseDevicePath(), Linux::SPIUARTDriver::begin(), and from().

Here is the caller graph for this function:

◆ read()

int16_t Linux::UARTDriver::read ( )
overridevirtual

Implements AP_HAL::BetterStream.

Referenced by _parseDevicePath(), and from().

Here is the caller graph for this function:

◆ receive_time_constraint_us()

uint64_t Linux::UARTDriver::receive_time_constraint_us ( uint16_t  nbytes)
overridevirtual

Reimplemented from AP_HAL::UARTDriver.

Referenced by HALSITL::UARTDriver::_timer_tick(), and set_flow_control().

Here is the caller graph for this function:

◆ set_blocking_writes()

void Linux::UARTDriver::set_blocking_writes ( bool  blocking)
virtual

Implements AP_HAL::UARTDriver.

Referenced by _parseDevicePath(), and from().

Here is the caller graph for this function:

◆ set_device_path()

void UARTDriver::set_device_path ( const char *  path)

Definition at line 46 of file UARTDriver.cpp.

Referenced by from(), and HAL_Linux::run().

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

◆ set_flow_control()

virtual void Linux::UARTDriver::set_flow_control ( enum flow_control  flow_control_setting)
inlineoverridevirtual

Reimplemented from AP_HAL::UARTDriver.

Definition at line 47 of file UARTDriver.h.

Here is the call graph for this function:

◆ tx_pending()

bool Linux::UARTDriver::tx_pending ( )
virtual

Implements AP_HAL::UARTDriver.

Referenced by _parseDevicePath(), and from().

Here is the caller graph for this function:

◆ txspace()

uint32_t Linux::UARTDriver::txspace ( )
overridevirtual

Implements AP_HAL::BetterStream.

Referenced by _parseDevicePath(), and from().

Here is the caller graph for this function:

◆ write() [1/2]

size_t Linux::UARTDriver::write ( uint8_t  c)
virtual

Implements AP_HAL::BetterStream.

Referenced by _parseDevicePath(), and from().

Here is the caller graph for this function:

◆ write() [2/2]

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

Reimplemented from AP_HAL::BetterStream.

Member Data Documentation

◆ _base_port

uint16_t Linux::UARTDriver::_base_port
private

Definition at line 72 of file UARTDriver.h.

Referenced by _parseDevicePath().

◆ _baudrate

uint32_t Linux::UARTDriver::_baudrate
private

Definition at line 73 of file UARTDriver.h.

Referenced by HALSITL::UARTDriver::_timer_tick(), and set_device_path().

◆ _connected

bool Linux::UARTDriver::_connected
private

Definition at line 76 of file UARTDriver.h.

Referenced by _parseDevicePath(), _write_fd(), and set_device_path().

◆ _console

bool Linux::UARTDriver::_console
private

Definition at line 70 of file UARTDriver.h.

Referenced by set_device_path(), and UARTDriver().

◆ _device

AP_HAL::OwnPtr<SerialDevice> Linux::UARTDriver::_device
private

◆ _flag

char* Linux::UARTDriver::_flag
private

Definition at line 75 of file UARTDriver.h.

Referenced by _parseDevicePath().

◆ _in_timer

volatile bool Linux::UARTDriver::_in_timer
private

◆ _initialised

volatile bool Linux::UARTDriver::_initialised
protected

◆ _ip

char* Linux::UARTDriver::_ip
private

Definition at line 74 of file UARTDriver.h.

Referenced by _parseDevicePath().

◆ _last_write_time

uint64_t Linux::UARTDriver::_last_write_time
private

Definition at line 83 of file UARTDriver.h.

◆ _nonblocking_writes

bool Linux::UARTDriver::_nonblocking_writes
private

Definition at line 69 of file UARTDriver.h.

Referenced by _parseDevicePath().

◆ _packetise

bool Linux::UARTDriver::_packetise
private

Definition at line 77 of file UARTDriver.h.

Referenced by _parseDevicePath(), and _write_pending_bytes().

◆ _readbuf

ByteBuffer Linux::UARTDriver::_readbuf {0}
protected

◆ _receive_timestamp

uint64_t Linux::UARTDriver::_receive_timestamp[2]
private

Definition at line 86 of file UARTDriver.h.

Referenced by HALSITL::UARTDriver::_timer_tick().

◆ _receive_timestamp_idx

uint8_t Linux::UARTDriver::_receive_timestamp_idx
private

Definition at line 87 of file UARTDriver.h.

Referenced by HALSITL::UARTDriver::_timer_tick().

◆ _writebuf

ByteBuffer Linux::UARTDriver::_writebuf {0}
protected

◆ device_path

const char* Linux::UARTDriver::device_path
protected

Definition at line 90 of file UARTDriver.h.

Referenced by Linux::SPIUARTDriver::begin(), and set_device_path().


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