Select one of the symbols to view example projects that use it.
 
Outline
#include <stdint.h>
#include <stdbool.h>
#include "sdkconfig.h"
#include "esp_err.h"
#include "esp_ieee802154_types.h"
#include "esp_coex_i154.h"
esp_ieee802154_enable();
esp_ieee802154_disable();
esp_ieee802154_get_channel();
esp_ieee802154_set_channel(uint8_t);
esp_ieee802154_get_txpower();
esp_ieee802154_set_txpower(int8_t);
esp_ieee802154_set_power_table(esp_ieee802154_txpower_table_t);
esp_ieee802154_get_power_table(esp_ieee802154_txpower_table_t *);
esp_ieee802154_set_power_with_channel(uint8_t, int8_t);
esp_ieee802154_get_power_with_channel(uint8_t, int8_t *);
esp_ieee802154_get_promiscuous();
esp_ieee802154_set_promiscuous(bool);
esp_ieee802154_get_state();
esp_ieee802154_sleep();
esp_ieee802154_receive();
esp_ieee802154_transmit(const uint8_t *, bool);
esp_ieee802154_set_ack_timeout(uint32_t);
esp_ieee802154_get_ack_timeout();
esp_ieee802154_get_panid();
esp_ieee802154_set_panid(uint16_t);
esp_ieee802154_get_short_address();
esp_ieee802154_set_short_address(uint16_t);
esp_ieee802154_get_extended_address(uint8_t *);
esp_ieee802154_set_extended_address(const uint8_t *);
esp_ieee802154_get_multipan_panid(esp_ieee802154_multipan_index_t);
esp_ieee802154_set_multipan_panid(esp_ieee802154_multipan_index_t, uint16_t);
esp_ieee802154_get_multipan_short_address(esp_ieee802154_multipan_index_t);
esp_ieee802154_set_multipan_short_address(esp_ieee802154_multipan_index_t, uint16_t);
esp_ieee802154_get_multipan_extended_address(esp_ieee802154_multipan_index_t, uint8_t *);
esp_ieee802154_set_multipan_extended_address(esp_ieee802154_multipan_index_t, const uint8_t *);
esp_ieee802154_get_multipan_enable();
esp_ieee802154_set_multipan_enable(uint8_t);
esp_ieee802154_get_coordinator();
esp_ieee802154_set_coordinator(bool);
esp_ieee802154_get_pending_mode();
esp_ieee802154_set_pending_mode(esp_ieee802154_pending_mode_t);
esp_ieee802154_add_pending_addr(const uint8_t *, bool);
esp_ieee802154_clear_pending_addr(const uint8_t *, bool);
esp_ieee802154_reset_pending_table(bool);
esp_ieee802154_get_cca_threshold();
esp_ieee802154_set_cca_threshold(int8_t);
esp_ieee802154_get_cca_mode();
esp_ieee802154_set_cca_mode(esp_ieee802154_cca_mode_t);
esp_ieee802154_set_rx_when_idle(bool);
esp_ieee802154_get_rx_when_idle();
esp_ieee802154_energy_detect(uint32_t);
esp_ieee802154_receive_handle_done(const uint8_t *);
esp_ieee802154_receive_done(uint8_t *, esp_ieee802154_frame_info_t *);
esp_ieee802154_receive_sfd_done();
esp_ieee802154_transmit_done(const uint8_t *, const uint8_t *, esp_ieee802154_frame_info_t *);
esp_ieee802154_transmit_failed(const uint8_t *, esp_ieee802154_tx_error_t);
esp_ieee802154_transmit_sfd_done(uint8_t *);
esp_ieee802154_energy_detect_done(int8_t);
esp_ieee802154_receive_at(uint32_t);
esp_ieee802154_transmit_at(const uint8_t *, bool, uint32_t);
esp_ieee802154_get_recent_rssi();
esp_ieee802154_get_recent_lqi();
esp_ieee802154_set_transmit_security(uint8_t *, uint8_t *, uint8_t *);
esp_ieee802154_enh_ack_generator(uint8_t *, esp_ieee802154_frame_info_t *, uint8_t *);
esp_ieee802154_event_callback_list_register(esp_ieee802154_event_cb_list_t);
esp_ieee802154_event_callback_list_unregister();
Files
loading (1/5)...
SourceVuESP-IDF Framework and ExamplesESP-IDFcomponents/ieee802154/include/esp_ieee802154.h
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/* * SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 *//* ... */ #pragma once #include <stdint.h> #include <stdbool.h> #include "sdkconfig.h" #include "esp_err.h" #include "esp_ieee802154_types.h"5 includes #if !CONFIG_IEEE802154_TEST && (CONFIG_ESP_COEX_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE) #include "esp_coex_i154.h" #endif #ifdef __cplusplus extern "C" { #endif /** * @brief Initialize the IEEE 802.15.4 subsystem. * * @return * - ESP_OK on success. * - ESP_FAIL on failure. * *//* ... */ esp_err_t esp_ieee802154_enable(void); /** * @brief Deinitialize the IEEE 802.15.4 subsystem. * * @return * - ESP_OK on success. * - ESP_FAIL on failure. *//* ... */ esp_err_t esp_ieee802154_disable(void); /** * @brief Get the operational channel. * * @return The channel number (11~26). * *//* ... */ uint8_t esp_ieee802154_get_channel(void); /** * @brief Set the operational channel. * * @param[in] channel The channel number (11-26). * * @return * - ESP_OK on success. * - ESP_FAIL on failure. *//* ... */ esp_err_t esp_ieee802154_set_channel(uint8_t channel); /** * @brief Get the transmit power. * * @return The transmit power in dBm. * *//* ... */ int8_t esp_ieee802154_get_txpower(void); /** * @brief Set the transmit power. * * @param[in] power The transmit power in dBm. * * @return * - ESP_OK on success. * - ESP_FAIL on failure. *//* ... */ esp_err_t esp_ieee802154_set_txpower(int8_t power); /** * @brief Set the transmission power table. * * @param[in] power_table The power table. * * @return * - ESP_OK Set the transmission power table to successfully. *//* ... */ esp_err_t esp_ieee802154_set_power_table(esp_ieee802154_txpower_table_t power_table); /** * @brief Get the transmission power table. * * @param[out] out_power_table The power table. * * @return * - ESP_OK Get the transmission power table successfully. * - ESP_ERR_INVALID_ARG Invalid arguments. * *//* ... */ esp_err_t esp_ieee802154_get_power_table(esp_ieee802154_txpower_table_t *out_power_table); /** * @brief Set the transmission power for a specific channel. * * @param[in] channel The channel. * @param[in] power The power. * * @return * - ESP_OK Set the transmission power for a specific channel successfully. * - ESP_ERR_INVALID_ARG Invalid arguments. *//* ... */ esp_err_t esp_ieee802154_set_power_with_channel(uint8_t channel, int8_t power); /** * @brief Get the transmission power for a specific channel. * * @param[in] channel The channel. * @param[out] out_power The power. * * @return * - ESP_OK Get the transmission power for a specific channel successfully. * - ESP_ERR_INVALID_ARG Invalid arguments. *//* ... */ esp_err_t esp_ieee802154_get_power_with_channel(uint8_t channel, int8_t *out_power); /** * @brief Get the promiscuous mode. * * @return * - True The promiscuous mode is enabled. * - False The promiscuous mode is disabled. * *//* ... */ bool esp_ieee802154_get_promiscuous(void); /** * @brief Set the promiscuous mode. * * @param[in] enable The promiscuous mode to be set. * * @return * - ESP_OK on success. * - ESP_FAIL on failure. *//* ... */ esp_err_t esp_ieee802154_set_promiscuous(bool enable); /** * @brief Get the IEEE 802.15.4 Radio state. * * @return The IEEE 802.15.4 Radio state, refer to esp_ieee802154_state_t. * *//* ... */ esp_ieee802154_state_t esp_ieee802154_get_state(void); /** * @brief Set the IEEE 802.15.4 Radio to sleep state. * * @return * - ESP_OK on success. * - ESP_FAIL on failure due to invalid state. * *//* ... */ esp_err_t esp_ieee802154_sleep(void); /** * @brief Set the IEEE 802.15.4 Radio to receive state. * * @note Radio will continue receiving until it receives a valid frame. * Refer to `esp_ieee802154_receive_done()`. * * @return * - ESP_OK on success * - ESP_FAIL on failure due to invalid state. * *//* ... */ esp_err_t esp_ieee802154_receive(void); /** * @brief Transmit the given frame. * The transmit result will be reported via `esp_ieee802154_transmit_done()` * or `esp_ieee802154_transmit_failed()`. * * @param[in] frame The pointer to the frame, the frame format: * |-----------------------------------------------------------------------| * | Len | MHR | MAC Payload | FCS | * |-----------------------------------------------------------------------| * @param[in] cca Perform CCA before transmission if it's true, otherwise transmit the frame directly. * * @note During transmission, the hardware calculates the FCS, and send it over the air right after the MAC payload, * so you just need to prepare the length, mac header and mac payload content. * * @return * - ESP_OK on success. * - ESP_ERR_INVALID_ARG on an invalid frame. * - ESP_FAIL on failure due to invalid state. * *//* ... */ esp_err_t esp_ieee802154_transmit(const uint8_t *frame, bool cca); /** * @brief Set the time to wait for the ack frame. * * @param[in] timeout The time to wait for the ack frame, in us. * It Should be a multiple of 16. The default value is 1728 us (108 * 16). * * @return * - ESP_OK on success. * - ESP_FAIL on failure. *//* ... */ esp_err_t esp_ieee802154_set_ack_timeout(uint32_t timeout); /** * @brief Get the time to wait for the ack frame. * * @return The time to wait for the ack frame, in us. *//* ... */ uint32_t esp_ieee802154_get_ack_timeout(void); /** * @brief Get the device PAN ID. * * @return The device PAN ID. * *//* ... */ uint16_t esp_ieee802154_get_panid(void); /** * @brief Set the device PAN ID. * * @param[in] panid The device PAN ID. * * @return * - ESP_OK on success. * - ESP_FAIL on failure. *//* ... */ esp_err_t esp_ieee802154_set_panid(uint16_t panid); /** * @brief Get the device short address. * * @return The device short address. * *//* ... */ uint16_t esp_ieee802154_get_short_address(void); /** * @brief Set the device short address. * * @param[in] short_address The device short address. * * @return * - ESP_OK on success. * - ESP_FAIL on failure. *//* ... */ esp_err_t esp_ieee802154_set_short_address(uint16_t short_address); /** * @brief Get the device extended address. * * @param[out] ext_addr The pointer to the device extended address. * * @return * - ESP_OK on success. * - ESP_FAIL on failure. *//* ... */ esp_err_t esp_ieee802154_get_extended_address(uint8_t *ext_addr); /** * @brief Set the device extended address. * * @param[in] ext_addr The pointer to the device extended address. * * @return * - ESP_OK on success. * - ESP_FAIL on failure. *//* ... */ esp_err_t esp_ieee802154_set_extended_address(const uint8_t *ext_addr); /** * @brief Get the device PAN ID for specific interface. * * @param[in] index The interface index. * * @return The device PAN ID. * *//* ... */ uint16_t esp_ieee802154_get_multipan_panid(esp_ieee802154_multipan_index_t index); /** * @brief Set the device PAN ID for specific interface. * * @param[in] index The interface index. * @param[in] panid The device PAN ID. * * @return * - ESP_OK on success. * - ESP_FAIL on failure. *//* ... */ esp_err_t esp_ieee802154_set_multipan_panid(esp_ieee802154_multipan_index_t index, uint16_t panid); /** * @brief Get the device short address for specific interface. * * @param[in] index The interface index. * * @return The device short address. * *//* ... */ uint16_t esp_ieee802154_get_multipan_short_address(esp_ieee802154_multipan_index_t index); /** * @brief Set the device short address for specific interface. * * @param[in] index The interface index. * @param[in] short_address The device short address. * * @return * - ESP_OK on success. * - ESP_FAIL on failure. *//* ... */ esp_err_t esp_ieee802154_set_multipan_short_address(esp_ieee802154_multipan_index_t index, uint16_t short_address); /** * @brief Get the device extended address for specific interface. * * @param[in] index The interface index. * @param[out] ext_addr The pointer to the device extended address. * * @return * - ESP_OK on success. * - ESP_FAIL on failure. *//* ... */ esp_err_t esp_ieee802154_get_multipan_extended_address(esp_ieee802154_multipan_index_t index, uint8_t *ext_addr); /** * @brief Set the device extended address for specific interface. * * @param[in] index The interface index. * @param[in] ext_addr The pointer to the device extended address. * * @return * - ESP_OK on success. * - ESP_FAIL on failure. *//* ... */ esp_err_t esp_ieee802154_set_multipan_extended_address(esp_ieee802154_multipan_index_t index, const uint8_t *ext_addr); /** * @brief Get the device current multipan interface enable mask. * * @return Current multipan interface enable mask. * *//* ... */ uint8_t esp_ieee802154_get_multipan_enable(void); /** * @brief Enable specific interface for the device. * * As an example, call `esp_ieee802154_set_multipan_enable(BIT(ESP_IEEE802154_MULTIPAN_0) | BIT(ESP_IEEE802154_MULTIPAN_1));` * to enable multipan interface 0 and 1. * * @param[in] mask The multipan interface bit mask. * * @return * - ESP_OK on success. * - ESP_FAIL on failure. *//* ... */ esp_err_t esp_ieee802154_set_multipan_enable(uint8_t mask); /** * @brief Get the device coordinator. * * @return * - True The coordinator is enabled. * - False The coordinator is disabled. * *//* ... */ bool esp_ieee802154_get_coordinator(void); /** * @brief Set the device coordinator role. * * @param[in] enable The coordinator role to be set. * * @return * - ESP_OK on success. * - ESP_FAIL on failure. *//* ... */ esp_err_t esp_ieee802154_set_coordinator(bool enable); /** * @brief Get the auto frame pending mode. * * @return The auto frame pending mode, refer to esp_ieee802154_pending_mode_t. * *//* ... */ esp_ieee802154_pending_mode_t esp_ieee802154_get_pending_mode(void); /** * @brief Set the auto frame pending mode. * * @param[in] pending_mode The auto frame pending mode, refer to esp_ieee802154_pending_mode_t. * * @return * - ESP_OK on success. * - ESP_FAIL on failure. *//* ... */ esp_err_t esp_ieee802154_set_pending_mode(esp_ieee802154_pending_mode_t pending_mode); /** * @brief Add address to the source matching table. * * @param[in] addr The pointer to the address. * @param[in] is_short Short address or Extended address. * * @return * - ESP_OK on success. * - ESP_ERR_NO_MEM if the pending table is full. * *//* ... */ esp_err_t esp_ieee802154_add_pending_addr(const uint8_t *addr, bool is_short); /** * @brief Remove address from the source matching table. * * @param[in] addr The pointer to the address. * @param[in] is_short Short address or Extended address. * * @return * - ESP_OK on success. * - ESP_ERR_NOT_FOUND if the address was not found from the source matching table. * *//* ... */ esp_err_t esp_ieee802154_clear_pending_addr(const uint8_t *addr, bool is_short); /** * @brief Clear the source matching table to empty. * * @param[in] is_short Clear Short address table or Extended address table. * * @return * - ESP_OK on success. * - ESP_FAIL on failure. *//* ... */ esp_err_t esp_ieee802154_reset_pending_table(bool is_short); /** * @brief Get the CCA threshold. * * @return The CCA threshold in dBm. * *//* ... */ int8_t esp_ieee802154_get_cca_threshold(void); /** * @brief Set the CCA threshold. * * @param[in] cca_threshold The CCA threshold in dBm. * * @return * - ESP_OK on success. * - ESP_FAIL on failure. *//* ... */ esp_err_t esp_ieee802154_set_cca_threshold(int8_t cca_threshold); /** * @brief Get the CCA mode. * * @return The CCA mode, refer to esp_ieee802154_cca_mode_t. * *//* ... */ esp_ieee802154_cca_mode_t esp_ieee802154_get_cca_mode(void); /** * @brief Set the CCA mode. * * @param[in] cca_mode The CCA mode, refer to esp_ieee802154_cca_mode_t. * * @return * - ESP_OK on success. * - ESP_FAIL on failure. *//* ... */ esp_err_t esp_ieee802154_set_cca_mode(esp_ieee802154_cca_mode_t cca_mode); /** * @brief Enable rx_on_when_idle mode, radio will receive during idle. * * @param[in] enable Enable/Disable rx_on_when_idle mode. * * @return * - ESP_OK on success. * - ESP_FAIL on failure. *//* ... */ esp_err_t esp_ieee802154_set_rx_when_idle(bool enable); /** * @brief Get the rx_on_when_idle mode. * * @return rx_on_when_idle mode. * *//* ... */ bool esp_ieee802154_get_rx_when_idle(void); /** * @brief Perform energy detection. * * @param[in] duration The duration of energy detection, in symbol unit (16 us). * The result will be reported via esp_ieee802154_energy_detect_done(). * * @return * - ESP_OK on success. * - ESP_FAIL on failure due to invalid state. * *//* ... */ esp_err_t esp_ieee802154_energy_detect(uint32_t duration); /** * @brief Notify the IEEE 802.15.4 Radio that the frame is handled done by upper layer. * * @param[in] frame The pointer to the frame which was passed from the function `esp_ieee802154_receive_done()` * or ack frame from `esp_ieee802154_transmit_done()`. * * @return * - ESP_OK on success * - ESP_FAIL if frame is invalid. * *//* ... */ esp_err_t esp_ieee802154_receive_handle_done(const uint8_t *frame); /** Below are the events generated by IEEE 802.15.4 subsystem, which are in ISR context **/ /** * @brief A Frame was received. * * @note User must call the function `esp_ieee802154_receive_handle_done()` to notify 802.15.4 driver after the received frame is handled. * * @param[in] frame The point to the received frame, frame format: * |-----------------------------------------------------------------------| * | Len | MHR | MAC Payload (no FCS) | * |-----------------------------------------------------------------------| * @param[in] frame_info More information of the received frame, refer to esp_ieee802154_frame_info_t. * * @note During receiving, the hardware calculates the FCS of the received frame, and may drop it if the FCS doesn't match, only the valid * frames will be received and notified by esp_ieee802154_receive_done(). Please note that the FCS field is replaced by RSSI and LQI * value of the received frame. * *//* ... */ extern void esp_ieee802154_receive_done(uint8_t *frame, esp_ieee802154_frame_info_t *frame_info); /** * @brief The SFD field of the frame was received. * *//* ... */ extern void esp_ieee802154_receive_sfd_done(void); /** * @brief The Frame Transmission succeeded. * * @note If the ack frame is not null, user must call the function `esp_ieee802154_receive_handle_done()` to notify 802.15.4 driver * after the ack frame is handled. * * @param[in] frame The pointer to the transmitted frame. * @param[in] ack The received ACK frame, it could be NULL if the transmitted frame's AR bit is not set. * @param[in] ack_frame_info More information of the ACK frame, refer to esp_ieee802154_frame_info_t. * *//* ... */ extern void esp_ieee802154_transmit_done(const uint8_t *frame, const uint8_t *ack, esp_ieee802154_frame_info_t *ack_frame_info); /** * @brief The Frame Transmission failed. Refer to `esp_ieee802154_transmit()`. * * @param[in] frame The pointer to the frame. * @param[in] error The transmission failure reason, refer to esp_ieee802154_tx_error_t. * *//* ... */ extern void esp_ieee802154_transmit_failed(const uint8_t *frame, esp_ieee802154_tx_error_t error); /** * @brief The SFD field of the frame was transmitted. * *//* ... */ extern void esp_ieee802154_transmit_sfd_done(uint8_t *frame); /** * @brief The energy detection done. Refer to `esp_ieee802154_energy_detect()`. * * @param[in] power The detected power level, in dBm. * *//* ... */ extern void esp_ieee802154_energy_detect_done(int8_t power); /** * @brief Set the IEEE 802.15.4 Radio to receive state at a specific time. * * @note Radio will start receiving after the timestamp, and continue receiving until it receives a valid frame. * Refer to `esp_ieee802154_receive_done()`. * * @param[in] time A specific timestamp for starting receiving. * @return * - ESP_OK on success * - ESP_FAIL on failure due to invalid state. * *//* ... */ esp_err_t esp_ieee802154_receive_at(uint32_t time); /** * @brief Transmit the given frame at a specific time. * The transmit result will be reported via `esp_ieee802154_transmit_done()` * or `esp_ieee802154_transmit_failed()`. * * @param[in] frame The pointer to the frame. Refer to `esp_ieee802154_transmit()`. * @param[in] cca Perform CCA before transmission if it's true, otherwise transmit the frame directly. * @param[in] time A specific timestamp for starting transmission. * * @return * - ESP_OK on success. * - ESP_ERR_INVALID_ARG on an invalid frame. * - ESP_FAIL on failure due to invalid state. * *//* ... */ esp_err_t esp_ieee802154_transmit_at(const uint8_t *frame, bool cca, uint32_t time); /** * @brief Get the RSSI of the most recent received frame. * * @return The value of RSSI. * *//* ... */ int8_t esp_ieee802154_get_recent_rssi(void); /** * @brief Get the LQI of the most recent received frame. * * @return The value of LQI. * *//* ... */ uint8_t esp_ieee802154_get_recent_lqi(void); /** * @brief Set the key and addr for a frame needs to be encrypted by HW. * * @param[in] frame A frame needs to be encrypted. Refer to `esp_ieee802154_transmit()`. * @param[in] key A 16-bytes key for encryption. * @param[in] addr An 8-bytes addr for HW to generate nonce, in general, is the device extended address. * * @return * - ESP_OK on success. * - ESP_FAIL on failure. *//* ... */ esp_err_t esp_ieee802154_set_transmit_security(uint8_t *frame, uint8_t *key, uint8_t *addr); /** * @brief This function will be called when a received frame needs to be acked with Enh-Ack, the upper * layer should generate the Enh-Ack frame in this callback function. * * @param[in] frame The received frame. * @param[in] frame_info The frame information. Refer to `esp_ieee802154_frame_info_t`. * @param[out] enhack_frame The Enh-ack frame need to be generated via this function, HW will send it back after AIFS. * * @return * - ESP_OK if Enh-Ack generates done. * - ESP_FAIL if Enh-Ack generates failed. * *//* ... */ esp_err_t esp_ieee802154_enh_ack_generator(uint8_t *frame, esp_ieee802154_frame_info_t *frame_info, uint8_t* enhack_frame); /** * The configurable definitions via Kconfig *//* ... */ #if CONFIG_IEEE802154_TXRX_STATISTIC /** * @brief Clear the current IEEE802.15.4 statistic. * *//* ... */ void esp_ieee802154_txrx_statistic_clear(void); /** * @brief Print the current IEEE802.15.4 statistic. * *//* ... */ void esp_ieee802154_txrx_statistic_print(void);/* ... */ #endif // CONFIG_IEEE802154_TXRX_STATISTIC #if CONFIG_IEEE802154_RX_BUFFER_STATISTIC /** * @brief Print the current IEEE802.15.4 rx buffer statistic. * *//* ... */ void esp_ieee802154_rx_buffer_statistic_clear(void); /** * @brief Clear the current IEEE802.15.4 rx buffer statistic. * *//* ... */ void esp_ieee802154_rx_buffer_statistic_print(void);/* ... */ #endif // CONFIG_IEEE802154_RX_BUFFER_STATISTIC #if CONFIG_IEEE802154_RECORD /** * @brief Print the current IEEE802.15.4 event/command/state record. * *//* ... */ void esp_ieee802154_record_print(void);/* ... */ #endif // CONFIG_IEEE802154_RECORD #if !CONFIG_IEEE802154_TEST && (CONFIG_ESP_COEX_SW_COEXIST_ENABLE || CONFIG_EXTERNAL_COEX_ENABLE) /** * @brief Set the IEEE802.15.4 coexist config. * * @param[in] config The config of IEEE802.15.4 coexist. * *//* ... */ void esp_ieee802154_set_coex_config(esp_ieee802154_coex_config_t config); /** * @brief Get the IEEE802.15.4 coexist config. * * @return * - The config of IEEE802.15.4 coexist. * *//* ... */ esp_ieee802154_coex_config_t esp_ieee802154_get_coex_config(void);/* ... */ #endif /** * @brief Register process callbacks for events generated by the IEEE 802.15.4 subsystem. * * @param[in] cb_list The event process callback list, please refer to `esp_ieee802154_event_cb_list_t`. * * @note This API should be called only when IEEE 802.15.4 subsystem is not enabled * or after IEEE 802.15.4 subsystem is disabled (refer to `esp_ieee802154_disable`). * * @return * - ESP_OK on success. * - ESP_FAIL on failure. *//* ... */ esp_err_t esp_ieee802154_event_callback_list_register(esp_ieee802154_event_cb_list_t cb_list); /** * @brief Unregister process callbacks for events generated by the IEEE 802.15.4 subsystem. * * @note This API should be called only when IEEE 802.15.4 subsystem is not enabled * or after IEEE 802.15.4 subsystem is disabled (refer to `esp_ieee802154_disable`). * * @return * - ESP_OK on success. * - ESP_FAIL on failure. *//* ... */ esp_err_t esp_ieee802154_event_callback_list_unregister(void); #ifdef __cplusplus }{...} #endif
Details
Show:
from
Types: Columns:
This file uses the notable symbols shown below. Click anywhere in the file to view more details.