39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
73#define LR_CMD_SYS_GET_VER "sys get ver"
74#define LR_CMD_MAC_PAUSE "mac pause"
75#define LR_CMD_RADIO_SET_WDT "radio set wdt 0"
82#define LR_JM_OTAA "otaa"
83#define LR_JM_ABP "abp"
89#define LR_PL_CNF "cnf "
90#define LR_PL_UNCNF "uncnf "
96#define LR_INVALID_PARAM 1
97#define LR_NOT_JOINED 2
98#define LR_NO_FREE_CH 3
100#define LR_ERR_REJOIN_NEEDED 5
102#define LR_MAC_PAUSED 7
103#define LR_INVALID_PAR_DATA_LEN 8
104#define LR_KEYS_NOT_INIT 9
107#define LR_INVALID_REPAR_DATA_LEN 13
108#define LR_RADIO_ERR 14
115#define LR_MAX_DATA_SIZE 256
116#define LR_MAX_TRANSFER_SIZE 384
118#define LR_MAX_CMD_SIZE 64
124#define LR_MAX_RSP_SIZE 20
130#define LR_RESP_COUNT 100
136#define LR_TIMER_EXPIRED 50000
142#define LR_MAC_TX "mac tx "
143#define LR_JOIN "mac join "
144#define LR_RADIO_TX "radio tx "
145#define LR_RADIO_RX "radio rx "
152#define DRV_RX_BUFFER_SIZE 300
170#define LR_MAP_MIKROBUS( cfg, mikrobus ) \
171 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
172 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
173 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
174 cfg.rts = MIKROBUS( mikrobus, MIKROBUS_CS ); \
175 cfg.cts = MIKROBUS( mikrobus, MIKROBUS_INT )
226 void ( *callback_resp )(
char *response );
425uint8_t
lr_rx (
lr_t *ctx,
char *window_size,
char *response );
#define LR_MAX_TRANSFER_SIZE
Definition lr.h:116
#define DRV_RX_BUFFER_SIZE
LR driver buffer size.
Definition lr.h:152
uint8_t lr_rx(lr_t *ctx, char *window_size, char *response)
Main receiver function
uint8_t lr_tx(lr_t *ctx, char *buffer)
Main tnanceiver function.
void lr_cmd(lr_t *ctx, char *cmd, char *response)
Send command function.
uint8_t lr_join(lr_t *ctx, char *join_mode, char *response)
Function for setting join mode.
void lr_generic_write(lr_t *ctx, char *data_buf, uint16_t len)
LR data writing function.
int32_t lr_generic_read(lr_t *ctx, char *data_buf, uint16_t max_len)
LR data reading function.
void lr_tick_conf(lr_t *ctx, uint32_t timer_limit)
Timer Configuration.
void lr_isr_process(lr_t *ctx)
Main Process.
void lr_rx_isr(lr_t *ctx, char rx_input)
Receiver.
void lr_tick_isr(lr_t *ctx)
Timer.
void lr_put_char(lr_t *ctx, char data_in)
Function for write char.
void lr_default_cfg(lr_t *ctx, bool cb_default, void(*response_p)(char *response))
LR default configuration function.
uint8_t lr_mac_tx(lr_t *ctx, lr_mac_t *mac)
Function for writing mac parameters.
err_t lr_init(lr_t *ctx, lr_cfg_t *cfg)
LR initialization function.
void lr_cfg_setup(lr_cfg_t *cfg)
LR configuration object setup function.
lr_return_value_t
LR Click return value data.
Definition lr.h:300
@ LR_OK
Definition lr.h:301
@ LR_ERROR
Definition lr.h:302
Click buffers object definition.
Definition lr.h:185
uint16_t rx_buffer_len
Definition lr.h:188
LR Click configuration object.
Definition lr.h:276
pin_name_t rts
Definition lr.h:283
uint32_t baud_rate
Definition lr.h:287
pin_name_t cts
Definition lr.h:284
bool uart_blocking
Definition lr.h:288
uart_data_bits_t data_bit
Definition lr.h:289
pin_name_t tx_pin
Definition lr.h:279
pin_name_t rx_pin
Definition lr.h:278
uart_stop_bits_t stop_bit
Definition lr.h:291
uart_parity_t parity_bit
Definition lr.h:290
pin_name_t rst
Definition lr.h:282
Mac object definition.
Definition lr.h:235
char * response
Definition lr.h:239
char * payload
Definition lr.h:236
char * port_no
Definition lr.h:237
char * buffer
Definition lr.h:238
Process Flags object definition.
Definition lr.h:211
bool rsp_rdy_f
Definition lr.h:212
bool lr_rdy_f
Definition lr.h:213
Response object definition.
Definition lr.h:222
bool callback_default
Definition lr.h:225
bool rsp_f
Definition lr.h:223
char * rsp_buffer
Definition lr.h:224
LR Click context object.
Definition lr.h:248
char data_in
Definition lr.h:267
lr_procces_flags_t flags
Definition lr.h:265
lr_response_t rsp
Definition lr.h:266
digital_out_t rts
Definition lr.h:251
lr_buffers_t buff
Definition lr.h:263
uart_t uart
Definition lr.h:257
digital_in_t cts
Definition lr.h:254
digital_out_t rst
Definition lr.h:250
lr_timer_t tm
Definition lr.h:264
Timer Flags and Counter object definition.
Definition lr.h:197
bool timeout_f
Definition lr.h:199
bool timer_f
Definition lr.h:198
uint32_t ticker
Definition lr.h:201
bool timer_use_f
Definition lr.h:200
uint32_t timer_max
Definition lr.h:202