35#ifndef RS485ISOLATOR2_H
36#define RS485ISOLATOR2_H
42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
67#define RS485ISOLATOR2_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
69 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
70 cfg.re = MIKROBUS( mikrobus, MIKROBUS_RST ); \
71 cfg.de = MIKROBUS( mikrobus, MIKROBUS_CS ); \
72 cfg.inr = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
73 cfg. ind = MIKROBUS( mikrobus, MIKROBUS_INT )
80#define RS485ISOLATOR2_RETVAL uint8_t
82#define RS485ISOLATOR2_OK 0x00
83#define RS485ISOLATOR2_INIT_ERROR 0xFF
90#define DRV_RX_BUFFER_SIZE 500
93#define RS485ISOLATOR2_ENABLE_RE 0x00
94#define RS485ISOLATOR2_DISABLE_RE 0x01
98#define RS485ISOLATOR2_ENABLE_DE 0x01
99#define RS485ISOLATOR2_DISABLE_DE 0x00
103#define RS485ISOLATOR2_ENABLE_INR 0x01
104#define RS485ISOLATOR2_DISABLE_INR 0x00
108#define RS485ISOLATOR2_ENABLE_IND 0x01
109#define RS485ISOLATOR2_DISABLE_IND 0x00
#define DRV_RX_BUFFER_SIZE
Definition rs485isolator2.h:90
#define RS485ISOLATOR2_RETVAL
Definition rs485isolator2.h:80
void rs485isolator2_set_ind_pin(rs485isolator2_t *ctx, uint8_t state)
Get IND (int) pin state.
void rs485isolator2_send_bit_by_bit(rs485isolator2_t *ctx, char *command)
Bit by bit write function.
void rs485isolator2_generic_write(rs485isolator2_t *ctx, char *data_buf, uint16_t len)
Generic write function.
void rs485isolator2_set_inr_pin(rs485isolator2_t *ctx, uint8_t state)
Set INR ( pwm ) pin state.
void rs485isolator2_set_de_pin(rs485isolator2_t *ctx, uint8_t state)
Set DE ( cs ) pin state.
int32_t rs485isolator2_generic_read(rs485isolator2_t *ctx, char *data_buf, uint16_t max_len)
Generic read function.
void rs485isolator2_set_re_pin(rs485isolator2_t *ctx, uint8_t state)
Set RE ( reset ) pin state.
RS485ISOLATOR2_RETVAL rs485isolator2_init(rs485isolator2_t *ctx, rs485isolator2_cfg_t *cfg)
Initialization function.
void rs485isolator2_cfg_setup(rs485isolator2_cfg_t *cfg)
Config Object Initialization function.
uint8_t rs485isolator2_error_t
Error type.
Definition rs485isolator2.h:168
Click configuration structure definition.
Definition rs485isolator2.h:142
uint32_t baud_rate
Definition rs485isolator2.h:157
pin_name_t re
Definition rs485isolator2.h:150
bool uart_blocking
Definition rs485isolator2.h:158
uart_data_bits_t data_bit
Definition rs485isolator2.h:159
pin_name_t tx_pin
Definition rs485isolator2.h:146
pin_name_t de
Definition rs485isolator2.h:151
pin_name_t inr
Definition rs485isolator2.h:152
pin_name_t rx_pin
Definition rs485isolator2.h:145
uart_stop_bits_t stop_bit
Definition rs485isolator2.h:161
uart_parity_t parity_bit
Definition rs485isolator2.h:160
pin_name_t ind
Definition rs485isolator2.h:153
Click ctx object definition.
Definition rs485isolator2.h:121
digital_out_t re
Definition rs485isolator2.h:124
uart_t uart
Definition rs485isolator2.h:131
digital_out_t de
Definition rs485isolator2.h:125
digital_out_t ind
Definition rs485isolator2.h:127
digital_out_t inr
Definition rs485isolator2.h:126