Firmware SDK
twr_cmwx1zzabz.h
1 #ifndef _TWR_CMWX1ZZABZ_H
2 #define _TWR_CMWX1ZZABZ_H
3 
4 #include <twr_scheduler.h>
5 #include <twr_gpio.h>
6 #include <twr_uart.h>
7 
11 
13 
14 #define TWR_CMWX1ZZABZ_TX_MAX_PACKET_SIZE 230
15 
16 #define TWR_CMWX1ZZABZ_TX_FIFO_BUFFER_SIZE (TWR_CMWX1ZZABZ_TX_MAX_PACKET_SIZE + 25)
17 #define TWR_CMWX1ZZABZ_RX_FIFO_BUFFER_SIZE 220
18 #define TWR_CMWX1ZZABZ_CUSTOM_COMMAND_BUFFER_SIZE 32
19 #define TWR_CMWX1ZZABZ_FW_VERSION_BUFFER_SIZE 64
20 
21 
23 
25 
26 typedef enum
27 {
30 
33 
36 
39 
42 
45 
48 
51 
54 
57 
60 
63 
66 
67  TWR_CMWX1ZZABZ_EVENT_LINK_CHECK_OK = 13,
68 
69  TWR_CMWX1ZZABZ_EVENT_LINK_CHECK_NOK = 14,
70 
71  TWR_CMWX1ZZABZ_EVENT_MODEM_FACTORY_RESET = 15,
72 
73  TWR_CMWX1ZZABZ_EVENT_CUSTOM_AT = 16
74 
76 
78 
79 typedef struct twr_cmwx1zzabz_t twr_cmwx1zzabz_t;
80 
82 
83 typedef enum
84 {
85  TWR_CMWX1ZZABZ_CONFIG_MODE_ABP = 0,
86  TWR_CMWX1ZZABZ_CONFIG_MODE_OTAA = 1
87 
89 
91 
92 typedef enum
93 {
94  TWR_CMWX1ZZABZ_CONFIG_BAND_AS923 = 0,
95  TWR_CMWX1ZZABZ_CONFIG_BAND_AU915 = 1,
96  TWR_CMWX1ZZABZ_CONFIG_BAND_EU868 = 5,
97  TWR_CMWX1ZZABZ_CONFIG_BAND_KR920 = 6,
98  TWR_CMWX1ZZABZ_CONFIG_BAND_IN865 = 7,
99  TWR_CMWX1ZZABZ_CONFIG_BAND_US915 = 8
100 
102 
104 
105 typedef enum
106 {
107  TWR_CMWX1ZZABZ_CONFIG_CLASS_A = 0,
108  TWR_CMWX1ZZABZ_CONFIG_CLASS_C = 2
109 
111 
113 
114 typedef enum
115 {
116  TWR_CMWX1ZZABZ_CONFIG_DATARATE_AS923_SF12_125KHZ = 0,
117  TWR_CMWX1ZZABZ_CONFIG_DATARATE_AS923_SF11_125KHZ = 1,
118  TWR_CMWX1ZZABZ_CONFIG_DATARATE_AS923_SF10_125KHZ = 2,
119  TWR_CMWX1ZZABZ_CONFIG_DATARATE_AS923_SF9_125KHZ = 3,
120  TWR_CMWX1ZZABZ_CONFIG_DATARATE_AS923_SF8_125KHZ = 4,
121  TWR_CMWX1ZZABZ_CONFIG_DATARATE_AS923_SF7_125KHZ = 5,
122  TWR_CMWX1ZZABZ_CONFIG_DATARATE_AS923_SF7_250KHZ = 6,
123  TWR_CMWX1ZZABZ_CONFIG_DATARATE_AS923_FSK_50KBPS = 7,
124 
126 
128 
129 typedef enum
130 {
131  TWR_CMWX1ZZABZ_CONFIG_DATARATE_AU915_SF12_125KHZ = 0,
132  TWR_CMWX1ZZABZ_CONFIG_DATARATE_AU915_SF11_125KHZ = 1,
133  TWR_CMWX1ZZABZ_CONFIG_DATARATE_AU915_SF10_125KHZ = 2,
134  TWR_CMWX1ZZABZ_CONFIG_DATARATE_AU915_SF9_125KHZ = 3,
135  TWR_CMWX1ZZABZ_CONFIG_DATARATE_AU915_SF8_125KHZ = 4,
136  TWR_CMWX1ZZABZ_CONFIG_DATARATE_AU915_SF7_125KHZ = 5,
137  TWR_CMWX1ZZABZ_CONFIG_DATARATE_AU915_SF8_500KHZ = 6,
138  TWR_CMWX1ZZABZ_CONFIG_DATARATE_AU915_SF12_500KHZ = 8,
139  TWR_CMWX1ZZABZ_CONFIG_DATARATE_AU915_SF11_500KHZ = 9,
140  TWR_CMWX1ZZABZ_CONFIG_DATARATE_AU915_SF10_500KHZ = 10,
141  TWR_CMWX1ZZABZ_CONFIG_DATARATE_AU915_SF9_500KHZ = 11,
142  TWR_CMWX1ZZABZ_CONFIG_DATARATE_AU915_SF8_500KHZ_2 = 12,
143  TWR_CMWX1ZZABZ_CONFIG_DATARATE_AU915_SF7_500KHZ = 13
144 
146 
147 
149 
150 typedef enum
151 {
152  TWR_CMWX1ZZABZ_CONFIG_DATARATE_EU868_SF12_125KHZ = 0,
153  TWR_CMWX1ZZABZ_CONFIG_DATARATE_EU868_SF11_125KHZ = 1,
154  TWR_CMWX1ZZABZ_CONFIG_DATARATE_EU868_SF10_125KHZ = 2,
155  TWR_CMWX1ZZABZ_CONFIG_DATARATE_EU868_SF9_125KHZ = 3,
156  TWR_CMWX1ZZABZ_CONFIG_DATARATE_EU868_SF8_125KHZ = 4,
157  TWR_CMWX1ZZABZ_CONFIG_DATARATE_EU868_SF7_125KHZ = 5,
158  TWR_CMWX1ZZABZ_CONFIG_DATARATE_EU868_SF7_250KHZ = 6,
159  TWR_CMWX1ZZABZ_CONFIG_DATARATE_EU868_FSK_50KBPS = 7
160 
162 
164 
165 typedef enum
166 {
167  TWR_CMWX1ZZABZ_CONFIG_DATARATE_KR920_SF12_125KHZ = 0,
168  TWR_CMWX1ZZABZ_CONFIG_DATARATE_KR920_SF11_125KHZ = 1,
169  TWR_CMWX1ZZABZ_CONFIG_DATARATE_KR920_SF10_125KHZ = 2,
170  TWR_CMWX1ZZABZ_CONFIG_DATARATE_KR920_SF9_125KHZ = 3,
171  TWR_CMWX1ZZABZ_CONFIG_DATARATE_KR920_SF8_125KHZ = 4,
172  TWR_CMWX1ZZABZ_CONFIG_DATARATE_KR920_SF7_125KHZ = 5
173 
175 
177 
178 typedef enum
179 {
180  TWR_CMWX1ZZABZ_CONFIG_DATARATE_US915_SF10_125KHZ = 0,
181  TWR_CMWX1ZZABZ_CONFIG_DATARATE_US915_SF9_125KHZ = 1,
182  TWR_CMWX1ZZABZ_CONFIG_DATARATE_US915_SF8_125KHZ = 2,
183  TWR_CMWX1ZZABZ_CONFIG_DATARATE_US915_SF7_125KHZ = 3,
184  TWR_CMWX1ZZABZ_CONFIG_DATARATE_US915_SF8_500KHZ = 4,
185  TWR_CMWX1ZZABZ_CONFIG_DATARATE_US915_SF12_500KHZ = 8,
186  TWR_CMWX1ZZABZ_CONFIG_DATARATE_US915_SF11_500KHZ = 9,
187  TWR_CMWX1ZZABZ_CONFIG_DATARATE_US915_SF10_500KHZ = 10,
188  TWR_CMWX1ZZABZ_CONFIG_DATARATE_US915_SF9_500KHZ = 11,
189  TWR_CMWX1ZZABZ_CONFIG_DATARATE_US915_SF8_500KHZ_2 = 12,
190  TWR_CMWX1ZZABZ_CONFIG_DATARATE_US915_SF7_500KHZ = 13
191 
193 
195 
196 typedef enum
197 {
198  TWR_CMWX1ZZABZ_CONFIG_INDEX_DEVADDR = 0,
199  TWR_CMWX1ZZABZ_CONFIG_INDEX_DEVEUI = 1,
200  TWR_CMWX1ZZABZ_CONFIG_INDEX_APPEUI = 2,
201  TWR_CMWX1ZZABZ_CONFIG_INDEX_NWKSKEY = 3,
202  TWR_CMWX1ZZABZ_CONFIG_INDEX_APPSKEY = 4,
203  TWR_CMWX1ZZABZ_CONFIG_INDEX_APPKEY = 5,
204  TWR_CMWX1ZZABZ_CONFIG_INDEX_BAND = 6,
205  TWR_CMWX1ZZABZ_CONFIG_INDEX_MODE = 7,
206  TWR_CMWX1ZZABZ_CONFIG_INDEX_CLASS = 8,
207  TWR_CMWX1ZZABZ_CONFIG_INDEX_RX2 = 9,
208  TWR_CMWX1ZZABZ_CONFIG_INDEX_NWK = 10,
209  TWR_CMWX1ZZABZ_CONFIG_INDEX_ADAPTIVE_DATARATE = 11,
210  TWR_CMWX1ZZABZ_CONFIG_INDEX_DATARATE = 12,
211  TWR_CMWX1ZZABZ_CONFIG_INDEX_REP = 13,
212  TWR_CMWX1ZZABZ_CONFIG_INDEX_RTYNUM = 14,
213  TWR_CMWX1ZZABZ_CONFIG_INDEX_LAST_ITEM
214 
215 } twr_cmwx1zzabz_config_index_t;
216 
217 typedef enum
218 {
219  TWR_CMWX1ZZABZ_STATE_READY,
220  TWR_CMWX1ZZABZ_STATE_ERROR,
221  TWR_CMWX1ZZABZ_STATE_INITIALIZE,
222  TWR_CMWX1ZZABZ_STATE_INITIALIZE_AT_RESPONSE,
223  TWR_CMWX1ZZABZ_STATE_IDLE,
224  TWR_CMWX1ZZABZ_STATE_INITIALIZE_COMMAND_SEND,
225  TWR_CMWX1ZZABZ_STATE_INITIALIZE_COMMAND_RESPONSE,
226 
227  TWR_CMWX1ZZABZ_STATE_CONFIG_SAVE_SEND,
228  TWR_CMWX1ZZABZ_STATE_CONFIG_SAVE_RESPONSE,
229 
230  TWR_CMWX1ZZABZ_STATE_SEND_MESSAGE_COMMAND,
231  TWR_CMWX1ZZABZ_STATE_SEND_MESSAGE_CONFIRMED_COMMAND,
232  TWR_CMWX1ZZABZ_STATE_SEND_MESSAGE_RESPONSE,
233 
234  TWR_CMWX1ZZABZ_STATE_JOIN_SEND,
235  TWR_CMWX1ZZABZ_STATE_JOIN_RESPONSE,
236 
237  TWR_CMWX1ZZABZ_STATE_CUSTOM_COMMAND_SEND,
238  TWR_CMWX1ZZABZ_STATE_CUSTOM_COMMAND_RESPONSE,
239 
240  TWR_CMWX1ZZABZ_STATE_LINK_CHECK_SEND,
241  TWR_CMWX1ZZABZ_STATE_LINK_CHECK_RESPONSE,
242  TWR_CMWX1ZZABZ_STATE_LINK_CHECK_RESPONSE_ANS,
243 
244  TWR_CMWX1ZZABZ_STATE_RECEIVE,
245  TWR_CMWX1ZZABZ_STATE_RECOVER_BAUDRATE_UART,
246  TWR_CMWX1ZZABZ_STATE_RECOVER_BAUDRATE_REBOOT
247 
248 } twr_cmwx1zzabz_state_t;
249 
250 typedef struct
251 {
255  char devaddr[8 + 1];
256  char deveui[16 + 1];
257  char appeui[16 + 1];
258  char nwkskey[32 + 1];
259  char appskey[32 + 1];
260  char appkey[32 + 1];
261  uint32_t rx2_frequency;
262  uint8_t rx2_datarate;
263  uint8_t nwk_public;
264  bool adaptive_datarate;
265  uint8_t datarate;
266  uint8_t repetition_unconfirmed;
267  uint8_t repetition_confirmed;
268 
269 } twr_cmwx1zzabz_config;
270 
271 struct twr_cmwx1zzabz_t
272 {
273  twr_scheduler_task_id_t _task_id;
274  twr_uart_channel_t _uart_channel;
275  twr_cmwx1zzabz_state_t _state;
276  twr_cmwx1zzabz_state_t _state_after_sleep;
277  twr_fifo_t _tx_fifo;
278  twr_fifo_t _rx_fifo;
279  uint8_t _tx_fifo_buffer[TWR_CMWX1ZZABZ_TX_FIFO_BUFFER_SIZE];
280  uint8_t _rx_fifo_buffer[TWR_CMWX1ZZABZ_RX_FIFO_BUFFER_SIZE];
281  void (*_event_handler)(twr_cmwx1zzabz_t *, twr_cmwx1zzabz_event_t, void *);
282  void *_event_param;
283  char _command[TWR_CMWX1ZZABZ_TX_FIFO_BUFFER_SIZE];
284  char _response[TWR_CMWX1ZZABZ_RX_FIFO_BUFFER_SIZE];
285  uint8_t _response_length;
286  uint8_t _message_buffer[TWR_CMWX1ZZABZ_TX_MAX_PACKET_SIZE];
287  size_t _message_length;
288  uint8_t _message_port;
289  uint8_t _init_command_index;
290  uint8_t _save_command_index;
291  bool _save_flag;
292  uint32_t _save_config_mask;
293  twr_cmwx1zzabz_config _config;
294  bool _join_command;
295  bool _link_check_command;
296  bool _custom_command;
297  char _custom_command_buf[TWR_CMWX1ZZABZ_CUSTOM_COMMAND_BUFFER_SIZE];
298  uint8_t _tx_port;
299  bool _debug;
300 
301  char _fw_version[TWR_CMWX1ZZABZ_FW_VERSION_BUFFER_SIZE];
302 
303  int32_t _cmd_rfq_rssi;
304  int32_t _cmd_rfq_snr;
305 
306  uint32_t _cmd_frmcnt_uplink;
307  uint32_t _cmd_frmcnt_downlink;
308 
309  uint8_t _cmd_link_check_margin;
310  uint8_t _cmd_link_check_gwcnt;
311 
312  twr_tick_t _timeout;
313 };
314 
316 
320 
322 
325 
327 
330 
332 
337 
338 void twr_cmwx1zzabz_set_event_handler(twr_cmwx1zzabz_t *self, void (*event_handler)(twr_cmwx1zzabz_t *, twr_cmwx1zzabz_event_t, void *), void *event_param);
339 
344 
346 
353 
354 bool twr_cmwx1zzabz_send_message(twr_cmwx1zzabz_t *self, const void *buffer, size_t length);
355 
362 
363 bool twr_cmwx1zzabz_send_message_confirmed(twr_cmwx1zzabz_t *self, const void *buffer, size_t length);
364 
368 
369 void twr_cmwx1zzabz_set_devaddr(twr_cmwx1zzabz_t *self, char *devaddr);
370 
374 
375 void twr_cmwx1zzabz_get_devaddr(twr_cmwx1zzabz_t *self, char *devaddr);
376 
380 
381 void twr_cmwx1zzabz_set_deveui(twr_cmwx1zzabz_t *self, char *deveui);
382 
386 
387 void twr_cmwx1zzabz_get_deveui(twr_cmwx1zzabz_t *self, char *deveui);
388 
392 
393 void twr_cmwx1zzabz_set_appeui(twr_cmwx1zzabz_t *self, char *appeui);
394 
398 
399 void twr_cmwx1zzabz_get_appeui(twr_cmwx1zzabz_t *self, char *appeui);
400 
404 
405 void twr_cmwx1zzabz_set_nwkskey(twr_cmwx1zzabz_t *self, char *nwkskey);
406 
410 
411 void twr_cmwx1zzabz_get_nwkskey(twr_cmwx1zzabz_t *self, char *nwkskey);
412 
416 
417 void twr_cmwx1zzabz_set_appskey(twr_cmwx1zzabz_t *self, char *appskey);
418 
422 
423 void twr_cmwx1zzabz_get_appskey(twr_cmwx1zzabz_t *self, char *appskey);
424 
428 
429 void twr_cmwx1zzabz_set_appkey(twr_cmwx1zzabz_t *self, char *appkey);
430 
434 
435 void twr_cmwx1zzabz_get_appkey(twr_cmwx1zzabz_t *self, char *appkey);
436 
440 
442 
446 
448 
452 
454 
458 
460 
464 
466 
470 
472 
477 
479 
483 
485 
489 
491 
497 
498 uint32_t twr_cmwx1zzabz_get_received_message_data(twr_cmwx1zzabz_t *self, uint8_t *buffer, uint32_t buffer_size);
499 
503 
504 void twr_cmwx1zzabz_set_port(twr_cmwx1zzabz_t *self, uint8_t port);
505 
509 
511 
516 
517 void twr_cmwx1zzabz_set_rx2(twr_cmwx1zzabz_t *self, uint32_t frequency, uint8_t datarate);
518 
523 
524 void twr_cmwx1zzabz_get_rx2(twr_cmwx1zzabz_t *self, uint32_t *frequency, uint8_t *datarate);
525 
529 
530 void twr_cmwx1zzabz_set_nwk_public(twr_cmwx1zzabz_t *self, uint8_t public);
531 
535 
537 
541 
543 
547 
549 
553 
554 void twr_cmwx1zzabz_set_datarate(twr_cmwx1zzabz_t *self, uint8_t datarate);
555 
559 
561 
565 
566 void twr_cmwx1zzabz_set_debug(twr_cmwx1zzabz_t *self, bool debug);
567 
571 
573 
577 
579 
583 
584 bool twr_cmwx1zzabz_custom_at(twr_cmwx1zzabz_t *self, char *at_command);
585 
588 
590 
596 
597 bool twr_cmwx1zzabz_get_rfq(twr_cmwx1zzabz_t *self, int32_t *rssi, int32_t *snr);
598 
601 
603 
609 
610 bool twr_cmwx1zzabz_get_frame_counter(twr_cmwx1zzabz_t *self, uint32_t *uplink, uint32_t *downlink);
611 
614 
616 
622 
623 bool twr_cmwx1zzabz_get_link_check(twr_cmwx1zzabz_t *self, uint8_t *margin, uint8_t *gateway_count);
624 
627 
629 
633 
635 
639 
640 void twr_cmwx1zzabz_set_repeat_unconfirmed(twr_cmwx1zzabz_t *self, uint8_t repeat);
641 
645 
647 
651 
652 void twr_cmwx1zzabz_set_repeat_confirmed(twr_cmwx1zzabz_t *self, uint8_t repeat);
653 
657 
659 
661 
662 #endif // _TWR_CMWX1ZZABZ_H
twr_cmwx1zzabz_config_datarate_as923_t
Datarate for AS923.
void twr_cmwx1zzabz_set_adaptive_datarate(twr_cmwx1zzabz_t *self, bool enable)
Set the configuration adaptive data rate.
bool twr_cmwx1zzabz_link_check(twr_cmwx1zzabz_t *self)
Request send of link check packet.
void twr_cmwx1zzabz_set_appeui(twr_cmwx1zzabz_t *self, char *appeui)
Set APPEUI.
void twr_cmwx1zzabz_get_deveui(twr_cmwx1zzabz_t *self, char *deveui)
Get DEVEUI.
void twr_cmwx1zzabz_init(twr_cmwx1zzabz_t *self, twr_uart_channel_t uart_channel)
Initialize CMWX1ZZABZ.
char * twr_cmwx1zzabz_get_error_command(twr_cmwx1zzabz_t *self)
Get pointer to string containg last sent command.
uint8_t twr_cmwx1zzabz_get_nwk_public(twr_cmwx1zzabz_t *self)
Get the configuration if public networks are enabled.
void twr_cmwx1zzabz_set_rx2(twr_cmwx1zzabz_t *self, uint32_t frequency, uint8_t datarate)
Set the frequency and datarate for RX2 receive window.
void twr_cmwx1zzabz_set_nwkskey(twr_cmwx1zzabz_t *self, char *nwkskey)
Set NWKSKEY.
void twr_cmwx1zzabz_get_appkey(twr_cmwx1zzabz_t *self, char *appkey)
Get APPKEY.
uint8_t twr_cmwx1zzabz_get_datarate(twr_cmwx1zzabz_t *self)
Get the configuration of datarate.
bool twr_cmwx1zzabz_send_message(twr_cmwx1zzabz_t *self, const void *buffer, size_t length)
Send LoRa message.
void twr_cmwx1zzabz_set_debug(twr_cmwx1zzabz_t *self, bool debug)
Set debugging flag which prints modem communication to twr_log.
void twr_cmwx1zzabz_get_nwkskey(twr_cmwx1zzabz_t *self, char *nwkskey)
Set NWKSKEY.
void twr_cmwx1zzabz_set_event_handler(twr_cmwx1zzabz_t *self, void(*event_handler)(twr_cmwx1zzabz_t *, twr_cmwx1zzabz_event_t, void *), void *event_param)
Set callback function.
twr_cmwx1zzabz_config_datarate_au915_t
Datarate for AU915.
bool twr_cmwx1zzabz_is_ready(twr_cmwx1zzabz_t *self)
Check if modem is ready for commands.
bool twr_cmwx1zzabz_get_rfq(twr_cmwx1zzabz_t *self, int32_t *rssi, int32_t *snr)
Get RF quality values in callback.
void twr_cmwx1zzabz_set_band(twr_cmwx1zzabz_t *self, twr_cmwx1zzabz_config_band_t band)
Set BAND.
void twr_cmwx1zzabz_set_repeat_unconfirmed(twr_cmwx1zzabz_t *self, uint8_t repeat)
Set number of transmissions of unconfirmed message.
twr_cmwx1zzabz_config_datarate_eu868_t
Datarate for EU868.
bool twr_cmwx1zzabz_frame_counter(twr_cmwx1zzabz_t *self)
Request frame counter value.
twr_cmwx1zzabz_config_mode_t
LoRa mode ABP/OTAA.
bool twr_cmwx1zzabz_get_link_check(twr_cmwx1zzabz_t *self, uint8_t *margin, uint8_t *gateway_count)
Get link check values.
void twr_cmwx1zzabz_set_devaddr(twr_cmwx1zzabz_t *self, char *devaddr)
Set DEVADDR.
twr_cmwx1zzabz_config_datarate_kr920_t
Datarate for KR920.
void twr_cmwx1zzabz_join(twr_cmwx1zzabz_t *self)
Start LoRa OTAA join procedure.
char * twr_cmwx1zzabz_get_fw_version(twr_cmwx1zzabz_t *self)
Get firmware version string.
twr_cmwx1zzabz_config_band_t twr_cmwx1zzabz_get_band(twr_cmwx1zzabz_t *self)
Get BAND.
void twr_cmwx1zzabz_set_port(twr_cmwx1zzabz_t *self, uint8_t port)
Set the port for the transmission of the messages.
void twr_cmwx1zzabz_get_devaddr(twr_cmwx1zzabz_t *self, char *devaddr)
Get DEVADDR.
bool twr_cmwx1zzabz_rfq(twr_cmwx1zzabz_t *self)
Request RF quality of the last received packet (JOIN, LNPARAM, confirmed message)
void twr_cmwx1zzabz_set_class(twr_cmwx1zzabz_t *self, twr_cmwx1zzabz_config_class_t class)
Set device class.
uint32_t twr_cmwx1zzabz_get_received_message_data(twr_cmwx1zzabz_t *self, uint8_t *buffer, uint32_t buffer_size)
Get received message data.
twr_cmwx1zzabz_config_class_t
LoRa device class A or C.
void twr_cmwx1zzabz_reboot(twr_cmwx1zzabz_t *self)
Reboot and initialize CMWX1ZZABZ.
void twr_cmwx1zzabz_get_appskey(twr_cmwx1zzabz_t *self, char *appskey)
Get APPSKEY.
uint32_t twr_cmwx1zzabz_get_received_message_length(twr_cmwx1zzabz_t *self)
Get length of the received message.
void twr_cmwx1zzabz_set_nwk_public(twr_cmwx1zzabz_t *self, uint8_t public)
Set the configuration enabling public networks.
twr_cmwx1zzabz_config_datarate_us915_t
Datarate for US915.
void twr_cmwx1zzabz_set_deveui(twr_cmwx1zzabz_t *self, char *deveui)
Set DEVEUI.
twr_cmwx1zzabz_config_band_t
Frequency modes and standards.
uint8_t twr_cmwx1zzabz_get_port(twr_cmwx1zzabz_t *self)
Get the port for the transmission of the messages.
uint8_t twr_cmwx1zzabz_get_repeat_confirmed(twr_cmwx1zzabz_t *self)
Get number of transmissions of confirmed message.
bool twr_cmwx1zzabz_custom_at(twr_cmwx1zzabz_t *self, char *at_command)
Send custom AT command to LoRa Module.
void twr_cmwx1zzabz_deinit(twr_cmwx1zzabz_t *self)
Deinitialize CMWX1ZZABZ.
uint8_t twr_cmwx1zzabz_get_repeat_unconfirmed(twr_cmwx1zzabz_t *self)
Get number of transmissions of unconfirmed message.
void twr_cmwx1zzabz_set_datarate(twr_cmwx1zzabz_t *self, uint8_t datarate)
Set the configuration of datarate.
void twr_cmwx1zzabz_set_appkey(twr_cmwx1zzabz_t *self, char *appkey)
Set APPKEY.
void twr_cmwx1zzabz_set_appskey(twr_cmwx1zzabz_t *self, char *appskey)
Set APPSKEY.
twr_cmwx1zzabz_config_mode_t twr_cmwx1zzabz_get_mode(twr_cmwx1zzabz_t *self)
Get ABP/OTAA mode.
void twr_cmwx1zzabz_get_appeui(twr_cmwx1zzabz_t *self, char *appeui)
Get APPEUI.
bool twr_cmwx1zzabz_get_adaptive_datarate(twr_cmwx1zzabz_t *self)
Get the configuration if adaptive data rate are enabled.
twr_cmwx1zzabz_config_class_t twr_cmwx1zzabz_get_class(twr_cmwx1zzabz_t *self)
Get device class.
bool twr_cmwx1zzabz_factory_reset(twr_cmwx1zzabz_t *self)
Send factory reset command to LoRa Module.
struct twr_cmwx1zzabz_t twr_cmwx1zzabz_t
CMWX1ZZABZ instance.
bool twr_cmwx1zzabz_get_frame_counter(twr_cmwx1zzabz_t *self, uint32_t *uplink, uint32_t *downlink)
Get frame counter value.
void twr_cmwx1zzabz_get_rx2(twr_cmwx1zzabz_t *self, uint32_t *frequency, uint8_t *datarate)
Get the frequency and datarate for RX2 receive window.
bool twr_cmwx1zzabz_send_message_confirmed(twr_cmwx1zzabz_t *self, const void *buffer, size_t length)
Send LoRa confirmed message.
void twr_cmwx1zzabz_set_mode(twr_cmwx1zzabz_t *self, twr_cmwx1zzabz_config_mode_t mode)
Set ABP/OTAA mode.
char * twr_cmwx1zzabz_get_error_response(twr_cmwx1zzabz_t *self)
Get pointer to string containg response on last sent command.
uint8_t twr_cmwx1zzabz_get_received_message_port(twr_cmwx1zzabz_t *self)
Get port of the received message.
twr_cmwx1zzabz_event_t
Callback events.
void twr_cmwx1zzabz_set_repeat_confirmed(twr_cmwx1zzabz_t *self, uint8_t repeat)
Set number of transmissions of confirmed message.
@ TWR_CMWX1ZZABZ_EVENT_ERROR
Error event.
@ TWR_CMWX1ZZABZ_EVENT_CONFIG_SAVE_DONE
Configuration save done.
@ TWR_CMWX1ZZABZ_EVENT_MESSAGE_RECEIVED
Received message.
@ TWR_CMWX1ZZABZ_EVENT_FRAME_COUNTER
Frame counter response.
@ TWR_CMWX1ZZABZ_EVENT_SEND_MESSAGE_DONE
RF frame transmission finished event.
@ TWR_CMWX1ZZABZ_EVENT_READY
Ready event.
@ TWR_CMWX1ZZABZ_EVENT_MESSAGE_NOT_CONFIRMED
Sent message not confirmed.
@ TWR_CMWX1ZZABZ_EVENT_MESSAGE_CONFIRMED
Sent message confirmed.
@ TWR_CMWX1ZZABZ_EVENT_JOIN_ERROR
OTAA join error.
@ TWR_CMWX1ZZABZ_EVENT_SEND_MESSAGE_START
RF frame transmission started event.
@ TWR_CMWX1ZZABZ_EVENT_JOIN_SUCCESS
OTAA join success.
@ TWR_CMWX1ZZABZ_EVENT_RFQ
RF quality response.
@ TWR_CMWX1ZZABZ_EVENT_MESSAGE_RETRANSMISSION
Retransmission of the confirmed message.
size_t twr_scheduler_task_id_t
Task ID assigned by scheduler.
Definition: twr_scheduler.h:22
uint64_t twr_tick_t
Timestamp data type.
Definition: twr_tick.h:16
twr_uart_channel_t
UART channels.
Definition: twr_uart.h:14
Structure of FIFO instance.
Definition: twr_fifo.h:13