| LibDriver NRF24L01 1.0.0 NRF24L01 full function driver

driver_nrf24l01_send_receive_test.c
Go to the documentation of this file.
1
37 #include "driver_nrf24l01_send_receive_test.h"
38
39 static nrf24l01_handle_t gs_handle;
48 uint8_t nrf24l01_interrupt_test_irq_handler(void)
49 {
50 if (nrf24l01_irq_handler(&gs_handle) != 0)
51 {
52 return 1;
53 }
54 else
55 {
56 return 0;
57 }
58 }
59
67 uint8_t nrf24l01_send_test(void)
68 {
69 uint8_t res;
70 uint8_t reg;
71 uint8_t i;
72 nrf24l01_info_t info;
73 uint8_t addr0[5] = {0x1A, 0x01, 0x02, 0x03, 0x00};
74 uint8_t addr1[5] = {0x1B, 0x01, 0x02, 0x03, 0x01};
75 uint8_t addr2[5] = {0x1B, 0x01, 0x02, 0x03, 0x02};
76 uint8_t addr3[5] = {0x1B, 0x01, 0x02, 0x03, 0x03};
77 uint8_t addr4[5] = {0x1B, 0x01, 0x02, 0x03, 0x04};
78 uint8_t addr5[5] = {0x1B, 0x01, 0x02, 0x03, 0x05};
79 uint8_t data[32];
80
81 /* link function */
82 DRIVER_NRF24L01_LINK_INIT(&gs_handle, nrf24l01_handle_t);
83 DRIVER_NRF24L01_LINK_SPI_INIT(&gs_handle, nrf24l01_interface_spi_init);
84 DRIVER_NRF24L01_LINK_SPI_DEINIT(&gs_handle, nrf24l01_interface_spi_deinit);
85 DRIVER_NRF24L01_LINK_SPI_READ(&gs_handle, nrf24l01_interface_spi_read);
86 DRIVER_NRF24L01_LINK_SPI_WRITE(&gs_handle, nrf24l01_interface_spi_write);
87 DRIVER_NRF24L01_LINK_GPIO_INIT(&gs_handle, nrf24l01_interface_gpio_init);
88 DRIVER_NRF24L01_LINK_GPIO_DEINIT(&gs_handle, nrf24l01_interface_gpio_deinit);
89 DRIVER_NRF24L01_LINK_GPIO_WRITE(&gs_handle, nrf24l01_interface_gpio_write);
90 DRIVER_NRF24L01_LINK_DELAY_MS(&gs_handle, nrf24l01_interface_delay_ms);
91 DRIVER_NRF24L01_LINK_DEBUG_PRINT(&gs_handle, nrf24l01_interface_debug_print);
92 DRIVER_NRF24L01_LINK_RECEIVE_CALLBACK(&gs_handle, nrf24l01_interface_receive_callback);
93
94 /* get information */
95 res = nrf24l01_info(&info);
96 if (res != 0)
97 {
98 nrf24l01_interface_debug_print("nrf24l01: get info failed.\n");
99
100 return 1;
101 }
102 else
103 {
104 /* print chip info */
105 nrf24l01_interface_debug_print("nrf24l01: chip is %s.\n", info.chip_name);
106 nrf24l01_interface_debug_print("nrf24l01: manufacturer is %s.\n", info.manufacturer_name);
107 nrf24l01_interface_debug_print("nrf24l01: interface is %s.\n", info.interface);
108 nrf24l01_interface_debug_print("nrf24l01: driver version is %d.%d.\n", info.driver_version / 1000, (info.driver_version % 1000) / 100);
109 nrf24l01_interface_debug_print("nrf24l01: min supply voltage is %0.1fV.\n", info.supply_voltage_min_v);
110 nrf24l01_interface_debug_print("nrf24l01: max supply voltage is %0.1fV.\n", info.supply_voltage_max_v);
111 nrf24l01_interface_debug_print("nrf24l01: max current is %0.2fmA.\n", info.max_current_ma);
112 nrf24l01_interface_debug_print("nrf24l01: max temperature is %0.1fC.\n", info.temperature_max);
113 nrf24l01_interface_debug_print("nrf24l01: min temperature is %0.1fC.\n", info.temperature_min);
114 }
115
116 /* start send test */
117 nrf24l01_interface_debug_print("nrf24l01: start send test.\n");
118
119 /* init */
120 res = nrf24l01_init(&gs_handle);
121 if (res != 0)
122 {
123 nrf24l01_interface_debug_print("nrf24l01: init failed.\n");
124
125 return 1;
126 }
127
128 /* set active false */
129 res = nrf24l01_set_active(&gs_handle, NRF24L01_BOOL_FALSE);
130 if (res != 0)
131 {
132 nrf24l01_interface_debug_print("nrf24l01: set active failed.\n");
133 (void)nrf24l01_deinit(&gs_handle);
134
135 return 1;
136 }
137
138 /* enable power up */
139 res = nrf24l01_set_config(&gs_handle, NRF24L01_CONFIG_PWR_UP, NRF24L01_BOOL_TRUE);
140 if (res != 0)
141 {
142 nrf24l01_interface_debug_print("nrf24l01: set config failed.\n");
143 (void)nrf24l01_deinit(&gs_handle);
144
145 return 1;
146 }
147
148 /* enable crco */
149 res = nrf24l01_set_config(&gs_handle, NRF24L01_CONFIG_CRCO, NRF24L01_BOOL_TRUE);
150 if (res != 0)
151 {
152 nrf24l01_interface_debug_print("nrf24l01: set config failed.\n");
153 (void)nrf24l01_deinit(&gs_handle);
154
155 return 1;
156 }
157
158 /* enable crc */
159 res = nrf24l01_set_config(&gs_handle, NRF24L01_CONFIG_EN_CRC, NRF24L01_BOOL_TRUE);
160 if (res != 0)
161 {
162 nrf24l01_interface_debug_print("nrf24l01: set config failed.\n");
163 (void)nrf24l01_deinit(&gs_handle);
164
165 return 1;
166 }
167
168 /* enable max rt */
169 res = nrf24l01_set_config(&gs_handle, NRF24L01_CONFIG_MASK_MAX_RT, NRF24L01_BOOL_FALSE);
170 if (res != 0)
171 {
172 nrf24l01_interface_debug_print("nrf24l01: set config failed.\n");
173 (void)nrf24l01_deinit(&gs_handle);
174
175 return 1;
176 }
177
178 /* enable tx ds */
179 res = nrf24l01_set_config(&gs_handle, NRF24L01_CONFIG_MASK_TX_DS, NRF24L01_BOOL_FALSE);
180 if (res != 0)
181 {
182 nrf24l01_interface_debug_print("nrf24l01: set config failed.\n");
183 (void)nrf24l01_deinit(&gs_handle);
184
185 return 1;
186 }
187
188 /* enable rx dr */
189 res = nrf24l01_set_config(&gs_handle, NRF24L01_CONFIG_MASK_RX_DR, NRF24L01_BOOL_FALSE);
190 if (res != 0)
191 {
192 nrf24l01_interface_debug_print("nrf24l01: set config failed.\n");
193 (void)nrf24l01_deinit(&gs_handle);
194
195 return 1;
196 }
197
198 /* set tx mode */
199 res = nrf24l01_set_mode(&gs_handle, NRF24L01_MODE_TX);
200 if (res != 0)
201 {
202 nrf24l01_interface_debug_print("nrf24l01: set mode failed.\n");
203 (void)nrf24l01_deinit(&gs_handle);
204
205 return 1;
206 }
207
208 /* enable pipe 0 auto acknowledgment */
209 res = nrf24l01_set_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_0, NRF24L01_BOOL_TRUE);
210 if (res != 0)
211 {
212 nrf24l01_interface_debug_print("nrf24l01: set auto acknowledgment failed.\n");
213 (void)nrf24l01_deinit(&gs_handle);
214
215 return 1;
216 }
217
218 /* enable pipe 1 auto acknowledgment */
219 res = nrf24l01_set_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_1, NRF24L01_BOOL_TRUE);
220 if (res != 0)
221 {
222 nrf24l01_interface_debug_print("nrf24l01: set auto acknowledgment failed.\n");
223 (void)nrf24l01_deinit(&gs_handle);
224
225 return 1;
226 }
227
228 /* enable pipe 2 auto acknowledgment */
229 res = nrf24l01_set_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_2, NRF24L01_BOOL_TRUE);
230 if (res != 0)
231 {
232 nrf24l01_interface_debug_print("nrf24l01: set auto acknowledgment failed.\n");
233 (void)nrf24l01_deinit(&gs_handle);
234
235 return 1;
236 }
237
238 /* enable pipe 3 auto acknowledgment */
239 res = nrf24l01_set_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_3, NRF24L01_BOOL_TRUE);
240 if (res != 0)
241 {
242 nrf24l01_interface_debug_print("nrf24l01: set auto acknowledgment failed.\n");
243 (void)nrf24l01_deinit(&gs_handle);
244
245 return 1;
246 }
247
248 /* enable pipe 4 auto acknowledgment */
249 res = nrf24l01_set_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_4, NRF24L01_BOOL_TRUE);
250 if (res != 0)
251 {
252 nrf24l01_interface_debug_print("nrf24l01: set auto acknowledgment failed.\n");
253 (void)nrf24l01_deinit(&gs_handle);
254
255 return 1;
256 }
257
258 /* enable pipe 5 auto acknowledgment */
259 res = nrf24l01_set_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_5, NRF24L01_BOOL_TRUE);
260 if (res != 0)
261 {
262 nrf24l01_interface_debug_print("nrf24l01: set auto acknowledgment failed.\n");
263 (void)nrf24l01_deinit(&gs_handle);
264
265 return 1;
266 }
267
268 /* enable pipe 0 rx */
269 res = nrf24l01_set_rx_pipe(&gs_handle, NRF24L01_PIPE_0, NRF24L01_BOOL_TRUE);
270 if (res != 0)
271 {
272 nrf24l01_interface_debug_print("nrf24l01: set rx pipe failed.\n");
273 (void)nrf24l01_deinit(&gs_handle);
274
275 return 1;
276 }
277
278 /* enable pipe 1 rx */
279 res = nrf24l01_set_rx_pipe(&gs_handle, NRF24L01_PIPE_1, NRF24L01_BOOL_TRUE);
280 if (res != 0)
281 {
282 nrf24l01_interface_debug_print("nrf24l01: set rx pipe failed.\n");
283 (void)nrf24l01_deinit(&gs_handle);
284
285 return 1;
286 }
287
288 /* enable pipe 2 rx */
289 res = nrf24l01_set_rx_pipe(&gs_handle, NRF24L01_PIPE_2, NRF24L01_BOOL_TRUE);
290 if (res != 0)
291 {
292 nrf24l01_interface_debug_print("nrf24l01: set rx pipe failed.\n");
293 (void)nrf24l01_deinit(&gs_handle);
294
295 return 1;
296 }
297
298 /* enable pipe 3 rx */
299 res = nrf24l01_set_rx_pipe(&gs_handle, NRF24L01_PIPE_3, NRF24L01_BOOL_TRUE);
300 if (res != 0)
301 {
302 nrf24l01_interface_debug_print("nrf24l01: set rx pipe failed.\n");
303 (void)nrf24l01_deinit(&gs_handle);
304
305 return 1;
306 }
307
308 /* enable pipe 4 rx */
309 res = nrf24l01_set_rx_pipe(&gs_handle, NRF24L01_PIPE_4, NRF24L01_BOOL_TRUE);
310 if (res != 0)
311 {
312 nrf24l01_interface_debug_print("nrf24l01: set rx pipe failed.\n");
313 (void)nrf24l01_deinit(&gs_handle);
314
315 return 1;
316 }
317
318 /* enable pipe 5 rx */
319 res = nrf24l01_set_rx_pipe(&gs_handle, NRF24L01_PIPE_5, NRF24L01_BOOL_TRUE);
320 if (res != 0)
321 {
322 nrf24l01_interface_debug_print("nrf24l01: set rx pipe failed.\n");
323 (void)nrf24l01_deinit(&gs_handle);
324
325 return 1;
326 }
327
328 /* set address width 5 bytes */
329 res = nrf24l01_set_address_width(&gs_handle, NRF24L01_ADDRESS_WIDTH_5_BYTES);
330 if (res != 0)
331 {
332 nrf24l01_interface_debug_print("nrf24l01: set address width failed.\n");
333 (void)nrf24l01_deinit(&gs_handle);
334
335 return 1;
336 }
337
338 /* convert auto retransmit delay */
339 res = nrf24l01_auto_retransmit_delay_convert_to_register(&gs_handle, 750, (uint8_t *)&reg);
340 if (res != 0)
341 {
342 nrf24l01_interface_debug_print("nrf24l01: auto retransmit delay failed.\n");
343 (void)nrf24l01_deinit(&gs_handle);
344
345 return 1;
346 }
347
348 /* set auto retransmit delay */
349 res = nrf24l01_set_auto_retransmit_delay(&gs_handle, reg);
350 if (res != 0)
351 {
352 nrf24l01_interface_debug_print("nrf24l01: auto retransmit delay failed.\n");
353 (void)nrf24l01_deinit(&gs_handle);
354
355 return 1;
356 }
357
358 /* set the auto retransmit count */
359 res = nrf24l01_set_auto_retransmit_count(&gs_handle, 10);
360 if (res != 0)
361 {
362 nrf24l01_interface_debug_print("nrf24l01: auto retransmit count failed.\n");
363 (void)nrf24l01_deinit(&gs_handle);
364
365 return 1;
366 }
367
368 /* set the channel frequency */
369 res = nrf24l01_set_channel_frequency(&gs_handle, 20);
370 if (res != 0)
371 {
372 nrf24l01_interface_debug_print("nrf24l01: set channel frequency failed.\n");
373 (void)nrf24l01_deinit(&gs_handle);
374
375 return 1;
376 }
377
378 /* disable continuous carrier transmit */
379 res = nrf24l01_set_continuous_carrier_transmit(&gs_handle, NRF24L01_BOOL_FALSE);
380 if (res != 0)
381 {
382 nrf24l01_interface_debug_print("nrf24l01: set continuous carrier transmit failed.\n");
383 (void)nrf24l01_deinit(&gs_handle);
384
385 return 1;
386 }
387
388 /* disable force pll lock signal */
389 res = nrf24l01_set_force_pll_lock_signal(&gs_handle, NRF24L01_BOOL_FALSE);
390 if (res != 0)
391 {
392 nrf24l01_interface_debug_print("nrf24l01: set force pll lock signal failed.\n");
393 (void)nrf24l01_deinit(&gs_handle);
394
395 return 1;
396 }
397
398 /* 2M rate */
399 res = nrf24l01_set_data_rate(&gs_handle, NRF24L01_DATA_RATE_2M);
400 if (res != 0)
401 {
402 nrf24l01_interface_debug_print("nrf24l01: set data rate 2M failed.\n");
403 (void)nrf24l01_deinit(&gs_handle);
404
405 return 1;
406 }
407
408 /* set output power 0 dBm */
409 res = nrf24l01_set_output_power(&gs_handle, NRF24L01_OUTPUT_POWER_0_DBM);
410 if (res != 0)
411 {
412 nrf24l01_interface_debug_print("nrf24l01: set output power failed.\n");
413 (void)nrf24l01_deinit(&gs_handle);
414
415 return 1;
416 }
417
418 /* clear interrupt rx_dr */
419 res = nrf24l01_clear_interrupt(&gs_handle, NRF24L01_INTERRUPT_RX_DR);
420 if (res != 0)
421 {
422 nrf24l01_interface_debug_print("nrf24l01: clear interrupt failed.\n");
423 (void)nrf24l01_deinit(&gs_handle);
424
425 return 1;
426 }
427
428 /* clear interrupt tx_ds */
429 res = nrf24l01_clear_interrupt(&gs_handle, NRF24L01_INTERRUPT_TX_DS);
430 if (res != 0)
431 {
432 nrf24l01_interface_debug_print("nrf24l01: clear interrupt failed.\n");
433 (void)nrf24l01_deinit(&gs_handle);
434
435 return 1;
436 }
437
438 /* clear interrupt max_rt */
439 res = nrf24l01_clear_interrupt(&gs_handle, NRF24L01_INTERRUPT_MAX_RT);
440 if (res != 0)
441 {
442 nrf24l01_interface_debug_print("nrf24l01: clear interrupt failed.\n");
443 (void)nrf24l01_deinit(&gs_handle);
444
445 return 1;
446 }
447
448 /* clear interrupt tx_full */
449 res = nrf24l01_clear_interrupt(&gs_handle, NRF24L01_INTERRUPT_TX_FULL);
450 if (res != 0)
451 {
452 nrf24l01_interface_debug_print("nrf24l01: clear interrupt failed.\n");
453 (void)nrf24l01_deinit(&gs_handle);
454
455 return 1;
456 }
457
458 /* set rx pipe 0 address */
459 res = nrf24l01_set_rx_pipe_0_address(&gs_handle, (uint8_t *)addr0, 5);
460 if (res != 0)
461 {
462 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 0 address failed.\n");
463 (void)nrf24l01_deinit(&gs_handle);
464
465 return 1;
466 }
467
468 /* set rx pipe 1 address */
469 res = nrf24l01_set_rx_pipe_1_address(&gs_handle, (uint8_t *)addr1, 5);
470 if (res != 0)
471 {
472 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 1 address failed.\n");
473 (void)nrf24l01_deinit(&gs_handle);
474
475 return 1;
476 }
477
478 /* set rx pipe 2 address */
479 res = nrf24l01_set_rx_pipe_2_address(&gs_handle, addr2[4]);
480 if (res != 0)
481 {
482 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 2 address failed.\n");
483 (void)nrf24l01_deinit(&gs_handle);
484
485 return 1;
486 }
487
488 /* set rx pipe 3 address */
489 res = nrf24l01_set_rx_pipe_3_address(&gs_handle, addr3[4]);
490 if (res != 0)
491 {
492 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 3 address failed.\n");
493 (void)nrf24l01_deinit(&gs_handle);
494
495 return 1;
496 }
497
498 /* set rx pipe 4 address */
499 res = nrf24l01_set_rx_pipe_4_address(&gs_handle, addr4[4]);
500 if (res != 0)
501 {
502 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 4 address failed.\n");
503 (void)nrf24l01_deinit(&gs_handle);
504
505 return 1;
506 }
507
508 /* set rx pipe 5 address */
509 res = nrf24l01_set_rx_pipe_5_address(&gs_handle, addr5[4]);
510 if (res != 0)
511 {
512 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 5 address failed.\n");
513 (void)nrf24l01_deinit(&gs_handle);
514
515 return 1;
516 }
517
518 /* set pipe 0 payload number */
519 res = nrf24l01_set_pipe_0_payload_number(&gs_handle, 32);
520 if (res != 0)
521 {
522 nrf24l01_interface_debug_print("nrf24l01: set pipe 0 payload number failed.\n");
523 (void)nrf24l01_deinit(&gs_handle);
524
525 return 1;
526 }
527
528 /* set pipe 1 payload number */
529 res = nrf24l01_set_pipe_1_payload_number(&gs_handle, 32);
530 if (res != 0)
531 {
532 nrf24l01_interface_debug_print("nrf24l01: set pipe 1 payload number failed.\n");
533 (void)nrf24l01_deinit(&gs_handle);
534
535 return 1;
536 }
537
538 /* set pipe 2 payload number */
539 res = nrf24l01_set_pipe_2_payload_number(&gs_handle, 32);
540 if (res != 0)
541 {
542 nrf24l01_interface_debug_print("nrf24l01: set pipe 2 payload number failed.\n");
543 (void)nrf24l01_deinit(&gs_handle);
544
545 return 1;
546 }
547
548 /* set pipe 3 payload number */
549 res = nrf24l01_set_pipe_3_payload_number(&gs_handle, 32);
550 if (res != 0)
551 {
552 nrf24l01_interface_debug_print("nrf24l01: set pipe 3 payload number failed.\n");
553 (void)nrf24l01_deinit(&gs_handle);
554
555 return 1;
556 }
557
558 /* set pipe 4 payload number */
559 res = nrf24l01_set_pipe_4_payload_number(&gs_handle, 32);
560 if (res != 0)
561 {
562 nrf24l01_interface_debug_print("nrf24l01: set pipe 4 payload number failed.\n");
563 (void)nrf24l01_deinit(&gs_handle);
564
565 return 1;
566 }
567
568 /* set pipe 5 payload number */
569 res = nrf24l01_set_pipe_5_payload_number(&gs_handle, 32);
570 if (res != 0)
571 {
572 nrf24l01_interface_debug_print("nrf24l01: set pipe 5 payload number failed.\n");
573 (void)nrf24l01_deinit(&gs_handle);
574
575 return 1;
576 }
577
578 /* enable pipe 0 dynamic payload */
579 res = nrf24l01_set_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_0, NRF24L01_BOOL_TRUE);
580 if (res != 0)
581 {
582 nrf24l01_interface_debug_print("nrf24l01: set pipe dynamic payload failed.\n");
583 (void)nrf24l01_deinit(&gs_handle);
584
585 return 1;
586 }
587
588 /* enable pipe 1 dynamic payload */
589 res = nrf24l01_set_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_1, NRF24L01_BOOL_TRUE);
590 if (res != 0)
591 {
592 nrf24l01_interface_debug_print("nrf24l01: set pipe dynamic payload failed.\n");
593 (void)nrf24l01_deinit(&gs_handle);
594
595 return 1;
596 }
597
598 /* enable pipe 2 dynamic payload */
599 res = nrf24l01_set_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_2, NRF24L01_BOOL_TRUE);
600 if (res != 0)
601 {
602 nrf24l01_interface_debug_print("nrf24l01: set pipe dynamic payload failed.\n");
603 (void)nrf24l01_deinit(&gs_handle);
604
605 return 1;
606 }
607
608 /* enable pipe 3 dynamic payload */
609 res = nrf24l01_set_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_3, NRF24L01_BOOL_TRUE);
610 if (res != 0)
611 {
612 nrf24l01_interface_debug_print("nrf24l01: set pipe dynamic payload failed.\n");
613 (void)nrf24l01_deinit(&gs_handle);
614
615 return 1;
616 }
617
618 /* enable pipe 4 dynamic payload */
619 res = nrf24l01_set_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_4, NRF24L01_BOOL_TRUE);
620 if (res != 0)
621 {
622 nrf24l01_interface_debug_print("nrf24l01: set pipe dynamic payload failed.\n");
623 (void)nrf24l01_deinit(&gs_handle);
624
625 return 1;
626 }
627
628 /* enable pipe 5 dynamic payload */
629 res = nrf24l01_set_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_5, NRF24L01_BOOL_TRUE);
630 if (res != 0)
631 {
632 nrf24l01_interface_debug_print("nrf24l01: set pipe dynamic payload failed.\n");
633 (void)nrf24l01_deinit(&gs_handle);
634
635 return 1;
636 }
637
638 /* enable dynamic payload */
639 res = nrf24l01_set_dynamic_payload(&gs_handle, NRF24L01_BOOL_TRUE);
640 if (res != 0)
641 {
642 nrf24l01_interface_debug_print("nrf24l01: set dynamic payload failed.\n");
643 (void)nrf24l01_deinit(&gs_handle);
644
645 return 1;
646 }
647
648 /* disable payload with ack */
649 res = nrf24l01_set_payload_with_ack(&gs_handle, NRF24L01_BOOL_FALSE);
650 if (res != 0)
651 {
652 nrf24l01_interface_debug_print("nrf24l01: set payload with ack failed.\n");
653 (void)nrf24l01_deinit(&gs_handle);
654
655 return 1;
656 }
657
658 /* disable tx payload with no ack */
659 res = nrf24l01_set_tx_payload_with_no_ack(&gs_handle, NRF24L01_BOOL_FALSE);
660 if (res != 0)
661 {
662 nrf24l01_interface_debug_print("nrf24l01: set tx payload with no ack failed.\n");
663 (void)nrf24l01_deinit(&gs_handle);
664
665 return 1;
666 }
667
668 /* flush tx */
669 res = nrf24l01_flush_tx(&gs_handle);
670 if (res != 0)
671 {
672 nrf24l01_interface_debug_print("nrf24l01: flush tx failed.\n");
673 (void)nrf24l01_deinit(&gs_handle);
674
675 return 1;
676 }
677
678 /* set tx address */
679 res = nrf24l01_set_tx_address(&gs_handle, (uint8_t *)addr0, 5);
680 if (res != 0)
681 {
682 nrf24l01_interface_debug_print("nrf24l01: set tx address failed.\n");
683 (void)nrf24l01_deinit(&gs_handle);
684
685 return 1;
686 }
687
688 /* set rx pipe 0 address */
689 res = nrf24l01_set_rx_pipe_0_address(&gs_handle, (uint8_t *)addr0, 5);
690 if (res != 0)
691 {
692 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 0 address failed.\n");
693 (void)nrf24l01_deinit(&gs_handle);
694
695 return 1;
696 }
697
698 /* set data */
699 for (i = 0; i < 32; i++)
700 {
701 data[i] = i;
702 }
703
704 /* send data */
705 res = nrf24l01_send(&gs_handle, (uint8_t *)data, 32);
706 if (res != 0)
707 {
708 nrf24l01_interface_debug_print("nrf24l01: send data failed.\n");
709 (void)nrf24l01_deinit(&gs_handle);
710
711 return 1;
712 }
713
714 /* delay 100 ms */
715 nrf24l01_interface_delay_ms(100);
716
717 /* disable active */
718 res = nrf24l01_set_active(&gs_handle, NRF24L01_BOOL_FALSE);
719 if (res != 0)
720 {
721 nrf24l01_interface_debug_print("nrf24l01: set active failed.\n");
722 (void)nrf24l01_deinit(&gs_handle);
723
724 return 1;
725 }
726
727 /* set tx address */
728 res = nrf24l01_set_tx_address(&gs_handle, (uint8_t *)addr1, 5);
729 if (res != 0)
730 {
731 nrf24l01_interface_debug_print("nrf24l01: set tx address failed.\n");
732 (void)nrf24l01_deinit(&gs_handle);
733
734 return 1;
735 }
736
737 /* set rx pipe 1 address */
738 res = nrf24l01_set_rx_pipe_0_address(&gs_handle, (uint8_t *)addr1, 5);
739 if (res != 0)
740 {
741 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 0 address failed.\n");
742 (void)nrf24l01_deinit(&gs_handle);
743
744 return 1;
745 }
746
747 /* send data */
748 res = nrf24l01_send(&gs_handle, (uint8_t *)data, 32);
749 if (res != 0)
750 {
751 nrf24l01_interface_debug_print("nrf24l01: send data failed.\n");
752 (void)nrf24l01_deinit(&gs_handle);
753
754 return 1;
755 }
756
757 /* delay 100 ms */
758 nrf24l01_interface_delay_ms(100);
759
760 /* disable active */
761 res = nrf24l01_set_active(&gs_handle, NRF24L01_BOOL_FALSE);
762 if (res != 0)
763 {
764 nrf24l01_interface_debug_print("nrf24l01: set active failed.\n");
765 (void)nrf24l01_deinit(&gs_handle);
766
767 return 1;
768 }
769
770 /* set tx address */
771 res = nrf24l01_set_tx_address(&gs_handle, (uint8_t *)&addr2, 5);
772 if (res != 0)
773 {
774 nrf24l01_interface_debug_print("nrf24l01: set tx address failed.\n");
775 (void)nrf24l01_deinit(&gs_handle);
776
777 return 1;
778 }
779
780 /* set rx pipe 2 address */
781 res = nrf24l01_set_rx_pipe_0_address(&gs_handle, (uint8_t *)addr2, 5);
782 if (res != 0)
783 {
784 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 0 address failed.\n");
785 (void)nrf24l01_deinit(&gs_handle);
786
787 return 1;
788 }
789
790 /* send data */
791 res = nrf24l01_send(&gs_handle, (uint8_t *)data, 32);
792 if (res != 0)
793 {
794 nrf24l01_interface_debug_print("nrf24l01: send data failed.\n");
795 (void)nrf24l01_deinit(&gs_handle);
796
797 return 1;
798 }
799
800 /* delay 100 ms */
801 nrf24l01_interface_delay_ms(100);
802
803 /* disable active */
804 res = nrf24l01_set_active(&gs_handle, NRF24L01_BOOL_FALSE);
805 if (res != 0)
806 {
807 nrf24l01_interface_debug_print("nrf24l01: set active failed.\n");
808 (void)nrf24l01_deinit(&gs_handle);
809
810 return 1;
811 }
812
813 /* set tx address */
814 res = nrf24l01_set_tx_address(&gs_handle, (uint8_t *)&addr3, 5);
815 if (res != 0)
816 {
817 nrf24l01_interface_debug_print("nrf24l01: set tx address failed.\n");
818 (void)nrf24l01_deinit(&gs_handle);
819
820 return 1;
821 }
822
823 /* set rx pipe 3 address */
824 res = nrf24l01_set_rx_pipe_0_address(&gs_handle, (uint8_t *)addr3, 5);
825 if (res != 0)
826 {
827 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 0 address failed.\n");
828 (void)nrf24l01_deinit(&gs_handle);
829
830 return 1;
831 }
832
833 /* send data */
834 res = nrf24l01_send(&gs_handle, (uint8_t *)data, 32);
835 if (res != 0)
836 {
837 nrf24l01_interface_debug_print("nrf24l01: send data failed.\n");
838 (void)nrf24l01_deinit(&gs_handle);
839
840 return 1;
841 }
842
843 /* delay 100 ms */
844 nrf24l01_interface_delay_ms(100);
845
846 /* disable active */
847 res = nrf24l01_set_active(&gs_handle, NRF24L01_BOOL_FALSE);
848 if (res != 0)
849 {
850 nrf24l01_interface_debug_print("nrf24l01: set active failed.\n");
851 (void)nrf24l01_deinit(&gs_handle);
852
853 return 1;
854 }
855
856 /* set tx address */
857 res = nrf24l01_set_tx_address(&gs_handle, (uint8_t *)&addr4, 5);
858 if (res != 0)
859 {
860 nrf24l01_interface_debug_print("nrf24l01: set tx address failed.\n");
861 (void)nrf24l01_deinit(&gs_handle);
862
863 return 1;
864 }
865
866 /* set rx pipe 4 address */
867 res = nrf24l01_set_rx_pipe_0_address(&gs_handle, (uint8_t *)addr4, 5);
868 if (res != 0)
869 {
870 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 0 address failed.\n");
871 (void)nrf24l01_deinit(&gs_handle);
872
873 return 1;
874 }
875
876 /* send data */
877 res = nrf24l01_send(&gs_handle, (uint8_t *)data, 32);
878 if (res != 0)
879 {
880 nrf24l01_interface_debug_print("nrf24l01: send data failed.\n");
881 (void)nrf24l01_deinit(&gs_handle);
882
883 return 1;
884 }
885
886 /* delay 100 ms */
887 nrf24l01_interface_delay_ms(100);
888
889 /* disable active */
890 res = nrf24l01_set_active(&gs_handle, NRF24L01_BOOL_FALSE);
891 if (res != 0)
892 {
893 nrf24l01_interface_debug_print("nrf24l01: set active failed.\n");
894 (void)nrf24l01_deinit(&gs_handle);
895
896 return 1;
897 }
898
899 /* set tx address */
900 res = nrf24l01_set_tx_address(&gs_handle, (uint8_t *)&addr5, 5);
901 if (res != 0)
902 {
903 nrf24l01_interface_debug_print("nrf24l01: set tx address failed.\n");
904 (void)nrf24l01_deinit(&gs_handle);
905
906 return 1;
907 }
908
909 /* set rx pipe 5 address */
910 res = nrf24l01_set_rx_pipe_0_address(&gs_handle, (uint8_t *)addr5, 5);
911 if (res != 0)
912 {
913 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 0 address failed.\n");
914 (void)nrf24l01_deinit(&gs_handle);
915
916 return 1;
917 }
918
919 /* send data */
920 res = nrf24l01_send(&gs_handle, (uint8_t *)data, 32);
921 if (res != 0)
922 {
923 nrf24l01_interface_debug_print("nrf24l01: send data failed.\n");
924 (void)nrf24l01_deinit(&gs_handle);
925
926 return 1;
927 }
928
929 /* finish send test */
930 nrf24l01_interface_debug_print("nrf24l01: finish send test.\n");
931 (void)nrf24l01_deinit(&gs_handle);
932
933 return 0;
934 }
935
943 uint8_t nrf24l01_receive_test(void)
944 {
945 uint8_t res;
946 uint8_t reg;
947 nrf24l01_info_t info;
948 uint8_t addr0[5] = {0x1A, 0x01, 0x02, 0x03, 0x00};
949 uint8_t addr1[5] = {0x1B, 0x01, 0x02, 0x03, 0x01};
950 uint8_t addr2[5] = {0x1B, 0x01, 0x02, 0x03, 0x02};
951 uint8_t addr3[5] = {0x1B, 0x01, 0x02, 0x03, 0x03};
952 uint8_t addr4[5] = {0x1B, 0x01, 0x02, 0x03, 0x04};
953 uint8_t addr5[5] = {0x1B, 0x01, 0x02, 0x03, 0x05};
954
955 /* link function */
956 DRIVER_NRF24L01_LINK_INIT(&gs_handle, nrf24l01_handle_t);
957 DRIVER_NRF24L01_LINK_SPI_INIT(&gs_handle, nrf24l01_interface_spi_init);
958 DRIVER_NRF24L01_LINK_SPI_DEINIT(&gs_handle, nrf24l01_interface_spi_deinit);
959 DRIVER_NRF24L01_LINK_SPI_READ(&gs_handle, nrf24l01_interface_spi_read);
960 DRIVER_NRF24L01_LINK_SPI_WRITE(&gs_handle, nrf24l01_interface_spi_write);
961 DRIVER_NRF24L01_LINK_GPIO_INIT(&gs_handle, nrf24l01_interface_gpio_init);
962 DRIVER_NRF24L01_LINK_GPIO_DEINIT(&gs_handle, nrf24l01_interface_gpio_deinit);
963 DRIVER_NRF24L01_LINK_GPIO_WRITE(&gs_handle, nrf24l01_interface_gpio_write);
964 DRIVER_NRF24L01_LINK_DELAY_MS(&gs_handle, nrf24l01_interface_delay_ms);
965 DRIVER_NRF24L01_LINK_DEBUG_PRINT(&gs_handle, nrf24l01_interface_debug_print);
966 DRIVER_NRF24L01_LINK_RECEIVE_CALLBACK(&gs_handle, nrf24l01_interface_receive_callback);
967
968 /* get information */
969 res = nrf24l01_info(&info);
970 if (res != 0)
971 {
972 nrf24l01_interface_debug_print("nrf24l01: get info failed.\n");
973
974 return 1;
975 }
976 else
977 {
978 /* print chip info */
979 nrf24l01_interface_debug_print("nrf24l01: chip is %s.\n", info.chip_name);
980 nrf24l01_interface_debug_print("nrf24l01: manufacturer is %s.\n", info.manufacturer_name);
981 nrf24l01_interface_debug_print("nrf24l01: interface is %s.\n", info.interface);
982 nrf24l01_interface_debug_print("nrf24l01: driver version is %d.%d.\n", info.driver_version / 1000, (info.driver_version % 1000) / 100);
983 nrf24l01_interface_debug_print("nrf24l01: min supply voltage is %0.1fV.\n", info.supply_voltage_min_v);
984 nrf24l01_interface_debug_print("nrf24l01: max supply voltage is %0.1fV.\n", info.supply_voltage_max_v);
985 nrf24l01_interface_debug_print("nrf24l01: max current is %0.2fmA.\n", info.max_current_ma);
986 nrf24l01_interface_debug_print("nrf24l01: max temperature is %0.1fC.\n", info.temperature_max);
987 nrf24l01_interface_debug_print("nrf24l01: min temperature is %0.1fC.\n", info.temperature_min);
988 }
989
990 /* start receive test */
991 nrf24l01_interface_debug_print("nrf24l01: start receive test.\n");
992
993 /* init */
994 res = nrf24l01_init(&gs_handle);
995 if (res != 0)
996 {
997 nrf24l01_interface_debug_print("nrf24l01: init failed.\n");
998
999 return 1;
1000 }
1001
1002 /* set active false */
1003 res = nrf24l01_set_active(&gs_handle, NRF24L01_BOOL_FALSE);
1004 if (res != 0)
1005 {
1006 nrf24l01_interface_debug_print("nrf24l01: set active failed.\n");
1007 (void)nrf24l01_deinit(&gs_handle);
1008
1009 return 1;
1010 }
1011
1012 /* enable power up */
1013 res = nrf24l01_set_config(&gs_handle, NRF24L01_CONFIG_PWR_UP, NRF24L01_BOOL_TRUE);
1014 if (res != 0)
1015 {
1016 nrf24l01_interface_debug_print("nrf24l01: set config failed.\n");
1017 (void)nrf24l01_deinit(&gs_handle);
1018
1019 return 1;
1020 }
1021
1022 /* enable crco */
1023 res = nrf24l01_set_config(&gs_handle, NRF24L01_CONFIG_CRCO, NRF24L01_BOOL_TRUE);
1024 if (res != 0)
1025 {
1026 nrf24l01_interface_debug_print("nrf24l01: set config failed.\n");
1027 (void)nrf24l01_deinit(&gs_handle);
1028
1029 return 1;
1030 }
1031
1032 /* enable crc */
1033 res = nrf24l01_set_config(&gs_handle, NRF24L01_CONFIG_EN_CRC, NRF24L01_BOOL_TRUE);
1034 if (res != 0)
1035 {
1036 nrf24l01_interface_debug_print("nrf24l01: set config failed.\n");
1037 (void)nrf24l01_deinit(&gs_handle);
1038
1039 return 1;
1040 }
1041
1042 /* enable max rt */
1043 res = nrf24l01_set_config(&gs_handle, NRF24L01_CONFIG_MASK_MAX_RT, NRF24L01_BOOL_FALSE);
1044 if (res != 0)
1045 {
1046 nrf24l01_interface_debug_print("nrf24l01: set config failed.\n");
1047 (void)nrf24l01_deinit(&gs_handle);
1048
1049 return 1;
1050 }
1051
1052 /* enable tx ds */
1053 res = nrf24l01_set_config(&gs_handle, NRF24L01_CONFIG_MASK_TX_DS, NRF24L01_BOOL_FALSE);
1054 if (res != 0)
1055 {
1056 nrf24l01_interface_debug_print("nrf24l01: set config failed.\n");
1057 (void)nrf24l01_deinit(&gs_handle);
1058
1059 return 1;
1060 }
1061
1062 /* enable rx dr */
1063 res = nrf24l01_set_config(&gs_handle, NRF24L01_CONFIG_MASK_RX_DR, NRF24L01_BOOL_FALSE);
1064 if (res != 0)
1065 {
1066 nrf24l01_interface_debug_print("nrf24l01: set config failed.\n");
1067 (void)nrf24l01_deinit(&gs_handle);
1068
1069 return 1;
1070 }
1071
1072 /* set rx mode */
1073 res = nrf24l01_set_mode(&gs_handle, NRF24L01_MODE_RX);
1074 if (res != 0)
1075 {
1076 nrf24l01_interface_debug_print("nrf24l01: set mode failed.\n");
1077 (void)nrf24l01_deinit(&gs_handle);
1078
1079 return 1;
1080 }
1081
1082 /* enable pipe 0 auto acknowledgment */
1083 res = nrf24l01_set_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_0, NRF24L01_BOOL_TRUE);
1084 if (res != 0)
1085 {
1086 nrf24l01_interface_debug_print("nrf24l01: set auto acknowledgment failed.\n");
1087 (void)nrf24l01_deinit(&gs_handle);
1088
1089 return 1;
1090 }
1091
1092 /* enable pipe 1 auto acknowledgment */
1093 res = nrf24l01_set_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_1, NRF24L01_BOOL_TRUE);
1094 if (res != 0)
1095 {
1096 nrf24l01_interface_debug_print("nrf24l01: set auto acknowledgment failed.\n");
1097 (void)nrf24l01_deinit(&gs_handle);
1098
1099 return 1;
1100 }
1101
1102 /* enable pipe 2 auto acknowledgment */
1103 res = nrf24l01_set_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_2, NRF24L01_BOOL_TRUE);
1104 if (res != 0)
1105 {
1106 nrf24l01_interface_debug_print("nrf24l01: set auto acknowledgment failed.\n");
1107 (void)nrf24l01_deinit(&gs_handle);
1108
1109 return 1;
1110 }
1111
1112 /* enable pipe 3 auto acknowledgment */
1113 res = nrf24l01_set_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_3, NRF24L01_BOOL_TRUE);
1114 if (res != 0)
1115 {
1116 nrf24l01_interface_debug_print("nrf24l01: set auto acknowledgment failed.\n");
1117 (void)nrf24l01_deinit(&gs_handle);
1118
1119 return 1;
1120 }
1121
1122 /* enable pipe 4 auto acknowledgment */
1123 res = nrf24l01_set_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_4, NRF24L01_BOOL_TRUE);
1124 if (res != 0)
1125 {
1126 nrf24l01_interface_debug_print("nrf24l01: set auto acknowledgment failed.\n");
1127 (void)nrf24l01_deinit(&gs_handle);
1128
1129 return 1;
1130 }
1131
1132 /* enable pipe 5 auto acknowledgment */
1133 res = nrf24l01_set_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_5, NRF24L01_BOOL_TRUE);
1134 if (res != 0)
1135 {
1136 nrf24l01_interface_debug_print("nrf24l01: set auto acknowledgment failed.\n");
1137 (void)nrf24l01_deinit(&gs_handle);
1138
1139 return 1;
1140 }
1141
1142 /* enable pipe 0 rx */
1143 res = nrf24l01_set_rx_pipe(&gs_handle, NRF24L01_PIPE_0, NRF24L01_BOOL_TRUE);
1144 if (res != 0)
1145 {
1146 nrf24l01_interface_debug_print("nrf24l01: set rx pipe failed.\n");
1147 (void)nrf24l01_deinit(&gs_handle);
1148
1149 return 1;
1150 }
1151
1152 /* enable pipe 1 rx */
1153 res = nrf24l01_set_rx_pipe(&gs_handle, NRF24L01_PIPE_1, NRF24L01_BOOL_TRUE);
1154 if (res != 0)
1155 {
1156 nrf24l01_interface_debug_print("nrf24l01: set rx pipe failed.\n");
1157 (void)nrf24l01_deinit(&gs_handle);
1158
1159 return 1;
1160 }
1161
1162 /* enable pipe 2 rx */
1163 res = nrf24l01_set_rx_pipe(&gs_handle, NRF24L01_PIPE_2, NRF24L01_BOOL_TRUE);
1164 if (res != 0)
1165 {
1166 nrf24l01_interface_debug_print("nrf24l01: set rx pipe failed.\n");
1167 (void)nrf24l01_deinit(&gs_handle);
1168
1169 return 1;
1170 }
1171
1172 /* enable pipe 3 rx */
1173 res = nrf24l01_set_rx_pipe(&gs_handle, NRF24L01_PIPE_3, NRF24L01_BOOL_TRUE);
1174 if (res != 0)
1175 {
1176 nrf24l01_interface_debug_print("nrf24l01: set rx pipe failed.\n");
1177 (void)nrf24l01_deinit(&gs_handle);
1178
1179 return 1;
1180 }
1181
1182 /* enable pipe 4 rx */
1183 res = nrf24l01_set_rx_pipe(&gs_handle, NRF24L01_PIPE_4, NRF24L01_BOOL_TRUE);
1184 if (res != 0)
1185 {
1186 nrf24l01_interface_debug_print("nrf24l01: set rx pipe failed.\n");
1187 (void)nrf24l01_deinit(&gs_handle);
1188
1189 return 1;
1190 }
1191
1192 /* enable pipe 5 rx */
1193 res = nrf24l01_set_rx_pipe(&gs_handle, NRF24L01_PIPE_5, NRF24L01_BOOL_TRUE);
1194 if (res != 0)
1195 {
1196 nrf24l01_interface_debug_print("nrf24l01: set rx pipe failed.\n");
1197 (void)nrf24l01_deinit(&gs_handle);
1198
1199 return 1;
1200 }
1201
1202 /* set address width 5 bytes */
1203 res = nrf24l01_set_address_width(&gs_handle, NRF24L01_ADDRESS_WIDTH_5_BYTES);
1204 if (res != 0)
1205 {
1206 nrf24l01_interface_debug_print("nrf24l01: set address width failed.\n");
1207 (void)nrf24l01_deinit(&gs_handle);
1208
1209 return 1;
1210 }
1211
1212 /* convert auto retransmit delay */
1213 res = nrf24l01_auto_retransmit_delay_convert_to_register(&gs_handle, 750, (uint8_t *)&reg);
1214 if (res != 0)
1215 {
1216 nrf24l01_interface_debug_print("nrf24l01: auto retransmit delay failed.\n");
1217 (void)nrf24l01_deinit(&gs_handle);
1218
1219 return 1;
1220 }
1221
1222 /* set auto retransmit delay */
1223 res = nrf24l01_set_auto_retransmit_delay(&gs_handle, reg);
1224 if (res != 0)
1225 {
1226 nrf24l01_interface_debug_print("nrf24l01: auto retransmit delay failed.\n");
1227 (void)nrf24l01_deinit(&gs_handle);
1228
1229 return 1;
1230 }
1231
1232 /* set the auto retransmit count */
1233 res = nrf24l01_set_auto_retransmit_count(&gs_handle, 10);
1234 if (res != 0)
1235 {
1236 nrf24l01_interface_debug_print("nrf24l01: auto retransmit count failed.\n");
1237 (void)nrf24l01_deinit(&gs_handle);
1238
1239 return 1;
1240 }
1241
1242 /* set the channel frequency */
1243 res = nrf24l01_set_channel_frequency(&gs_handle, 20);
1244 if (res != 0)
1245 {
1246 nrf24l01_interface_debug_print("nrf24l01: set channel frequency failed.\n");
1247 (void)nrf24l01_deinit(&gs_handle);
1248
1249 return 1;
1250 }
1251
1252 /* disable continuous carrier transmit */
1253 res = nrf24l01_set_continuous_carrier_transmit(&gs_handle, NRF24L01_BOOL_FALSE);
1254 if (res != 0)
1255 {
1256 nrf24l01_interface_debug_print("nrf24l01: set continuous carrier transmit failed.\n");
1257 (void)nrf24l01_deinit(&gs_handle);
1258
1259 return 1;
1260 }
1261
1262 /* disable force pll lock signal */
1263 res = nrf24l01_set_force_pll_lock_signal(&gs_handle, NRF24L01_BOOL_FALSE);
1264 if (res != 0)
1265 {
1266 nrf24l01_interface_debug_print("nrf24l01: set force pll lock signal failed.\n");
1267 (void)nrf24l01_deinit(&gs_handle);
1268
1269 return 1;
1270 }
1271
1272 /* 2M rate */
1273 res = nrf24l01_set_data_rate(&gs_handle, NRF24L01_DATA_RATE_2M);
1274 if (res != 0)
1275 {
1276 nrf24l01_interface_debug_print("nrf24l01: set data rate 2M failed.\n");
1277 (void)nrf24l01_deinit(&gs_handle);
1278
1279 return 1;
1280 }
1281
1282 /* set output power 0 dBm */
1283 res = nrf24l01_set_output_power(&gs_handle, NRF24L01_OUTPUT_POWER_0_DBM);
1284 if (res != 0)
1285 {
1286 nrf24l01_interface_debug_print("nrf24l01: set output power failed.\n");
1287 (void)nrf24l01_deinit(&gs_handle);
1288
1289 return 1;
1290 }
1291
1292 /* clear interrupt rx_dr */
1293 res = nrf24l01_clear_interrupt(&gs_handle, NRF24L01_INTERRUPT_RX_DR);
1294 if (res != 0)
1295 {
1296 nrf24l01_interface_debug_print("nrf24l01: clear interrupt failed.\n");
1297 (void)nrf24l01_deinit(&gs_handle);
1298
1299 return 1;
1300 }
1301
1302 /* clear interrupt tx_ds */
1303 res = nrf24l01_clear_interrupt(&gs_handle, NRF24L01_INTERRUPT_TX_DS);
1304 if (res != 0)
1305 {
1306 nrf24l01_interface_debug_print("nrf24l01: clear interrupt failed.\n");
1307 (void)nrf24l01_deinit(&gs_handle);
1308
1309 return 1;
1310 }
1311
1312 /* clear interrupt max_rt */
1313 res = nrf24l01_clear_interrupt(&gs_handle, NRF24L01_INTERRUPT_MAX_RT);
1314 if (res != 0)
1315 {
1316 nrf24l01_interface_debug_print("nrf24l01: clear interrupt failed.\n");
1317 (void)nrf24l01_deinit(&gs_handle);
1318
1319 return 1;
1320 }
1321
1322 /* clear interrupt tx_full */
1323 res = nrf24l01_clear_interrupt(&gs_handle, NRF24L01_INTERRUPT_TX_FULL);
1324 if (res != 0)
1325 {
1326 nrf24l01_interface_debug_print("nrf24l01: clear interrupt failed.\n");
1327 (void)nrf24l01_deinit(&gs_handle);
1328
1329 return 1;
1330 }
1331
1332 /* set rx pipe 0 address */
1333 res = nrf24l01_set_rx_pipe_0_address(&gs_handle, (uint8_t *)addr0, 5);
1334 if (res != 0)
1335 {
1336 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 0 address failed.\n");
1337 (void)nrf24l01_deinit(&gs_handle);
1338
1339 return 1;
1340 }
1341
1342 /* set rx pipe 1 address */
1343 res = nrf24l01_set_rx_pipe_1_address(&gs_handle, (uint8_t *)addr1, 5);
1344 if (res != 0)
1345 {
1346 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 1 address failed.\n");
1347 (void)nrf24l01_deinit(&gs_handle);
1348
1349 return 1;
1350 }
1351
1352 /* set rx pipe 2 address */
1353 res = nrf24l01_set_rx_pipe_2_address(&gs_handle, addr2[4]);
1354 if (res != 0)
1355 {
1356 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 2 address failed.\n");
1357 (void)nrf24l01_deinit(&gs_handle);
1358
1359 return 1;
1360 }
1361
1362 /* set rx pipe 3 address */
1363 res = nrf24l01_set_rx_pipe_3_address(&gs_handle, addr3[4]);
1364 if (res != 0)
1365 {
1366 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 3 address failed.\n");
1367 (void)nrf24l01_deinit(&gs_handle);
1368
1369 return 1;
1370 }
1371
1372 /* set rx pipe 4 address */
1373 res = nrf24l01_set_rx_pipe_4_address(&gs_handle, addr4[4]);
1374 if (res != 0)
1375 {
1376 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 4 address failed.\n");
1377 (void)nrf24l01_deinit(&gs_handle);
1378
1379 return 1;
1380 }
1381
1382 /* set rx pipe 5 address */
1383 res = nrf24l01_set_rx_pipe_5_address(&gs_handle, addr5[4]);
1384 if (res != 0)
1385 {
1386 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 5 address failed.\n");
1387 (void)nrf24l01_deinit(&gs_handle);
1388
1389 return 1;
1390 }
1391
1392 /* set pipe 0 payload number */
1393 res = nrf24l01_set_pipe_0_payload_number(&gs_handle, 32);
1394 if (res != 0)
1395 {
1396 nrf24l01_interface_debug_print("nrf24l01: set pipe 0 payload number failed.\n");
1397 (void)nrf24l01_deinit(&gs_handle);
1398
1399 return 1;
1400 }
1401
1402 /* set pipe 1 payload number */
1403 res = nrf24l01_set_pipe_1_payload_number(&gs_handle, 32);
1404 if (res != 0)
1405 {
1406 nrf24l01_interface_debug_print("nrf24l01: set pipe 1 payload number failed.\n");
1407 (void)nrf24l01_deinit(&gs_handle);
1408
1409 return 1;
1410 }
1411
1412 /* set pipe 2 payload number */
1413 res = nrf24l01_set_pipe_2_payload_number(&gs_handle, 32);
1414 if (res != 0)
1415 {
1416 nrf24l01_interface_debug_print("nrf24l01: set pipe 2 payload number failed.\n");
1417 (void)nrf24l01_deinit(&gs_handle);
1418
1419 return 1;
1420 }
1421
1422 /* set pipe 3 payload number */
1423 res = nrf24l01_set_pipe_3_payload_number(&gs_handle, 32);
1424 if (res != 0)
1425 {
1426 nrf24l01_interface_debug_print("nrf24l01: set pipe 3 payload number failed.\n");
1427 (void)nrf24l01_deinit(&gs_handle);
1428
1429 return 1;
1430 }
1431
1432 /* set pipe 4 payload number */
1433 res = nrf24l01_set_pipe_4_payload_number(&gs_handle, 32);
1434 if (res != 0)
1435 {
1436 nrf24l01_interface_debug_print("nrf24l01: set pipe 4 payload number failed.\n");
1437 (void)nrf24l01_deinit(&gs_handle);
1438
1439 return 1;
1440 }
1441
1442 /* set pipe 5 payload number */
1443 res = nrf24l01_set_pipe_5_payload_number(&gs_handle, 32);
1444 if (res != 0)
1445 {
1446 nrf24l01_interface_debug_print("nrf24l01: set pipe 5 payload number failed.\n");
1447 (void)nrf24l01_deinit(&gs_handle);
1448
1449 return 1;
1450 }
1451
1452 /* enable pipe 0 dynamic payload */
1453 res = nrf24l01_set_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_0, NRF24L01_BOOL_TRUE);
1454 if (res != 0)
1455 {
1456 nrf24l01_interface_debug_print("nrf24l01: set pipe dynamic payload failed.\n");
1457 (void)nrf24l01_deinit(&gs_handle);
1458
1459 return 1;
1460 }
1461
1462 /* enable pipe 1 dynamic payload */
1463 res = nrf24l01_set_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_1, NRF24L01_BOOL_TRUE);
1464 if (res != 0)
1465 {
1466 nrf24l01_interface_debug_print("nrf24l01: set pipe dynamic payload failed.\n");
1467 (void)nrf24l01_deinit(&gs_handle);
1468
1469 return 1;
1470 }
1471
1472 /* enable pipe 2 dynamic payload */
1473 res = nrf24l01_set_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_2, NRF24L01_BOOL_TRUE);
1474 if (res != 0)
1475 {
1476 nrf24l01_interface_debug_print("nrf24l01: set pipe dynamic payload failed.\n");
1477 (void)nrf24l01_deinit(&gs_handle);
1478
1479 return 1;
1480 }
1481
1482 /* enable pipe 3 dynamic payload */
1483 res = nrf24l01_set_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_3, NRF24L01_BOOL_TRUE);
1484 if (res != 0)
1485 {
1486 nrf24l01_interface_debug_print("nrf24l01: set pipe dynamic payload failed.\n");
1487 (void)nrf24l01_deinit(&gs_handle);
1488
1489 return 1;
1490 }
1491
1492 /* enable pipe 4 dynamic payload */
1493 res = nrf24l01_set_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_4, NRF24L01_BOOL_TRUE);
1494 if (res != 0)
1495 {
1496 nrf24l01_interface_debug_print("nrf24l01: set pipe dynamic payload failed.\n");
1497 (void)nrf24l01_deinit(&gs_handle);
1498
1499 return 1;
1500 }
1501
1502 /* enable pipe 5 dynamic payload */
1503 res = nrf24l01_set_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_5, NRF24L01_BOOL_TRUE);
1504 if (res != 0)
1505 {
1506 nrf24l01_interface_debug_print("nrf24l01: set pipe dynamic payload failed.\n");
1507 (void)nrf24l01_deinit(&gs_handle);
1508
1509 return 1;
1510 }
1511
1512 /* enable dynamic payload */
1513 res = nrf24l01_set_dynamic_payload(&gs_handle, NRF24L01_BOOL_TRUE);
1514 if (res != 0)
1515 {
1516 nrf24l01_interface_debug_print("nrf24l01: set dynamic payload failed.\n");
1517 (void)nrf24l01_deinit(&gs_handle);
1518
1519 return 1;
1520 }
1521
1522 /* disable payload with ack */
1523 res = nrf24l01_set_payload_with_ack(&gs_handle, NRF24L01_BOOL_FALSE);
1524 if (res != 0)
1525 {
1526 nrf24l01_interface_debug_print("nrf24l01: set payload with ack failed.\n");
1527 (void)nrf24l01_deinit(&gs_handle);
1528
1529 return 1;
1530 }
1531
1532 /* disable tx payload with no ack */
1533 res = nrf24l01_set_tx_payload_with_no_ack(&gs_handle, NRF24L01_BOOL_FALSE);
1534 if (res != 0)
1535 {
1536 nrf24l01_interface_debug_print("nrf24l01: set tx payload with no ack failed.\n");
1537 (void)nrf24l01_deinit(&gs_handle);
1538
1539 return 1;
1540 }
1541
1542 /* flush rx */
1543 res = nrf24l01_flush_rx(&gs_handle);
1544 if (res != 0)
1545 {
1546 nrf24l01_interface_debug_print("nrf24l01: flush rx failed.\n");
1547 (void)nrf24l01_deinit(&gs_handle);
1548
1549 return 1;
1550 }
1551
1552 /* enable active */
1553 res = nrf24l01_set_active(&gs_handle, NRF24L01_BOOL_TRUE);
1554 if (res != 0)
1555 {
1556 nrf24l01_interface_debug_print("nrf24l01: set active failed.\n");
1557 (void)nrf24l01_deinit(&gs_handle);
1558
1559 return 1;
1560 }
1561
1562 /* delay 5s */
1563 nrf24l01_interface_delay_ms(5000);
1564
1565 /* finish receive test */
1566 nrf24l01_interface_debug_print("nrf24l01: finish receive test.\n");
1567 (void)nrf24l01_deinit(&gs_handle);
1568
1569 return 0;
1570 }
driver_nrf24l01_send_receive_test.h
driver nrf24l01 send receive test header file
nrf24l01_flush_tx
uint8_t nrf24l01_flush_tx(nrf24l01_handle_t *handle)
flush tx
Definition: driver_nrf24l01.c:3550
nrf24l01_set_dynamic_payload
uint8_t nrf24l01_set_dynamic_payload(nrf24l01_handle_t *handle, nrf24l01_bool_t enable)
enable or disable the dynamic payload
Definition: driver_nrf24l01.c:3194
nrf24l01_set_rx_pipe_3_address
uint8_t nrf24l01_set_rx_pipe_3_address(nrf24l01_handle_t *handle, uint8_t addr)
set the rx pipe 3 address
Definition: driver_nrf24l01.c:2246
nrf24l01_set_tx_address
uint8_t nrf24l01_set_tx_address(nrf24l01_handle_t *handle, uint8_t *addr, uint8_t len)
set the tx address
Definition: driver_nrf24l01.c:2458
nrf24l01_set_pipe_2_payload_number
uint8_t nrf24l01_set_pipe_2_payload_number(nrf24l01_handle_t *handle, uint8_t num)
set the pipe 2 payload number
Definition: driver_nrf24l01.c:2764
nrf24l01_set_pipe_0_payload_number
uint8_t nrf24l01_set_pipe_0_payload_number(nrf24l01_handle_t *handle, uint8_t num)
set the pipe 0 payload number
Definition: driver_nrf24l01.c:2608
nrf24l01_set_tx_payload_with_no_ack
uint8_t nrf24l01_set_tx_payload_with_no_ack(nrf24l01_handle_t *handle, nrf24l01_bool_t enable)
enable or disable the tx payload with no ack
Definition: driver_nrf24l01.c:3358
nrf24l01_set_pipe_dynamic_payload
uint8_t nrf24l01_set_pipe_dynamic_payload(nrf24l01_handle_t *handle, nrf24l01_pipe_t pipe, nrf24l01_bool_t enable)
enable or disable the pipe dynamic payload
Definition: driver_nrf24l01.c:3111
nrf24l01_set_auto_retransmit_count
uint8_t nrf24l01_set_auto_retransmit_count(nrf24l01_handle_t *handle, uint8_t count)
set the auto retransmit count
Definition: driver_nrf24l01.c:1136
nrf24l01_set_pipe_4_payload_number
uint8_t nrf24l01_set_pipe_4_payload_number(nrf24l01_handle_t *handle, uint8_t num)
set the pipe 4 payload number
Definition: driver_nrf24l01.c:2920
nrf24l01_send
uint8_t nrf24l01_send(nrf24l01_handle_t *handle, uint8_t *buf, uint8_t len)
send data
Definition: driver_nrf24l01.c:350
nrf24l01_set_payload_with_ack
uint8_t nrf24l01_set_payload_with_ack(nrf24l01_handle_t *handle, nrf24l01_bool_t enable)
enable or disable the payload with ack
Definition: driver_nrf24l01.c:3276
nrf24l01_set_config
uint8_t nrf24l01_set_config(nrf24l01_handle_t *handle, nrf24l01_config_t config, nrf24l01_bool_t enable)
enable or disable configure
Definition: driver_nrf24l01.c:577
nrf24l01_set_output_power
uint8_t nrf24l01_set_output_power(nrf24l01_handle_t *handle, nrf24l01_output_power_t power)
set the output power
Definition: driver_nrf24l01.c:1561
nrf24l01_set_rx_pipe_1_address
uint8_t nrf24l01_set_rx_pipe_1_address(nrf24l01_handle_t *handle, uint8_t *addr, uint8_t len)
set the rx pipe 1 address
Definition: driver_nrf24l01.c:2027
nrf24l01_set_channel_frequency
uint8_t nrf24l01_set_channel_frequency(nrf24l01_handle_t *handle, uint8_t freq)
set the channel frequency
Definition: driver_nrf24l01.c:1225
nrf24l01_irq_handler
uint8_t nrf24l01_irq_handler(nrf24l01_handle_t *handle)
irq handler
Definition: driver_nrf24l01.c:436
nrf24l01_set_auto_acknowledgment
uint8_t nrf24l01_set_auto_acknowledgment(nrf24l01_handle_t *handle, nrf24l01_pipe_t pipe, nrf24l01_bool_t enable)
enable or disable auto acknowledgment
Definition: driver_nrf24l01.c:743
nrf24l01_clear_interrupt
uint8_t nrf24l01_clear_interrupt(nrf24l01_handle_t *handle, nrf24l01_interrupt_t type)
clear the interrupt status
Definition: driver_nrf24l01.c:1681
nrf24l01_set_pipe_3_payload_number
uint8_t nrf24l01_set_pipe_3_payload_number(nrf24l01_handle_t *handle, uint8_t num)
set the pipe 3 payload number
Definition: driver_nrf24l01.c:2842
nrf24l01_auto_retransmit_delay_convert_to_register
uint8_t nrf24l01_auto_retransmit_delay_convert_to_register(nrf24l01_handle_t *handle, uint32_t us, uint8_t *reg)
convert the delay to the register raw data
Definition: driver_nrf24l01.c:1081
nrf24l01_set_rx_pipe_5_address
uint8_t nrf24l01_set_rx_pipe_5_address(nrf24l01_handle_t *handle, uint8_t addr)
set the rx pipe 5 address
Definition: driver_nrf24l01.c:2386
nrf24l01_set_address_width
uint8_t nrf24l01_set_address_width(nrf24l01_handle_t *handle, nrf24l01_address_width_t width)
set the address width
Definition: driver_nrf24l01.c:910
nrf24l01_set_active
uint8_t nrf24l01_set_active(nrf24l01_handle_t *handle, nrf24l01_bool_t enable)
enable or disable the chip
Definition: driver_nrf24l01.c:315
nrf24l01_set_rx_pipe
uint8_t nrf24l01_set_rx_pipe(nrf24l01_handle_t *handle, nrf24l01_pipe_t pipe, nrf24l01_bool_t enable)
enable or disable rx pipe
Definition: driver_nrf24l01.c:827
nrf24l01_info
uint8_t nrf24l01_info(nrf24l01_info_t *info)
get chip's information
Definition: driver_nrf24l01.c:3892
nrf24l01_set_pipe_5_payload_number
uint8_t nrf24l01_set_pipe_5_payload_number(nrf24l01_handle_t *handle, uint8_t num)
set the pipe 5 payload number
Definition: driver_nrf24l01.c:2998
nrf24l01_set_continuous_carrier_transmit
uint8_t nrf24l01_set_continuous_carrier_transmit(nrf24l01_handle_t *handle, nrf24l01_bool_t enable)
enable or disable continuous carrier transmit
Definition: driver_nrf24l01.c:1313
nrf24l01_init
uint8_t nrf24l01_init(nrf24l01_handle_t *handle)
initialize the chip
Definition: driver_nrf24l01.c:153
nrf24l01_set_force_pll_lock_signal
uint8_t nrf24l01_set_force_pll_lock_signal(nrf24l01_handle_t *handle, nrf24l01_bool_t enable)
enable or disable force pll lock signal
Definition: driver_nrf24l01.c:1395
nrf24l01_set_rx_pipe_2_address
uint8_t nrf24l01_set_rx_pipe_2_address(nrf24l01_handle_t *handle, uint8_t addr)
set the rx pipe 2 address
Definition: driver_nrf24l01.c:2176
nrf24l01_set_mode
uint8_t nrf24l01_set_mode(nrf24l01_handle_t *handle, nrf24l01_mode_t mode)
set the chip mode
Definition: driver_nrf24l01.c:660
nrf24l01_set_auto_retransmit_delay
uint8_t nrf24l01_set_auto_retransmit_delay(nrf24l01_handle_t *handle, uint8_t delay)
set the auto retransmit delay
Definition: driver_nrf24l01.c:993
nrf24l01_set_pipe_1_payload_number
uint8_t nrf24l01_set_pipe_1_payload_number(nrf24l01_handle_t *handle, uint8_t num)
set the pipe 1 payload number
Definition: driver_nrf24l01.c:2686
nrf24l01_flush_rx
uint8_t nrf24l01_flush_rx(nrf24l01_handle_t *handle)
flush rx
Definition: driver_nrf24l01.c:3584
nrf24l01_deinit
uint8_t nrf24l01_deinit(nrf24l01_handle_t *handle)
close the chip
Definition: driver_nrf24l01.c:249
nrf24l01_set_data_rate
uint8_t nrf24l01_set_data_rate(nrf24l01_handle_t *handle, nrf24l01_data_rate_t rate)
set the data rate
Definition: driver_nrf24l01.c:1477
nrf24l01_set_rx_pipe_0_address
uint8_t nrf24l01_set_rx_pipe_0_address(nrf24l01_handle_t *handle, uint8_t *addr, uint8_t len)
set the rx pipe 0 address
Definition: driver_nrf24l01.c:1876
nrf24l01_set_rx_pipe_4_address
uint8_t nrf24l01_set_rx_pipe_4_address(nrf24l01_handle_t *handle, uint8_t addr)
set the rx pipe 4 address
Definition: driver_nrf24l01.c:2316
NRF24L01_OUTPUT_POWER_0_DBM
@ NRF24L01_OUTPUT_POWER_0_DBM
Definition: driver_nrf24l01.h:132
NRF24L01_CONFIG_CRCO
@ NRF24L01_CONFIG_CRCO
Definition: driver_nrf24l01.h:77
NRF24L01_CONFIG_EN_CRC
@ NRF24L01_CONFIG_EN_CRC
Definition: driver_nrf24l01.h:76
NRF24L01_CONFIG_MASK_TX_DS
@ NRF24L01_CONFIG_MASK_TX_DS
Definition: driver_nrf24l01.h:74
NRF24L01_CONFIG_MASK_MAX_RT
@ NRF24L01_CONFIG_MASK_MAX_RT
Definition: driver_nrf24l01.h:75
NRF24L01_CONFIG_PWR_UP
@ NRF24L01_CONFIG_PWR_UP
Definition: driver_nrf24l01.h:78
NRF24L01_CONFIG_MASK_RX_DR
@ NRF24L01_CONFIG_MASK_RX_DR
Definition: driver_nrf24l01.h:73
NRF24L01_MODE_RX
@ NRF24L01_MODE_RX
Definition: driver_nrf24l01.h:87
NRF24L01_MODE_TX
@ NRF24L01_MODE_TX
Definition: driver_nrf24l01.h:86
NRF24L01_INTERRUPT_TX_DS
@ NRF24L01_INTERRUPT_TX_DS
Definition: driver_nrf24l01.h:141
NRF24L01_INTERRUPT_MAX_RT
@ NRF24L01_INTERRUPT_MAX_RT
Definition: driver_nrf24l01.h:142
NRF24L01_INTERRUPT_RX_DR
@ NRF24L01_INTERRUPT_RX_DR
Definition: driver_nrf24l01.h:140
NRF24L01_INTERRUPT_TX_FULL
@ NRF24L01_INTERRUPT_TX_FULL
Definition: driver_nrf24l01.h:143
NRF24L01_ADDRESS_WIDTH_5_BYTES
@ NRF24L01_ADDRESS_WIDTH_5_BYTES
Definition: driver_nrf24l01.h:111
NRF24L01_PIPE_0
@ NRF24L01_PIPE_0
Definition: driver_nrf24l01.h:95
NRF24L01_PIPE_4
@ NRF24L01_PIPE_4
Definition: driver_nrf24l01.h:99
NRF24L01_PIPE_5
@ NRF24L01_PIPE_5
Definition: driver_nrf24l01.h:100
NRF24L01_PIPE_3
@ NRF24L01_PIPE_3
Definition: driver_nrf24l01.h:98
NRF24L01_PIPE_1
@ NRF24L01_PIPE_1
Definition: driver_nrf24l01.h:96
NRF24L01_PIPE_2
@ NRF24L01_PIPE_2
Definition: driver_nrf24l01.h:97
NRF24L01_DATA_RATE_2M
@ NRF24L01_DATA_RATE_2M
Definition: driver_nrf24l01.h:120
NRF24L01_BOOL_FALSE
@ NRF24L01_BOOL_FALSE
Definition: driver_nrf24l01.h:64
NRF24L01_BOOL_TRUE
@ NRF24L01_BOOL_TRUE
Definition: driver_nrf24l01.h:65
nrf24l01_interface_spi_read
uint8_t nrf24l01_interface_spi_read(uint8_t reg, uint8_t *buf, uint16_t len)
interface spi bus read
Definition: driver_nrf24l01_interface_template.c:73
nrf24l01_interface_spi_deinit
uint8_t nrf24l01_interface_spi_deinit(void)
interface spi bus deinit
Definition: driver_nrf24l01_interface_template.c:58
nrf24l01_interface_delay_ms
void nrf24l01_interface_delay_ms(uint32_t ms)
interface delay ms
Definition: driver_nrf24l01_interface_template.c:135
nrf24l01_interface_receive_callback
void nrf24l01_interface_receive_callback(uint8_t type, uint8_t num, uint8_t *buf, uint8_t len)
interface receive callback
Definition: driver_nrf24l01_interface_template.c:158
nrf24l01_interface_debug_print
void nrf24l01_interface_debug_print(const char *const fmt,...)
interface print format data
Definition: driver_nrf24l01_interface_template.c:145
nrf24l01_interface_gpio_deinit
uint8_t nrf24l01_interface_gpio_deinit(void)
interface gpio deinit
Definition: driver_nrf24l01_interface_template.c:112
nrf24l01_interface_gpio_init
uint8_t nrf24l01_interface_gpio_init(void)
interface gpio init
Definition: driver_nrf24l01_interface_template.c:100
nrf24l01_interface_spi_init
uint8_t nrf24l01_interface_spi_init(void)
interface spi bus init
Definition: driver_nrf24l01_interface_template.c:46
nrf24l01_interface_spi_write
uint8_t nrf24l01_interface_spi_write(uint8_t reg, uint8_t *buf, uint16_t len)
interface spi bus write
Definition: driver_nrf24l01_interface_template.c:88
nrf24l01_interface_gpio_write
uint8_t nrf24l01_interface_gpio_write(uint8_t data)
interface gpio write
Definition: driver_nrf24l01_interface_template.c:125
DRIVER_NRF24L01_LINK_DELAY_MS
#define DRIVER_NRF24L01_LINK_DELAY_MS(HANDLE, FUC)
link delay_ms function
Definition: driver_nrf24l01.h:274
DRIVER_NRF24L01_LINK_SPI_INIT
#define DRIVER_NRF24L01_LINK_SPI_INIT(HANDLE, FUC)
link spi_init function
Definition: driver_nrf24l01.h:218
DRIVER_NRF24L01_LINK_GPIO_WRITE
#define DRIVER_NRF24L01_LINK_GPIO_WRITE(HANDLE, FUC)
link gpio_write function
Definition: driver_nrf24l01.h:266
DRIVER_NRF24L01_LINK_DEBUG_PRINT
#define DRIVER_NRF24L01_LINK_DEBUG_PRINT(HANDLE, FUC)
link debug_print function
Definition: driver_nrf24l01.h:282
DRIVER_NRF24L01_LINK_GPIO_INIT
#define DRIVER_NRF24L01_LINK_GPIO_INIT(HANDLE, FUC)
link gpio_init function
Definition: driver_nrf24l01.h:250
DRIVER_NRF24L01_LINK_SPI_READ
#define DRIVER_NRF24L01_LINK_SPI_READ(HANDLE, FUC)
link spi_read function
Definition: driver_nrf24l01.h:234
DRIVER_NRF24L01_LINK_SPI_WRITE
#define DRIVER_NRF24L01_LINK_SPI_WRITE(HANDLE, FUC)
link gpio_write function
Definition: driver_nrf24l01.h:242
DRIVER_NRF24L01_LINK_GPIO_DEINIT
#define DRIVER_NRF24L01_LINK_GPIO_DEINIT(HANDLE, FUC)
link gpio_deinit function
Definition: driver_nrf24l01.h:258
DRIVER_NRF24L01_LINK_INIT
#define DRIVER_NRF24L01_LINK_INIT(HANDLE, STRUCTURE)
initialize nrf24l01_handle_t structure
Definition: driver_nrf24l01.h:210
DRIVER_NRF24L01_LINK_SPI_DEINIT
#define DRIVER_NRF24L01_LINK_SPI_DEINIT(HANDLE, FUC)
link spi_deinit function
Definition: driver_nrf24l01.h:226
DRIVER_NRF24L01_LINK_RECEIVE_CALLBACK
#define DRIVER_NRF24L01_LINK_RECEIVE_CALLBACK(HANDLE, FUC)
link receive_callback function
Definition: driver_nrf24l01.h:290
nrf24l01_receive_test
uint8_t nrf24l01_receive_test(void)
receive test
Definition: driver_nrf24l01_send_receive_test.c:943
nrf24l01_send_test
uint8_t nrf24l01_send_test(void)
send test
Definition: driver_nrf24l01_send_receive_test.c:67
nrf24l01_interrupt_test_irq_handler
uint8_t nrf24l01_interrupt_test_irq_handler(void)
nrf24l01 interrupt test irq
Definition: driver_nrf24l01_send_receive_test.c:48
nrf24l01_handle_s
nrf24l01 handle structure definition
Definition: driver_nrf24l01.h:162
nrf24l01_info_s
nrf24l01 information structure definition
Definition: driver_nrf24l01.h:181
nrf24l01_info_s::temperature_max
float temperature_max
Definition: driver_nrf24l01.h:189
nrf24l01_info_s::supply_voltage_max_v
float supply_voltage_max_v
Definition: driver_nrf24l01.h:186
nrf24l01_info_s::driver_version
uint32_t driver_version
Definition: driver_nrf24l01.h:190
nrf24l01_info_s::temperature_min
float temperature_min
Definition: driver_nrf24l01.h:188
nrf24l01_info_s::max_current_ma
float max_current_ma
Definition: driver_nrf24l01.h:187
nrf24l01_info_s::manufacturer_name
char manufacturer_name[32]
Definition: driver_nrf24l01.h:183
nrf24l01_info_s::supply_voltage_min_v
float supply_voltage_min_v
Definition: driver_nrf24l01.h:185
nrf24l01_info_s::interface
char interface[8]
Definition: driver_nrf24l01.h:184
nrf24l01_info_s::chip_name
char chip_name[32]
Definition: driver_nrf24l01.h:182