35#ifndef RS485ISOLATOR_H
36#define RS485ISOLATOR_H
42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
66#define RS485ISOLATOR_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
68 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
69 cfg.re = MIKROBUS( mikrobus, MIKROBUS_RST ); \
70 cfg.de = MIKROBUS( mikrobus, MIKROBUS_CS )
77#define RS485ISOLATOR_OK 0
78#define RS485ISOLATOR_ERROR -1
85#define RS485ISOLATOR_RECEIVER_ENABLE 0
86#define RS485ISOLATOR_RECEIVER_DISABLE 1
93#define RS485ISOLATOR_DRIVER_ENABLE 1
94#define RS485ISOLATOR_DRIVER_DISABLE 0
101#define RS485ISOLATOR_DRV_RX_BUFFER_SIZE 200
102#define RS485ISOLATOR_DRV_TX_BUFFER_SIZE 200
#define RS485ISOLATOR_DRV_RX_BUFFER_SIZE
Definition rs485isolator.h:101
#define RS485ISOLATOR_DRV_TX_BUFFER_SIZE
Definition rs485isolator.h:102
void rs485isolator_cfg_setup(rs485isolator_cfg_t *cfg)
Config Object Initialization function.
err_t rs485isolator_init(rs485isolator_t *ctx, rs485isolator_cfg_t *cfg)
Initialization function.
void rs485isolator_set_driver_mode(rs485isolator_t *ctx, uint8_t state)
Set driver state.
void rs485isolator_set_receiver_mode(rs485isolator_t *ctx, uint8_t state)
Set receiver state.
void rs485isolator_generic_write(rs485isolator_t *ctx, uint8_t *data_buf, uint16_t len)
Generic write function.
err_t rs485isolator_generic_read(rs485isolator_t *ctx, uint8_t *data_buf, uint16_t max_len)
Generic read function.
Click configuration structure definition.
Definition rs485isolator.h:132
uint32_t baud_rate
Definition rs485isolator.h:142
pin_name_t re
Definition rs485isolator.h:138
bool uart_blocking
Definition rs485isolator.h:143
uart_data_bits_t data_bit
Definition rs485isolator.h:144
pin_name_t tx_pin
Definition rs485isolator.h:135
pin_name_t de
Definition rs485isolator.h:139
pin_name_t rx_pin
Definition rs485isolator.h:134
uart_stop_bits_t stop_bit
Definition rs485isolator.h:146
uart_parity_t parity_bit
Definition rs485isolator.h:145
Click ctx object definition.
Definition rs485isolator.h:115
digital_out_t re
Definition rs485isolator.h:117
uart_t uart
Definition rs485isolator.h:121
digital_out_t de
Definition rs485isolator.h:118