LibDriver NRF905
Loading...
Searching...
No Matches
driver_nrf905_register_test.c
Go to the documentation of this file.
1
36
38#include <stdlib.h>
39
40static nrf905_handle_t gs_handle;
41
50{
51 uint8_t res;
52 uint8_t i;
53 uint16_t reg;
54 uint8_t w;
55 uint8_t w_check;
56 uint8_t status;
57 uint16_t freq;
58 uint16_t freq_check;
59 float mhz;
60 float mhz_check;
61 uint8_t buf[32];
62 uint8_t buf_check[32];
63 nrf905_bool_t enable;
64 nrf905_info_t info;
66 nrf905_rx_mode_t rx_mode;
67 nrf905_crc_mode_t crc_mode;
69 nrf905_output_power_t output_power;
72
73 /* link function */
92
93 /* get information */
94 res = nrf905_info(&info);
95 if (res != 0)
96 {
97 nrf905_interface_debug_print("nrf905: get info failed.\n");
98
99 return 1;
100 }
101 else
102 {
103 /* print chip info */
104 nrf905_interface_debug_print("nrf905: chip is %s.\n", info.chip_name);
105 nrf905_interface_debug_print("nrf905: manufacturer is %s.\n", info.manufacturer_name);
106 nrf905_interface_debug_print("nrf905: interface is %s.\n", info.interface);
107 nrf905_interface_debug_print("nrf905: driver version is %d.%d.\n", info.driver_version / 1000, (info.driver_version % 1000) / 100);
108 nrf905_interface_debug_print("nrf905: min supply voltage is %0.1fV.\n", info.supply_voltage_min_v);
109 nrf905_interface_debug_print("nrf905: max supply voltage is %0.1fV.\n", info.supply_voltage_max_v);
110 nrf905_interface_debug_print("nrf905: max current is %0.2fmA.\n", info.max_current_ma);
111 nrf905_interface_debug_print("nrf905: max temperature is %0.1fC.\n", info.temperature_max);
112 nrf905_interface_debug_print("nrf905: min temperature is %0.1fC.\n", info.temperature_min);
113 }
114
115 /* start register test */
116 nrf905_interface_debug_print("nrf905: start register test.\n");
117
118 /* init */
119 res = nrf905_init(&gs_handle);
120 if (res != 0)
121 {
122 nrf905_interface_debug_print("nrf905: init failed.\n");
123
124 return 1;
125 }
126
127 /* power up the chip */
128 res = nrf905_set_power_up(&gs_handle, NRF905_BOOL_TRUE);
129 if (res != 0)
130 {
131 nrf905_interface_debug_print("nrf905: power up failed.\n");
132 (void)(void)nrf905_deinit(&gs_handle);
133
134 return 1;
135 }
136
137 /* disable the tx or rx */
138 res = nrf905_set_enable(&gs_handle, NRF905_BOOL_FALSE);
139 if (res != 0)
140 {
141 nrf905_interface_debug_print("nrf905: enable failed.\n");
142 (void)nrf905_deinit(&gs_handle);
143
144 return 1;
145 }
146
147 /* set rx mode */
148 res = nrf905_set_mode(&gs_handle, NRF905_MODE_RX);
149 if (res != 0)
150 {
151 nrf905_interface_debug_print("nrf905: set mode failed.\n");
152 (void)nrf905_deinit(&gs_handle);
153
154 return 1;
155 }
156
157 /* nrf905_set_tx_payload/nrf905_get_tx_payload test */
158 nrf905_interface_debug_print("nrf905: nrf905_set_tx_payload/nrf905_get_tx_payload test.\n");
159
160 for (i = 0; i < 32; i++)
161 {
162 buf[i] = rand() % 256;
163 }
164 res = nrf905_set_tx_payload(&gs_handle, buf, 32);
165 if (res != 0)
166 {
167 nrf905_interface_debug_print("nrf905: set tx payload failed.\n");
168 (void)nrf905_deinit(&gs_handle);
169
170 return 1;
171 }
172 res = nrf905_get_tx_payload(&gs_handle, buf_check, 32);
173 if (res != 0)
174 {
175 nrf905_interface_debug_print("nrf905: get tx payload failed.\n");
176 (void)nrf905_deinit(&gs_handle);
177
178 return 1;
179 }
180 nrf905_interface_debug_print("nrf905: check tx_payload %s.\n", (memcmp(buf, buf_check, 32) == 0) ? "ok" : "error");
181
182 /* nrf905_get_rx_payload test */
183 nrf905_interface_debug_print("nrf905: nrf905_get_rx_payload test.\n");
184
185 res = nrf905_get_rx_payload(&gs_handle, buf_check, 32);
186 if (res != 0)
187 {
188 nrf905_interface_debug_print("nrf905: get rx payload failed.\n");
189 (void)nrf905_deinit(&gs_handle);
190
191 return 1;
192 }
193 nrf905_interface_debug_print("nrf905: check rx payload %s.\n", (res == 0) ? "ok" : "error");
194
195 /* nrf905_set_tx_address/nrf905_get_tx_address test */
196 nrf905_interface_debug_print("nrf905: nrf905_set_tx_address/nrf905_get_tx_address test.\n");
197
198 for (i = 0; i < 4; i++)
199 {
200 buf[i] = rand() % 256;
201 }
202 res = nrf905_set_tx_address(&gs_handle, buf, 4);
203 if (res != 0)
204 {
205 nrf905_interface_debug_print("nrf905: set tx address failed.\n");
206 (void)nrf905_deinit(&gs_handle);
207
208 return 1;
209 }
210 res = nrf905_get_tx_address(&gs_handle, buf_check, 4);
211 if (res != 0)
212 {
213 nrf905_interface_debug_print("nrf905: get tx address failed.\n");
214 (void)nrf905_deinit(&gs_handle);
215
216 return 1;
217 }
218 nrf905_interface_debug_print("nrf905: check tx address %s.\n", (memcmp(buf, buf_check, 4) == 0) ? "ok" : "error");
219
220 /* nrf905_set_frequency/nrf905_get_frequency test */
221 nrf905_interface_debug_print("nrf905: nrf905_set_frequency/nrf905_get_frequency test.\n");
222
223 freq = rand() % 0x1FF;
224 res = nrf905_set_frequency(&gs_handle, freq);
225 if (res != 0)
226 {
227 nrf905_interface_debug_print("nrf905: set frequency failed.\n");
228 (void)nrf905_deinit(&gs_handle);
229
230 return 1;
231 }
232 res = nrf905_get_frequency(&gs_handle, (uint16_t *)&freq_check);
233 if (res != 0)
234 {
235 nrf905_interface_debug_print("nrf905: get frequency failed.\n");
236 (void)nrf905_deinit(&gs_handle);
237
238 return 1;
239 }
240 nrf905_interface_debug_print("nrf905: check frequency %s.\n", (freq_check == freq) ? "ok" : "error");
241
242 /* nrf905_frequency_convert_to_register/nrf905_frequency_convert_to_data test */
243 nrf905_interface_debug_print("nrf905: nrf905_frequency_convert_to_register/nrf905_frequency_convert_to_data test.\n");
244
245 mhz = 433.0f + (float)(rand() % 100) / 10.0f;
246 res= nrf905_frequency_convert_to_register(&gs_handle, mhz, &reg);
247 if (res != 0)
248 {
249 nrf905_interface_debug_print("nrf905: frequency convert to register failed.\n");
250 (void)nrf905_deinit(&gs_handle);
251
252 return 1;
253 }
254 nrf905_interface_debug_print("nrf905: set frequency %0.2f MHz.\n", mhz);
255 res = nrf905_frequency_convert_to_data(&gs_handle, reg, (float *)&mhz_check);
256 if (res != 0)
257 {
258 nrf905_interface_debug_print("nrf905: frequency convert to data failed.\n");
259 (void)nrf905_deinit(&gs_handle);
260
261 return 1;
262 }
263 nrf905_interface_debug_print("nrf905: check frequency %0.2f MHz.\n", mhz_check);
264
265 /* nrf905_set_pll_mode/nrf905_get_pll_mode test */
266 nrf905_interface_debug_print("nrf905: nrf905_set_pll_mode/nrf905_get_pll_mode test.\n");
267
268 /* set pll mode 868_915_MHZ */
270 if (res != 0)
271 {
272 nrf905_interface_debug_print("nrf905: set pll mode failed.\n");
273 (void)nrf905_deinit(&gs_handle);
274
275 return 1;
276 }
277 nrf905_interface_debug_print("nrf905: set pll mode 868_915_MHZ.\n");
278 res = nrf905_get_pll_mode(&gs_handle, &mode);
279 if (res != 0)
280 {
281 nrf905_interface_debug_print("nrf905: get pll mode failed.\n");
282 (void)nrf905_deinit(&gs_handle);
283
284 return 1;
285 }
286 nrf905_interface_debug_print("nrf905: check pll mode %s.\n", (mode == NRF905_PLL_MODE_868_915_MHZ) ? "ok" : "error");
287
288 /* set pll mode 433_MHZ */
290 if (res != 0)
291 {
292 nrf905_interface_debug_print("nrf905: set pll mode failed.\n");
293 (void)nrf905_deinit(&gs_handle);
294
295 return 1;
296 }
297 nrf905_interface_debug_print("nrf905: set pll mode 433_MHZ.\n");
298 res = nrf905_get_pll_mode(&gs_handle, &mode);
299 if (res != 0)
300 {
301 nrf905_interface_debug_print("nrf905: get pll mode failed.\n");
302 (void)nrf905_deinit(&gs_handle);
303
304 return 1;
305 }
306 nrf905_interface_debug_print("nrf905: check pll mode %s.\n", (mode == NRF905_PLL_MODE_433_MHZ) ? "ok" : "error");
307
308 /* nrf905_set_output_power/nrf905_get_output_power test */
309 nrf905_interface_debug_print("nrf905: nrf905_set_output_power/nrf905_get_output_power test.\n");
310
311 /* set output power -10dBm */
313 if (res != 0)
314 {
315 nrf905_interface_debug_print("nrf905: set output power failed.\n");
316 (void)nrf905_deinit(&gs_handle);
317
318 return 1;
319 }
320 nrf905_interface_debug_print("nrf905: set output power -10dBm.\n");
321 res = nrf905_get_output_power(&gs_handle, &output_power);
322 if (res != 0)
323 {
324 nrf905_interface_debug_print("nrf905: get output power failed.\n");
325 (void)nrf905_deinit(&gs_handle);
326
327 return 1;
328 }
329 nrf905_interface_debug_print("nrf905: check output power %s.\n", (output_power == NRF905_OUTPUT_POWER_NEGATIVE_10_DBM) ? "ok" : "error");
330
331 /* set output power -2dBm */
333 if (res != 0)
334 {
335 nrf905_interface_debug_print("nrf905: set output power failed.\n");
336 (void)nrf905_deinit(&gs_handle);
337
338 return 1;
339 }
340 nrf905_interface_debug_print("nrf905: set output power -2dBm.\n");
341 res = nrf905_get_output_power(&gs_handle, &output_power);
342 if (res != 0)
343 {
344 nrf905_interface_debug_print("nrf905: get output power failed.\n");
345 (void)nrf905_deinit(&gs_handle);
346
347 return 1;
348 }
349 nrf905_interface_debug_print("nrf905: check output power %s.\n", (output_power == NRF905_OUTPUT_POWER_NEGATIVE_2_DBM) ? "ok" : "error");
350
351 /* set output power +6dBm */
353 if (res != 0)
354 {
355 nrf905_interface_debug_print("nrf905: set output power failed.\n");
356 (void)nrf905_deinit(&gs_handle);
357
358 return 1;
359 }
360 nrf905_interface_debug_print("nrf905: set output power +6dBm.\n");
361 res = nrf905_get_output_power(&gs_handle, &output_power);
362 if (res != 0)
363 {
364 nrf905_interface_debug_print("nrf905: get output power failed.\n");
365 (void)nrf905_deinit(&gs_handle);
366
367 return 1;
368 }
369 nrf905_interface_debug_print("nrf905: check output power %s.\n", (output_power == NRF905_OUTPUT_POWER_6_DBM) ? "ok" : "error");
370
371 /* set output power +10dBm */
373 if (res != 0)
374 {
375 nrf905_interface_debug_print("nrf905: set output power failed.\n");
376 (void)nrf905_deinit(&gs_handle);
377
378 return 1;
379 }
380 nrf905_interface_debug_print("nrf905: set output power +10dBm.\n");
381 res = nrf905_get_output_power(&gs_handle, &output_power);
382 if (res != 0)
383 {
384 nrf905_interface_debug_print("nrf905: get output power failed.\n");
385 (void)nrf905_deinit(&gs_handle);
386
387 return 1;
388 }
389 nrf905_interface_debug_print("nrf905: check output power %s.\n", (output_power == NRF905_OUTPUT_POWER_10_DBM) ? "ok" : "error");
390
391 /* nrf905_set_rx_mode/nrf905_get_rx_mode test */
392 nrf905_interface_debug_print("nrf905: nrf905_set_rx_mode/nrf905_get_rx_mode test.\n");
393
394 /* set rx mode reduced power */
396 if (res != 0)
397 {
398 nrf905_interface_debug_print("nrf905: set rx mode failed.\n");
399 (void)nrf905_deinit(&gs_handle);
400
401 return 1;
402 }
403 nrf905_interface_debug_print("nrf905: set rx mode reduced power.\n");
404 res = nrf905_get_rx_mode(&gs_handle, &rx_mode);
405 if (res != 0)
406 {
407 nrf905_interface_debug_print("nrf905: get rx mode failed.\n");
408 (void)nrf905_deinit(&gs_handle);
409
410 return 1;
411 }
412 nrf905_interface_debug_print("nrf905: check rx mode %s.\n", (rx_mode == NRF905_RX_MODE_REDUCED_POWER) ? "ok" : "error");
413
414 /* set rx mode normal */
415 res = nrf905_set_rx_mode(&gs_handle, NRF905_RX_MODE_NORMAL);
416 if (res != 0)
417 {
418 nrf905_interface_debug_print("nrf905: set rx mode failed.\n");
419 (void)nrf905_deinit(&gs_handle);
420
421 return 1;
422 }
423 nrf905_interface_debug_print("nrf905: set rx mode normal.\n");
424 res = nrf905_get_rx_mode(&gs_handle, &rx_mode);
425 if (res != 0)
426 {
427 nrf905_interface_debug_print("nrf905: get rx mode failed.\n");
428 (void)nrf905_deinit(&gs_handle);
429
430 return 1;
431 }
432 nrf905_interface_debug_print("nrf905: check rx mode %s.\n", (rx_mode == NRF905_RX_MODE_NORMAL) ? "ok" : "error");
433
434 /* nrf905_set_auto_retransmit/nrf905_get_auto_retransmit test */
435 nrf905_interface_debug_print("nrf905: nrf905_set_auto_retransmit/nrf905_get_auto_retransmit test.\n");
436
437 /* enable the auto retransmit */
439 if (res != 0)
440 {
441 nrf905_interface_debug_print("nrf905: set auto retransmit failed.\n");
442 (void)nrf905_deinit(&gs_handle);
443
444 return 1;
445 }
446 nrf905_interface_debug_print("nrf905: enable the auto retransmit.\n");
447 res = nrf905_get_auto_retransmit(&gs_handle, &enable);
448 if (res != 0)
449 {
450 nrf905_interface_debug_print("nrf905: get auto retransmit failed.\n");
451 (void)nrf905_deinit(&gs_handle);
452
453 return 1;
454 }
455 nrf905_interface_debug_print("nrf905: check auto retransmit %s.\n", (enable == NRF905_BOOL_TRUE) ? "ok" : "error");
456
457 /* disable the auto retransmit */
459 if (res != 0)
460 {
461 nrf905_interface_debug_print("nrf905: set auto retransmit failed.\n");
462 (void)nrf905_deinit(&gs_handle);
463
464 return 1;
465 }
466 nrf905_interface_debug_print("nrf905: disable the auto retransmit.\n");
467 res = nrf905_get_auto_retransmit(&gs_handle, &enable);
468 if (res != 0)
469 {
470 nrf905_interface_debug_print("nrf905: get auto retransmit failed.\n");
471 (void)nrf905_deinit(&gs_handle);
472
473 return 1;
474 }
475 nrf905_interface_debug_print("nrf905: check auto retransmit %s.\n", (enable == NRF905_BOOL_FALSE) ? "ok" : "error");
476
477 /* nrf905_set_rx_address_width/nrf905_get_rx_address_width test */
478 nrf905_interface_debug_print("nrf905: nrf905_set_rx_address_width/nrf905_get_rx_address_width test.\n");
479
480 /* set rx address width 1 byte */
482 if (res != 0)
483 {
484 nrf905_interface_debug_print("nrf905: set rx address width failed.\n");
485 (void)nrf905_deinit(&gs_handle);
486
487 return 1;
488 }
489 nrf905_interface_debug_print("nrf905: set rx address width 1 byte.\n");
490 res = nrf905_get_rx_address_width(&gs_handle, &width);
491 if (res != 0)
492 {
493 nrf905_interface_debug_print("nrf905: get rx address width failed.\n");
494 (void)nrf905_deinit(&gs_handle);
495
496 return 1;
497 }
498 nrf905_interface_debug_print("nrf905: check rx address width %s.\n", (width == NRF905_ADDRESS_WIDTH_1_BYTE) ? "ok" : "error");
499
500 /* set rx address width 4 byte */
502 if (res != 0)
503 {
504 nrf905_interface_debug_print("nrf905: set rx address width failed.\n");
505 (void)nrf905_deinit(&gs_handle);
506
507 return 1;
508 }
509 nrf905_interface_debug_print("nrf905: set rx address width 4 byte.\n");
510 res = nrf905_get_rx_address_width(&gs_handle, &width);
511 if (res != 0)
512 {
513 nrf905_interface_debug_print("nrf905: get rx address width failed.\n");
514 (void)nrf905_deinit(&gs_handle);
515
516 return 1;
517 }
518 nrf905_interface_debug_print("nrf905: check rx address width %s.\n", (width == NRF905_ADDRESS_WIDTH_4_BYTE) ? "ok" : "error");
519
520 /* nrf905_set_tx_address_width/nrf905_get_tx_address_width test */
521 nrf905_interface_debug_print("nrf905: nrf905_set_tx_address_width/nrf905_get_tx_address_width test.\n");
522
523 /* set tx address width 1 byte */
525 if (res != 0)
526 {
527 nrf905_interface_debug_print("nrf905: set tx address width failed.\n");
528 (void)nrf905_deinit(&gs_handle);
529
530 return 1;
531 }
532 nrf905_interface_debug_print("nrf905: set tx address width 1 byte.\n");
533 res = nrf905_get_tx_address_width(&gs_handle, &width);
534 if (res != 0)
535 {
536 nrf905_interface_debug_print("nrf905: get tx address width failed.\n");
537 (void)nrf905_deinit(&gs_handle);
538
539 return 1;
540 }
541 nrf905_interface_debug_print("nrf905: check tx address width %s.\n", (width == NRF905_ADDRESS_WIDTH_1_BYTE) ? "ok" : "error");
542
543 /* set tx address width 4 byte */
545 if (res != 0)
546 {
547 nrf905_interface_debug_print("nrf905: set tx address width failed.\n");
548 (void)nrf905_deinit(&gs_handle);
549
550 return 1;
551 }
552 nrf905_interface_debug_print("nrf905: set tx address width 4 byte.\n");
553 res = nrf905_get_tx_address_width(&gs_handle, &width);
554 if (res != 0)
555 {
556 nrf905_interface_debug_print("nrf905: get tx address width failed.\n");
557 (void)nrf905_deinit(&gs_handle);
558
559 return 1;
560 }
561 nrf905_interface_debug_print("nrf905: check tx address width %s.\n", (width == NRF905_ADDRESS_WIDTH_4_BYTE) ? "ok" : "error");
562
563 /* nrf905_set_rx_payload_width/nrf905_get_rx_payload_width test */
564 nrf905_interface_debug_print("nrf905: nrf905_set_rx_payload_width/nrf905_get_rx_payload_width test.\n");
565
566 w = rand() % 32;
567 res = nrf905_set_rx_payload_width(&gs_handle, w);
568 if (res != 0)
569 {
570 nrf905_interface_debug_print("nrf905: set rx payload width failed.\n");
571 (void)nrf905_deinit(&gs_handle);
572
573 return 1;
574 }
575 nrf905_interface_debug_print("nrf905: set rx payload width %d.\n", w);
576 res = nrf905_get_rx_payload_width(&gs_handle, (uint8_t *)&w_check);
577 if (res != 0)
578 {
579 nrf905_interface_debug_print("nrf905: get rx payload width failed.\n");
580 (void)nrf905_deinit(&gs_handle);
581
582 return 1;
583 }
584 nrf905_interface_debug_print("nrf905: check rx payload width %s.\n", (w_check == w) ? "ok" : "error");
585
586 /* nrf905_set_tx_payload_width/nrf905_get_tx_payload_width test */
587 nrf905_interface_debug_print("nrf905: nrf905_set_tx_payload_width/nrf905_get_tx_payload_width test.\n");
588
589 /* set tx payload width */
590 res = nrf905_set_tx_payload_width(&gs_handle, w);
591 if (res != 0)
592 {
593 nrf905_interface_debug_print("nrf905: set tx payload width failed.\n");
594 (void)nrf905_deinit(&gs_handle);
595
596 return 1;
597 }
598 nrf905_interface_debug_print("nrf905: set tx payload width %d.\n", w);
599 res = nrf905_get_tx_payload_width(&gs_handle, &w_check);
600 if (res != 0)
601 {
602 nrf905_interface_debug_print("nrf905: get tx payload width failed.\n");
603 (void)nrf905_deinit(&gs_handle);
604
605 return 1;
606 }
607 nrf905_interface_debug_print("nrf905: check tx payload width %s.\n", (w_check == w) ? "ok" : "error");
608
609 /* nrf905_set_rx_address/nrf905_get_rx_address test */
610 nrf905_interface_debug_print("nrf905: nrf905_set_rx_address/nrf905_get_rx_address test.\n");
611
612 buf[0] = rand() % 256;
613 buf[1] = rand() % 256;
614 buf[2] = rand() % 256;
615 buf[3] = rand() % 256;
616 res = nrf905_set_rx_address(&gs_handle, buf);
617 if (res != 0)
618 {
619 nrf905_interface_debug_print("nrf905: set rx address failed.\n");
620 (void)nrf905_deinit(&gs_handle);
621
622 return 1;
623 }
624 nrf905_interface_debug_print("nrf905: set rx address 0x%02X 0x%02X 0x%02X 0x%02X.\n",
625 buf[0], buf[1], buf[2], buf[3]);
626 res = nrf905_get_rx_address(&gs_handle, buf_check);
627 if (res != 0)
628 {
629 nrf905_interface_debug_print("nrf905: get rx address failed.\n");
630 (void)nrf905_deinit(&gs_handle);
631
632 return 1;
633 }
634 nrf905_interface_debug_print("nrf905: check rx address %s.\n", (memcmp(buf, buf_check, 4) == 0) ? "ok" : "error");
635
636 /* nrf905_set_output_clock_frequency/nrf905_get_output_clock_frequency test */
637 nrf905_interface_debug_print("nrf905: nrf905_set_output_clock_frequency/nrf905_get_output_clock_frequency test.\n");
638
639 /* set output clock frequency 4MHz */
641 if (res != 0)
642 {
643 nrf905_interface_debug_print("nrf905: set output clock frequency failed.\n");
644 (void)nrf905_deinit(&gs_handle);
645
646 return 1;
647 }
648 nrf905_interface_debug_print("nrf905: set output clock frequency 4MHz.\n");
649 res = nrf905_get_output_clock_frequency(&gs_handle, &clock_freq);
650 if (res != 0)
651 {
652 nrf905_interface_debug_print("nrf905: get output clock frequency failed.\n");
653 (void)nrf905_deinit(&gs_handle);
654
655 return 1;
656 }
657 nrf905_interface_debug_print("nrf905: check output clock frequency %s.\n", (clock_freq == NRF905_OUTPUT_CLOCK_FREQUENCY_4MHZ) ? "ok" : "error");
658
659 /* set output clock frequency 2MHz */
661 if (res != 0)
662 {
663 nrf905_interface_debug_print("nrf905: set output clock frequency failed.\n");
664 (void)nrf905_deinit(&gs_handle);
665
666 return 1;
667 }
668 nrf905_interface_debug_print("nrf905: set output clock frequency 2MHz.\n");
669 res = nrf905_get_output_clock_frequency(&gs_handle, &clock_freq);
670 if (res != 0)
671 {
672 nrf905_interface_debug_print("nrf905: get output clock frequency failed.\n");
673 (void)nrf905_deinit(&gs_handle);
674
675 return 1;
676 }
677 nrf905_interface_debug_print("nrf905: check output clock frequency %s.\n", (clock_freq == NRF905_OUTPUT_CLOCK_FREQUENCY_2MHZ) ? "ok" : "error");
678
679 /* set output clock frequency 1MHz */
681 if (res != 0)
682 {
683 nrf905_interface_debug_print("nrf905: set output clock frequency failed.\n");
684 (void)nrf905_deinit(&gs_handle);
685
686 return 1;
687 }
688 nrf905_interface_debug_print("nrf905: set output clock frequency 1MHz.\n");
689 res = nrf905_get_output_clock_frequency(&gs_handle, &clock_freq);
690 if (res != 0)
691 {
692 nrf905_interface_debug_print("nrf905: get output clock frequency failed.\n");
693 (void)nrf905_deinit(&gs_handle);
694
695 return 1;
696 }
697 nrf905_interface_debug_print("nrf905: check output clock frequency %s.\n", (clock_freq == NRF905_OUTPUT_CLOCK_FREQUENCY_1MHZ) ? "ok" : "error");
698
699 /* set output clock frequency 500KHz */
701 if (res != 0)
702 {
703 nrf905_interface_debug_print("nrf905: set output clock frequency failed.\n");
704 (void)nrf905_deinit(&gs_handle);
705
706 return 1;
707 }
708 nrf905_interface_debug_print("nrf905: set output clock frequency 500KHz.\n");
709 res = nrf905_get_output_clock_frequency(&gs_handle, &clock_freq);
710 if (res != 0)
711 {
712 nrf905_interface_debug_print("nrf905: get output clock frequency failed.\n");
713 (void)nrf905_deinit(&gs_handle);
714
715 return 1;
716 }
717 nrf905_interface_debug_print("nrf905: check output clock frequency %s.\n", (clock_freq == NRF905_OUTPUT_CLOCK_FREQUENCY_500KHZ) ? "ok" : "error");
718
719 /* nrf905_set_output_clock/nrf905_get_output_clock test */
720 nrf905_interface_debug_print("nrf905: nrf905_set_output_clock/nrf905_get_output_clock test.\n");
721
722 /* disable the output clock */
724 if (res != 0)
725 {
726 nrf905_interface_debug_print("nrf905: set output clock failed.\n");
727 (void)nrf905_deinit(&gs_handle);
728
729 return 1;
730 }
731 nrf905_interface_debug_print("nrf905: disable the output clock.\n");
732 res = nrf905_get_output_clock(&gs_handle, &enable);
733 if (res != 0)
734 {
735 nrf905_interface_debug_print("nrf905: get output clock failed.\n");
736 (void)nrf905_deinit(&gs_handle);
737
738 return 1;
739 }
740 nrf905_interface_debug_print("nrf905: check output clock %s.\n", (enable == NRF905_BOOL_FALSE) ? "ok" : "error");
741
742 /* enable the output clock */
743 res = nrf905_set_output_clock(&gs_handle, NRF905_BOOL_TRUE);
744 if (res != 0)
745 {
746 nrf905_interface_debug_print("nrf905: set output clock failed.\n");
747 (void)nrf905_deinit(&gs_handle);
748
749 return 1;
750 }
751 nrf905_interface_debug_print("nrf905: enable the output clock.\n");
752 res = nrf905_get_output_clock(&gs_handle, &enable);
753 if (res != 0)
754 {
755 nrf905_interface_debug_print("nrf905: get output clock failed.\n");
756 (void)nrf905_deinit(&gs_handle);
757
758 return 1;
759 }
760 nrf905_interface_debug_print("nrf905: check output clock %s.\n", (enable == NRF905_BOOL_TRUE) ? "ok" : "error");
761
762 /* nrf905_set_crystal_oscillator_frequency/nrf905_get_crystal_oscillator_frequency test */
763 nrf905_interface_debug_print("nrf905: nrf905_set_crystal_oscillator_frequency/nrf905_get_crystal_oscillator_frequency test.\n");
764
765 /* set crystal oscillator frequency 4MHz */
767 if (res != 0)
768 {
769 nrf905_interface_debug_print("nrf905: set crystal oscillator frequency failed.\n");
770 (void)nrf905_deinit(&gs_handle);
771
772 return 1;
773 }
774 nrf905_interface_debug_print("nrf905: set crystal oscillator frequency 4MHz.\n");
775 res = nrf905_get_crystal_oscillator_frequency(&gs_handle, &osc_freq);
776 if (res != 0)
777 {
778 nrf905_interface_debug_print("nrf905: get crystal oscillator frequency failed.\n");
779 (void)nrf905_deinit(&gs_handle);
780
781 return 1;
782 }
783 nrf905_interface_debug_print("nrf905: check crystal oscillator frequency %s.\n", (osc_freq == NRF905_CRYSTAL_OSCILLATOR_FREQUENCY_4MHZ) ? "ok" : "error");
784
785 /* set crystal oscillator frequency 8MHz */
787 if (res != 0)
788 {
789 nrf905_interface_debug_print("nrf905: set crystal oscillator frequency failed.\n");
790 (void)nrf905_deinit(&gs_handle);
791
792 return 1;
793 }
794 nrf905_interface_debug_print("nrf905: set crystal oscillator frequency 8MHz.\n");
795 res = nrf905_get_crystal_oscillator_frequency(&gs_handle, &osc_freq);
796 if (res != 0)
797 {
798 nrf905_interface_debug_print("nrf905: get crystal oscillator frequency failed.\n");
799 (void)nrf905_deinit(&gs_handle);
800
801 return 1;
802 }
803 nrf905_interface_debug_print("nrf905: check crystal oscillator frequency %s.\n", (osc_freq == NRF905_CRYSTAL_OSCILLATOR_FREQUENCY_8MHZ) ? "ok" : "error");
804
805 /* set crystal oscillator frequency 12MHz */
807 if (res != 0)
808 {
809 nrf905_interface_debug_print("nrf905: set crystal oscillator frequency failed.\n");
810 (void)nrf905_deinit(&gs_handle);
811
812 return 1;
813 }
814 nrf905_interface_debug_print("nrf905: set crystal oscillator frequency 12MHz.\n");
815 res = nrf905_get_crystal_oscillator_frequency(&gs_handle, &osc_freq);
816 if (res != 0)
817 {
818 nrf905_interface_debug_print("nrf905: get crystal oscillator frequency failed.\n");
819 (void)nrf905_deinit(&gs_handle);
820
821 return 1;
822 }
823 nrf905_interface_debug_print("nrf905: check crystal oscillator frequency %s.\n", (osc_freq == NRF905_CRYSTAL_OSCILLATOR_FREQUENCY_12MHZ) ? "ok" : "error");
824
825 /* set crystal oscillator frequency 20MHz */
827 if (res != 0)
828 {
829 nrf905_interface_debug_print("nrf905: set crystal oscillator frequency failed.\n");
830 (void)nrf905_deinit(&gs_handle);
831
832 return 1;
833 }
834 nrf905_interface_debug_print("nrf905: set crystal oscillator frequency 20MHz.\n");
835 res = nrf905_get_crystal_oscillator_frequency(&gs_handle, &osc_freq);
836 if (res != 0)
837 {
838 nrf905_interface_debug_print("nrf905: get crystal oscillator frequency failed.\n");
839 (void)nrf905_deinit(&gs_handle);
840
841 return 1;
842 }
843 nrf905_interface_debug_print("nrf905: check crystal oscillator frequency %s.\n", (osc_freq == NRF905_CRYSTAL_OSCILLATOR_FREQUENCY_20MHZ) ? "ok" : "error");
844
845 /* set crystal oscillator frequency 16MHz */
847 if (res != 0)
848 {
849 nrf905_interface_debug_print("nrf905: set crystal oscillator frequency failed.\n");
850 (void)nrf905_deinit(&gs_handle);
851
852 return 1;
853 }
854 nrf905_interface_debug_print("nrf905: set crystal oscillator frequency 16MHz.\n");
855 res = nrf905_get_crystal_oscillator_frequency(&gs_handle, &osc_freq);
856 if (res != 0)
857 {
858 nrf905_interface_debug_print("nrf905: get crystal oscillator frequency failed.\n");
859 (void)nrf905_deinit(&gs_handle);
860
861 return 1;
862 }
863 nrf905_interface_debug_print("nrf905: check crystal oscillator frequency %s.\n", (osc_freq == NRF905_CRYSTAL_OSCILLATOR_FREQUENCY_16MHZ) ? "ok" : "error");
864
865 /* nrf905_set_crc/nrf905_get_crc test */
866 nrf905_interface_debug_print("nrf905: nrf905_set_crc/nrf905_get_crc test.\n");
867
868 /* disable the crc */
869 res = nrf905_set_crc(&gs_handle, NRF905_BOOL_FALSE);
870 if (res != 0)
871 {
872 nrf905_interface_debug_print("nrf905: set crc failed.\n");
873 (void)nrf905_deinit(&gs_handle);
874
875 return 1;
876 }
877 nrf905_interface_debug_print("nrf905: disable the crc.\n");
878 res = nrf905_get_crc(&gs_handle, &enable);
879 if (res != 0)
880 {
881 nrf905_interface_debug_print("nrf905: get crc failed.\n");
882 (void)nrf905_deinit(&gs_handle);
883
884 return 1;
885 }
886 nrf905_interface_debug_print("nrf905: check crc %s.\n", (enable == NRF905_BOOL_FALSE) ? "ok" : "error");
887
888 /* enable the crc */
889 res = nrf905_set_crc(&gs_handle, NRF905_BOOL_TRUE);
890 if (res != 0)
891 {
892 nrf905_interface_debug_print("nrf905: set crc failed.\n");
893 (void)nrf905_deinit(&gs_handle);
894
895 return 1;
896 }
897 nrf905_interface_debug_print("nrf905: enable the crc.\n");
898 res = nrf905_get_crc(&gs_handle, &enable);
899 if (res != 0)
900 {
901 nrf905_interface_debug_print("nrf905: get crc failed.\n");
902 (void)nrf905_deinit(&gs_handle);
903
904 return 1;
905 }
906 nrf905_interface_debug_print("nrf905: check crc %s.\n", (enable == NRF905_BOOL_TRUE) ? "ok" : "error");
907
908 /* nrf905_set_crc_mode/nrf905_get_crc_mode test */
909 nrf905_interface_debug_print("nrf905: nrf905_set_crc_mode/nrf905_get_crc_mode test.\n");
910
911 /* set crc mode 8 */
912 res = nrf905_set_crc_mode(&gs_handle, NRF905_CRC_MODE_8);
913 if (res != 0)
914 {
915 nrf905_interface_debug_print("nrf905: set crc mode failed.\n");
916 (void)nrf905_deinit(&gs_handle);
917
918 return 1;
919 }
920 nrf905_interface_debug_print("nrf905: set crc mode 8.\n");
921 res = nrf905_get_crc_mode(&gs_handle, &crc_mode);
922 if (res != 0)
923 {
924 nrf905_interface_debug_print("nrf905: get crc mode failed.\n");
925 (void)nrf905_deinit(&gs_handle);
926
927 return 1;
928 }
929 nrf905_interface_debug_print("nrf905: check crc mode %s.\n", (crc_mode == NRF905_CRC_MODE_8) ? "ok" : "error");
930
931 /* set crc mode 16 */
932 res = nrf905_set_crc_mode(&gs_handle, NRF905_CRC_MODE_16);
933 if (res != 0)
934 {
935 nrf905_interface_debug_print("nrf905: set crc mode failed.\n");
936 (void)nrf905_deinit(&gs_handle);
937
938 return 1;
939 }
940 nrf905_interface_debug_print("nrf905: set crc mode 16.\n");
941 res = nrf905_get_crc_mode(&gs_handle, &crc_mode);
942 if (res != 0)
943 {
944 nrf905_interface_debug_print("nrf905: get crc mode failed.\n");
945 (void)nrf905_deinit(&gs_handle);
946
947 return 1;
948 }
949 nrf905_interface_debug_print("nrf905: check crc mode %s.\n", (crc_mode == NRF905_CRC_MODE_16) ? "ok" : "error");
950
951 /* nrf905_read_conf/nrf905_write_conf test */
952 nrf905_interface_debug_print("nrf905: nrf905_read_conf/nrf905_write_conf test.\n");
953
954 /* write conf */
955 res = nrf905_write_conf(&gs_handle);
956 if (res != 0)
957 {
958 nrf905_interface_debug_print("nrf905: write conf failed.\n");
959 (void)nrf905_deinit(&gs_handle);
960
961 return 1;
962 }
963 memcpy((uint8_t *)buf, gs_handle.conf, 10);
964 res = nrf905_read_conf(&gs_handle, (uint8_t *)buf_check);
965 if (res != 0)
966 {
967 nrf905_interface_debug_print("nrf905: read conf failed.\n");
968 (void)nrf905_deinit(&gs_handle);
969
970 return 1;
971 }
972 nrf905_interface_debug_print("nrf905: check conf %s.\n", (memcmp(buf, buf_check, 10) == 0) ? "ok" : "error");
973
974 /* nrf905_read_conf/nrf905_update_conf test */
975 nrf905_interface_debug_print("nrf905: nrf905_read_conf/nrf905_update_conf test.\n");
976
977 res = nrf905_update_conf(&gs_handle, (uint8_t *)buf);
978 if (res != 0)
979 {
980 nrf905_interface_debug_print("nrf905: update conf failed.\n");
981 (void)nrf905_deinit(&gs_handle);
982
983 return 1;
984 }
985 res = nrf905_read_conf(&gs_handle, (uint8_t *)buf_check);
986 if (res != 0)
987 {
988 nrf905_interface_debug_print("nrf905: read conf failed.\n");
989 (void)nrf905_deinit(&gs_handle);
990
991 return 1;
992 }
993 nrf905_interface_debug_print("nrf905: check conf %s.\n", (memcmp(buf, buf_check, 10) == 0) ? "ok" : "error");
994
995 /* nrf905_channel_config/nrf905_read_conf test */
996 nrf905_interface_debug_print("nrf905: nrf905_channel_config/nrf905_read_conf test.\n");
997
999 if (res != 0)
1000 {
1001 nrf905_interface_debug_print("nrf905: channel conf failed.\n");
1002 (void)nrf905_deinit(&gs_handle);
1003
1004 return 1;
1005 }
1006 res = nrf905_read_conf(&gs_handle, (uint8_t *)buf);
1007 if (res != 0)
1008 {
1009 nrf905_interface_debug_print("nrf905: read conf failed.\n");
1010 (void)nrf905_deinit(&gs_handle);
1011
1012 return 1;
1013 }
1014 res = nrf905_update_conf(&gs_handle, (uint8_t *)buf);
1015 if (res != 0)
1016 {
1017 nrf905_interface_debug_print("nrf905: update conf failed.\n");
1018 (void)nrf905_deinit(&gs_handle);
1019
1020 return 1;
1021 }
1022 res = nrf905_get_frequency(&gs_handle, &freq);
1023 if (res != 0)
1024 {
1025 nrf905_interface_debug_print("nrf905: get frequency failed.\n");
1026 (void)nrf905_deinit(&gs_handle);
1027
1028 return 1;
1029 }
1030 res = nrf905_get_pll_mode(&gs_handle, &mode);
1031 if (res != 0)
1032 {
1033 nrf905_interface_debug_print("nrf905: get pll mode failed.\n");
1034 (void)nrf905_deinit(&gs_handle);
1035
1036 return 1;
1037 }
1038 res = nrf905_get_output_power(&gs_handle, &output_power);
1039 if (res != 0)
1040 {
1041 nrf905_interface_debug_print("nrf905: get output power failed.\n");
1042 (void)nrf905_deinit(&gs_handle);
1043
1044 return 1;
1045 }
1046 nrf905_interface_debug_print("nrf905: check channel config %s.\n",
1047 ((freq == 0x0000) && (mode == NRF905_PLL_MODE_868_915_MHZ)&&
1048 (output_power == NRF905_OUTPUT_POWER_6_DBM)) ? "ok" : "error");
1049
1050 /* nrf905_get_status test */
1051 nrf905_interface_debug_print("nrf905: nrf905_get_status test.\n");
1052
1053 res = nrf905_get_status(&gs_handle, &status);
1054 if (res != 0)
1055 {
1056 nrf905_interface_debug_print("nrf905: get status failed.\n");
1057 (void)nrf905_deinit(&gs_handle);
1058
1059 return 1;
1060 }
1061 nrf905_interface_debug_print("nrf905: status is 0x%02X.\n", status);
1062
1063 /* finish register test */
1064 nrf905_interface_debug_print("nrf905: finish register test.\n");
1065 (void)nrf905_deinit(&gs_handle);
1066
1067 return 0;
1068}
driver nrf905 register test header file
nrf905_address_width_t
nrf905 address width enumeration definition
uint8_t nrf905_set_output_clock(nrf905_handle_t *handle, nrf905_bool_t enable)
enable or disable the output clock
nrf905_output_clock_frequency_t
nrf905 output clock frequency enumeration definition
uint8_t nrf905_get_rx_address_width(nrf905_handle_t *handle, nrf905_address_width_t *width)
get the rx address width
uint8_t nrf905_set_frequency(nrf905_handle_t *handle, uint16_t freq)
set the frequency
uint8_t nrf905_read_conf(nrf905_handle_t *handle, uint8_t conf[10])
read the conf
uint8_t nrf905_set_tx_payload_width(nrf905_handle_t *handle, uint8_t width)
set the tx payload width
uint8_t nrf905_init(nrf905_handle_t *handle)
initialize the chip
uint8_t nrf905_get_crc_mode(nrf905_handle_t *handle, nrf905_crc_mode_t *mode)
get the crc mode
uint8_t nrf905_get_auto_retransmit(nrf905_handle_t *handle, nrf905_bool_t *enable)
get the auto retransmit status
nrf905_crystal_oscillator_frequency_t
nrf905 crystal oscillator frequency enumeration definition
uint8_t nrf905_update_conf(nrf905_handle_t *handle, uint8_t conf[10])
update the conf
uint8_t nrf905_get_rx_address(nrf905_handle_t *handle, uint8_t addr[4])
get the rx address
uint8_t nrf905_frequency_convert_to_register(nrf905_handle_t *handle, float mhz, uint16_t *reg)
convert the frequency to the register raw data
nrf905_crc_mode_t
nrf905 crc mode enumeration definition
uint8_t nrf905_set_crc_mode(nrf905_handle_t *handle, nrf905_crc_mode_t mode)
set the crc mode
uint8_t nrf905_set_pll_mode(nrf905_handle_t *handle, nrf905_pll_mode_t mode)
set the pll mode
nrf905_output_power_t
nrf905 output power enumeration definition
uint8_t nrf905_get_tx_payload_width(nrf905_handle_t *handle, uint8_t *width)
get the tx payload width
uint8_t nrf905_set_output_power(nrf905_handle_t *handle, nrf905_output_power_t output_power)
set the output power
uint8_t nrf905_set_enable(nrf905_handle_t *handle, nrf905_bool_t enable)
enable or disable the chip
struct nrf905_info_s nrf905_info_t
nrf905 information structure definition
nrf905_pll_mode_t
nrf905 pll mode enumeration definition
uint8_t nrf905_get_tx_address_width(nrf905_handle_t *handle, nrf905_address_width_t *width)
get the tx address width
uint8_t nrf905_get_tx_payload(nrf905_handle_t *handle, uint8_t *buf, uint8_t len)
get the tx payload
uint8_t nrf905_set_rx_payload_width(nrf905_handle_t *handle, uint8_t width)
set the rx payload width
uint8_t nrf905_set_power_up(nrf905_handle_t *handle, nrf905_bool_t enable)
set the power up
uint8_t nrf905_get_status(nrf905_handle_t *handle, uint8_t *status)
get the status
uint8_t nrf905_get_rx_mode(nrf905_handle_t *handle, nrf905_rx_mode_t *mode)
get the rx mode
uint8_t nrf905_get_output_power(nrf905_handle_t *handle, nrf905_output_power_t *output_power)
get the output power
uint8_t nrf905_set_rx_address_width(nrf905_handle_t *handle, nrf905_address_width_t width)
set the rx address width
uint8_t nrf905_set_crystal_oscillator_frequency(nrf905_handle_t *handle, nrf905_crystal_oscillator_frequency_t freq)
set the crystal oscillator frequency
uint8_t nrf905_set_rx_address(nrf905_handle_t *handle, uint8_t addr[4])
set the rx address
uint8_t nrf905_info(nrf905_info_t *info)
get chip's information
uint8_t nrf905_set_tx_address_width(nrf905_handle_t *handle, nrf905_address_width_t width)
set the tx address width
uint8_t nrf905_get_output_clock(nrf905_handle_t *handle, nrf905_bool_t *enable)
get the output clock status
uint8_t nrf905_set_tx_address(nrf905_handle_t *handle, uint8_t *addr, uint8_t len)
set the tx address
uint8_t nrf905_get_pll_mode(nrf905_handle_t *handle, nrf905_pll_mode_t *mode)
get the pll mode
uint8_t nrf905_set_rx_mode(nrf905_handle_t *handle, nrf905_rx_mode_t mode)
set the rx mode
uint8_t nrf905_write_conf(nrf905_handle_t *handle)
write the conf
uint8_t nrf905_frequency_convert_to_data(nrf905_handle_t *handle, uint16_t reg, float *mhz)
convert the register raw data to the frequency
uint8_t nrf905_get_tx_address(nrf905_handle_t *handle, uint8_t *addr, uint8_t len)
get the tx address
uint8_t nrf905_get_crystal_oscillator_frequency(nrf905_handle_t *handle, nrf905_crystal_oscillator_frequency_t *freq)
get the crystal oscillator frequency
uint8_t nrf905_set_auto_retransmit(nrf905_handle_t *handle, nrf905_bool_t enable)
enable or disable the auto retransmit
uint8_t nrf905_get_rx_payload_width(nrf905_handle_t *handle, uint8_t *width)
get the rx payload width
uint8_t nrf905_set_output_clock_frequency(nrf905_handle_t *handle, nrf905_output_clock_frequency_t freq)
set the output clock frequency
uint8_t nrf905_set_mode(nrf905_handle_t *handle, nrf905_mode_t mode)
set the mode
uint8_t nrf905_channel_config(nrf905_handle_t *handle, uint16_t freq, nrf905_pll_mode_t mode, nrf905_output_power_t power)
config the channel
nrf905_rx_mode_t
nrf905 rx mode enumeration definition
uint8_t nrf905_get_frequency(nrf905_handle_t *handle, uint16_t *freq)
get the frequency
struct nrf905_handle_s nrf905_handle_t
nrf905 handle structure definition
uint8_t nrf905_get_rx_payload(nrf905_handle_t *handle, uint8_t *buf, uint8_t len)
get the rx payload
uint8_t nrf905_set_crc(nrf905_handle_t *handle, nrf905_bool_t enable)
enable or disable the crc
uint8_t nrf905_deinit(nrf905_handle_t *handle)
close the chip
uint8_t nrf905_get_output_clock_frequency(nrf905_handle_t *handle, nrf905_output_clock_frequency_t *freq)
get the output clock frequency
uint8_t nrf905_set_tx_payload(nrf905_handle_t *handle, uint8_t *buf, uint8_t len)
set the tx payload
nrf905_bool_t
nrf905 bool enumeration definition
uint8_t nrf905_get_crc(nrf905_handle_t *handle, nrf905_bool_t *enable)
get the crc status
@ NRF905_ADDRESS_WIDTH_1_BYTE
@ NRF905_ADDRESS_WIDTH_4_BYTE
@ NRF905_OUTPUT_CLOCK_FREQUENCY_1MHZ
@ NRF905_OUTPUT_CLOCK_FREQUENCY_4MHZ
@ NRF905_OUTPUT_CLOCK_FREQUENCY_2MHZ
@ NRF905_OUTPUT_CLOCK_FREQUENCY_500KHZ
@ NRF905_CRYSTAL_OSCILLATOR_FREQUENCY_12MHZ
@ NRF905_CRYSTAL_OSCILLATOR_FREQUENCY_16MHZ
@ NRF905_CRYSTAL_OSCILLATOR_FREQUENCY_8MHZ
@ NRF905_CRYSTAL_OSCILLATOR_FREQUENCY_20MHZ
@ NRF905_CRYSTAL_OSCILLATOR_FREQUENCY_4MHZ
@ NRF905_CRC_MODE_8
@ NRF905_CRC_MODE_16
@ NRF905_OUTPUT_POWER_6_DBM
@ NRF905_OUTPUT_POWER_NEGATIVE_2_DBM
@ NRF905_OUTPUT_POWER_10_DBM
@ NRF905_OUTPUT_POWER_NEGATIVE_10_DBM
@ NRF905_MODE_RX
@ NRF905_PLL_MODE_433_MHZ
@ NRF905_PLL_MODE_868_915_MHZ
@ NRF905_RX_MODE_REDUCED_POWER
@ NRF905_RX_MODE_NORMAL
@ NRF905_BOOL_FALSE
@ NRF905_BOOL_TRUE
uint8_t nrf905_interface_spi_deinit(void)
interface spi bus deinit
uint8_t nrf905_interface_spi_init(void)
interface spi bus init
uint8_t nrf905_interface_spi_transmit(uint8_t *tx, uint8_t *rx, uint16_t len)
interface spi bus transmit
void nrf905_interface_debug_print(const char *const fmt,...)
interface print format data
uint8_t nrf905_interface_ce_gpio_init(void)
interface ce gpio init
uint8_t nrf905_interface_spi_write(uint8_t reg, uint8_t *buf, uint16_t len)
interface spi bus write
uint8_t nrf905_interface_pwr_up_gpio_init(void)
interface pwr up gpio init
void nrf905_interface_delay_ms(uint32_t ms)
interface delay ms
uint8_t nrf905_interface_pwr_up_gpio_write(uint8_t data)
interface pwr up gpio write
uint8_t nrf905_interface_tx_en_gpio_write(uint8_t data)
interface tx en gpio write
uint8_t nrf905_interface_pwr_up_gpio_deinit(void)
interface pwr up gpio deinit
uint8_t nrf905_interface_ce_gpio_write(uint8_t data)
interface ce gpio write
uint8_t nrf905_interface_spi_read(uint8_t reg, uint8_t *buf, uint16_t len)
interface spi bus read
uint8_t nrf905_interface_tx_en_gpio_init(void)
interface tx en gpio init
uint8_t nrf905_interface_ce_gpio_deinit(void)
interface ce gpio deinit
void nrf905_interface_receive_callback(uint8_t type, uint8_t *buf, uint8_t len)
interface receive callback
uint8_t nrf905_interface_tx_en_gpio_deinit(void)
interface tx en gpio deinit
uint8_t nrf905_register_test(void)
register test
float supply_voltage_max_v
uint32_t driver_version
char manufacturer_name[32]
float supply_voltage_min_v
char chip_name[32]