Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_module_rs485.h
1 #ifndef _BC_MODULE_RS485_H
2 #define _BC_MODULE_RS485_H
3 
4 #include "bc_tick.h"
5 #include "bc_sc16is740.h"
6 #include "bc_scheduler.h"
7 #include "bc_fifo.h"
8 
12 
14 
15 typedef enum
16 {
19 
22 
25 
28 
31 
33 
35 
36 typedef enum
37 {
38  BC_MODULE_RS485_BAUDRATE_9600 = BC_SC16IS740_BAUDRATE_9600,
39  BC_MODULE_RS485_BAUDRATE_19200 = BC_SC16IS740_BAUDRATE_19200,
40  BC_MODULE_RS485_BAUDRATE_38400 = BC_SC16IS740_BAUDRATE_38400,
41  BC_MODULE_RS485_BAUDRATE_57600 = BC_SC16IS740_BAUDRATE_57600,
42  BC_MODULE_RS485_BAUDRATE_115200 = BC_SC16IS740_BAUDRATE_115200
43 
45 
49 
50 bool bc_module_rs485_init(void);
51 
55 
56 bool bc_module_rs485_measure(void);
57 
60 
61 bool bc_module_rs485_get_voltage(float *volt);
62 
66 
67 void bc_module_rs485_set_event_handler(void (*event_handler)(bc_module_rs485_event_t, void *), void *event_param);
68 
71 
73 
77 
78 size_t bc_module_rs485_write(uint8_t *buffer, size_t length);
79 
82 
83 bool bc_module_rs485_available(size_t *available);
84 
89 
90 size_t bc_module_rs485_read(uint8_t *buffer, size_t length, bc_tick_t timeout);
91 
97 
99 
103 
104 void bc_module_rs485_set_async_fifo(bc_fifo_t *write_fifo, bc_fifo_t *read_fifo);
105 
110 
111 size_t bc_module_rs485_async_write(uint8_t *buffer, size_t length);
112 
117 
119 
123 
125 
130 
131 size_t bc_module_rs485_async_read(void *buffer, size_t length);
132 
134 
135 #endif
uint64_t bc_tick_t
Timestamp data type.
Definition: bc_tick.h:16
Structure of FIFO instance.
Definition: bc_fifo.h:12
size_t bc_module_rs485_write(uint8_t *buffer, size_t length)
Write data to RS-485 bus.
size_t bc_module_rs485_async_write(uint8_t *buffer, size_t length)
Add data to be transmited in async mode.
bool bc_module_rs485_measure(void)
Start single voltage measurement.
size_t bc_module_rs485_read(uint8_t *buffer, size_t length, bc_tick_t timeout)
Read the received data.
bc_module_rs485_event_t
Callback events.
void bc_module_rs485_set_update_interval(bc_tick_t interval)
Set measurement interval.
void bc_module_rs485_set_event_handler(void(*event_handler)(bc_module_rs485_event_t, void *), void *event_param)
Set callback function.
bc_module_rs485_baudrate_t
Baudrates.
bool bc_module_rs485_async_read_stop(void)
Stop async reading.
bool bc_module_rs485_set_baudrate(bc_module_rs485_baudrate_t baudrate)
Set baudrate.
bool bc_module_rs485_async_read_start(bc_tick_t timeout)
Start async reading.
void bc_module_rs485_set_async_fifo(bc_fifo_t *write_fifo, bc_fifo_t *read_fifo)
Set FIFO.
bool bc_module_rs485_get_voltage(float *volt)
Get measured voltage.
bool bc_module_rs485_available(size_t *available)
Get number of received bytes.
size_t bc_module_rs485_async_read(void *buffer, size_t length)
Get data that has been received in async mode.
bool bc_module_rs485_init(void)
Initialize RS-485 Module.