Collaboration diagram for UART Driver:

Classes

union  smg_uart_config_format_t
 Structure for easier decomposing of format value. More...
 
struct  smg_uart_t
 
struct  smg_uart_config_t
 
struct  smg_uart_intr_config_t
 UART interrupt configuration parameters for smg_uart_intr_config function. More...
 

Macros

#define UART_NO   -1
 No UART specified. More...
 
#define UART_PIN_DEFAULT   (255)
 Use default pin assignments. More...
 
#define UART_PIN_NO_CHANGE   (-1)
 Use default pin assignments. More...
 
#define UART_RX_FIFO_SIZE   0x80
 
#define UART_TX_FIFO_SIZE   0x80
 

Typedefs

using uart_options_t = uint8_t
 
typedef void(* smg_uart_callback_t) (smg_uart_t *uart, uint32_t status)
 callback invoked directly from ISR More...
 
using smg_uart_notify_callback_t = void(*)(smg_uart_t *uart, smg_uart_notify_code_t code)
 Port notification callback function type. More...
 

Enumerations

enum  smg_uart_bits_t { UART_NB_BIT_5 = 0 , UART_NB_BIT_6 = 1 , UART_NB_BIT_7 = 2 , UART_NB_BIT_8 = 3 }
 Number of UART data bits. More...
 
enum  smg_uart_parity_t { UART_PARITY_NONE = 0 , UART_PARITY_EVEN = 2 , UART_PARITY_ODD = 3 }
 UART parity setting. More...
 
enum  smg_uart_stop_bits_t { UART_NB_STOP_BIT_0 = 0 , UART_NB_STOP_BIT_1 = 1 , UART_NB_STOP_BIT_15 = 2 , UART_NB_STOP_BIT_2 = 3 }
 Number of UART stop bits. More...
 
enum  smg_uart_format_settings_t {
  UART_PARITY_MASK = 0B00000011 , UART_PARITY_SHIFT = 0 , UART_NB_BIT_MASK = 0B00001100 , UART_NB_BIT_SHIFT = 2 ,
  UART_NB_STOP_BIT_MASK = 0B00110000 , UART_NB_STOP_BIT_SHIFT = 4
}
 
enum  smg_uart_format_t {
  UART_5N1 = SMG_UART_FORMAT(UART_NB_BIT_5, UART_NB_STOP_BIT_1, UART_PARITY_NONE) , UART_6N1 = SMG_UART_FORMAT(UART_NB_BIT_6, UART_NB_STOP_BIT_1, UART_PARITY_NONE) , UART_7N1 = SMG_UART_FORMAT(UART_NB_BIT_7, UART_NB_STOP_BIT_1, UART_PARITY_NONE) , UART_8N1 = SMG_UART_FORMAT(UART_NB_BIT_8, UART_NB_STOP_BIT_1, UART_PARITY_NONE) ,
  UART_5N2 = SMG_UART_FORMAT(UART_NB_BIT_5, UART_NB_STOP_BIT_2, UART_PARITY_NONE) , UART_6N2 = SMG_UART_FORMAT(UART_NB_BIT_6, UART_NB_STOP_BIT_2, UART_PARITY_NONE) , UART_7N2 = SMG_UART_FORMAT(UART_NB_BIT_7, UART_NB_STOP_BIT_2, UART_PARITY_NONE) , UART_8N2 = SMG_UART_FORMAT(UART_NB_BIT_8, UART_NB_STOP_BIT_2, UART_PARITY_NONE) ,
  UART_5E1 = SMG_UART_FORMAT(UART_NB_BIT_5, UART_NB_STOP_BIT_1, UART_PARITY_EVEN) , UART_6E1 = SMG_UART_FORMAT(UART_NB_BIT_6, UART_NB_STOP_BIT_1, UART_PARITY_EVEN) , UART_7E1 = SMG_UART_FORMAT(UART_NB_BIT_7, UART_NB_STOP_BIT_1, UART_PARITY_EVEN) , UART_8E1 = SMG_UART_FORMAT(UART_NB_BIT_8, UART_NB_STOP_BIT_1, UART_PARITY_EVEN) ,
  UART_5E2 = SMG_UART_FORMAT(UART_NB_BIT_5, UART_NB_STOP_BIT_2, UART_PARITY_EVEN) , UART_6E2 = SMG_UART_FORMAT(UART_NB_BIT_6, UART_NB_STOP_BIT_2, UART_PARITY_EVEN) , UART_7E2 = SMG_UART_FORMAT(UART_NB_BIT_7, UART_NB_STOP_BIT_2, UART_PARITY_EVEN) , UART_8E2 = SMG_UART_FORMAT(UART_NB_BIT_8, UART_NB_STOP_BIT_2, UART_PARITY_EVEN) ,
  UART_5O1 = SMG_UART_FORMAT(UART_NB_BIT_5, UART_NB_STOP_BIT_1, UART_PARITY_ODD) , UART_6O1 = SMG_UART_FORMAT(UART_NB_BIT_6, UART_NB_STOP_BIT_1, UART_PARITY_ODD) , UART_7O1 = SMG_UART_FORMAT(UART_NB_BIT_7, UART_NB_STOP_BIT_1, UART_PARITY_ODD) , UART_8O1 = SMG_UART_FORMAT(UART_NB_BIT_8, UART_NB_STOP_BIT_1, UART_PARITY_ODD) ,
  UART_5O2 = SMG_UART_FORMAT(UART_NB_BIT_5, UART_NB_STOP_BIT_2, UART_PARITY_ODD) , UART_6O2 = SMG_UART_FORMAT(UART_NB_BIT_6, UART_NB_STOP_BIT_2, UART_PARITY_ODD) , UART_7O2 = SMG_UART_FORMAT(UART_NB_BIT_7, UART_NB_STOP_BIT_2, UART_PARITY_ODD) , UART_8O2 = SMG_UART_FORMAT(UART_NB_BIT_8, UART_NB_STOP_BIT_2, UART_PARITY_ODD)
}
 Options for config argument of uart_init. More...
 
enum  smg_uart_status_t {
  UART_STATUS_TX_DONE = BIT(14) , UART_STATUS_RXFIFO_TOUT = BIT(8) , UART_STATUS_BRK_DET = BIT(7) , UART_STATUS_CTS_CHG = BIT(6) ,
  UART_STATUS_DSR_CHG = BIT(5) , UART_STATUS_RXFIFO_OVF = BIT(4) , UART_STATUS_FRM_ERR = BIT(3) , UART_STATUS_PARITY_ERR = BIT(2) ,
  UART_STATUS_TXFIFO_EMPTY = BIT(1) , UART_STATUS_RXFIFO_FULL = BIT(0)
}
 
enum  smg_uart_mode_t { UART_FULL , UART_RX_ONLY , UART_TX_ONLY }
 values for mode argument of uart_init More...
 
enum  smg_uart_option_bits_t { UART_OPT_TXWAIT , UART_OPT_CALLBACK_RAW }
 bit values for options argument of uart_init More...
 
enum  smg_uart_notify_code_t {
  UART_NOTIFY_AFTER_OPEN , UART_NOTIFY_BEFORE_CLOSE , UART_NOTIFY_AFTER_WRITE , UART_NOTIFY_BEFORE_READ ,
  UART_NOTIFY_WAIT_TX
}
 Indicates notification, parameters refer to uart_notify_info_t structure. More...
 

Functions

static constexpr uint8_t SMG_UART_FORMAT (smg_uart_bits_t databits, smg_uart_stop_bits_t stopbits, smg_uart_parity_t parity)
 
bool smg_uart_set_notify (unsigned uart_nr, smg_uart_notify_callback_t callback)
 Set the notification callback function. More...
 
smg_uart_tsmg_uart_init (uint8_t uart_nr, uint32_t baudrate, smg_uart_format_t format, smg_uart_mode_t mode, uint8_t tx_pin, size_t rx_size, size_t tx_size=0)
 
smg_uart_tsmg_uart_init_ex (const smg_uart_config_t &cfg)
 
void smg_uart_uninit (smg_uart_t *uart)
 
void smg_uart_set_format (smg_uart_t *uart, smg_uart_format_t format)
 Set the UART data format. More...
 
bool smg_uart_intr_config (smg_uart_t *uart, const smg_uart_intr_config_t *config)
 Configure interrupt thresholds. More...
 
int smg_uart_get_nr (smg_uart_t *uart)
 
smg_uart_tsmg_uart_get_uart (uint8_t uart_nr)
 Get the uart structure for the given number. More...
 
void smg_uart_set_callback (smg_uart_t *uart, smg_uart_callback_t callback, void *param)
 Set callback handler for serial port. More...
 
void * smg_uart_get_callback_param (smg_uart_t *uart)
 Get the callback parameter specified by uart_set_callback() More...
 
static void smg_uart_set_options (smg_uart_t *uart, uart_options_t options)
 Set option flags. More...
 
uint8_t smg_uart_get_status (smg_uart_t *uart)
 Get error flags and clear them. More...
 
static uart_options_t smg_uart_get_options (smg_uart_t *uart)
 
void smg_uart_swap (smg_uart_t *uart, int tx_pin)
 
bool smg_uart_set_tx (smg_uart_t *uart, int tx_pin)
 
bool smg_uart_set_pins (smg_uart_t *uart, int tx_pin, int rx_pin)
 
bool smg_uart_tx_enabled (smg_uart_t *uart)
 
bool smg_uart_rx_enabled (smg_uart_t *uart)
 
uint32_t smg_uart_set_baudrate_reg (int uart_nr, uint32_t baud_rate)
 set UART baud rate, given the UART number More...
 
uint32_t smg_uart_set_baudrate (smg_uart_t *uart, uint32_t baud_rate)
 set UART baud rate More...
 
uint32_t smg_uart_get_baudrate (smg_uart_t *uart)
 get the actual baud rate in use More...
 
size_t smg_uart_resize_rx_buffer (smg_uart_t *uart, size_t new_size)
 
size_t smg_uart_rx_buffer_size (smg_uart_t *uart)
 
size_t smg_uart_resize_tx_buffer (smg_uart_t *uart, size_t new_size)
 
size_t smg_uart_tx_buffer_size (smg_uart_t *uart)
 
size_t smg_uart_write (smg_uart_t *uart, const void *buffer, size_t size)
 write a block of data More...
 
static size_t smg_uart_write_char (smg_uart_t *uart, char c)
 queue a single character for output More...
 
size_t smg_uart_read (smg_uart_t *uart, void *buffer, size_t size)
 read a block of data More...
 
static int smg_uart_read_char (smg_uart_t *uart)
 read a received character More...
 
int smg_uart_peek_char (smg_uart_t *uart)
 see what the next character in the rx buffer is More...
 
int smg_uart_peek_last_char (smg_uart_t *uart)
 fetch last character read out of FIFO More...
 
int smg_uart_rx_find (smg_uart_t *uart, char c)
 
size_t smg_uart_rx_available (smg_uart_t *uart)
 determine available data which can be read More...
 
size_t smg_uart_tx_free (smg_uart_t *uart)
 return free space in transmit buffer More...
 
void smg_uart_wait_tx_empty (smg_uart_t *uart)
 
void smg_uart_set_break (smg_uart_t *uart, bool state)
 Set or clear a break condition on the TX line. More...
 
void smg_uart_flush (smg_uart_t *uart, smg_uart_mode_t mode=UART_FULL)
 discard any buffered data and reset hardware FIFOs More...
 
void smg_uart_set_debug (int uart_nr)
 
int smg_uart_get_debug ()
 
void smg_uart_start_isr (smg_uart_t *uart)
 enable interrupts for a UART More...
 
void smg_uart_stop_isr (smg_uart_t *uart)
 disable interrupts for a UART More...
 
void smg_uart_detach (int uart_nr)
 detach a UART interrupt service routine More...
 
void smg_uart_detach_all ()
 detach all UART interrupt service routines More...
 
uint8_t smg_uart_disable_interrupts ()
 disable interrupts and return current interrupt state More...
 
void smg_uart_restore_interrupts ()
 re-enable interrupts after calling uart_disable_interrupts() More...
 

Detailed Description

Macro Definition Documentation

◆ UART_NO

#define UART_NO   -1

No UART specified.

◆ UART_PIN_DEFAULT

#define UART_PIN_DEFAULT   (255)

Use default pin assignments.

◆ UART_PIN_NO_CHANGE

#define UART_PIN_NO_CHANGE   (-1)

Use default pin assignments.

◆ UART_RX_FIFO_SIZE

#define UART_RX_FIFO_SIZE   0x80

◆ UART_TX_FIFO_SIZE

#define UART_TX_FIFO_SIZE   0x80

Typedef Documentation

◆ smg_uart_callback_t

typedef void(* smg_uart_callback_t) (smg_uart_t *uart, uint32_t status)

callback invoked directly from ISR

Parameters
argthe UART object
statusUART USIS STATUS flag bits indicating cause of interrupt
Note
Values can be: UIFE: TX FIFO Empty UIFF: RX FIFO Full UITO: RX FIFO Timeout UIBD: Break Detected

Errors can be detected via uart_get_status().

◆ smg_uart_notify_callback_t

Port notification callback function type.

Parameters
info
Return values
booltrue if callback handled operation, false to default to normal operation

◆ uart_options_t

using uart_options_t = uint8_t

Enumeration Type Documentation

◆ smg_uart_bits_t

Number of UART data bits.

Enumerator
UART_NB_BIT_5 
UART_NB_BIT_6 
UART_NB_BIT_7 
UART_NB_BIT_8 

◆ smg_uart_format_settings_t

Enumerator
UART_PARITY_MASK 
UART_PARITY_SHIFT 
UART_NB_BIT_MASK 
UART_NB_BIT_SHIFT 
UART_NB_STOP_BIT_MASK 
UART_NB_STOP_BIT_SHIFT 

◆ smg_uart_format_t

Options for config argument of uart_init.

Enumerator
UART_5N1 
UART_6N1 
UART_7N1 
UART_8N1 
UART_5N2 
UART_6N2 
UART_7N2 
UART_8N2 
UART_5E1 
UART_6E1 
UART_7E1 
UART_8E1 
UART_5E2 
UART_6E2 
UART_7E2 
UART_8E2 
UART_5O1 
UART_6O1 
UART_7O1 
UART_8O1 
UART_5O2 
UART_6O2 
UART_7O2 
UART_8O2 

◆ smg_uart_mode_t

values for mode argument of uart_init

Enumerator
UART_FULL 

Both receive and transmit - will revert to TX only if RX not supported.

UART_RX_ONLY 

Receive only.

UART_TX_ONLY 

Transmit only.

◆ smg_uart_notify_code_t

Indicates notification, parameters refer to uart_notify_info_t structure.

Enumerator
UART_NOTIFY_AFTER_OPEN 

Called when uart has been initialised successfully.

UART_NOTIFY_BEFORE_CLOSE 

Called immediately before uart is closed and destroyed.

UART_NOTIFY_AFTER_WRITE 

Called after data has been written into tx buffer.

UART_NOTIFY_BEFORE_READ 

Called before data is read from rx buffer.

UART_NOTIFY_WAIT_TX 

Called to ensure all buffered data is output.

◆ smg_uart_option_bits_t

bit values for options argument of uart_init

Note
use _BV(opt) to specify values
Enumerator
UART_OPT_TXWAIT 

If buffers are full then uart_write() will wait for free space.

UART_OPT_CALLBACK_RAW 

ISR invokes user callback function with no pre-processing.

◆ smg_uart_parity_t

UART parity setting.

Actually combines two bits: bit 1 is set for parity enable, clear if disabled bit 0 is set for even parity, clear for odd parity

Enumerator
UART_PARITY_NONE 
UART_PARITY_EVEN 
UART_PARITY_ODD 

◆ smg_uart_status_t

Enumerator
UART_STATUS_TX_DONE 

All data transmitted (ESP32 only)

UART_STATUS_RXFIFO_TOUT 
UART_STATUS_BRK_DET 
UART_STATUS_CTS_CHG 
UART_STATUS_DSR_CHG 
UART_STATUS_RXFIFO_OVF 
UART_STATUS_FRM_ERR 
UART_STATUS_PARITY_ERR 
UART_STATUS_TXFIFO_EMPTY 
UART_STATUS_RXFIFO_FULL 

◆ smg_uart_stop_bits_t

Number of UART stop bits.

Enumerator
UART_NB_STOP_BIT_0 
UART_NB_STOP_BIT_1 
UART_NB_STOP_BIT_15 
UART_NB_STOP_BIT_2 

Function Documentation

◆ smg_uart_detach()

void smg_uart_detach ( int  uart_nr)

detach a UART interrupt service routine

Parameters
uart_nr

◆ smg_uart_detach_all()

void smg_uart_detach_all ( )

detach all UART interrupt service routines

Note
call at startup to put all UARTs into a known state

◆ smg_uart_disable_interrupts()

uint8_t smg_uart_disable_interrupts ( )

disable interrupts and return current interrupt state

Return values
statenon-zero if any UART interrupts were active

◆ smg_uart_flush()

void smg_uart_flush ( smg_uart_t uart,
smg_uart_mode_t  mode = UART_FULL 
)

discard any buffered data and reset hardware FIFOs

Parameters
uart
modeWhether to flush TX, RX or both (the default)
Note
this function does not wait for any transmissions to complete

◆ SMG_UART_FORMAT()

static constexpr uint8_t SMG_UART_FORMAT ( smg_uart_bits_t  databits,
smg_uart_stop_bits_t  stopbits,
smg_uart_parity_t  parity 
)
inlinestaticconstexpr

◆ smg_uart_get_baudrate()

uint32_t smg_uart_get_baudrate ( smg_uart_t uart)

get the actual baud rate in use

Parameters
uart
Return values
uint32_tthe baud rate, 0 on failure

◆ smg_uart_get_callback_param()

void* smg_uart_get_callback_param ( smg_uart_t uart)

Get the callback parameter specified by uart_set_callback()

Parameters
uart
Return values
void*the callback parameter

◆ smg_uart_get_debug()

int smg_uart_get_debug ( )

◆ smg_uart_get_nr()

int smg_uart_get_nr ( smg_uart_t uart)

◆ smg_uart_get_options()

static uart_options_t smg_uart_get_options ( smg_uart_t uart)
inlinestatic

◆ smg_uart_get_status()

uint8_t smg_uart_get_status ( smg_uart_t uart)

Get error flags and clear them.

Parameters
uart
Return values
Statuserror bits:
Note
To detect errors during a transaction, call at the start to clear the flags, then check the value at the end. Only these values are cleared/returned: UIBD: Break Detected UIOF: RX FIFO OverFlow UIFR: Frame Error UIPE: Parity Error

◆ smg_uart_get_uart()

smg_uart_t* smg_uart_get_uart ( uint8_t  uart_nr)

Get the uart structure for the given number.

Parameters
uart_nr
Return values
uart_t*Returns nullptr if uart isn't initialised

◆ smg_uart_init()

smg_uart_t* smg_uart_init ( uint8_t  uart_nr,
uint32_t  baudrate,
smg_uart_format_t  format,
smg_uart_mode_t  mode,
uint8_t  tx_pin,
size_t  rx_size,
size_t  tx_size = 0 
)

◆ smg_uart_init_ex()

smg_uart_t* smg_uart_init_ex ( const smg_uart_config_t cfg)

◆ smg_uart_intr_config()

bool smg_uart_intr_config ( smg_uart_t uart,
const smg_uart_intr_config_t config 
)

Configure interrupt thresholds.

Parameters
uart
config
Return values
booltrue on success, false on error (bad parameter or unsupported)

◆ smg_uart_peek_char()

int smg_uart_peek_char ( smg_uart_t uart)

see what the next character in the rx buffer is

Parameters
uart
Return values
intreturns -1 if buffer is empty or not allocated
Note
if buffer isn't allocated data may be in the hardware FIFO, which must be read out using uart_read()

◆ smg_uart_peek_last_char()

int smg_uart_peek_last_char ( smg_uart_t uart)

fetch last character read out of FIFO

Parameters
uart
Return values
intthe character, or -1 if rx buffer is empty or unallocated
Note
this is only useful if an rx buffer has been allocated of sufficient size to contain a message. This function then indicates the terminating character.

◆ smg_uart_read()

size_t smg_uart_read ( smg_uart_t uart,
void *  buffer,
size_t  size 
)

read a block of data

Parameters
uart
bufferwhere to write the data
sizerequested quantity of bytes to read
Return values
size_tnumber of bytes read

◆ smg_uart_read_char()

static int smg_uart_read_char ( smg_uart_t uart)
inlinestatic

read a received character

Parameters
uart
Return values
thecharacter, -1 on failure

◆ smg_uart_resize_rx_buffer()

size_t smg_uart_resize_rx_buffer ( smg_uart_t uart,
size_t  new_size 
)

◆ smg_uart_resize_tx_buffer()

size_t smg_uart_resize_tx_buffer ( smg_uart_t uart,
size_t  new_size 
)

◆ smg_uart_restore_interrupts()

void smg_uart_restore_interrupts ( )

re-enable interrupts after calling uart_disable_interrupts()

◆ smg_uart_rx_available()

size_t smg_uart_rx_available ( smg_uart_t uart)

determine available data which can be read

Parameters
uart
Return values
size_t
Note
this obtains a count of data both in the memory buffer and hardware FIFO

◆ smg_uart_rx_buffer_size()

size_t smg_uart_rx_buffer_size ( smg_uart_t uart)

◆ smg_uart_rx_enabled()

bool smg_uart_rx_enabled ( smg_uart_t uart)

◆ smg_uart_rx_find()

int smg_uart_rx_find ( smg_uart_t uart,
char  c 
)

◆ smg_uart_set_baudrate()

uint32_t smg_uart_set_baudrate ( smg_uart_t uart,
uint32_t  baud_rate 
)

set UART baud rate

Parameters
uart
baud_raterequested baud rate
Return values
uint32_tactual baudrate used, 0 on failure

◆ smg_uart_set_baudrate_reg()

uint32_t smg_uart_set_baudrate_reg ( int  uart_nr,
uint32_t  baud_rate 
)

set UART baud rate, given the UART number

Parameters
uart_nr
baud_raterequested baud rate
Return values
uint32_tactual baudrate used, 0 on failure

◆ smg_uart_set_break()

void smg_uart_set_break ( smg_uart_t uart,
bool  state 
)

Set or clear a break condition on the TX line.

Parameters
uart
state

◆ smg_uart_set_callback()

void smg_uart_set_callback ( smg_uart_t uart,
smg_uart_callback_t  callback,
void *  param 
)

Set callback handler for serial port.

Parameters
uart
callbackspecify nullptr to disable callbacks
paramuser parameter passed to callback

◆ smg_uart_set_debug()

void smg_uart_set_debug ( int  uart_nr)

◆ smg_uart_set_format()

void smg_uart_set_format ( smg_uart_t uart,
smg_uart_format_t  format 
)

Set the UART data format.

Parameters
uart
formatUART CONF0 register bits

◆ smg_uart_set_notify()

bool smg_uart_set_notify ( unsigned  uart_nr,
smg_uart_notify_callback_t  callback 
)

Set the notification callback function.

Parameters
uart_nrWhich uart to register notifications for
callback
Return values
booltrue on success

◆ smg_uart_set_options()

static void smg_uart_set_options ( smg_uart_t uart,
uart_options_t  options 
)
inlinestatic

Set option flags.

Parameters
uart
optionsThe option(s) to set

◆ smg_uart_set_pins()

bool smg_uart_set_pins ( smg_uart_t uart,
int  tx_pin,
int  rx_pin 
)

◆ smg_uart_set_tx()

bool smg_uart_set_tx ( smg_uart_t uart,
int  tx_pin 
)

◆ smg_uart_start_isr()

void smg_uart_start_isr ( smg_uart_t uart)

enable interrupts for a UART

Parameters
uart

◆ smg_uart_stop_isr()

void smg_uart_stop_isr ( smg_uart_t uart)

disable interrupts for a UART

Parameters
uart

◆ smg_uart_swap()

void smg_uart_swap ( smg_uart_t uart,
int  tx_pin 
)

◆ smg_uart_tx_buffer_size()

size_t smg_uart_tx_buffer_size ( smg_uart_t uart)

◆ smg_uart_tx_enabled()

bool smg_uart_tx_enabled ( smg_uart_t uart)

◆ smg_uart_tx_free()

size_t smg_uart_tx_free ( smg_uart_t uart)

return free space in transmit buffer

◆ smg_uart_uninit()

void smg_uart_uninit ( smg_uart_t uart)

◆ smg_uart_wait_tx_empty()

void smg_uart_wait_tx_empty ( smg_uart_t uart)
Deprecated:
don't use this - causes extended delays - use callback notification

◆ smg_uart_write()

size_t smg_uart_write ( smg_uart_t uart,
const void *  buffer,
size_t  size 
)

write a block of data

Parameters
uart
buffer
size
Return values
size_tnumber of bytes buffered for transmission

◆ smg_uart_write_char()

static size_t smg_uart_write_char ( smg_uart_t uart,
char  c 
)
inlinestatic

queue a single character for output

Parameters
uart
c
Return values
size_t1 if character was written, 0 on failure