Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
UART Class Reference

#include <uart.h>

Inheritance diagram for UART:
Inheritance graph
[legend]

Public Types

enum  uart_mode_t { MODE_8N1, MODE_8E2 }
 
- Public Types inherited from Serial
enum  { POLLING = 0x00, INTERRUPT = 0x01, DMA_TX = 0x02, DMA_RX = 0x04 }
 
enum  { UART = 0, VCP = 1 }
 

Public Member Functions

void DMA_Rx_IRQ_callback ()
 
void DMA_Tx_IRQ_callback ()
 
bool flush () override
 
void init (const uart_hardware_struct_t *conf, uint32_t baudrate_, uart_mode_t mode=MODE_8N1)
 
void put_byte (uint8_t ch) override
 
uint8_t read_byte () override
 
void register_rx_callback (void(*cb)(uint8_t data)) override
 
uint32_t rx_bytes_waiting () override
 
bool set_mode (uint32_t baud, uart_mode_t mode)
 
bool tx_buffer_empty () override
 
uint32_t tx_bytes_free () override
 
 UART ()
 
void unregister_rx_callback () override
 
void USART_IRQ_callback ()
 
void write (const uint8_t *ch, uint8_t len) override
 
- Public Member Functions inherited from Serial
 Serial ()
 

Private Member Functions

void init_DMA ()
 
void init_NVIC ()
 
void init_UART (uint32_t baudrate_, uart_mode_t mode=MODE_8N1)
 
void startDMA ()
 

Private Attributes

uint32_t baudrate_
 
const uart_hardware_struct_tc_
 
uint8_t rx_buffer_ [RX_BUFFER_SIZE]
 
uint16_t rx_buffer_head_
 
uint16_t rx_buffer_tail_
 
GPIO rx_pin_
 
uint8_t tx_buffer_ [TX_BUFFER_SIZE]
 
uint16_t tx_buffer_head_
 
uint16_t tx_buffer_tail_
 
GPIO tx_pin_
 

Additional Inherited Members

- Protected Attributes inherited from Serial
uint8_t mode_
 
std::function< void(uint8_t)> receive_CB_ = nullptr
 
GPIO rx_pin_
 
GPIO tx_pin_
 

Detailed Description

Definition at line 43 of file uart.h.

Member Enumeration Documentation

Enumerator
MODE_8N1 
MODE_8E2 

Definition at line 47 of file uart.h.

Constructor & Destructor Documentation

UART::UART ( )

Definition at line 37 of file uart.cpp.

Member Function Documentation

void UART::DMA_Rx_IRQ_callback ( )

Definition at line 294 of file uart.cpp.

void UART::DMA_Tx_IRQ_callback ( )

Definition at line 316 of file uart.cpp.

bool UART::flush ( )
overridevirtual

Implements Serial.

Definition at line 284 of file uart.cpp.

void UART::init ( const uart_hardware_struct_t conf,
uint32_t  baudrate_,
uart_mode_t  mode = MODE_8N1 
)

Definition at line 41 of file uart.cpp.

void UART::init_DMA ( )
private

Definition at line 101 of file uart.cpp.

void UART::init_NVIC ( )
private

Definition at line 160 of file uart.cpp.

void UART::init_UART ( uint32_t  baudrate_,
uart_mode_t  mode = MODE_8N1 
)
private

Definition at line 68 of file uart.cpp.

void UART::put_byte ( uint8_t  ch)
overridevirtual

Implements Serial.

Definition at line 235 of file uart.cpp.

uint8_t UART::read_byte ( )
overridevirtual

Implements Serial.

Definition at line 216 of file uart.cpp.

void UART::register_rx_callback ( void(*)(uint8_t data)  cb)
overridevirtual

Implements Serial.

Definition at line 325 of file uart.cpp.

uint32_t UART::rx_bytes_waiting ( )
overridevirtual

Implements Serial.

Definition at line 240 of file uart.cpp.

bool UART::set_mode ( uint32_t  baud,
uart_mode_t  mode 
)

Definition at line 273 of file uart.cpp.

void UART::startDMA ( )
private

Definition at line 194 of file uart.cpp.

bool UART::tx_buffer_empty ( )
overridevirtual

Implements Serial.

Definition at line 279 of file uart.cpp.

uint32_t UART::tx_bytes_free ( )
overridevirtual

Implements Serial.

Definition at line 261 of file uart.cpp.

void UART::unregister_rx_callback ( )
overridevirtual

Implements Serial.

Definition at line 330 of file uart.cpp.

void UART::USART_IRQ_callback ( )
void UART::write ( const uint8_t *  ch,
uint8_t  len 
)
overridevirtual

Implements Serial.

Definition at line 178 of file uart.cpp.

Member Data Documentation

uint32_t UART::baudrate_
private

Definition at line 79 of file uart.h.

const uart_hardware_struct_t* UART::c_
private

Definition at line 77 of file uart.h.

uint8_t UART::rx_buffer_[RX_BUFFER_SIZE]
private

Definition at line 80 of file uart.h.

uint16_t UART::rx_buffer_head_
private

Definition at line 82 of file uart.h.

uint16_t UART::rx_buffer_tail_
private

Definition at line 83 of file uart.h.

GPIO UART::rx_pin_
private

Definition at line 86 of file uart.h.

uint8_t UART::tx_buffer_[TX_BUFFER_SIZE]
private

Definition at line 81 of file uart.h.

uint16_t UART::tx_buffer_head_
private

Definition at line 84 of file uart.h.

uint16_t UART::tx_buffer_tail_
private

Definition at line 85 of file uart.h.

GPIO UART::tx_pin_
private

Definition at line 87 of file uart.h.


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


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Wed Jul 3 2019 19:59:31