Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_sc16is740

Driver for SC16IS740 single UART with I2C-bus interface, 64 bytes of transmit and receive FIFOs. More...

Enumerations

enum  bc_sc16is740_fifo_t {
  BC_SC16IS740_FIFO_RX = 0x02,
  BC_SC16IS740_FIFO_TX = 0x04
}
 Fifo type.
 
enum  bc_sc16is740_baudrate_t {
  BC_SC16IS740_BAUDRATE_9600 = 88,
  BC_SC16IS740_BAUDRATE_19200 = 44,
  BC_SC16IS740_BAUDRATE_38400 = 22,
  BC_SC16IS740_BAUDRATE_57600 = 15,
  BC_SC16IS740_BAUDRATE_115200 = 7
}
 Baudrates.
 

Functions

bool bc_sc16is740_init (bc_sc16is740_t *self, bc_i2c_channel_t i2c_channel, uint8_t i2c_address)
 SC16IS740 instance. More...
 
bool bc_sc16is740_reset_fifo (bc_sc16is740_t *self, bc_sc16is740_fifo_t fifo)
 Reset FIFO. More...
 
bool bc_sc16is740_get_spaces_available (bc_sc16is740_t *self, size_t *spaces_available)
 Get TX FIXO space available. More...
 
size_t bc_sc16is740_write (bc_sc16is740_t *self, uint8_t *buffer, size_t length)
 Write. More...
 
bool bc_sc16is740_available (bc_sc16is740_t *self, size_t *available)
 Get RX FIXO available data. More...
 
size_t bc_sc16is740_read (bc_sc16is740_t *self, uint8_t *buffer, size_t length, bc_tick_t timeout)
 Read. More...
 
bool bc_sc16is740_set_baudrate (bc_sc16is740_t *self, bc_sc16is740_baudrate_t baudrate)
 Set baudrate. More...
 

Detailed Description

Driver for SC16IS740 single UART with I2C-bus interface, 64 bytes of transmit and receive FIFOs.

Function Documentation

bool bc_sc16is740_available ( bc_sc16is740_t *  self,
size_t *  available 
)

Get RX FIXO available data.

Parameters
[in]selfInstance
[out]available
Returns
true On success
false On failure

Definition at line 136 of file bc_sc16is740.c.

Referenced by bc_module_rs485_available(), and bc_sc16is740_read().

Here is the call graph for this function:

Here is the caller graph for this function:

bool bc_sc16is740_get_spaces_available ( bc_sc16is740_t *  self,
size_t *  spaces_available 
)

Get TX FIXO space available.

Parameters
[in]selfInstance
[out]spaces_available
Returns
true On success
false On failure

Definition at line 88 of file bc_sc16is740.c.

Referenced by bc_sc16is740_write().

Here is the call graph for this function:

Here is the caller graph for this function:

bool bc_sc16is740_init ( bc_sc16is740_t *  self,
bc_i2c_channel_t  i2c_channel,
uint8_t  i2c_address 
)

SC16IS740 instance.

Initialize SC16IS740

Parameters
[in]selfInstance
[in]i2c_channelI2C channel
[in]i2c_addressI2C device address
Returns
true On success
false On failure

Definition at line 23 of file bc_sc16is740.c.

Referenced by bc_module_rs485_init().

Here is the call graph for this function:

Here is the caller graph for this function:

size_t bc_sc16is740_read ( bc_sc16is740_t *  self,
uint8_t *  buffer,
size_t  length,
bc_tick_t  timeout 
)

Read.

Parameters
[in]selfInstance
[out]bufferPointer to destination buffer
[in]lengthNumber of bytes to be read
[in]timeoutWrite operation timeout in ticks
Returns
Number of bytes read

Definition at line 150 of file bc_sc16is740.c.

Referenced by bc_module_rs485_read().

Here is the call graph for this function:

Here is the caller graph for this function:

bool bc_sc16is740_reset_fifo ( bc_sc16is740_t *  self,
bc_sc16is740_fifo_t  fifo 
)

Reset FIFO.

Parameters
[in]selfInstance
[in]fifo
Returns
true On success
false On failure

Definition at line 79 of file bc_sc16is740.c.

Referenced by bc_module_rs485_init().

Here is the call graph for this function:

Here is the caller graph for this function:

bool bc_sc16is740_set_baudrate ( bc_sc16is740_t *  self,
bc_sc16is740_baudrate_t  baudrate 
)

Set baudrate.

Parameters
[in]selfInstance
[in]baudrate
Returns
true On success
false On failure

Definition at line 202 of file bc_sc16is740.c.

Referenced by bc_module_rs485_set_baudrate().

Here is the call graph for this function:

Here is the caller graph for this function:

size_t bc_sc16is740_write ( bc_sc16is740_t *  self,
uint8_t *  buffer,
size_t  length 
)

Write.

Parameters
[in]selfInstance
[in]bufferPointer to source buffer
[in]lengthNumber of bytes to be written
Returns
Number of bytes written

Definition at line 102 of file bc_sc16is740.c.

Referenced by bc_module_rs485_write().

Here is the call graph for this function:

Here is the caller graph for this function: