Firmware SDK
|
Driver for SC16IS740 single UART with I2C-bus interface, 64 bytes of transmit and receive FIFOs. More...
Enumerations | |
enum | twr_sc16is740_fifo_t { TWR_SC16IS740_FIFO_RX = 0x02 , TWR_SC16IS740_FIFO_TX = 0x04 } |
Fifo type. | |
enum | twr_sc16is740_baudrate_t { TWR_SC16IS740_BAUDRATE_9600 = 88 , TWR_SC16IS740_BAUDRATE_19200 = 44 , TWR_SC16IS740_BAUDRATE_38400 = 22 , TWR_SC16IS740_BAUDRATE_57600 = 15 , TWR_SC16IS740_BAUDRATE_115200 = 7 } |
Baudrates. | |
Functions | |
bool | twr_sc16is740_init (twr_sc16is740_t *self, twr_i2c_channel_t i2c_channel, uint8_t i2c_address) |
SC16IS740 instance. More... | |
bool | twr_sc16is740_reset_fifo (twr_sc16is740_t *self, twr_sc16is740_fifo_t fifo) |
Reset FIFO. More... | |
bool | twr_sc16is740_get_spaces_available (twr_sc16is740_t *self, size_t *spaces_available) |
Get TX FIXO space available. More... | |
size_t | twr_sc16is740_write (twr_sc16is740_t *self, uint8_t *buffer, size_t length) |
Write. More... | |
bool | twr_sc16is740_available (twr_sc16is740_t *self, size_t *available) |
Get RX FIXO available data. More... | |
size_t | twr_sc16is740_read (twr_sc16is740_t *self, uint8_t *buffer, size_t length, twr_tick_t timeout) |
Read. More... | |
bool | twr_sc16is740_set_baudrate (twr_sc16is740_t *self, twr_sc16is740_baudrate_t baudrate) |
Set baudrate. More... | |
Driver for SC16IS740 single UART with I2C-bus interface, 64 bytes of transmit and receive FIFOs.
bool twr_sc16is740_available | ( | twr_sc16is740_t * | self, |
size_t * | available | ||
) |
Get RX FIXO available data.
[in] | self | Instance |
[out] | available |
Definition at line 136 of file twr_sc16is740.c.
Referenced by twr_module_rs485_available(), and twr_sc16is740_read().
bool twr_sc16is740_get_spaces_available | ( | twr_sc16is740_t * | self, |
size_t * | spaces_available | ||
) |
Get TX FIXO space available.
[in] | self | Instance |
[out] | spaces_available |
Definition at line 88 of file twr_sc16is740.c.
Referenced by twr_sc16is740_write().
bool twr_sc16is740_init | ( | twr_sc16is740_t * | self, |
twr_i2c_channel_t | i2c_channel, | ||
uint8_t | i2c_address | ||
) |
SC16IS740 instance.
Initialize SC16IS740
[in] | self | Instance |
[in] | i2c_channel | I2C channel |
[in] | i2c_address | I2C device address |
Definition at line 23 of file twr_sc16is740.c.
Referenced by twr_module_rs485_init().
size_t twr_sc16is740_read | ( | twr_sc16is740_t * | self, |
uint8_t * | buffer, | ||
size_t | length, | ||
twr_tick_t | timeout | ||
) |
Read.
[in] | self | Instance |
[out] | buffer | Pointer to destination buffer |
[in] | length | Number of bytes to be read |
[in] | timeout | Write operation timeout in ticks |
Definition at line 150 of file twr_sc16is740.c.
Referenced by twr_module_rs485_read().
bool twr_sc16is740_reset_fifo | ( | twr_sc16is740_t * | self, |
twr_sc16is740_fifo_t | fifo | ||
) |
Reset FIFO.
[in] | self | Instance |
[in] | fifo |
Definition at line 79 of file twr_sc16is740.c.
Referenced by twr_module_rs485_init().
bool twr_sc16is740_set_baudrate | ( | twr_sc16is740_t * | self, |
twr_sc16is740_baudrate_t | baudrate | ||
) |
Set baudrate.
[in] | self | Instance |
[in] | baudrate |
Definition at line 202 of file twr_sc16is740.c.
Referenced by twr_module_rs485_set_baudrate().
size_t twr_sc16is740_write | ( | twr_sc16is740_t * | self, |
uint8_t * | buffer, | ||
size_t | length | ||
) |
Write.
[in] | self | Instance |
[in] | buffer | Pointer to source buffer |
[in] | length | Number of bytes to be written |
Definition at line 102 of file twr_sc16is740.c.
Referenced by twr_module_rs485_write().