| LibDriver NRF24L01 1.0.0 NRF24L01 full function driver

driver_nrf24l01_register_test.c
Go to the documentation of this file.
1
37 #include "driver_nrf24l01_register_test.h"
38 #include <stdlib.h>
39
40 static nrf24l01_handle_t gs_handle;
49 uint8_t nrf24l01_register_test(void)
50 {
51 uint8_t res;
52 uint8_t len;
53 uint8_t value, value_check;
54 uint32_t us, us_check;
55 uint8_t addr[5];
56 uint8_t addr_check[5];
57 uint8_t buf[5];
58 nrf24l01_info_t info;
59 nrf24l01_bool_t enable;
60 nrf24l01_mode_t mode;
61 nrf24l01_address_width_t width;
62 nrf24l01_data_rate_t rate;
63 nrf24l01_output_power_t power;
64
65 /* link function */
66 DRIVER_NRF24L01_LINK_INIT(&gs_handle, nrf24l01_handle_t);
67 DRIVER_NRF24L01_LINK_SPI_INIT(&gs_handle, nrf24l01_interface_spi_init);
68 DRIVER_NRF24L01_LINK_SPI_DEINIT(&gs_handle, nrf24l01_interface_spi_deinit);
69 DRIVER_NRF24L01_LINK_SPI_READ(&gs_handle, nrf24l01_interface_spi_read);
70 DRIVER_NRF24L01_LINK_SPI_WRITE(&gs_handle, nrf24l01_interface_spi_write);
71 DRIVER_NRF24L01_LINK_GPIO_INIT(&gs_handle, nrf24l01_interface_gpio_init);
72 DRIVER_NRF24L01_LINK_GPIO_DEINIT(&gs_handle, nrf24l01_interface_gpio_deinit);
73 DRIVER_NRF24L01_LINK_GPIO_WRITE(&gs_handle, nrf24l01_interface_gpio_write);
74 DRIVER_NRF24L01_LINK_DELAY_MS(&gs_handle, nrf24l01_interface_delay_ms);
75 DRIVER_NRF24L01_LINK_DEBUG_PRINT(&gs_handle, nrf24l01_interface_debug_print);
76 DRIVER_NRF24L01_LINK_RECEIVE_CALLBACK(&gs_handle, nrf24l01_interface_receive_callback);
77
78 /* get information */
79 res = nrf24l01_info(&info);
80 if (res != 0)
81 {
82 nrf24l01_interface_debug_print("nrf24l01: get info failed.\n");
83
84 return 1;
85 }
86 else
87 {
88 /* print chip info */
89 nrf24l01_interface_debug_print("nrf24l01: chip is %s.\n", info.chip_name);
90 nrf24l01_interface_debug_print("nrf24l01: manufacturer is %s.\n", info.manufacturer_name);
91 nrf24l01_interface_debug_print("nrf24l01: interface is %s.\n", info.interface);
92 nrf24l01_interface_debug_print("nrf24l01: driver version is %d.%d.\n", info.driver_version / 1000, (info.driver_version % 1000) / 100);
93 nrf24l01_interface_debug_print("nrf24l01: min supply voltage is %0.1fV.\n", info.supply_voltage_min_v);
94 nrf24l01_interface_debug_print("nrf24l01: max supply voltage is %0.1fV.\n", info.supply_voltage_max_v);
95 nrf24l01_interface_debug_print("nrf24l01: max current is %0.2fmA.\n", info.max_current_ma);
96 nrf24l01_interface_debug_print("nrf24l01: max temperature is %0.1fC.\n", info.temperature_max);
97 nrf24l01_interface_debug_print("nrf24l01: min temperature is %0.1fC.\n", info.temperature_min);
98 }
99
100 /* start register test */
101 nrf24l01_interface_debug_print("nrf24l01: start register test.\n");
102
103 /* init */
104 res = nrf24l01_init(&gs_handle);
105 if (res != 0)
106 {
107 nrf24l01_interface_debug_print("nrf24l01: init failed.\n");
108
109 return 1;
110 }
111
112 /* set active false */
113 res = nrf24l01_set_active(&gs_handle, NRF24L01_BOOL_FALSE);
114 if (res != 0)
115 {
116 nrf24l01_interface_debug_print("nrf24l01: set active failed.\n");
117 (void)nrf24l01_deinit(&gs_handle);
118
119 return 1;
120 }
121
122 /* nrf24l01_set_config/nrf24l01_get_config test */
123 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_config/nrf24l01_get_config test.\n");
124
125 /* disable power up */
126 res = nrf24l01_set_config(&gs_handle, NRF24L01_CONFIG_PWR_UP, NRF24L01_BOOL_FALSE);
127 if (res != 0)
128 {
129 nrf24l01_interface_debug_print("nrf24l01: set config failed.\n");
130 (void)nrf24l01_deinit(&gs_handle);
131
132 return 1;
133 }
134 nrf24l01_interface_debug_print("nrf24l01: disable power up.\n");
135 res = nrf24l01_get_config(&gs_handle, NRF24L01_CONFIG_PWR_UP, &enable);
136 if (res != 0)
137 {
138 nrf24l01_interface_debug_print("nrf24l01: get config failed.\n");
139 (void)nrf24l01_deinit(&gs_handle);
140
141 return 1;
142 }
143 nrf24l01_interface_debug_print("nrf24l01: check config %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
144
145 /* enable power up */
146 res = nrf24l01_set_config(&gs_handle, NRF24L01_CONFIG_PWR_UP, NRF24L01_BOOL_TRUE);
147 if (res != 0)
148 {
149 nrf24l01_interface_debug_print("nrf24l01: set config failed.\n");
150 (void)nrf24l01_deinit(&gs_handle);
151
152 return 1;
153 }
154 nrf24l01_interface_debug_print("nrf24l01: enable power up.\n");
155 res = nrf24l01_get_config(&gs_handle, NRF24L01_CONFIG_PWR_UP, &enable);
156 if (res != 0)
157 {
158 nrf24l01_interface_debug_print("nrf24l01: get config failed.\n");
159 (void)nrf24l01_deinit(&gs_handle);
160
161 return 1;
162 }
163 nrf24l01_interface_debug_print("nrf24l01: check config %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
164
165 /* disable encoding 2 bytes */
166 res = nrf24l01_set_config(&gs_handle, NRF24L01_CONFIG_CRCO, NRF24L01_BOOL_FALSE);
167 if (res != 0)
168 {
169 nrf24l01_interface_debug_print("nrf24l01: set config failed.\n");
170 (void)nrf24l01_deinit(&gs_handle);
171
172 return 1;
173 }
174 nrf24l01_interface_debug_print("nrf24l01: disable encoding 2 bytes.\n");
175 res = nrf24l01_get_config(&gs_handle, NRF24L01_CONFIG_CRCO, &enable);
176 if (res != 0)
177 {
178 nrf24l01_interface_debug_print("nrf24l01: get config failed.\n");
179 (void)nrf24l01_deinit(&gs_handle);
180
181 return 1;
182 }
183 nrf24l01_interface_debug_print("nrf24l01: check config %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
184
185 /* enable encoding 2 bytes */
186 res = nrf24l01_set_config(&gs_handle, NRF24L01_CONFIG_CRCO, NRF24L01_BOOL_TRUE);
187 if (res != 0)
188 {
189 nrf24l01_interface_debug_print("nrf24l01: set config failed.\n");
190 (void)nrf24l01_deinit(&gs_handle);
191
192 return 1;
193 }
194 nrf24l01_interface_debug_print("nrf24l01: enable encoding 2 bytes.\n");
195 res = nrf24l01_get_config(&gs_handle, NRF24L01_CONFIG_CRCO, &enable);
196 if (res != 0)
197 {
198 nrf24l01_interface_debug_print("nrf24l01: get config failed.\n");
199 (void)nrf24l01_deinit(&gs_handle);
200
201 return 1;
202 }
203 nrf24l01_interface_debug_print("nrf24l01: check config %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
204
205 /* disable crc */
206 res = nrf24l01_set_config(&gs_handle, NRF24L01_CONFIG_EN_CRC, NRF24L01_BOOL_FALSE);
207 if (res != 0)
208 {
209 nrf24l01_interface_debug_print("nrf24l01: set config failed.\n");
210 (void)nrf24l01_deinit(&gs_handle);
211
212 return 1;
213 }
214 nrf24l01_interface_debug_print("nrf24l01: disable crc.\n");
215 res = nrf24l01_get_config(&gs_handle, NRF24L01_CONFIG_EN_CRC, &enable);
216 if (res != 0)
217 {
218 nrf24l01_interface_debug_print("nrf24l01: get config failed.\n");
219 (void)nrf24l01_deinit(&gs_handle);
220
221 return 1;
222 }
223 nrf24l01_interface_debug_print("nrf24l01: check config %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
224
225 /* enable crc */
226 res = nrf24l01_set_config(&gs_handle, NRF24L01_CONFIG_EN_CRC, NRF24L01_BOOL_TRUE);
227 if (res != 0)
228 {
229 nrf24l01_interface_debug_print("nrf24l01: set config failed.\n");
230 (void)nrf24l01_deinit(&gs_handle);
231
232 return 1;
233 }
234 nrf24l01_interface_debug_print("nrf24l01: enable crc.\n");
235 res = nrf24l01_get_config(&gs_handle, NRF24L01_CONFIG_EN_CRC, &enable);
236 if (res != 0)
237 {
238 nrf24l01_interface_debug_print("nrf24l01: get config failed.\n");
239 (void)nrf24l01_deinit(&gs_handle);
240
241 return 1;
242 }
243 nrf24l01_interface_debug_print("nrf24l01: check config %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
244
245 /* disable max rt */
246 res = nrf24l01_set_config(&gs_handle, NRF24L01_CONFIG_MASK_MAX_RT, NRF24L01_BOOL_FALSE);
247 if (res != 0)
248 {
249 nrf24l01_interface_debug_print("nrf24l01: set config failed.\n");
250 (void)nrf24l01_deinit(&gs_handle);
251
252 return 1;
253 }
254 nrf24l01_interface_debug_print("nrf24l01: disable max rt.\n");
255 res = nrf24l01_get_config(&gs_handle, NRF24L01_CONFIG_MASK_MAX_RT, &enable);
256 if (res != 0)
257 {
258 nrf24l01_interface_debug_print("nrf24l01: get config failed.\n");
259 (void)nrf24l01_deinit(&gs_handle);
260
261 return 1;
262 }
263 nrf24l01_interface_debug_print("nrf24l01: check config %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
264
265 /* enable max rt */
266 res = nrf24l01_set_config(&gs_handle, NRF24L01_CONFIG_MASK_MAX_RT, NRF24L01_BOOL_TRUE);
267 if (res != 0)
268 {
269 nrf24l01_interface_debug_print("nrf24l01: set config failed.\n");
270 (void)nrf24l01_deinit(&gs_handle);
271
272 return 1;
273 }
274 nrf24l01_interface_debug_print("nrf24l01: enable max rt.\n");
275 res = nrf24l01_get_config(&gs_handle, NRF24L01_CONFIG_MASK_MAX_RT, &enable);
276 if (res != 0)
277 {
278 nrf24l01_interface_debug_print("nrf24l01: get config failed.\n");
279 (void)nrf24l01_deinit(&gs_handle);
280
281 return 1;
282 }
283 nrf24l01_interface_debug_print("nrf24l01: check config %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
284
285 /* disable tx ds */
286 res = nrf24l01_set_config(&gs_handle, NRF24L01_CONFIG_MASK_TX_DS, NRF24L01_BOOL_FALSE);
287 if (res != 0)
288 {
289 nrf24l01_interface_debug_print("nrf24l01: set config failed.\n");
290 (void)nrf24l01_deinit(&gs_handle);
291
292 return 1;
293 }
294 nrf24l01_interface_debug_print("nrf24l01: disable tx ds.\n");
295 res = nrf24l01_get_config(&gs_handle, NRF24L01_CONFIG_MASK_TX_DS, &enable);
296 if (res != 0)
297 {
298 nrf24l01_interface_debug_print("nrf24l01: get config failed.\n");
299 (void)nrf24l01_deinit(&gs_handle);
300
301 return 1;
302 }
303 nrf24l01_interface_debug_print("nrf24l01: check config %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
304
305 /* enable tx ds */
306 res = nrf24l01_set_config(&gs_handle, NRF24L01_CONFIG_MASK_TX_DS, NRF24L01_BOOL_TRUE);
307 if (res != 0)
308 {
309 nrf24l01_interface_debug_print("nrf24l01: set config failed.\n");
310 (void)nrf24l01_deinit(&gs_handle);
311
312 return 1;
313 }
314 nrf24l01_interface_debug_print("nrf24l01: enable tx ds.\n");
315 res = nrf24l01_get_config(&gs_handle, NRF24L01_CONFIG_MASK_TX_DS, &enable);
316 if (res != 0)
317 {
318 nrf24l01_interface_debug_print("nrf24l01: get config failed.\n");
319 (void)nrf24l01_deinit(&gs_handle);
320
321 return 1;
322 }
323 nrf24l01_interface_debug_print("nrf24l01: check config %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
324
325 /* disable rx dr */
326 res = nrf24l01_set_config(&gs_handle, NRF24L01_CONFIG_MASK_RX_DR, NRF24L01_BOOL_FALSE);
327 if (res != 0)
328 {
329 nrf24l01_interface_debug_print("nrf24l01: set config failed.\n");
330 (void)nrf24l01_deinit(&gs_handle);
331
332 return 1;
333 }
334 nrf24l01_interface_debug_print("nrf24l01: disable rx dr.\n");
335 res = nrf24l01_get_config(&gs_handle, NRF24L01_CONFIG_MASK_RX_DR, &enable);
336 if (res != 0)
337 {
338 nrf24l01_interface_debug_print("nrf24l01: get config failed.\n");
339 (void)nrf24l01_deinit(&gs_handle);
340
341 return 1;
342 }
343 nrf24l01_interface_debug_print("nrf24l01: check config %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
344
345 /* enable rx dr */
346 res = nrf24l01_set_config(&gs_handle, NRF24L01_CONFIG_MASK_RX_DR, NRF24L01_BOOL_TRUE);
347 if (res != 0)
348 {
349 nrf24l01_interface_debug_print("nrf24l01: set config failed.\n");
350 (void)nrf24l01_deinit(&gs_handle);
351
352 return 1;
353 }
354 nrf24l01_interface_debug_print("nrf24l01: enable rx dr.\n");
355 res = nrf24l01_get_config(&gs_handle, NRF24L01_CONFIG_MASK_RX_DR, &enable);
356 if (res != 0)
357 {
358 nrf24l01_interface_debug_print("nrf24l01: get config failed.\n");
359 (void)nrf24l01_deinit(&gs_handle);
360
361 return 1;
362 }
363 nrf24l01_interface_debug_print("nrf24l01: check config %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
364
365 /* nrf24l01_set_mode/nrf24l01_get_mode test */
366 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_mode/nrf24l01_get_mode test.\n");
367
368 /* set tx mode */
369 res = nrf24l01_set_mode(&gs_handle, NRF24L01_MODE_TX);
370 if (res != 0)
371 {
372 nrf24l01_interface_debug_print("nrf24l01: set mode failed.\n");
373 (void)nrf24l01_deinit(&gs_handle);
374
375 return 1;
376 }
377 nrf24l01_interface_debug_print("nrf24l01: set tx mode.\n");
378 res = nrf24l01_get_mode(&gs_handle, &mode);
379 if (res != 0)
380 {
381 nrf24l01_interface_debug_print("nrf24l01: get mode failed.\n");
382 (void)nrf24l01_deinit(&gs_handle);
383
384 return 1;
385 }
386 nrf24l01_interface_debug_print("nrf24l01: check mode %s.\n", mode == NRF24L01_MODE_TX ? "ok" : "error");
387
388 /* set rx mode */
389 res = nrf24l01_set_mode(&gs_handle, NRF24L01_MODE_RX);
390 if (res != 0)
391 {
392 nrf24l01_interface_debug_print("nrf24l01: set mode failed.\n");
393 (void)nrf24l01_deinit(&gs_handle);
394
395 return 1;
396 }
397 nrf24l01_interface_debug_print("nrf24l01: set rx mode.\n");
398 res = nrf24l01_get_mode(&gs_handle, &mode);
399 if (res != 0)
400 {
401 nrf24l01_interface_debug_print("nrf24l01: get mode failed.\n");
402 (void)nrf24l01_deinit(&gs_handle);
403
404 return 1;
405 }
406 nrf24l01_interface_debug_print("nrf24l01: check mode %s.\n", mode == NRF24L01_MODE_RX ? "ok" : "error");
407
408 /* nrf24l01_set_auto_acknowledgment/nrf24l01_get_auto_acknowledgment test */
409 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_auto_acknowledgment/nrf24l01_get_auto_acknowledgment test.\n");
410
411 /* pipe 0 disable */
412 res = nrf24l01_set_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_0, NRF24L01_BOOL_FALSE);
413 if (res != 0)
414 {
415 nrf24l01_interface_debug_print("nrf24l01: set auto acknowledgment failed.\n");
416 (void)nrf24l01_deinit(&gs_handle);
417
418 return 1;
419 }
420 nrf24l01_interface_debug_print("nrf24l01: disable pipe 0 auto acknowledgment.\n");
421 res = nrf24l01_get_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_0, &enable);
422 if (res != 0)
423 {
424 nrf24l01_interface_debug_print("nrf24l01: get auto acknowledgment failed.\n");
425 (void)nrf24l01_deinit(&gs_handle);
426
427 return 1;
428 }
429 nrf24l01_interface_debug_print("nrf24l01: check auto acknowledgment %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
430
431 /* pipe 0 enable */
432 res = nrf24l01_set_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_0, NRF24L01_BOOL_TRUE);
433 if (res != 0)
434 {
435 nrf24l01_interface_debug_print("nrf24l01: set auto acknowledgment failed.\n");
436 (void)nrf24l01_deinit(&gs_handle);
437
438 return 1;
439 }
440 nrf24l01_interface_debug_print("nrf24l01: enable pipe 0 auto acknowledgment.\n");
441 res = nrf24l01_get_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_0, &enable);
442 if (res != 0)
443 {
444 nrf24l01_interface_debug_print("nrf24l01: get auto acknowledgment failed.\n");
445 (void)nrf24l01_deinit(&gs_handle);
446
447 return 1;
448 }
449 nrf24l01_interface_debug_print("nrf24l01: check auto acknowledgment %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
450
451 /* pipe 1 disable */
452 res = nrf24l01_set_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_1, NRF24L01_BOOL_FALSE);
453 if (res != 0)
454 {
455 nrf24l01_interface_debug_print("nrf24l01: set auto acknowledgment failed.\n");
456 (void)nrf24l01_deinit(&gs_handle);
457
458 return 1;
459 }
460 nrf24l01_interface_debug_print("nrf24l01: disable pipe 1 auto acknowledgment.\n");
461 res = nrf24l01_get_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_1, &enable);
462 if (res != 0)
463 {
464 nrf24l01_interface_debug_print("nrf24l01: get auto acknowledgment failed.\n");
465 (void)nrf24l01_deinit(&gs_handle);
466
467 return 1;
468 }
469 nrf24l01_interface_debug_print("nrf24l01: check auto acknowledgment %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
470
471 /* pipe 1 enable */
472 res = nrf24l01_set_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_1, NRF24L01_BOOL_TRUE);
473 if (res != 0)
474 {
475 nrf24l01_interface_debug_print("nrf24l01: set auto acknowledgment failed.\n");
476 (void)nrf24l01_deinit(&gs_handle);
477
478 return 1;
479 }
480 nrf24l01_interface_debug_print("nrf24l01: enable pipe 1 auto acknowledgment.\n");
481 res = nrf24l01_get_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_1, &enable);
482 if (res != 0)
483 {
484 nrf24l01_interface_debug_print("nrf24l01: get auto acknowledgment failed.\n");
485 (void)nrf24l01_deinit(&gs_handle);
486
487 return 1;
488 }
489 nrf24l01_interface_debug_print("nrf24l01: check auto acknowledgment %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
490
491 /* pipe 2 disable */
492 res = nrf24l01_set_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_2, NRF24L01_BOOL_FALSE);
493 if (res != 0)
494 {
495 nrf24l01_interface_debug_print("nrf24l01: set auto acknowledgment failed.\n");
496 (void)nrf24l01_deinit(&gs_handle);
497
498 return 1;
499 }
500 nrf24l01_interface_debug_print("nrf24l01: disable pipe 2 auto acknowledgment.\n");
501 res = nrf24l01_get_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_2, &enable);
502 if (res != 0)
503 {
504 nrf24l01_interface_debug_print("nrf24l01: get auto acknowledgment failed.\n");
505 (void)nrf24l01_deinit(&gs_handle);
506
507 return 1;
508 }
509 nrf24l01_interface_debug_print("nrf24l01: check auto acknowledgment %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
510
511 /* pipe 2 enable */
512 res = nrf24l01_set_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_2, NRF24L01_BOOL_TRUE);
513 if (res != 0)
514 {
515 nrf24l01_interface_debug_print("nrf24l01: set auto acknowledgment failed.\n");
516 (void)nrf24l01_deinit(&gs_handle);
517
518 return 1;
519 }
520 nrf24l01_interface_debug_print("nrf24l01: enable pipe 2 auto acknowledgment.\n");
521 res = nrf24l01_get_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_2, &enable);
522 if (res != 0)
523 {
524 nrf24l01_interface_debug_print("nrf24l01: get auto acknowledgment failed.\n");
525 (void)nrf24l01_deinit(&gs_handle);
526
527 return 1;
528 }
529 nrf24l01_interface_debug_print("nrf24l01: check auto acknowledgment %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
530
531 /* pipe 3 disable */
532 res = nrf24l01_set_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_3, NRF24L01_BOOL_FALSE);
533 if (res != 0)
534 {
535 nrf24l01_interface_debug_print("nrf24l01: set auto acknowledgment failed.\n");
536 (void)nrf24l01_deinit(&gs_handle);
537
538 return 1;
539 }
540 nrf24l01_interface_debug_print("nrf24l01: disable pipe 3 auto acknowledgment.\n");
541 res = nrf24l01_get_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_3, &enable);
542 if (res != 0)
543 {
544 nrf24l01_interface_debug_print("nrf24l01: get auto acknowledgment failed.\n");
545 (void)nrf24l01_deinit(&gs_handle);
546
547 return 1;
548 }
549 nrf24l01_interface_debug_print("nrf24l01: check auto acknowledgment %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
550
551 /* pipe 3 enable */
552 res = nrf24l01_set_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_3, NRF24L01_BOOL_TRUE);
553 if (res != 0)
554 {
555 nrf24l01_interface_debug_print("nrf24l01: set auto acknowledgment failed.\n");
556 (void)nrf24l01_deinit(&gs_handle);
557
558 return 1;
559 }
560 nrf24l01_interface_debug_print("nrf24l01: enable pipe 3 auto acknowledgment.\n");
561 res = nrf24l01_get_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_3, &enable);
562 if (res != 0)
563 {
564 nrf24l01_interface_debug_print("nrf24l01: get auto acknowledgment failed.\n");
565 (void)nrf24l01_deinit(&gs_handle);
566
567 return 1;
568 }
569 nrf24l01_interface_debug_print("nrf24l01: check auto acknowledgment %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
570
571 /* pipe 4 disable */
572 res = nrf24l01_set_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_4, NRF24L01_BOOL_FALSE);
573 if (res != 0)
574 {
575 nrf24l01_interface_debug_print("nrf24l01: set auto acknowledgment failed.\n");
576 (void)nrf24l01_deinit(&gs_handle);
577
578 return 1;
579 }
580 nrf24l01_interface_debug_print("nrf24l01: disable pipe 4 auto acknowledgment.\n");
581 res = nrf24l01_get_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_4, &enable);
582 if (res != 0)
583 {
584 nrf24l01_interface_debug_print("nrf24l01: get auto acknowledgment failed.\n");
585 (void)nrf24l01_deinit(&gs_handle);
586
587 return 1;
588 }
589 nrf24l01_interface_debug_print("nrf24l01: check auto acknowledgment %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
590
591 /* pipe 4 enable */
592 res = nrf24l01_set_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_4, NRF24L01_BOOL_TRUE);
593 if (res != 0)
594 {
595 nrf24l01_interface_debug_print("nrf24l01: set auto acknowledgment failed.\n");
596 (void)nrf24l01_deinit(&gs_handle);
597
598 return 1;
599 }
600 nrf24l01_interface_debug_print("nrf24l01: enable pipe 4 auto acknowledgment.\n");
601 res = nrf24l01_get_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_4, &enable);
602 if (res != 0)
603 {
604 nrf24l01_interface_debug_print("nrf24l01: get auto acknowledgment failed.\n");
605 (void)nrf24l01_deinit(&gs_handle);
606
607 return 1;
608 }
609 nrf24l01_interface_debug_print("nrf24l01: check auto acknowledgment %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
610
611 /* pipe 5 disable */
612 res = nrf24l01_set_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_5, NRF24L01_BOOL_FALSE);
613 if (res != 0)
614 {
615 nrf24l01_interface_debug_print("nrf24l01: set auto acknowledgment failed.\n");
616 (void)nrf24l01_deinit(&gs_handle);
617
618 return 1;
619 }
620 nrf24l01_interface_debug_print("nrf24l01: disable pipe 5 auto acknowledgment.\n");
621 res = nrf24l01_get_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_5, &enable);
622 if (res != 0)
623 {
624 nrf24l01_interface_debug_print("nrf24l01: get auto acknowledgment failed.\n");
625 (void)nrf24l01_deinit(&gs_handle);
626
627 return 1;
628 }
629 nrf24l01_interface_debug_print("nrf24l01: check auto acknowledgment %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
630
631 /* pipe 5 enable */
632 res = nrf24l01_set_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_5, NRF24L01_BOOL_TRUE);
633 if (res != 0)
634 {
635 nrf24l01_interface_debug_print("nrf24l01: set auto acknowledgment failed.\n");
636 (void)nrf24l01_deinit(&gs_handle);
637
638 return 1;
639 }
640 nrf24l01_interface_debug_print("nrf24l01: enable pipe 5 auto acknowledgment.\n");
641 res = nrf24l01_get_auto_acknowledgment(&gs_handle, NRF24L01_PIPE_5, &enable);
642 if (res != 0)
643 {
644 nrf24l01_interface_debug_print("nrf24l01: get auto acknowledgment failed.\n");
645 (void)nrf24l01_deinit(&gs_handle);
646
647 return 1;
648 }
649 nrf24l01_interface_debug_print("nrf24l01: check auto acknowledgment %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
650
651 /* nrf24l01_set_rx_pipe/nrf24l01_get_rx_pipe test */
652 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_rx_pipe/nrf24l01_get_rx_pipe test.\n");
653
654 /* disable rx pipe 0 */
655 res = nrf24l01_set_rx_pipe(&gs_handle, NRF24L01_PIPE_0, NRF24L01_BOOL_FALSE);
656 if (res != 0)
657 {
658 nrf24l01_interface_debug_print("nrf24l01: set rx pipe failed.\n");
659 (void)nrf24l01_deinit(&gs_handle);
660
661 return 1;
662 }
663 nrf24l01_interface_debug_print("nrf24l01: disable rx pipe 0.\n");
664 res = nrf24l01_get_rx_pipe(&gs_handle, NRF24L01_PIPE_0, &enable);
665 if (res != 0)
666 {
667 nrf24l01_interface_debug_print("nrf24l01: get rx pipe failed.\n");
668 (void)nrf24l01_deinit(&gs_handle);
669
670 return 1;
671 }
672 nrf24l01_interface_debug_print("nrf24l01: check rx pipe %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
673
674 /* enable rx pipe 0 */
675 res = nrf24l01_set_rx_pipe(&gs_handle, NRF24L01_PIPE_0, NRF24L01_BOOL_TRUE);
676 if (res != 0)
677 {
678 nrf24l01_interface_debug_print("nrf24l01: set rx pipe failed.\n");
679 (void)nrf24l01_deinit(&gs_handle);
680
681 return 1;
682 }
683 nrf24l01_interface_debug_print("nrf24l01: enable rx pipe 0.\n");
684 res = nrf24l01_get_rx_pipe(&gs_handle, NRF24L01_PIPE_0, &enable);
685 if (res != 0)
686 {
687 nrf24l01_interface_debug_print("nrf24l01: get rx pipe failed.\n");
688 (void)nrf24l01_deinit(&gs_handle);
689
690 return 1;
691 }
692 nrf24l01_interface_debug_print("nrf24l01: check rx pipe %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
693
694 /* disable rx pipe 1 */
695 res = nrf24l01_set_rx_pipe(&gs_handle, NRF24L01_PIPE_1, NRF24L01_BOOL_FALSE);
696 if (res != 0)
697 {
698 nrf24l01_interface_debug_print("nrf24l01: set rx pipe failed.\n");
699 (void)nrf24l01_deinit(&gs_handle);
700
701 return 1;
702 }
703 nrf24l01_interface_debug_print("nrf24l01: disable rx pipe 1.\n");
704 res = nrf24l01_get_rx_pipe(&gs_handle, NRF24L01_PIPE_1, &enable);
705 if (res != 0)
706 {
707 nrf24l01_interface_debug_print("nrf24l01: get rx pipe failed.\n");
708 (void)nrf24l01_deinit(&gs_handle);
709
710 return 1;
711 }
712 nrf24l01_interface_debug_print("nrf24l01: check rx pipe %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
713
714 /* enable rx pipe 1 */
715 res = nrf24l01_set_rx_pipe(&gs_handle, NRF24L01_PIPE_1, NRF24L01_BOOL_TRUE);
716 if (res != 0)
717 {
718 nrf24l01_interface_debug_print("nrf24l01: set rx pipe failed.\n");
719 (void)nrf24l01_deinit(&gs_handle);
720
721 return 1;
722 }
723 nrf24l01_interface_debug_print("nrf24l01: enable rx pipe 1.\n");
724 res = nrf24l01_get_rx_pipe(&gs_handle, NRF24L01_PIPE_1, &enable);
725 if (res != 0)
726 {
727 nrf24l01_interface_debug_print("nrf24l01: get rx pipe failed.\n");
728 (void)nrf24l01_deinit(&gs_handle);
729
730 return 1;
731 }
732 nrf24l01_interface_debug_print("nrf24l01: check rx pipe %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
733
734 /* disable rx pipe 2 */
735 res = nrf24l01_set_rx_pipe(&gs_handle, NRF24L01_PIPE_2, NRF24L01_BOOL_FALSE);
736 if (res != 0)
737 {
738 nrf24l01_interface_debug_print("nrf24l01: set rx pipe failed.\n");
739 (void)nrf24l01_deinit(&gs_handle);
740
741 return 1;
742 }
743 nrf24l01_interface_debug_print("nrf24l01: disable rx pipe 2.\n");
744 res = nrf24l01_get_rx_pipe(&gs_handle, NRF24L01_PIPE_2, &enable);
745 if (res != 0)
746 {
747 nrf24l01_interface_debug_print("nrf24l01: get rx pipe failed.\n");
748 (void)nrf24l01_deinit(&gs_handle);
749
750 return 1;
751 }
752 nrf24l01_interface_debug_print("nrf24l01: check rx pipe %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
753
754 /* enable rx pipe 2 */
755 res = nrf24l01_set_rx_pipe(&gs_handle, NRF24L01_PIPE_2, NRF24L01_BOOL_TRUE);
756 if (res != 0)
757 {
758 nrf24l01_interface_debug_print("nrf24l01: set rx pipe failed.\n");
759 (void)nrf24l01_deinit(&gs_handle);
760
761 return 1;
762 }
763 nrf24l01_interface_debug_print("nrf24l01: enable rx pipe 2.\n");
764 res = nrf24l01_get_rx_pipe(&gs_handle, NRF24L01_PIPE_2, &enable);
765 if (res != 0)
766 {
767 nrf24l01_interface_debug_print("nrf24l01: get rx pipe failed.\n");
768 (void)nrf24l01_deinit(&gs_handle);
769
770 return 1;
771 }
772 nrf24l01_interface_debug_print("nrf24l01: check rx pipe %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
773
774 /* disable rx pipe 3 */
775 res = nrf24l01_set_rx_pipe(&gs_handle, NRF24L01_PIPE_3, NRF24L01_BOOL_FALSE);
776 if (res != 0)
777 {
778 nrf24l01_interface_debug_print("nrf24l01: set rx pipe failed.\n");
779 (void)nrf24l01_deinit(&gs_handle);
780
781 return 1;
782 }
783 nrf24l01_interface_debug_print("nrf24l01: disable rx pipe 3.\n");
784 res = nrf24l01_get_rx_pipe(&gs_handle, NRF24L01_PIPE_3, &enable);
785 if (res != 0)
786 {
787 nrf24l01_interface_debug_print("nrf24l01: get rx pipe failed.\n");
788 (void)nrf24l01_deinit(&gs_handle);
789
790 return 1;
791 }
792 nrf24l01_interface_debug_print("nrf24l01: check rx pipe %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
793
794 /* enable rx pipe 3 */
795 res = nrf24l01_set_rx_pipe(&gs_handle, NRF24L01_PIPE_3, NRF24L01_BOOL_TRUE);
796 if (res != 0)
797 {
798 nrf24l01_interface_debug_print("nrf24l01: set rx pipe failed.\n");
799 (void)nrf24l01_deinit(&gs_handle);
800
801 return 1;
802 }
803 nrf24l01_interface_debug_print("nrf24l01: enable rx pipe 3.\n");
804 res = nrf24l01_get_rx_pipe(&gs_handle, NRF24L01_PIPE_3, &enable);
805 if (res != 0)
806 {
807 nrf24l01_interface_debug_print("nrf24l01: get rx pipe failed.\n");
808 (void)nrf24l01_deinit(&gs_handle);
809
810 return 1;
811 }
812 nrf24l01_interface_debug_print("nrf24l01: check rx pipe %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
813
814 /* disable rx pipe 4 */
815 res = nrf24l01_set_rx_pipe(&gs_handle, NRF24L01_PIPE_4, NRF24L01_BOOL_FALSE);
816 if (res != 0)
817 {
818 nrf24l01_interface_debug_print("nrf24l01: set rx pipe failed.\n");
819 (void)nrf24l01_deinit(&gs_handle);
820
821 return 1;
822 }
823 nrf24l01_interface_debug_print("nrf24l01: disable rx pipe 4.\n");
824 res = nrf24l01_get_rx_pipe(&gs_handle, NRF24L01_PIPE_4, &enable);
825 if (res != 0)
826 {
827 nrf24l01_interface_debug_print("nrf24l01: get rx pipe failed.\n");
828 (void)nrf24l01_deinit(&gs_handle);
829
830 return 1;
831 }
832 nrf24l01_interface_debug_print("nrf24l01: check rx pipe %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
833
834 /* enable rx pipe 4 */
835 res = nrf24l01_set_rx_pipe(&gs_handle, NRF24L01_PIPE_4, NRF24L01_BOOL_TRUE);
836 if (res != 0)
837 {
838 nrf24l01_interface_debug_print("nrf24l01: set rx pipe failed.\n");
839 (void)nrf24l01_deinit(&gs_handle);
840
841 return 1;
842 }
843 nrf24l01_interface_debug_print("nrf24l01: enable rx pipe 4.\n");
844 res = nrf24l01_get_rx_pipe(&gs_handle, NRF24L01_PIPE_4, &enable);
845 if (res != 0)
846 {
847 nrf24l01_interface_debug_print("nrf24l01: get rx pipe failed.\n");
848 (void)nrf24l01_deinit(&gs_handle);
849
850 return 1;
851 }
852 nrf24l01_interface_debug_print("nrf24l01: check rx pipe %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
853
854 /* disable rx pipe 5 */
855 res = nrf24l01_set_rx_pipe(&gs_handle, NRF24L01_PIPE_5, NRF24L01_BOOL_FALSE);
856 if (res != 0)
857 {
858 nrf24l01_interface_debug_print("nrf24l01: set rx pipe failed.\n");
859 (void)nrf24l01_deinit(&gs_handle);
860
861 return 1;
862 }
863 nrf24l01_interface_debug_print("nrf24l01: disable rx pipe 5.\n");
864 res = nrf24l01_get_rx_pipe(&gs_handle, NRF24L01_PIPE_5, &enable);
865 if (res != 0)
866 {
867 nrf24l01_interface_debug_print("nrf24l01: get rx pipe failed.\n");
868 (void)nrf24l01_deinit(&gs_handle);
869
870 return 1;
871 }
872 nrf24l01_interface_debug_print("nrf24l01: check rx pipe %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
873
874 /* enable rx pipe 5 */
875 res = nrf24l01_set_rx_pipe(&gs_handle, NRF24L01_PIPE_5, NRF24L01_BOOL_TRUE);
876 if (res != 0)
877 {
878 nrf24l01_interface_debug_print("nrf24l01: set rx pipe failed.\n");
879 (void)nrf24l01_deinit(&gs_handle);
880
881 return 1;
882 }
883 nrf24l01_interface_debug_print("nrf24l01: enable rx pipe 5.\n");
884 res = nrf24l01_get_rx_pipe(&gs_handle, NRF24L01_PIPE_5, &enable);
885 if (res != 0)
886 {
887 nrf24l01_interface_debug_print("nrf24l01: get rx pipe failed.\n");
888 (void)nrf24l01_deinit(&gs_handle);
889
890 return 1;
891 }
892 nrf24l01_interface_debug_print("nrf24l01: check rx pipe %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
893
894 /* nrf24l01_set_address_width/nrf24l01_get_address_width test */
895 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_address_width/nrf24l01_get_address_width test.\n");
896
897 /* set address width illegal */
898 res = nrf24l01_set_address_width(&gs_handle, NRF24L01_ADDRESS_WIDTH_ILLEGAL);
899 if (res != 0)
900 {
901 nrf24l01_interface_debug_print("nrf24l01: set address width failed.\n");
902 (void)nrf24l01_deinit(&gs_handle);
903
904 return 1;
905 }
906 nrf24l01_interface_debug_print("nrf24l01: set address width illegal.\n");
907 res = nrf24l01_get_address_width(&gs_handle, &width);
908 if (res != 0)
909 {
910 nrf24l01_interface_debug_print("nrf24l01: get address width failed.\n");
911 (void)nrf24l01_deinit(&gs_handle);
912
913 return 1;
914 }
915 nrf24l01_interface_debug_print("nrf24l01: check address width %s.\n", width == NRF24L01_ADDRESS_WIDTH_ILLEGAL ? "ok" : "error");
916
917 /* set address width 3 bytes */
918 res = nrf24l01_set_address_width(&gs_handle, NRF24L01_ADDRESS_WIDTH_3_BYTES);
919 if (res != 0)
920 {
921 nrf24l01_interface_debug_print("nrf24l01: set address width failed.\n");
922 (void)nrf24l01_deinit(&gs_handle);
923
924 return 1;
925 }
926 nrf24l01_interface_debug_print("nrf24l01: set address width 3 bytes.\n");
927 res = nrf24l01_get_address_width(&gs_handle, &width);
928 if (res != 0)
929 {
930 nrf24l01_interface_debug_print("nrf24l01: get address width failed.\n");
931 (void)nrf24l01_deinit(&gs_handle);
932
933 return 1;
934 }
935 nrf24l01_interface_debug_print("nrf24l01: check address width %s.\n", width == NRF24L01_ADDRESS_WIDTH_3_BYTES ? "ok" : "error");
936
937 /* set address width 4 bytes */
938 res = nrf24l01_set_address_width(&gs_handle, NRF24L01_ADDRESS_WIDTH_4_BYTES);
939 if (res != 0)
940 {
941 nrf24l01_interface_debug_print("nrf24l01: set address width failed.\n");
942 (void)nrf24l01_deinit(&gs_handle);
943
944 return 1;
945 }
946 nrf24l01_interface_debug_print("nrf24l01: set address width 4 bytes.\n");
947 res = nrf24l01_get_address_width(&gs_handle, &width);
948 if (res != 0)
949 {
950 nrf24l01_interface_debug_print("nrf24l01: get address width failed.\n");
951 (void)nrf24l01_deinit(&gs_handle);
952
953 return 1;
954 }
955 nrf24l01_interface_debug_print("nrf24l01: check address width %s.\n", width == NRF24L01_ADDRESS_WIDTH_4_BYTES ? "ok" : "error");
956
957 /* set address width 5 bytes */
958 res = nrf24l01_set_address_width(&gs_handle, NRF24L01_ADDRESS_WIDTH_5_BYTES);
959 if (res != 0)
960 {
961 nrf24l01_interface_debug_print("nrf24l01: set address width failed.\n");
962 (void)nrf24l01_deinit(&gs_handle);
963
964 return 1;
965 }
966 nrf24l01_interface_debug_print("nrf24l01: set address width 5 bytes.\n");
967 res = nrf24l01_get_address_width(&gs_handle, &width);
968 if (res != 0)
969 {
970 nrf24l01_interface_debug_print("nrf24l01: get address width failed.\n");
971 (void)nrf24l01_deinit(&gs_handle);
972
973 return 1;
974 }
975 nrf24l01_interface_debug_print("nrf24l01: check address width %s.\n", width == NRF24L01_ADDRESS_WIDTH_5_BYTES ? "ok" : "error");
976
977 /* nrf24l01_set_address_width/nrf24l01_get_address_width test */
978 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_address_width/nrf24l01_get_address_width test.\n");
979
980 value = rand() % 0xF;
981 res = nrf24l01_set_auto_retransmit_delay(&gs_handle, value);
982 if (res != 0)
983 {
984 nrf24l01_interface_debug_print("nrf24l01: set auto retransmit delay failed.\n");
985 (void)nrf24l01_deinit(&gs_handle);
986
987 return 1;
988 }
989 nrf24l01_interface_debug_print("nrf24l01: set auto retransmit delay %d.\n", value);
990 res = nrf24l01_get_auto_retransmit_delay(&gs_handle, (uint8_t *)&value_check);
991 if (res != 0)
992 {
993 nrf24l01_interface_debug_print("nrf24l01: get auto retransmit delay failed.\n");
994 (void)nrf24l01_deinit(&gs_handle);
995
996 return 1;
997 }
998 nrf24l01_interface_debug_print("nrf24l01: check auto retransmit delay %s.\n", value == value_check ? "ok" : "error");
999
1000 /* nrf24l01_auto_retransmit_delay_convert_to_register/nrf24l01_auto_retransmit_delay_convert_to_data test */
1001 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_auto_retransmit_delay_convert_to_register/nrf24l01_auto_retransmit_delay_convert_to_data test.\n");
1002
1003 us = 250 * (rand() % 0xF);
1004 res = nrf24l01_auto_retransmit_delay_convert_to_register(&gs_handle, us, (uint8_t *)&value);
1005 if (res != 0)
1006 {
1007 nrf24l01_interface_debug_print("nrf24l01: auto retransmit delay convert to register failed.\n");
1008 (void)nrf24l01_deinit(&gs_handle);
1009
1010 return 1;
1011 }
1012 res = nrf24l01_auto_retransmit_delay_convert_to_data(&gs_handle, value, (uint32_t *)&us_check);
1013 if (res != 0)
1014 {
1015 nrf24l01_interface_debug_print("nrf24l01: auto retransmit delay convert to data failed.\n");
1016 (void)nrf24l01_deinit(&gs_handle);
1017
1018 return 1;
1019 }
1020 nrf24l01_interface_debug_print("nrf24l01: check auto retransmit delay convert %d %d %d.\n", us, value, us_check);
1021
1022 /* nrf24l01_set_auto_retransmit_count/nrf24l01_get_auto_retransmit_count test */
1023 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_auto_retransmit_count/nrf24l01_get_auto_retransmit_count test.\n");
1024
1025 value = rand() % 0xF;
1026 res = nrf24l01_set_auto_retransmit_count(&gs_handle, value);
1027 if (res != 0)
1028 {
1029 nrf24l01_interface_debug_print("nrf24l01: set auto retransmit count failed.\n");
1030 (void)nrf24l01_deinit(&gs_handle);
1031
1032 return 1;
1033 }
1034 nrf24l01_interface_debug_print("nrf24l01: set auto retransmit count %d.\n", value);
1035 res = nrf24l01_get_auto_retransmit_count(&gs_handle, (uint8_t *)&value_check);
1036 if (res != 0)
1037 {
1038 nrf24l01_interface_debug_print("nrf24l01: get auto retransmit count failed.\n");
1039 (void)nrf24l01_deinit(&gs_handle);
1040
1041 return 1;
1042 }
1043 nrf24l01_interface_debug_print("nrf24l01: check auto retransmit count %s.\n", value == value_check ? "ok" : "error");
1044
1045 /* nrf24l01_set_channel_frequency/nrf24l01_get_channel_frequency test */
1046 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_channel_frequency/nrf24l01_get_channel_frequency test.\n");
1047
1048 value = rand() % 0xF;
1049 res = nrf24l01_set_channel_frequency(&gs_handle, value);
1050 if (res != 0)
1051 {
1052 nrf24l01_interface_debug_print("nrf24l01: set channel frequency failed.\n");
1053 (void)nrf24l01_deinit(&gs_handle);
1054
1055 return 1;
1056 }
1057 nrf24l01_interface_debug_print("nrf24l01: set channel frequency %d.\n", value);
1058 res = nrf24l01_get_channel_frequency(&gs_handle, (uint8_t *)&value_check);
1059 if (res != 0)
1060 {
1061 nrf24l01_interface_debug_print("nrf24l01: get channel frequency failed.\n");
1062 (void)nrf24l01_deinit(&gs_handle);
1063
1064 return 1;
1065 }
1066 nrf24l01_interface_debug_print("nrf24l01: check channel frequency %s.\n", value == value_check ? "ok" : "error");
1067
1068 /* nrf24l01_set_continuous_carrier_transmit/nrf24l01_get_continuous_carrier_transmit test */
1069 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_continuous_carrier_transmit/nrf24l01_get_continuous_carrier_transmit test.\n");
1070
1071 /* disable continuous carrier transmit */
1072 res = nrf24l01_set_continuous_carrier_transmit(&gs_handle, NRF24L01_BOOL_FALSE);
1073 if (res != 0)
1074 {
1075 nrf24l01_interface_debug_print("nrf24l01: set continuous carrier transmit failed.\n");
1076 (void)nrf24l01_deinit(&gs_handle);
1077
1078 return 1;
1079 }
1080 nrf24l01_interface_debug_print("nrf24l01: disable continuous carrier transmit.\n");
1081 res = nrf24l01_get_continuous_carrier_transmit(&gs_handle, &enable);
1082 if (res != 0)
1083 {
1084 nrf24l01_interface_debug_print("nrf24l01: get continuous carrier transmit failed.\n");
1085 (void)nrf24l01_deinit(&gs_handle);
1086
1087 return 1;
1088 }
1089 nrf24l01_interface_debug_print("nrf24l01: check continuous carrier transmit %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
1090
1091 /* enable continuous carrier transmit */
1092 res = nrf24l01_set_continuous_carrier_transmit(&gs_handle, NRF24L01_BOOL_TRUE);
1093 if (res != 0)
1094 {
1095 nrf24l01_interface_debug_print("nrf24l01: set continuous carrier transmit failed.\n");
1096 (void)nrf24l01_deinit(&gs_handle);
1097
1098 return 1;
1099 }
1100 nrf24l01_interface_debug_print("nrf24l01: enable continuous carrier transmit.\n");
1101 res = nrf24l01_get_continuous_carrier_transmit(&gs_handle, &enable);
1102 if (res != 0)
1103 {
1104 nrf24l01_interface_debug_print("nrf24l01: get continuous carrier transmit failed.\n");
1105 (void)nrf24l01_deinit(&gs_handle);
1106
1107 return 1;
1108 }
1109 nrf24l01_interface_debug_print("nrf24l01: check continuous carrier transmit %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
1110
1111 /* nrf24l01_set_force_pll_lock_signal/nrf24l01_get_force_pll_lock_signal test */
1112 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_force_pll_lock_signal/nrf24l01_get_force_pll_lock_signal test.\n");
1113
1114 /* enable force pll lock signal */
1115 res = nrf24l01_set_force_pll_lock_signal(&gs_handle, NRF24L01_BOOL_TRUE);
1116 if (res != 0)
1117 {
1118 nrf24l01_interface_debug_print("nrf24l01: set force pll lock signal failed.\n");
1119 (void)nrf24l01_deinit(&gs_handle);
1120
1121 return 1;
1122 }
1123 nrf24l01_interface_debug_print("nrf24l01: enable force pll lock signal.\n");
1124 res = nrf24l01_get_force_pll_lock_signal(&gs_handle, &enable);
1125 if (res != 0)
1126 {
1127 nrf24l01_interface_debug_print("nrf24l01: get force pll lock signal failed.\n");
1128 (void)nrf24l01_deinit(&gs_handle);
1129
1130 return 1;
1131 }
1132 nrf24l01_interface_debug_print("nrf24l01: check force pll lock signal %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
1133
1134 /* disable force pll lock signal */
1135 res = nrf24l01_set_force_pll_lock_signal(&gs_handle, NRF24L01_BOOL_FALSE);
1136 if (res != 0)
1137 {
1138 nrf24l01_interface_debug_print("nrf24l01: set force pll lock signal failed.\n");
1139 (void)nrf24l01_deinit(&gs_handle);
1140
1141 return 1;
1142 }
1143 nrf24l01_interface_debug_print("nrf24l01: disable force pll lock signal.\n");
1144 res = nrf24l01_get_force_pll_lock_signal(&gs_handle, &enable);
1145 if (res != 0)
1146 {
1147 nrf24l01_interface_debug_print("nrf24l01: get force pll lock signal failed.\n");
1148 (void)nrf24l01_deinit(&gs_handle);
1149
1150 return 1;
1151 }
1152 nrf24l01_interface_debug_print("nrf24l01: check force pll lock signal %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
1153
1154 /* nrf24l01_set_data_rate/nrf24l01_get_data_rate test */
1155 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_data_rate/nrf24l01_get_data_rate test.\n");
1156
1157 /* data rate 1M */
1158 res = nrf24l01_set_data_rate(&gs_handle, NRF24L01_DATA_RATE_1M);
1159 if (res != 0)
1160 {
1161 nrf24l01_interface_debug_print("nrf24l01: set data rate failed.\n");
1162 (void)nrf24l01_deinit(&gs_handle);
1163
1164 return 1;
1165 }
1166 nrf24l01_interface_debug_print("nrf24l01: data rate 1M.\n");
1167 res = nrf24l01_get_data_rate(&gs_handle, &rate);
1168 if (res != 0)
1169 {
1170 nrf24l01_interface_debug_print("nrf24l01: get data rate failed.\n");
1171 (void)nrf24l01_deinit(&gs_handle);
1172
1173 return 1;
1174 }
1175 nrf24l01_interface_debug_print("nrf24l01: check data rate %s.\n", rate == NRF24L01_DATA_RATE_1M ? "ok" : "error");
1176
1177 /* data rate 2M */
1178 res = nrf24l01_set_data_rate(&gs_handle, NRF24L01_DATA_RATE_2M);
1179 if (res != 0)
1180 {
1181 nrf24l01_interface_debug_print("nrf24l01: set data rate failed.\n");
1182 (void)nrf24l01_deinit(&gs_handle);
1183
1184 return 1;
1185 }
1186 nrf24l01_interface_debug_print("nrf24l01: data rate 2M.\n");
1187 res = nrf24l01_get_data_rate(&gs_handle, &rate);
1188 if (res != 0)
1189 {
1190 nrf24l01_interface_debug_print("nrf24l01: get data rate failed.\n");
1191 (void)nrf24l01_deinit(&gs_handle);
1192
1193 return 1;
1194 }
1195 nrf24l01_interface_debug_print("nrf24l01: check data rate %s.\n", rate == NRF24L01_DATA_RATE_2M ? "ok" : "error");
1196
1197 /* data rate 250K */
1198 res = nrf24l01_set_data_rate(&gs_handle, NRF24L01_DATA_RATE_250K);
1199 if (res != 0)
1200 {
1201 nrf24l01_interface_debug_print("nrf24l01: set data rate failed.\n");
1202 (void)nrf24l01_deinit(&gs_handle);
1203
1204 return 1;
1205 }
1206 nrf24l01_interface_debug_print("nrf24l01: data rate 250K.\n");
1207 res = nrf24l01_get_data_rate(&gs_handle, &rate);
1208 if (res != 0)
1209 {
1210 nrf24l01_interface_debug_print("nrf24l01: get data rate failed.\n");
1211 (void)nrf24l01_deinit(&gs_handle);
1212
1213 return 1;
1214 }
1215 nrf24l01_interface_debug_print("nrf24l01: check data rate %s.\n", rate == NRF24L01_DATA_RATE_250K ? "ok" : "error");
1216
1217 /* nrf24l01_set_output_power/nrf24l01_get_output_power test */
1218 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_output_power/nrf24l01_get_output_power test.\n");
1219
1220 /* output power -18 dBm */
1221 res = nrf24l01_set_output_power(&gs_handle, NRF24L01_OUTPUT_POWER_NEGATIVE_18_DBM);
1222 if (res != 0)
1223 {
1224 nrf24l01_interface_debug_print("nrf24l01: set output power failed.\n");
1225 (void)nrf24l01_deinit(&gs_handle);
1226
1227 return 1;
1228 }
1229 nrf24l01_interface_debug_print("nrf24l01: set output power -18 dBm.\n");
1230 res = nrf24l01_get_output_power(&gs_handle, &power);
1231 if (res != 0)
1232 {
1233 nrf24l01_interface_debug_print("nrf24l01: get output power failed.\n");
1234 (void)nrf24l01_deinit(&gs_handle);
1235
1236 return 1;
1237 }
1238 nrf24l01_interface_debug_print("nrf24l01: check output power %s.\n", power == NRF24L01_OUTPUT_POWER_NEGATIVE_18_DBM ? "ok" : "error");
1239
1240 /* output power -12 dBm */
1241 res = nrf24l01_set_output_power(&gs_handle, NRF24L01_OUTPUT_POWER_NEGATIVE_12_DBM);
1242 if (res != 0)
1243 {
1244 nrf24l01_interface_debug_print("nrf24l01: set output power failed.\n");
1245 (void)nrf24l01_deinit(&gs_handle);
1246
1247 return 1;
1248 }
1249 nrf24l01_interface_debug_print("nrf24l01: set output power -12 dBm.\n");
1250 res = nrf24l01_get_output_power(&gs_handle, &power);
1251 if (res != 0)
1252 {
1253 nrf24l01_interface_debug_print("nrf24l01: get output power failed.\n");
1254 (void)nrf24l01_deinit(&gs_handle);
1255
1256 return 1;
1257 }
1258 nrf24l01_interface_debug_print("nrf24l01: check output power %s.\n", power == NRF24L01_OUTPUT_POWER_NEGATIVE_12_DBM ? "ok" : "error");
1259
1260 /* output power -6 dBm */
1261 res = nrf24l01_set_output_power(&gs_handle, NRF24L01_OUTPUT_POWER_NEGATIVE_6_DBM);
1262 if (res != 0)
1263 {
1264 nrf24l01_interface_debug_print("nrf24l01: set output power failed.\n");
1265 (void)nrf24l01_deinit(&gs_handle);
1266
1267 return 1;
1268 }
1269 nrf24l01_interface_debug_print("nrf24l01: set output power -6 dBm.\n");
1270 res = nrf24l01_get_output_power(&gs_handle, &power);
1271 if (res != 0)
1272 {
1273 nrf24l01_interface_debug_print("nrf24l01: get output power failed.\n");
1274 (void)nrf24l01_deinit(&gs_handle);
1275
1276 return 1;
1277 }
1278 nrf24l01_interface_debug_print("nrf24l01: check output power %s.\n", power == NRF24L01_OUTPUT_POWER_NEGATIVE_6_DBM ? "ok" : "error");
1279
1280 /* output power 0 dBm */
1281 res = nrf24l01_set_output_power(&gs_handle, NRF24L01_OUTPUT_POWER_0_DBM);
1282 if (res != 0)
1283 {
1284 nrf24l01_interface_debug_print("nrf24l01: set output power failed.\n");
1285 (void)nrf24l01_deinit(&gs_handle);
1286
1287 return 1;
1288 }
1289 nrf24l01_interface_debug_print("nrf24l01: set output power 0 dBm.\n");
1290 res = nrf24l01_get_output_power(&gs_handle, &power);
1291 if (res != 0)
1292 {
1293 nrf24l01_interface_debug_print("nrf24l01: get output power failed.\n");
1294 (void)nrf24l01_deinit(&gs_handle);
1295
1296 return 1;
1297 }
1298 nrf24l01_interface_debug_print("nrf24l01: check output power %s.\n", power == NRF24L01_OUTPUT_POWER_0_DBM ? "ok" : "error");
1299
1300 /* nrf24l01_set_rx_pipe_0_address/nrf24l01_get_rx_pipe_0_address test */
1301 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_rx_pipe_0_address/nrf24l01_get_rx_pipe_0_address test.\n");
1302
1303 /* rx pipe 0 */
1304 addr[0] = rand() % 256;
1305 addr[1] = rand() % 256;
1306 addr[2] = rand() % 256;
1307 addr[3] = rand() % 256;
1308 addr[4] = rand() % 256;
1309 res = nrf24l01_set_rx_pipe_0_address(&gs_handle, (uint8_t *)addr, 5);
1310 if (res != 0)
1311 {
1312 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 0 address failed.\n");
1313 (void)nrf24l01_deinit(&gs_handle);
1314
1315 return 1;
1316 }
1317 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 0 addr 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X.\n",
1318 addr[0], addr[1], addr[2], addr[3], addr[4]);
1319 len = 5;
1320 res = nrf24l01_get_rx_pipe_0_address(&gs_handle, (uint8_t *)addr_check, (uint8_t *)&len);
1321 if (res != 0)
1322 {
1323 nrf24l01_interface_debug_print("nrf24l01: get rx pipe 0 address failed.\n");
1324 (void)nrf24l01_deinit(&gs_handle);
1325
1326 return 1;
1327 }
1328 nrf24l01_interface_debug_print("nrf24l01: check address %s with %d.\n", memcmp((uint8_t *)addr, (uint8_t *)addr_check, 5) == 0 ? "ok" : "error", len);
1329
1330 /* nrf24l01_set_rx_pipe_1_address/nrf24l01_get_rx_pipe_1_address test */
1331 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_rx_pipe_1_address/nrf24l01_get_rx_pipe_1_address test.\n");
1332
1333 /* rx pipe 1 */
1334 addr[0] = rand() % 256;
1335 addr[1] = rand() % 256;
1336 addr[2] = rand() % 256;
1337 addr[3] = rand() % 256;
1338 addr[4] = rand() % 256;
1339 res = nrf24l01_set_rx_pipe_1_address(&gs_handle, (uint8_t *)addr, 5);
1340 if (res != 0)
1341 {
1342 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 1 address failed.\n");
1343 (void)nrf24l01_deinit(&gs_handle);
1344
1345 return 1;
1346 }
1347 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 1 addr 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X.\n",
1348 addr[0], addr[1], addr[2], addr[3], addr[4]);
1349 len = 5;
1350 res = nrf24l01_get_rx_pipe_1_address(&gs_handle, (uint8_t *)addr_check, (uint8_t *)&len);
1351 if (res != 0)
1352 {
1353 nrf24l01_interface_debug_print("nrf24l01: get rx pipe 1 address failed.\n");
1354 (void)nrf24l01_deinit(&gs_handle);
1355
1356 return 1;
1357 }
1358 nrf24l01_interface_debug_print("nrf24l01: check address %s with %d.\n", memcmp((uint8_t *)addr, (uint8_t *)addr_check, 5) == 0 ? "ok" : "error", len);
1359
1360 /* nrf24l01_set_rx_pipe_2_address/nrf24l01_get_rx_pipe_2_address test */
1361 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_rx_pipe_2_address/nrf24l01_get_rx_pipe_2_address test.\n");
1362
1363 /* pipe 2 */
1364 value = rand() % 256;
1365 res = nrf24l01_set_rx_pipe_2_address(&gs_handle, value);
1366 if (res != 0)
1367 {
1368 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 2 address failed.\n");
1369 (void)nrf24l01_deinit(&gs_handle);
1370
1371 return 1;
1372 }
1373 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 2 addr 0x%02X.\n", value);
1374 res = nrf24l01_get_rx_pipe_2_address(&gs_handle, (uint8_t *)&value_check);
1375 if (res != 0)
1376 {
1377 nrf24l01_interface_debug_print("nrf24l01: get rx pipe 2 address failed.\n");
1378 (void)nrf24l01_deinit(&gs_handle);
1379
1380 return 1;
1381 }
1382 nrf24l01_interface_debug_print("nrf24l01: check address %s.\n", value_check == value ? "ok" : "error");
1383
1384 /* nrf24l01_set_rx_pipe_3_address/nrf24l01_get_rx_pipe_3_address test */
1385 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_rx_pipe_3_address/nrf24l01_get_rx_pipe_3_address test.\n");
1386
1387 /* pipe 3 */
1388 value = rand() % 256;
1389 res = nrf24l01_set_rx_pipe_3_address(&gs_handle, value);
1390 if (res != 0)
1391 {
1392 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 3 address failed.\n");
1393 (void)nrf24l01_deinit(&gs_handle);
1394
1395 return 1;
1396 }
1397 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 3 addr 0x%02X.\n", value);
1398 res = nrf24l01_get_rx_pipe_3_address(&gs_handle, (uint8_t *)&value_check);
1399 if (res != 0)
1400 {
1401 nrf24l01_interface_debug_print("nrf24l01: get rx pipe 3 address failed.\n");
1402 (void)nrf24l01_deinit(&gs_handle);
1403
1404 return 1;
1405 }
1406 nrf24l01_interface_debug_print("nrf24l01: check address %s.\n", value_check == value ? "ok" : "error");
1407
1408 /* nrf24l01_set_rx_pipe_4_address/nrf24l01_get_rx_pipe_4_address test */
1409 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_rx_pipe_4_address/nrf24l01_get_rx_pipe_4_address test.\n");
1410
1411 /* pipe 4 */
1412 value = rand() % 256;
1413 res = nrf24l01_set_rx_pipe_4_address(&gs_handle, value);
1414 if (res != 0)
1415 {
1416 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 4 address failed.\n");
1417 (void)nrf24l01_deinit(&gs_handle);
1418
1419 return 1;
1420 }
1421 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 4 addr 0x%02X.\n", value);
1422 res = nrf24l01_get_rx_pipe_4_address(&gs_handle, (uint8_t *)&value_check);
1423 if (res != 0)
1424 {
1425 nrf24l01_interface_debug_print("nrf24l01: get rx pipe 4 address failed.\n");
1426 (void)nrf24l01_deinit(&gs_handle);
1427
1428 return 1;
1429 }
1430 nrf24l01_interface_debug_print("nrf24l01: check address %s.\n", value_check == value ? "ok" : "error");
1431
1432 /* nrf24l01_set_rx_pipe_5_address/nrf24l01_get_rx_pipe_5_address test */
1433 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_rx_pipe_5_address/nrf24l01_get_rx_pipe_5_address test.\n");
1434
1435 /* pipe 5 */
1436 value = rand() % 256;
1437 res = nrf24l01_set_rx_pipe_5_address(&gs_handle, value);
1438 if (res != 0)
1439 {
1440 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 5 address failed.\n");
1441 (void)nrf24l01_deinit(&gs_handle);
1442
1443 return 1;
1444 }
1445 nrf24l01_interface_debug_print("nrf24l01: set rx pipe 5 addr 0x%02X.\n", value);
1446 res = nrf24l01_get_rx_pipe_5_address(&gs_handle, (uint8_t *)&value_check);
1447 if (res != 0)
1448 {
1449 nrf24l01_interface_debug_print("nrf24l01: get rx pipe 5 address failed.\n");
1450 (void)nrf24l01_deinit(&gs_handle);
1451
1452 return 1;
1453 }
1454 nrf24l01_interface_debug_print("nrf24l01: check address %s.\n", value_check == value ? "ok" : "error");
1455
1456 /* nrf24l01_set_tx_address/nrf24l01_get_tx_address test */
1457 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_tx_address/nrf24l01_get_tx_address test.\n");
1458
1459 /* tx */
1460 addr[0] = rand() % 256;
1461 addr[1] = rand() % 256;
1462 addr[2] = rand() % 256;
1463 addr[3] = rand() % 256;
1464 addr[4] = rand() % 256;
1465 res = nrf24l01_set_tx_address(&gs_handle, (uint8_t *)addr, 5);
1466 if (res != 0)
1467 {
1468 nrf24l01_interface_debug_print("nrf24l01: set tx address failed.\n");
1469 (void)nrf24l01_deinit(&gs_handle);
1470
1471 return 1;
1472 }
1473 nrf24l01_interface_debug_print("nrf24l01: set tx addr 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X.\n",
1474 addr[0], addr[1], addr[2], addr[3], addr[4]);
1475 len = 5;
1476 res = nrf24l01_get_tx_address(&gs_handle, (uint8_t *)addr_check, (uint8_t *)&len);
1477 if (res != 0)
1478 {
1479 nrf24l01_interface_debug_print("nrf24l01: get tx address failed.\n");
1480 (void)nrf24l01_deinit(&gs_handle);
1481
1482 return 1;
1483 }
1484 nrf24l01_interface_debug_print("nrf24l01: check address %s with %d.\n", memcmp((uint8_t *)addr, (uint8_t *)addr_check, 5) == 0 ? "ok" : "error", len);
1485
1486 /* nrf24l01_set_pipe_0_payload_number/nrf24l01_get_pipe_0_payload_number test */
1487 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_pipe_0_payload_number/nrf24l01_get_pipe_0_payload_number test.\n");
1488
1489 value = rand() % 32;
1490 res = nrf24l01_set_pipe_0_payload_number(&gs_handle, value);
1491 if (res != 0)
1492 {
1493 nrf24l01_interface_debug_print("nrf24l01: set pipe 0 payload number failed.\n");
1494 (void)nrf24l01_deinit(&gs_handle);
1495
1496 return 1;
1497 }
1498 nrf24l01_interface_debug_print("nrf24l01: set pipe 0 payload number %d.\n", value);
1499 res = nrf24l01_get_pipe_0_payload_number(&gs_handle, (uint8_t *)&value_check);
1500 if (res != 0)
1501 {
1502 nrf24l01_interface_debug_print("nrf24l01: get pipe 0 payload number failed.\n");
1503 (void)nrf24l01_deinit(&gs_handle);
1504
1505 return 1;
1506 }
1507 nrf24l01_interface_debug_print("nrf24l01: check payload number %s.\n", value_check == value ? "ok" : "error");
1508
1509 /* nrf24l01_set_pipe_1_payload_number/nrf24l01_get_pipe_1_payload_number test */
1510 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_pipe_1_payload_number/nrf24l01_get_pipe_1_payload_number test.\n");
1511
1512 value = rand() % 32;
1513 res = nrf24l01_set_pipe_1_payload_number(&gs_handle, value);
1514 if (res != 0)
1515 {
1516 nrf24l01_interface_debug_print("nrf24l01: set pipe 1 payload number failed.\n");
1517 (void)nrf24l01_deinit(&gs_handle);
1518
1519 return 1;
1520 }
1521 nrf24l01_interface_debug_print("nrf24l01: set pipe 1 payload number %d.\n", value);
1522 res = nrf24l01_get_pipe_1_payload_number(&gs_handle, (uint8_t *)&value_check);
1523 if (res != 0)
1524 {
1525 nrf24l01_interface_debug_print("nrf24l01: get pipe 1 payload number failed.\n");
1526 (void)nrf24l01_deinit(&gs_handle);
1527
1528 return 1;
1529 }
1530 nrf24l01_interface_debug_print("nrf24l01: check payload number %s.\n", value_check == value ? "ok" : "error");
1531
1532 /* nrf24l01_set_pipe_2_payload_number/nrf24l01_get_pipe_2_payload_number test */
1533 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_pipe_2_payload_number/nrf24l01_get_pipe_2_payload_number test.\n");
1534
1535 value = rand() % 32;
1536 res = nrf24l01_set_pipe_2_payload_number(&gs_handle, value);
1537 if (res != 0)
1538 {
1539 nrf24l01_interface_debug_print("nrf24l01: set pipe 2 payload number failed.\n");
1540 (void)nrf24l01_deinit(&gs_handle);
1541
1542 return 1;
1543 }
1544 nrf24l01_interface_debug_print("nrf24l01: set pipe 2 payload number %d.\n", value);
1545 res = nrf24l01_get_pipe_2_payload_number(&gs_handle, (uint8_t *)&value_check);
1546 if (res != 0)
1547 {
1548 nrf24l01_interface_debug_print("nrf24l01: get pipe 2 payload number failed.\n");
1549 (void)nrf24l01_deinit(&gs_handle);
1550
1551 return 1;
1552 }
1553 nrf24l01_interface_debug_print("nrf24l01: check payload number %s.\n", value_check == value ? "ok" : "error");
1554
1555 /* nrf24l01_set_pipe_3_payload_number/nrf24l01_get_pipe_3_payload_number test */
1556 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_pipe_3_payload_number/nrf24l01_get_pipe_3_payload_number test.\n");
1557
1558 value = rand() % 32;
1559 res = nrf24l01_set_pipe_3_payload_number(&gs_handle, value);
1560 if (res != 0)
1561 {
1562 nrf24l01_interface_debug_print("nrf24l01: set pipe 3 payload number failed.\n");
1563 (void)nrf24l01_deinit(&gs_handle);
1564
1565 return 1;
1566 }
1567 nrf24l01_interface_debug_print("nrf24l01: set pipe 3 payload number %d.\n", value);
1568 res = nrf24l01_get_pipe_3_payload_number(&gs_handle, (uint8_t *)&value_check);
1569 if (res != 0)
1570 {
1571 nrf24l01_interface_debug_print("nrf24l01: get pipe 3 payload number failed.\n");
1572 (void)nrf24l01_deinit(&gs_handle);
1573
1574 return 1;
1575 }
1576 nrf24l01_interface_debug_print("nrf24l01: check payload number %s.\n", value_check == value ? "ok" : "error");
1577
1578 /* nrf24l01_set_pipe_4_payload_number/nrf24l01_get_pipe_4_payload_number test */
1579 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_pipe_4_payload_number/nrf24l01_get_pipe_4_payload_number test.\n");
1580
1581 value = rand() % 32;
1582 res = nrf24l01_set_pipe_4_payload_number(&gs_handle, value);
1583 if (res != 0)
1584 {
1585 nrf24l01_interface_debug_print("nrf24l01: set pipe 4 payload number failed.\n");
1586 (void)nrf24l01_deinit(&gs_handle);
1587
1588 return 1;
1589 }
1590 nrf24l01_interface_debug_print("nrf24l01: set pipe 4 payload number %d.\n", value);
1591 res = nrf24l01_get_pipe_4_payload_number(&gs_handle, (uint8_t *)&value_check);
1592 if (res != 0)
1593 {
1594 nrf24l01_interface_debug_print("nrf24l01: get pipe 4 payload number failed.\n");
1595 (void)nrf24l01_deinit(&gs_handle);
1596
1597 return 1;
1598 }
1599 nrf24l01_interface_debug_print("nrf24l01: check payload number %s.\n", value_check == value ? "ok" : "error");
1600
1601 /* nrf24l01_set_pipe_5_payload_number/nrf24l01_get_pipe_5_payload_number test */
1602 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_pipe_5_payload_number/nrf24l01_get_pipe_5_payload_number test.\n");
1603
1604 value = rand() % 32;
1605 res = nrf24l01_set_pipe_5_payload_number(&gs_handle, value);
1606 if (res != 0)
1607 {
1608 nrf24l01_interface_debug_print("nrf24l01: set pipe 5 payload number failed.\n");
1609 (void)nrf24l01_deinit(&gs_handle);
1610
1611 return 1;
1612 }
1613 nrf24l01_interface_debug_print("nrf24l01: set pipe 5 payload number %d.\n", value);
1614 res = nrf24l01_get_pipe_5_payload_number(&gs_handle, (uint8_t *)&value_check);
1615 if (res != 0)
1616 {
1617 nrf24l01_interface_debug_print("nrf24l01: get pipe 5 payload number failed.\n");
1618 (void)nrf24l01_deinit(&gs_handle);
1619
1620 return 1;
1621 }
1622 nrf24l01_interface_debug_print("nrf24l01: check payload number %s.\n", value_check == value ? "ok" : "error");
1623
1624 /* nrf24l01_set_pipe_dynamic_payload/nrf24l01_get_pipe_dynamic_payload test */
1625 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_pipe_dynamic_payload/nrf24l01_get_pipe_dynamic_payload test.\n");
1626
1627 /* disable pipe 0 */
1628 res = nrf24l01_set_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_0, NRF24L01_BOOL_FALSE);
1629 if (res != 0)
1630 {
1631 nrf24l01_interface_debug_print("nrf24l01: set pipe dynamic payload failed.\n");
1632 (void)nrf24l01_deinit(&gs_handle);
1633
1634 return 1;
1635 }
1636 nrf24l01_interface_debug_print("nrf24l01: disable pipe 0 dynamic payload.\n");
1637 res = nrf24l01_get_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_0, &enable);
1638 if (res != 0)
1639 {
1640 nrf24l01_interface_debug_print("nrf24l01: get pipe dynamic payload failed.\n");
1641 (void)nrf24l01_deinit(&gs_handle);
1642
1643 return 1;
1644 }
1645 nrf24l01_interface_debug_print("nrf24l01: check pipe dynamic payload %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
1646
1647 /* enable pipe 0 */
1648 res = nrf24l01_set_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_0, NRF24L01_BOOL_TRUE);
1649 if (res != 0)
1650 {
1651 nrf24l01_interface_debug_print("nrf24l01: set pipe dynamic payload failed.\n");
1652 (void)nrf24l01_deinit(&gs_handle);
1653
1654 return 1;
1655 }
1656 nrf24l01_interface_debug_print("nrf24l01: enable pipe 0 dynamic payload.\n");
1657 res = nrf24l01_get_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_0, &enable);
1658 if (res != 0)
1659 {
1660 nrf24l01_interface_debug_print("nrf24l01: get pipe dynamic payload failed.\n");
1661 (void)nrf24l01_deinit(&gs_handle);
1662
1663 return 1;
1664 }
1665 nrf24l01_interface_debug_print("nrf24l01: check pipe dynamic payload %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
1666
1667 /* disable pipe 1 */
1668 res = nrf24l01_set_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_1, NRF24L01_BOOL_FALSE);
1669 if (res != 0)
1670 {
1671 nrf24l01_interface_debug_print("nrf24l01: set pipe dynamic payload failed.\n");
1672 (void)nrf24l01_deinit(&gs_handle);
1673
1674 return 1;
1675 }
1676 nrf24l01_interface_debug_print("nrf24l01: disable pipe 1 dynamic payload.\n");
1677 res = nrf24l01_get_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_1, &enable);
1678 if (res != 0)
1679 {
1680 nrf24l01_interface_debug_print("nrf24l01: get pipe dynamic payload failed.\n");
1681 (void)nrf24l01_deinit(&gs_handle);
1682
1683 return 1;
1684 }
1685 nrf24l01_interface_debug_print("nrf24l01: check pipe dynamic payload %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
1686
1687 /* enable pipe 1 */
1688 res = nrf24l01_set_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_1, NRF24L01_BOOL_TRUE);
1689 if (res != 0)
1690 {
1691 nrf24l01_interface_debug_print("nrf24l01: set pipe dynamic payload failed.\n");
1692 (void)nrf24l01_deinit(&gs_handle);
1693
1694 return 1;
1695 }
1696 nrf24l01_interface_debug_print("nrf24l01: enable pipe 1 dynamic payload.\n");
1697 res = nrf24l01_get_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_1, &enable);
1698 if (res != 0)
1699 {
1700 nrf24l01_interface_debug_print("nrf24l01: get pipe dynamic payload failed.\n");
1701 (void)nrf24l01_deinit(&gs_handle);
1702
1703 return 1;
1704 }
1705 nrf24l01_interface_debug_print("nrf24l01: check pipe dynamic payload %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
1706
1707 /* disable pipe 2 */
1708 res = nrf24l01_set_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_2, NRF24L01_BOOL_FALSE);
1709 if (res != 0)
1710 {
1711 nrf24l01_interface_debug_print("nrf24l01: set pipe dynamic payload failed.\n");
1712 (void)nrf24l01_deinit(&gs_handle);
1713
1714 return 1;
1715 }
1716 nrf24l01_interface_debug_print("nrf24l01: disable pipe 2 dynamic payload.\n");
1717 res = nrf24l01_get_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_2, &enable);
1718 if (res != 0)
1719 {
1720 nrf24l01_interface_debug_print("nrf24l01: get pipe dynamic payload failed.\n");
1721 (void)nrf24l01_deinit(&gs_handle);
1722
1723 return 1;
1724 }
1725 nrf24l01_interface_debug_print("nrf24l01: check pipe dynamic payload %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
1726
1727 /* enable pipe 2 */
1728 res = nrf24l01_set_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_2, NRF24L01_BOOL_TRUE);
1729 if (res != 0)
1730 {
1731 nrf24l01_interface_debug_print("nrf24l01: set pipe dynamic payload failed.\n");
1732 (void)nrf24l01_deinit(&gs_handle);
1733
1734 return 1;
1735 }
1736 nrf24l01_interface_debug_print("nrf24l01: enable pipe 2 dynamic payload.\n");
1737 res = nrf24l01_get_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_2, &enable);
1738 if (res != 0)
1739 {
1740 nrf24l01_interface_debug_print("nrf24l01: get pipe dynamic payload failed.\n");
1741 (void)nrf24l01_deinit(&gs_handle);
1742
1743 return 1;
1744 }
1745 nrf24l01_interface_debug_print("nrf24l01: check pipe dynamic payload %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
1746
1747 /* disable pipe 3 */
1748 res = nrf24l01_set_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_3, NRF24L01_BOOL_FALSE);
1749 if (res != 0)
1750 {
1751 nrf24l01_interface_debug_print("nrf24l01: set pipe dynamic payload failed.\n");
1752 (void)nrf24l01_deinit(&gs_handle);
1753
1754 return 1;
1755 }
1756 nrf24l01_interface_debug_print("nrf24l01: disable pipe 3 dynamic payload.\n");
1757 res = nrf24l01_get_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_3, &enable);
1758 if (res != 0)
1759 {
1760 nrf24l01_interface_debug_print("nrf24l01: get pipe dynamic payload failed.\n");
1761 (void)nrf24l01_deinit(&gs_handle);
1762
1763 return 1;
1764 }
1765 nrf24l01_interface_debug_print("nrf24l01: check pipe dynamic payload %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
1766
1767 /* enable pipe 3 */
1768 res = nrf24l01_set_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_3, NRF24L01_BOOL_TRUE);
1769 if (res != 0)
1770 {
1771 nrf24l01_interface_debug_print("nrf24l01: set pipe dynamic payload failed.\n");
1772 (void)nrf24l01_deinit(&gs_handle);
1773
1774 return 1;
1775 }
1776 nrf24l01_interface_debug_print("nrf24l01: enable pipe 3 dynamic payload.\n");
1777 res = nrf24l01_get_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_3, &enable);
1778 if (res != 0)
1779 {
1780 nrf24l01_interface_debug_print("nrf24l01: get pipe dynamic payload failed.\n");
1781 (void)nrf24l01_deinit(&gs_handle);
1782
1783 return 1;
1784 }
1785 nrf24l01_interface_debug_print("nrf24l01: check pipe dynamic payload %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
1786
1787 /* disable pipe 4 */
1788 res = nrf24l01_set_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_4, NRF24L01_BOOL_FALSE);
1789 if (res != 0)
1790 {
1791 nrf24l01_interface_debug_print("nrf24l01: set pipe dynamic payload failed.\n");
1792 (void)nrf24l01_deinit(&gs_handle);
1793
1794 return 1;
1795 }
1796 nrf24l01_interface_debug_print("nrf24l01: disable pipe 4 dynamic payload.\n");
1797 res = nrf24l01_get_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_4, &enable);
1798 if (res != 0)
1799 {
1800 nrf24l01_interface_debug_print("nrf24l01: get pipe dynamic payload failed.\n");
1801 (void)nrf24l01_deinit(&gs_handle);
1802
1803 return 1;
1804 }
1805 nrf24l01_interface_debug_print("nrf24l01: check pipe dynamic payload %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
1806
1807 /* enable pipe 4 */
1808 res = nrf24l01_set_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_4, NRF24L01_BOOL_TRUE);
1809 if (res != 0)
1810 {
1811 nrf24l01_interface_debug_print("nrf24l01: set pipe dynamic payload failed.\n");
1812 (void)nrf24l01_deinit(&gs_handle);
1813
1814 return 1;
1815 }
1816 nrf24l01_interface_debug_print("nrf24l01: enable pipe 4 dynamic payload.\n");
1817 res = nrf24l01_get_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_4, &enable);
1818 if (res != 0)
1819 {
1820 nrf24l01_interface_debug_print("nrf24l01: get pipe dynamic payload failed.\n");
1821 (void)nrf24l01_deinit(&gs_handle);
1822
1823 return 1;
1824 }
1825 nrf24l01_interface_debug_print("nrf24l01: check pipe dynamic payload %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
1826
1827 /* disable pipe 5 */
1828 res = nrf24l01_set_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_5, NRF24L01_BOOL_FALSE);
1829 if (res != 0)
1830 {
1831 nrf24l01_interface_debug_print("nrf24l01: set pipe dynamic payload failed.\n");
1832 (void)nrf24l01_deinit(&gs_handle);
1833
1834 return 1;
1835 }
1836 nrf24l01_interface_debug_print("nrf24l01: disable pipe 5 dynamic payload.\n");
1837 res = nrf24l01_get_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_5, &enable);
1838 if (res != 0)
1839 {
1840 nrf24l01_interface_debug_print("nrf24l01: get pipe dynamic payload failed.\n");
1841 (void)nrf24l01_deinit(&gs_handle);
1842
1843 return 1;
1844 }
1845 nrf24l01_interface_debug_print("nrf24l01: check pipe dynamic payload %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
1846
1847 /* enable pipe 5 */
1848 res = nrf24l01_set_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_5, NRF24L01_BOOL_TRUE);
1849 if (res != 0)
1850 {
1851 nrf24l01_interface_debug_print("nrf24l01: set pipe dynamic payload failed.\n");
1852 (void)nrf24l01_deinit(&gs_handle);
1853
1854 return 1;
1855 }
1856 nrf24l01_interface_debug_print("nrf24l01: enable pipe 5 dynamic payload.\n");
1857 res = nrf24l01_get_pipe_dynamic_payload(&gs_handle, NRF24L01_PIPE_5, &enable);
1858 if (res != 0)
1859 {
1860 nrf24l01_interface_debug_print("nrf24l01: get pipe dynamic payload failed.\n");
1861 (void)nrf24l01_deinit(&gs_handle);
1862
1863 return 1;
1864 }
1865 nrf24l01_interface_debug_print("nrf24l01: check pipe dynamic payload %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
1866
1867 /* nrf24l01_set_dynamic_payload/nrf24l01_get_dynamic_payload test */
1868 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_dynamic_payload/nrf24l01_get_dynamic_payload test.\n");
1869
1870 /* disable dynamic payload */
1871 res = nrf24l01_set_dynamic_payload(&gs_handle, NRF24L01_BOOL_FALSE);
1872 if (res != 0)
1873 {
1874 nrf24l01_interface_debug_print("nrf24l01: set dynamic payload failed.\n");
1875 (void)nrf24l01_deinit(&gs_handle);
1876
1877 return 1;
1878 }
1879 nrf24l01_interface_debug_print("nrf24l01: disable dynamic payload.\n");
1880 res = nrf24l01_get_dynamic_payload(&gs_handle, &enable);
1881 if (res != 0)
1882 {
1883 nrf24l01_interface_debug_print("nrf24l01: get dynamic payload failed.\n");
1884 (void)nrf24l01_deinit(&gs_handle);
1885
1886 return 1;
1887 }
1888 nrf24l01_interface_debug_print("nrf24l01: check dynamic payload %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
1889
1890 /* enable dynamic payload */
1891 res = nrf24l01_set_dynamic_payload(&gs_handle, NRF24L01_BOOL_TRUE);
1892 if (res != 0)
1893 {
1894 nrf24l01_interface_debug_print("nrf24l01: set dynamic payload failed.\n");
1895 (void)nrf24l01_deinit(&gs_handle);
1896
1897 return 1;
1898 }
1899 nrf24l01_interface_debug_print("nrf24l01: enable dynamic payload.\n");
1900 res = nrf24l01_get_dynamic_payload(&gs_handle, &enable);
1901 if (res != 0)
1902 {
1903 nrf24l01_interface_debug_print("nrf24l01: get dynamic payload failed.\n");
1904 (void)nrf24l01_deinit(&gs_handle);
1905
1906 return 1;
1907 }
1908 nrf24l01_interface_debug_print("nrf24l01: check dynamic payload %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
1909
1910 /* nrf24l01_set_payload_with_ack/nrf24l01_get_payload_with_ack test */
1911 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_payload_with_ack/nrf24l01_get_payload_with_ack test.\n");
1912
1913 /* disable payload with ack */
1914 res = nrf24l01_set_payload_with_ack(&gs_handle, NRF24L01_BOOL_FALSE);
1915 if (res != 0)
1916 {
1917 nrf24l01_interface_debug_print("nrf24l01: set payload with ack failed.\n");
1918 (void)nrf24l01_deinit(&gs_handle);
1919
1920 return 1;
1921 }
1922 nrf24l01_interface_debug_print("nrf24l01: disable payload with ack.\n");
1923 res = nrf24l01_get_payload_with_ack(&gs_handle, &enable);
1924 if (res != 0)
1925 {
1926 nrf24l01_interface_debug_print("nrf24l01: get payload with ack failed.\n");
1927 (void)nrf24l01_deinit(&gs_handle);
1928
1929 return 1;
1930 }
1931 nrf24l01_interface_debug_print("nrf24l01: check payload with ack %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
1932
1933 /* enable payload with ack */
1934 res = nrf24l01_set_payload_with_ack(&gs_handle, NRF24L01_BOOL_TRUE);
1935 if (res != 0)
1936 {
1937 nrf24l01_interface_debug_print("nrf24l01: set payload with ack failed.\n");
1938 (void)nrf24l01_deinit(&gs_handle);
1939
1940 return 1;
1941 }
1942 nrf24l01_interface_debug_print("nrf24l01: enable payload with ack.\n");
1943 res = nrf24l01_get_payload_with_ack(&gs_handle, &enable);
1944 if (res != 0)
1945 {
1946 nrf24l01_interface_debug_print("nrf24l01: get payload with ack failed.\n");
1947 (void)nrf24l01_deinit(&gs_handle);
1948
1949 return 1;
1950 }
1951 nrf24l01_interface_debug_print("nrf24l01: check payload with ack %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
1952
1953 /* nrf24l01_set_tx_payload_with_no_ack/nrf24l01_get_tx_payload_with_no_ack test */
1954 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_set_tx_payload_with_no_ack/nrf24l01_get_tx_payload_with_no_ack test.\n");
1955
1956 /* disable tx payload with no ack */
1957 res = nrf24l01_set_tx_payload_with_no_ack(&gs_handle, NRF24L01_BOOL_FALSE);
1958 if (res != 0)
1959 {
1960 nrf24l01_interface_debug_print("nrf24l01: set tx payload with no ack failed.\n");
1961 (void)nrf24l01_deinit(&gs_handle);
1962
1963 return 1;
1964 }
1965 nrf24l01_interface_debug_print("nrf24l01: disable tx payload with no ack.\n");
1966 res = nrf24l01_get_tx_payload_with_no_ack(&gs_handle, &enable);
1967 if (res != 0)
1968 {
1969 nrf24l01_interface_debug_print("nrf24l01: get tx payload with no ack failed.\n");
1970 (void)nrf24l01_deinit(&gs_handle);
1971
1972 return 1;
1973 }
1974 nrf24l01_interface_debug_print("nrf24l01: check tx payload with no ack %s.\n", enable == NRF24L01_BOOL_FALSE ? "ok" : "error");
1975
1976 /* enable tx payload with no ack */
1977 res = nrf24l01_set_tx_payload_with_no_ack(&gs_handle, NRF24L01_BOOL_TRUE);
1978 if (res != 0)
1979 {
1980 nrf24l01_interface_debug_print("nrf24l01: set tx payload with no ack failed.\n");
1981 (void)nrf24l01_deinit(&gs_handle);
1982
1983 return 1;
1984 }
1985 nrf24l01_interface_debug_print("nrf24l01: enable tx payload with no ack.\n");
1986 res = nrf24l01_get_tx_payload_with_no_ack(&gs_handle, &enable);
1987 if (res != 0)
1988 {
1989 nrf24l01_interface_debug_print("nrf24l01: get tx payload with no ack failed.\n");
1990 (void)nrf24l01_deinit(&gs_handle);
1991
1992 return 1;
1993 }
1994 nrf24l01_interface_debug_print("nrf24l01: check tx payload with no ack %s.\n", enable == NRF24L01_BOOL_TRUE ? "ok" : "error");
1995
1996 /* nrf24l01_read_rx_payload test */
1997 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_read_rx_payload test.\n");
1998
1999 /* read rx payload */
2000 res = nrf24l01_read_rx_payload(&gs_handle, (uint8_t *)buf, 32);
2001 if (res != 0)
2002 {
2003 nrf24l01_interface_debug_print("nrf24l01: set rx payload failed.\n");
2004 (void)nrf24l01_deinit(&gs_handle);
2005
2006 return 1;
2007 }
2008 nrf24l01_interface_debug_print("nrf24l01: check rx payload %s.\n", res == 0 ? "ok" : "error");
2009
2010 /* nrf24l01 write tx payload test */
2011 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_write_tx_payload test.\n");
2012
2013 /* write tx payload */
2014 res = nrf24l01_write_tx_payload(&gs_handle, (uint8_t *)buf, 32);
2015 if (res != 0)
2016 {
2017 nrf24l01_interface_debug_print("nrf24l01: set tx payload failed.\n");
2018 (void)nrf24l01_deinit(&gs_handle);
2019
2020 return 1;
2021 }
2022 nrf24l01_interface_debug_print("nrf24l01: check tx payload %s.\n", res == 0 ? "ok" : "error");
2023
2024 /* nrf24l01 get interrupt test */
2025 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_get_interrupt test.\n");
2026
2027 /* rx_dr */
2028 res = nrf24l01_get_interrupt(&gs_handle, NRF24L01_INTERRUPT_RX_DR, &enable);
2029 if (res != 0)
2030 {
2031 nrf24l01_interface_debug_print("nrf24l01: get interrupt failed.\n");
2032 (void)nrf24l01_deinit(&gs_handle);
2033
2034 return 1;
2035 }
2036 nrf24l01_interface_debug_print("nrf24l01: check rx_dr %s.\n", enable == 0 ? "enable" : "disable");
2037
2038 /* tx_ds */
2039 res = nrf24l01_get_interrupt(&gs_handle, NRF24L01_INTERRUPT_TX_DS, &enable);
2040 if (res != 0)
2041 {
2042 nrf24l01_interface_debug_print("nrf24l01: get interrupt failed.\n");
2043 (void)nrf24l01_deinit(&gs_handle);
2044
2045 return 1;
2046 }
2047 nrf24l01_interface_debug_print("nrf24l01: check tx_ds %s.\n", enable == 0 ? "enable" : "disable");
2048
2049 /* max_rt */
2050 res = nrf24l01_get_interrupt(&gs_handle, NRF24L01_INTERRUPT_MAX_RT, &enable);
2051 if (res != 0)
2052 {
2053 nrf24l01_interface_debug_print("nrf24l01: get interrupt failed.\n");
2054 (void)nrf24l01_deinit(&gs_handle);
2055
2056 return 1;
2057 }
2058 nrf24l01_interface_debug_print("nrf24l01: check max_rt %s.\n", enable == 0 ? "enable" : "disable");
2059
2060 /* tx_full */
2061 res = nrf24l01_get_interrupt(&gs_handle, NRF24L01_INTERRUPT_TX_FULL, &enable);
2062 if (res != 0)
2063 {
2064 nrf24l01_interface_debug_print("nrf24l01: get interrupt failed.\n");
2065 (void)nrf24l01_deinit(&gs_handle);
2066
2067 return 1;
2068 }
2069 nrf24l01_interface_debug_print("nrf24l01: check tx_full %s.\n", enable == 0 ? "enable" : "disable");
2070
2071 /* nrf24l01 clear interrupt test */
2072 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_clear_interrupt test.\n");
2073
2074 /* rx_dr */
2075 res = nrf24l01_clear_interrupt(&gs_handle, NRF24L01_INTERRUPT_RX_DR);
2076 if (res != 0)
2077 {
2078 nrf24l01_interface_debug_print("nrf24l01: clear interrupt failed.\n");
2079 (void)nrf24l01_deinit(&gs_handle);
2080
2081 return 1;
2082 }
2083 nrf24l01_interface_debug_print("nrf24l01: check rx_dr %s.\n", res == 0 ? "ok" : "error");
2084
2085 /* tx_ds */
2086 res = nrf24l01_clear_interrupt(&gs_handle, NRF24L01_INTERRUPT_TX_DS);
2087 if (res != 0)
2088 {
2089 nrf24l01_interface_debug_print("nrf24l01: clear interrupt failed.\n");
2090 (void)nrf24l01_deinit(&gs_handle);
2091
2092 return 1;
2093 }
2094 nrf24l01_interface_debug_print("nrf24l01: check tx_ds %s.\n", res == 0 ? "ok" : "error");
2095
2096 /* max_rt */
2097 res = nrf24l01_clear_interrupt(&gs_handle, NRF24L01_INTERRUPT_MAX_RT);
2098 if (res != 0)
2099 {
2100 nrf24l01_interface_debug_print("nrf24l01: clear interrupt failed.\n");
2101 (void)nrf24l01_deinit(&gs_handle);
2102
2103 return 1;
2104 }
2105 nrf24l01_interface_debug_print("nrf24l01: check max_rt %s.\n", res == 0 ? "ok" : "error");
2106
2107 /* tx_full */
2108 res = nrf24l01_clear_interrupt(&gs_handle, NRF24L01_INTERRUPT_TX_FULL);
2109 if (res != 0)
2110 {
2111 nrf24l01_interface_debug_print("nrf24l01: clear interrupt failed.\n");
2112 (void)nrf24l01_deinit(&gs_handle);
2113
2114 return 1;
2115 }
2116 nrf24l01_interface_debug_print("nrf24l01: check tx_full %s.\n", res == 0 ? "ok" : "error");
2117
2118 /* nrf24l01 get data pipe number test */
2119 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_get_data_pipe_number test.\n");
2120
2121 /* get data pipe number */
2122 res = nrf24l01_get_data_pipe_number(&gs_handle, (uint8_t *)&value);
2123 if (res != 0)
2124 {
2125 nrf24l01_interface_debug_print("nrf24l01: get data pipe number failed.\n");
2126 (void)nrf24l01_deinit(&gs_handle);
2127
2128 return 1;
2129 }
2130 nrf24l01_interface_debug_print("nrf24l01: get data pipe number %d.\n", value);
2131
2132 /* nrf24l01 get lost packet count test */
2133 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_get_lost_packet_count test.\n");
2134
2135 /* get lost packet count */
2136 res = nrf24l01_get_lost_packet_count(&gs_handle, (uint8_t *)&value);
2137 if (res != 0)
2138 {
2139 nrf24l01_interface_debug_print("nrf24l01: get lost packet count failed.\n");
2140 (void)nrf24l01_deinit(&gs_handle);
2141
2142 return 1;
2143 }
2144 nrf24l01_interface_debug_print("nrf24l01: get lost packet count %d.\n", value);
2145
2146 /* nrf24l01 get retransmitted packet count test */
2147 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_get_retransmitted_packet_count test.\n");
2148
2149 /* get retransmitted packet count */
2150 res = nrf24l01_get_retransmitted_packet_count(&gs_handle, (uint8_t *)&value);
2151 if (res != 0)
2152 {
2153 nrf24l01_interface_debug_print("nrf24l01: get retransmitted packet count failed.\n");
2154 (void)nrf24l01_deinit(&gs_handle);
2155
2156 return 1;
2157 }
2158 nrf24l01_interface_debug_print("nrf24l01: get retransmitted packet count %d.\n", value);
2159
2160 /* nrf24l01 get received power detector test */
2161 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_get_received_power_detector test.\n");
2162
2163 /* get received power detector */
2164 res = nrf24l01_get_received_power_detector(&gs_handle, &enable);
2165 if (res != 0)
2166 {
2167 nrf24l01_interface_debug_print("nrf24l01: get received power detector failed.\n");
2168 (void)nrf24l01_deinit(&gs_handle);
2169
2170 return 1;
2171 }
2172 nrf24l01_interface_debug_print("nrf24l01: get received power detector %s.\n", enable == NRF24L01_BOOL_TRUE ? "enable" : "disable");
2173
2174 /* nrf24l01 get fifo status test */
2175 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_get_fifo_status test.\n");
2176
2177 /* get fifo status */
2178 res = nrf24l01_get_fifo_status(&gs_handle, (uint8_t *)&value);
2179 if (res != 0)
2180 {
2181 nrf24l01_interface_debug_print("nrf24l01: get fifo status failed.\n");
2182 (void)nrf24l01_deinit(&gs_handle);
2183
2184 return 1;
2185 }
2186 nrf24l01_interface_debug_print("nrf24l01: get fifo status 0x%02X.\n", value);
2187
2188 /* nrf24l01 get rx payload width test */
2189 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_get_rx_payload_width test.\n");
2190
2191 /* get rx payload width */
2192 res = nrf24l01_get_rx_payload_width(&gs_handle, (uint8_t *)&value);
2193 if (res != 0)
2194 {
2195 nrf24l01_interface_debug_print("nrf24l01: get rx payload width failed.\n");
2196 (void)nrf24l01_deinit(&gs_handle);
2197
2198 return 1;
2199 }
2200 nrf24l01_interface_debug_print("nrf24l01: get rx payload width 0x%02X.\n", value);
2201
2202 /* nrf24l01 flush tx test */
2203 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_flush_tx test.\n");
2204
2205 /* flush tx */
2206 res = nrf24l01_flush_tx(&gs_handle);
2207 if (res != 0)
2208 {
2209 nrf24l01_interface_debug_print("nrf24l01: flush tx failed.\n");
2210 (void)nrf24l01_deinit(&gs_handle);
2211
2212 return 1;
2213 }
2214 nrf24l01_interface_debug_print("nrf24l01: flush tx %s.\n", res == 0 ? "ok" : "error");
2215
2216 /* nrf24l01 flush rx test */
2217 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_flush_rx test.\n");
2218
2219 /* flush rx */
2220 res = nrf24l01_flush_rx(&gs_handle);
2221 if (res != 0)
2222 {
2223 nrf24l01_interface_debug_print("nrf24l01: flush rx failed.\n");
2224 (void)nrf24l01_deinit(&gs_handle);
2225
2226 return 1;
2227 }
2228 nrf24l01_interface_debug_print("nrf24l01: flush rx %s.\n", res == 0 ? "ok" : "error");
2229
2230 /* nrf24l01 reuse tx payload test */
2231 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_reuse_tx_payload test.\n");
2232
2233 /* reuse tx payload */
2234 res = nrf24l01_reuse_tx_payload(&gs_handle);
2235 if (res != 0)
2236 {
2237 nrf24l01_interface_debug_print("nrf24l01: reuse tx payload failed.\n");
2238 (void)nrf24l01_deinit(&gs_handle);
2239
2240 return 1;
2241 }
2242 nrf24l01_interface_debug_print("nrf24l01: reuse tx payload %s.\n", res == 0 ? "ok" : "error");
2243
2244 /* nrf24l01 write payload with ack test */
2245 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_write_payload_with_ack test.\n");
2246
2247 /* pipe 0 write payload with ack */
2248 res = nrf24l01_write_payload_with_ack(&gs_handle, NRF24L01_PIPE_0, (uint8_t *)buf, 32);
2249 if (res != 0)
2250 {
2251 nrf24l01_interface_debug_print("nrf24l01: write payload with ack failed.\n");
2252 (void)nrf24l01_deinit(&gs_handle);
2253
2254 return 1;
2255 }
2256 nrf24l01_interface_debug_print("nrf24l01: write payload with ack %s.\n", res == 0 ? "ok" : "error");
2257
2258 /* pipe 1 write payload with ack */
2259 res = nrf24l01_write_payload_with_ack(&gs_handle, NRF24L01_PIPE_1, (uint8_t *)buf, 32);
2260 if (res != 0)
2261 {
2262 nrf24l01_interface_debug_print("nrf24l01: write payload with ack failed.\n");
2263 (void)nrf24l01_deinit(&gs_handle);
2264
2265 return 1;
2266 }
2267 nrf24l01_interface_debug_print("nrf24l01: write payload with ack %s.\n", res == 0 ? "ok" : "error");
2268
2269 /* pipe 2 write payload with ack */
2270 res = nrf24l01_write_payload_with_ack(&gs_handle, NRF24L01_PIPE_2, (uint8_t *)buf, 32);
2271 if (res != 0)
2272 {
2273 nrf24l01_interface_debug_print("nrf24l01: write payload with ack failed.\n");
2274 (void)nrf24l01_deinit(&gs_handle);
2275
2276 return 1;
2277 }
2278 nrf24l01_interface_debug_print("nrf24l01: write payload with ack %s.\n", res == 0 ? "ok" : "error");
2279
2280 /* pipe 3 write payload with ack */
2281 res = nrf24l01_write_payload_with_ack(&gs_handle, NRF24L01_PIPE_3, (uint8_t *)buf, 32);
2282 if (res != 0)
2283 {
2284 nrf24l01_interface_debug_print("nrf24l01: write payload with ack failed.\n");
2285 (void)nrf24l01_deinit(&gs_handle);
2286
2287 return 1;
2288 }
2289 nrf24l01_interface_debug_print("nrf24l01: write payload with ack %s.\n", res == 0 ? "ok" : "error");
2290
2291 /* pipe 4 write payload with ack */
2292 res = nrf24l01_write_payload_with_ack(&gs_handle, NRF24L01_PIPE_4, (uint8_t *)buf, 32);
2293 if (res != 0)
2294 {
2295 nrf24l01_interface_debug_print("nrf24l01: write payload with ack failed.\n");
2296 (void)nrf24l01_deinit(&gs_handle);
2297
2298 return 1;
2299 }
2300 nrf24l01_interface_debug_print("nrf24l01: write payload with ack %s.\n", res == 0 ? "ok" : "error");
2301
2302 /* pipe 5 write payload with ack */
2303 res = nrf24l01_write_payload_with_ack(&gs_handle, NRF24L01_PIPE_5, (uint8_t *)buf, 32);
2304 if (res != 0)
2305 {
2306 nrf24l01_interface_debug_print("nrf24l01: write payload with ack failed.\n");
2307 (void)nrf24l01_deinit(&gs_handle);
2308
2309 return 1;
2310 }
2311 nrf24l01_interface_debug_print("nrf24l01: write payload with ack %s.\n", res == 0 ? "ok" : "error");
2312
2313 /* nrf24l01 write payload with no ack test */
2314 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_write_payload_with_no_ack test.\n");
2315
2316 /* write payload with no ack */
2317 res = nrf24l01_write_payload_with_no_ack(&gs_handle, (uint8_t *)buf, 32);
2318 if (res != 0)
2319 {
2320 nrf24l01_interface_debug_print("nrf24l01: write payload with no ack failed.\n");
2321 (void)nrf24l01_deinit(&gs_handle);
2322
2323 return 1;
2324 }
2325 nrf24l01_interface_debug_print("nrf24l01: write payload with no ack %s.\n", res == 0 ? "ok" : "error");
2326
2327 /* nrf24l01 nop test */
2328 nrf24l01_interface_debug_print("nrf24l01: nrf24l01_nop test.\n");
2329
2330 /* nop */
2331 res = nrf24l01_nop(&gs_handle);
2332 if (res != 0)
2333 {
2334 nrf24l01_interface_debug_print("nrf24l01: nop failed.\n");
2335 (void)nrf24l01_deinit(&gs_handle);
2336
2337 return 1;
2338 }
2339 nrf24l01_interface_debug_print("nrf24l01: nop %s.\n", res == 0 ? "ok" : "error");
2340
2341 /* finish register test */
2342 nrf24l01_interface_debug_print("nrf24l01: finish register test.\n");
2343 (void)nrf24l01_deinit(&gs_handle);
2344
2345 return 0;
2346 }
driver_nrf24l01_register_test.h
driver nrf24l01 register test header file
nrf24l01_get_rx_pipe_2_address
uint8_t nrf24l01_get_rx_pipe_2_address(nrf24l01_handle_t *handle, uint8_t *addr)
get the rx pipe 2 address
Definition: driver_nrf24l01.c:2211
nrf24l01_output_power_t
nrf24l01_output_power_t
nrf24l01 output power enumeration definition
Definition: driver_nrf24l01.h:128
nrf24l01_get_pipe_4_payload_number
uint8_t nrf24l01_get_pipe_4_payload_number(nrf24l01_handle_t *handle, uint8_t *num)
get the pipe 4 payload number
Definition: driver_nrf24l01.c:2961
nrf24l01_flush_tx
uint8_t nrf24l01_flush_tx(nrf24l01_handle_t *handle)
flush tx
Definition: driver_nrf24l01.c:3550
nrf24l01_get_auto_retransmit_delay
uint8_t nrf24l01_get_auto_retransmit_delay(nrf24l01_handle_t *handle, uint8_t *delay)
get the auto retransmit delay
Definition: driver_nrf24l01.c:1044
nrf24l01_get_rx_pipe_3_address
uint8_t nrf24l01_get_rx_pipe_3_address(nrf24l01_handle_t *handle, uint8_t *addr)
get the rx pipe 3 address
Definition: driver_nrf24l01.c:2281
nrf24l01_get_fifo_status
uint8_t nrf24l01_get_fifo_status(nrf24l01_handle_t *handle, uint8_t *status)
get the fifo status
Definition: driver_nrf24l01.c:3075
nrf24l01_get_pipe_1_payload_number
uint8_t nrf24l01_get_pipe_1_payload_number(nrf24l01_handle_t *handle, uint8_t *num)
get the pipe 1 payload number
Definition: driver_nrf24l01.c:2727
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_write_tx_payload
uint8_t nrf24l01_write_tx_payload(nrf24l01_handle_t *handle, uint8_t *buf, uint8_t len)
write the tx payload
Definition: driver_nrf24l01.c:3495
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_get_interrupt
uint8_t nrf24l01_get_interrupt(nrf24l01_handle_t *handle, nrf24l01_interrupt_t type, nrf24l01_bool_t *enable)
get the interrupt status
Definition: driver_nrf24l01.c:1644
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_get_retransmitted_packet_count
uint8_t nrf24l01_get_retransmitted_packet_count(nrf24l01_handle_t *handle, uint8_t *count)
get the retransmitted packet count
Definition: driver_nrf24l01.c:1800
nrf24l01_nop
uint8_t nrf24l01_nop(nrf24l01_handle_t *handle)
nop
Definition: driver_nrf24l01.c:3806
nrf24l01_get_rx_pipe_1_address
uint8_t nrf24l01_get_rx_pipe_1_address(nrf24l01_handle_t *handle, uint8_t *addr, uint8_t *len)
get the rx pipe 1 address
Definition: driver_nrf24l01.c:2103
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_get_dynamic_payload
uint8_t nrf24l01_get_dynamic_payload(nrf24l01_handle_t *handle, nrf24l01_bool_t *enable)
get the dynamic payload status
Definition: driver_nrf24l01.c:3239
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_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_write_payload_with_no_ack
uint8_t nrf24l01_write_payload_with_no_ack(nrf24l01_handle_t *handle, uint8_t *buf, uint8_t len)
write the payload with no ack
Definition: driver_nrf24l01.c:3750
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_get_received_power_detector
uint8_t nrf24l01_get_received_power_detector(nrf24l01_handle_t *handle, nrf24l01_bool_t *enable)
get the received power detector
Definition: driver_nrf24l01.c:1837
nrf24l01_get_rx_payload_width
uint8_t nrf24l01_get_rx_payload_width(nrf24l01_handle_t *handle, uint8_t *width)
get the rx payload width
Definition: driver_nrf24l01.c:3653
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_get_payload_with_ack
uint8_t nrf24l01_get_payload_with_ack(nrf24l01_handle_t *handle, nrf24l01_bool_t *enable)
get the payload with ack status
Definition: driver_nrf24l01.c:3321
nrf24l01_get_mode
uint8_t nrf24l01_get_mode(nrf24l01_handle_t *handle, nrf24l01_mode_t *mode)
get the chip mode
Definition: driver_nrf24l01.c:705
nrf24l01_mode_t
nrf24l01_mode_t
nrf24l01 mode enumeration definition
Definition: driver_nrf24l01.h:85
nrf24l01_auto_retransmit_delay_convert_to_data
uint8_t nrf24l01_auto_retransmit_delay_convert_to_data(nrf24l01_handle_t *handle, uint8_t reg, uint32_t *us)
convert the register raw data to the delay
Definition: driver_nrf24l01.c:1108
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_get_address_width
uint8_t nrf24l01_get_address_width(nrf24l01_handle_t *handle, nrf24l01_address_width_t *width)
get the address width
Definition: driver_nrf24l01.c:955
nrf24l01_get_pipe_0_payload_number
uint8_t nrf24l01_get_pipe_0_payload_number(nrf24l01_handle_t *handle, uint8_t *num)
get the pipe 0 payload number
Definition: driver_nrf24l01.c:2649
nrf24l01_get_auto_retransmit_count
uint8_t nrf24l01_get_auto_retransmit_count(nrf24l01_handle_t *handle, uint8_t *count)
get the auto retransmit count
Definition: driver_nrf24l01.c:1187
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_get_pipe_2_payload_number
uint8_t nrf24l01_get_pipe_2_payload_number(nrf24l01_handle_t *handle, uint8_t *num)
get the pipe 2 payload number
Definition: driver_nrf24l01.c:2805
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_get_output_power
uint8_t nrf24l01_get_output_power(nrf24l01_handle_t *handle, nrf24l01_output_power_t *power)
get the output power
Definition: driver_nrf24l01.c:1606
nrf24l01_get_auto_acknowledgment
uint8_t nrf24l01_get_auto_acknowledgment(nrf24l01_handle_t *handle, nrf24l01_pipe_t pipe, nrf24l01_bool_t *enable)
get the auto acknowledgment status
Definition: driver_nrf24l01.c:789
nrf24l01_get_rx_pipe_0_address
uint8_t nrf24l01_get_rx_pipe_0_address(nrf24l01_handle_t *handle, uint8_t *addr, uint8_t *len)
get the rx pipe 0 address
Definition: driver_nrf24l01.c:1952
nrf24l01_get_tx_address
uint8_t nrf24l01_get_tx_address(nrf24l01_handle_t *handle, uint8_t *addr, uint8_t *len)
get the tx address
Definition: driver_nrf24l01.c:2534
nrf24l01_get_pipe_dynamic_payload
uint8_t nrf24l01_get_pipe_dynamic_payload(nrf24l01_handle_t *handle, nrf24l01_pipe_t pipe, nrf24l01_bool_t *enable)
get the pipe dynamic payload status
Definition: driver_nrf24l01.c:3157
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_get_config
uint8_t nrf24l01_get_config(nrf24l01_handle_t *handle, nrf24l01_config_t config, nrf24l01_bool_t *enable)
get the configure
Definition: driver_nrf24l01.c:623
nrf24l01_write_payload_with_ack
uint8_t nrf24l01_write_payload_with_ack(nrf24l01_handle_t *handle, nrf24l01_pipe_t pipe, uint8_t *buf, uint8_t len)
write the payload with ack
Definition: driver_nrf24l01.c:3691
nrf24l01_get_rx_pipe
uint8_t nrf24l01_get_rx_pipe(nrf24l01_handle_t *handle, nrf24l01_pipe_t pipe, nrf24l01_bool_t *enable)
get the rx pipe status
Definition: driver_nrf24l01.c:873
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_get_data_pipe_number
uint8_t nrf24l01_get_data_pipe_number(nrf24l01_handle_t *handle, uint8_t *number)
get the data pipe number
Definition: driver_nrf24l01.c:1726
nrf24l01_get_data_rate
uint8_t nrf24l01_get_data_rate(nrf24l01_handle_t *handle, nrf24l01_data_rate_t *rate)
get the data rate
Definition: driver_nrf24l01.c:1524
nrf24l01_read_rx_payload
uint8_t nrf24l01_read_rx_payload(nrf24l01_handle_t *handle, uint8_t *buf, uint8_t len)
read the rx payload
Definition: driver_nrf24l01.c:3442
nrf24l01_get_rx_pipe_5_address
uint8_t nrf24l01_get_rx_pipe_5_address(nrf24l01_handle_t *handle, uint8_t *addr)
get the rx pipe 5 address
Definition: driver_nrf24l01.c:2421
nrf24l01_get_channel_frequency
uint8_t nrf24l01_get_channel_frequency(nrf24l01_handle_t *handle, uint8_t *freq)
get the channel frequency
Definition: driver_nrf24l01.c:1276
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_address_width_t
nrf24l01_address_width_t
nrf24l01 address width enumeration definition
Definition: driver_nrf24l01.h:107
nrf24l01_get_lost_packet_count
uint8_t nrf24l01_get_lost_packet_count(nrf24l01_handle_t *handle, uint8_t *count)
get the lost packet count
Definition: driver_nrf24l01.c:1763
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_get_continuous_carrier_transmit
uint8_t nrf24l01_get_continuous_carrier_transmit(nrf24l01_handle_t *handle, nrf24l01_bool_t *enable)
get the continuous carrier transmit status
Definition: driver_nrf24l01.c:1358
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_get_pipe_3_payload_number
uint8_t nrf24l01_get_pipe_3_payload_number(nrf24l01_handle_t *handle, uint8_t *num)
get the pipe 3 payload number
Definition: driver_nrf24l01.c:2883
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_get_rx_pipe_4_address
uint8_t nrf24l01_get_rx_pipe_4_address(nrf24l01_handle_t *handle, uint8_t *addr)
get the rx pipe 4 address
Definition: driver_nrf24l01.c:2351
nrf24l01_get_force_pll_lock_signal
uint8_t nrf24l01_get_force_pll_lock_signal(nrf24l01_handle_t *handle, nrf24l01_bool_t *enable)
get the force pll lock signal status
Definition: driver_nrf24l01.c:1440
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_get_pipe_5_payload_number
uint8_t nrf24l01_get_pipe_5_payload_number(nrf24l01_handle_t *handle, uint8_t *num)
get the pipe 5 payload number
Definition: driver_nrf24l01.c:3039
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_data_rate_t
nrf24l01_data_rate_t
nrf24l01 data rate enumeration definition
Definition: driver_nrf24l01.h:118
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_get_tx_payload_with_no_ack
uint8_t nrf24l01_get_tx_payload_with_no_ack(nrf24l01_handle_t *handle, nrf24l01_bool_t *enable)
get the tx payload with no ack status
Definition: driver_nrf24l01.c:3403
nrf24l01_bool_t
nrf24l01_bool_t
nrf24l01 bool enumeration definition
Definition: driver_nrf24l01.h:63
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_reuse_tx_payload
uint8_t nrf24l01_reuse_tx_payload(nrf24l01_handle_t *handle)
reuse the tx payload
Definition: driver_nrf24l01.c:3618
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_NEGATIVE_6_DBM
@ NRF24L01_OUTPUT_POWER_NEGATIVE_6_DBM
Definition: driver_nrf24l01.h:131
NRF24L01_OUTPUT_POWER_NEGATIVE_12_DBM
@ NRF24L01_OUTPUT_POWER_NEGATIVE_12_DBM
Definition: driver_nrf24l01.h:130
NRF24L01_OUTPUT_POWER_0_DBM
@ NRF24L01_OUTPUT_POWER_0_DBM
Definition: driver_nrf24l01.h:132
NRF24L01_OUTPUT_POWER_NEGATIVE_18_DBM
@ NRF24L01_OUTPUT_POWER_NEGATIVE_18_DBM
Definition: driver_nrf24l01.h:129
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_3_BYTES
@ NRF24L01_ADDRESS_WIDTH_3_BYTES
Definition: driver_nrf24l01.h:109
NRF24L01_ADDRESS_WIDTH_ILLEGAL
@ NRF24L01_ADDRESS_WIDTH_ILLEGAL
Definition: driver_nrf24l01.h:108
NRF24L01_ADDRESS_WIDTH_4_BYTES
@ NRF24L01_ADDRESS_WIDTH_4_BYTES
Definition: driver_nrf24l01.h:110
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_250K
@ NRF24L01_DATA_RATE_250K
Definition: driver_nrf24l01.h:121
NRF24L01_DATA_RATE_1M
@ NRF24L01_DATA_RATE_1M
Definition: driver_nrf24l01.h:119
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_register_test
uint8_t nrf24l01_register_test(void)
register test
Definition: driver_nrf24l01_register_test.c:49
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