1 #ifndef _TWR_MODULE_RS485_H
2 #define _TWR_MODULE_RS485_H
5 #include "twr_sc16is740.h"
6 #include "twr_scheduler.h"
38 TWR_MODULE_RS485_BAUDRATE_9600 = TWR_SC16IS740_BAUDRATE_9600,
39 TWR_MODULE_RS485_BAUDRATE_19200 = TWR_SC16IS740_BAUDRATE_19200,
40 TWR_MODULE_RS485_BAUDRATE_38400 = TWR_SC16IS740_BAUDRATE_38400,
41 TWR_MODULE_RS485_BAUDRATE_57600 = TWR_SC16IS740_BAUDRATE_57600,
42 TWR_MODULE_RS485_BAUDRATE_115200 = TWR_SC16IS740_BAUDRATE_115200
bool twr_module_rs485_measure(void)
Start single voltage measurement.
size_t twr_module_rs485_read(uint8_t *buffer, size_t length, twr_tick_t timeout)
Read the received data.
size_t twr_module_rs485_async_write(uint8_t *buffer, size_t length)
Add data to be transmited in async mode.
void twr_module_rs485_set_event_handler(void(*event_handler)(twr_module_rs485_event_t, void *), void *event_param)
Set callback function.
size_t twr_module_rs485_write(uint8_t *buffer, size_t length)
Write data to RS-485 bus.
twr_module_rs485_event_t
Callback events.
void twr_module_rs485_set_async_fifo(twr_fifo_t *write_fifo, twr_fifo_t *read_fifo)
Set FIFO.
bool twr_module_rs485_get_voltage(float *volt)
Get measured voltage.
bool twr_module_rs485_available(size_t *available)
Get number of received bytes.
bool twr_module_rs485_deinit(void)
Deinitialize RS-485 Module.
size_t twr_module_rs485_async_read(void *buffer, size_t length)
Get data that has been received in async mode.
bool twr_module_rs485_init(void)
Initialize RS-485 Module.
bool twr_module_rs485_async_read_start(twr_tick_t timeout)
Start async reading.
bool twr_module_rs485_set_baudrate(twr_module_rs485_baudrate_t baudrate)
Set baudrate.
twr_module_rs485_baudrate_t
Baudrates.
void twr_module_rs485_set_update_interval(twr_tick_t interval)
Set measurement interval.
bool twr_module_rs485_async_read_stop(void)
Stop async reading.
@ TWR_MODULE_RS485_EVENT_ASYNC_READ_DATA
Reading done event.
@ TWR_MODULE_RS485_EVENT_ERROR
Error event.
@ TWR_MODULE_RS485_EVENT_VOLTAGE
Update event.
@ TWR_MODULE_RS485_EVENT_ASYNC_READ_TIMEOUT
Timeout event.
@ TWR_MODULE_RS485_EVENT_ASYNC_WRITE_DONE
Async write done.
uint64_t twr_tick_t
Timestamp data type.
Structure of FIFO instance.