class::hal::UartAttributes

class hal::UartAttributes
  : public hal::PinAssignmentPeriphAttributes< uart_attr_t, uart_pin_assignment_t >

The Uart Attributes Class can be used to configure the UART. The sys::Cli classes can populate a UartAttr object using arguments passed on the command line.

For example, the following sample code will initialize a UART port based on parameters passed on the command line.

int main(int argc, char * argv[]){
   UartAttr uart_attr;
   Cli cli(argc, argv);

   cli.handle_uart(uart_attr);

   Uart uart(uart_attr.port());
   uart.init(uart_attr);
}

See also: hal::Uart

Summary

[UartAttributes](#classhal_1_1_uart_attributes_1a7a3cb2e0acd528a73dddd916ba69f248)()

mcu_pin_t cts() const

mcu_pin_t rts() const

mcu_pin_t rx() const

UartAttributes & set_cts(

const mcu_pin_t & pin
)

UartAttributes & set_flags(

u32 value
)

UartAttributes & set_frequency(

u32 value
)

UartAttributes & set_rts(

const mcu_pin_t & pin
)

UartAttributes & set_rx(

const mcu_pin_t & pin
)

UartAttributes & set_tx(

const mcu_pin_t & pin
)

UartAttributes & set_width(

u8 bits
)

mcu_pin_t tx() const

u8 width() const

Members

UartAttributes()

Constructs UART attributes with default settings.

Parameters

  • o_flags Flags for attibutes (default is UART_FLAG_SET_LINE_CODING_DEFAULT)

  • freq UART frequency (bitrate; default is 115200)

  • width UART byte width (default is 8)


mcu_pin_t cts() const

Accesses the cts pin assignment value.


mcu_pin_t rts() const

Accesses the rts pin assignment value.


mcu_pin_t rx() const

Accesses the rx pin assignment value.


UartAttributes & set_cts(

const mcu_pin_t & pin
)

Sets the cts pin assignment value.

Parameters

  • pin The cts pin

UartAttributes & set_flags(

u32 value
)


UartAttributes & set_frequency(

u32 value
)


UartAttributes & set_rts(

const mcu_pin_t & pin
)

Sets the rts pin assignment value.

Parameters

  • pin The rts pin

UartAttributes & set_rx(

const mcu_pin_t & pin
)

Sets the rx pin assignment value.

Parameters

  • pin The rx pin

UartAttributes & set_tx(

const mcu_pin_t & pin
)

Sets the tx pin assignment value.

Parameters

  • pin The tx pin

UartAttributes & set_width(

u8 bits
)

Sets the width in bits.

Parameters

  • bits The number of bits to use

mcu_pin_t tx() const

Accesses the tx pin assignment value.


u8 width() const

Accesses the width in bits (usually 8).


X

Thanks for Coming!

Subscribe to news and updates