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 RN4871_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
68 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
69 cfg.rst_n = MIKROBUS( mikrobus, MIKROBUS_RST ); \
70 cfg.uart_rts = MIKROBUS( mikrobus, MIKROBUS_CS ); \
71 cfg.uart_cts = MIKROBUS( mikrobus, MIKROBUS_INT )
78#define RN4871_RETVAL uint8_t
81#define RN4871_INIT_ERROR 0xFF
88#define RN4871_DEVICETYPE_MASTER 0x02
89#define RN4871_DEVICETYPE_SLAVE 0x03
92#define RN4871_ID_MASTER 0x35
93#define RN4871_ID_SLAVE 0x32
94#define RN4871_MTYPE_MSG 'M'
95#define RN4871_DTYPE_STRING 0x5331
102#define DRV_RX_BUFFER_SIZE 500
135 char device_buffer[ 255 ];
#define DRV_RX_BUFFER_SIZE
Definition rn4871.h:102
#define RN4871_RETVAL
Definition rn4871.h:78
RN4871_RETVAL rn4871_init(rn4871_t *ctx, rn4871_cfg_t *cfg)
Initialization function.
void rn4871_disconnect(rn4871_t *ctx)
Disconnecting from slave device.
void rn4871_reset(rn4871_t *ctx)
Hardware reset function.
void rn4871_initialize(rn4871_t *ctx, char *p_addr)
Initialization RN4871 module.
void rn4871_uart_write(rn4871_t *ctx, uint8_t *wr_buf)
UART write function.
void rn4871_cfg_setup(rn4871_cfg_t *cfg)
Config Object Initialization function.
uint8_t rn4871_int_get(rn4871_t *ctx)
Get interrupt state function.
void rn4871_rst_set(rn4871_t *ctx, uint8_t pin_state)
Set states of RST pin to desired state.
void rn4871_receive(rn4871_t *ctx, char tmp)
Receiving character function.
int32_t rn4871_generic_read(rn4871_t *ctx, char *data_buf, uint16_t max_len)
Generic read function.
void rn4871_send(rn4871_t *ctx, uint8_t msg_type, uint16_t data_type, uint8_t id, uint8_t *payload)
Send message function.
void rn4871_connect(rn4871_t *ctx, char *p_addr)
Connecting to slave device.
uint8_t rn4871_read(rn4871_t *ctx, uint8_t *process_buffer)
Reading received message.
void rn4871_generic_write(rn4871_t *ctx, char *data_buf, uint16_t len)
Generic write function.
void rn4871_cs_set(rn4871_t *ctx, uint8_t pin_state)
Set states of CS pin to desired state.
Click configuration structure definition.
Definition rn4871.h:144
uint32_t baud_rate
Definition rn4871.h:158
pin_name_t rst_n
Definition rn4871.h:152
pin_name_t uart_rts
Definition rn4871.h:153
bool uart_blocking
Definition rn4871.h:159
uart_data_bits_t data_bit
Definition rn4871.h:160
pin_name_t tx_pin
Definition rn4871.h:148
pin_name_t rx_pin
Definition rn4871.h:147
uart_stop_bits_t stop_bit
Definition rn4871.h:162
uart_parity_t parity_bit
Definition rn4871.h:161
pin_name_t uart_cts
Definition rn4871.h:154
Click ctx object definition.
Definition rn4871.h:115
digital_in_t uart_cts
Definition rn4871.h:123
uint8_t buffer_position
Definition rn4871.h:136
digital_out_t uart_rts
Definition rn4871.h:119
uart_t uart
Definition rn4871.h:127
uint8_t end_flag
Definition rn4871.h:132
digital_out_t rst_n
Definition rn4871.h:118
uint8_t sentence_flag
Definition rn4871.h:133