Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_sc16is740.h
1 #ifndef _BC_SC16IS740_H
2 #define _BC_SC16IS740_H
3 
4 #include <bc_i2c.h>
5 #include <bc_tick.h>
6 
10 
12 
13 typedef enum
14 {
15  BC_SC16IS740_FIFO_RX = 0x02,
16  BC_SC16IS740_FIFO_TX = 0x04
17 
19 
21 
22 typedef enum
23 {
24  BC_SC16IS740_BAUDRATE_9600 = 88,
25  BC_SC16IS740_BAUDRATE_19200 = 44,
26  BC_SC16IS740_BAUDRATE_38400 = 22,
27  BC_SC16IS740_BAUDRATE_57600 = 15,
28  BC_SC16IS740_BAUDRATE_115200 = 7
29 
31 
33 
35 
36 typedef struct
37 {
38  bc_i2c_channel_t _i2c_channel;
39  uint8_t _i2c_address;
40 
41 } bc_sc16is740_t;
42 
44 
51 
52 bool bc_sc16is740_init(bc_sc16is740_t *self, bc_i2c_channel_t i2c_channel, uint8_t i2c_address);
53 
59 
60 bool bc_sc16is740_reset_fifo(bc_sc16is740_t *self, bc_sc16is740_fifo_t fifo);
61 
67 
68 bool bc_sc16is740_get_spaces_available(bc_sc16is740_t *self, size_t *spaces_available);
69 
75 
76 size_t bc_sc16is740_write(bc_sc16is740_t *self, uint8_t *buffer, size_t length);
77 
83 
84 bool bc_sc16is740_available(bc_sc16is740_t *self, size_t *available);
85 
92 
93 size_t bc_sc16is740_read(bc_sc16is740_t *self, uint8_t *buffer, size_t length, bc_tick_t timeout);
94 
100 
101 bool bc_sc16is740_set_baudrate(bc_sc16is740_t *self, bc_sc16is740_baudrate_t baudrate);
102 
104 
105 #endif // _BC_SC16IS740_H
uint64_t bc_tick_t
Timestamp data type.
Definition: bc_tick.h:16
size_t bc_sc16is740_read(bc_sc16is740_t *self, uint8_t *buffer, size_t length, bc_tick_t timeout)
Read.
Definition: bc_sc16is740.c:150
bool bc_sc16is740_get_spaces_available(bc_sc16is740_t *self, size_t *spaces_available)
Get TX FIXO space available.
Definition: bc_sc16is740.c:88
bool bc_sc16is740_init(bc_sc16is740_t *self, bc_i2c_channel_t i2c_channel, uint8_t i2c_address)
SC16IS740 instance.
Definition: bc_sc16is740.c:23
bc_sc16is740_fifo_t
Fifo type.
Definition: bc_sc16is740.h:13
size_t bc_sc16is740_write(bc_sc16is740_t *self, uint8_t *buffer, size_t length)
Write.
Definition: bc_sc16is740.c:102
bc_i2c_channel_t
I2C channels.
Definition: bc_i2c.h:15
bc_sc16is740_baudrate_t
Baudrates.
Definition: bc_sc16is740.h:22
bool bc_sc16is740_available(bc_sc16is740_t *self, size_t *available)
Get RX FIXO available data.
Definition: bc_sc16is740.c:136
bool bc_sc16is740_set_baudrate(bc_sc16is740_t *self, bc_sc16is740_baudrate_t baudrate)
Set baudrate.
Definition: bc_sc16is740.c:202
bool bc_sc16is740_reset_fifo(bc_sc16is740_t *self, bc_sc16is740_fifo_t fifo)
Reset FIFO.
Definition: bc_sc16is740.c:79