LibDriver X9CXX
Loading...
Searching...
No Matches
driver_x9cxx.c
Go to the documentation of this file.
1
36
37#include "driver_x9cxx.h"
38
42#define CHIP_NAME "Renesas X9CXX"
43#define MANUFACTURER_NAME "Renesas"
44#define SUPPLY_VOLTAGE_MIN 4.5f
45#define SUPPLY_VOLTAGE_MAX 5.5f
46#define MAX_CURRENT 3.0f
47#define TEMPERATURE_MIN -40.0f
48#define TEMPERATURE_MAX 85.0f
49#define DRIVER_VERSION 1000
50
60static uint8_t a_x9cxx_step_prev(x9cxx_handle_t *handle, uint8_t inc)
61{
62 uint8_t res;
63
64 res = handle->inc_gpio_write(1); /* inc set high */
65 if (res != 0) /* check the result */
66 {
67 return 1; /* return error */
68 }
69 handle->delay_us(X9CXX_OPERATE_DELAY_US); /* delay */
70
71 if (inc != 0) /* up */
72 {
73 res = handle->up_down_gpio_write(1); /* set up */
74 if (res != 0) /* check the result */
75 {
76 return 1; /* return error */
77 }
78 }
79 else /* down */
80 {
81 res = handle->up_down_gpio_write(0); /* set down */
82 if (res != 0) /* check the result */
83 {
84 return 1; /* return error */
85 }
86 }
87 handle->delay_us(X9CXX_OPERATE_DELAY_US); /* delay */
88
89 res = handle->cs_gpio_write(0); /* cs set low */
90 if (res != 0) /* check the result */
91 {
92 return 1; /* return error */
93 }
94 handle->delay_us(X9CXX_OPERATE_DELAY_US); /* delay */
95
96 return 0; /* success return 0 */
97}
98
108static uint8_t a_x9cxx_step(x9cxx_handle_t *handle, uint8_t inc)
109{
110 uint8_t res;
111
112 res = handle->inc_gpio_write(1); /* inc set high */
113 if (res != 0) /* check the result */
114 {
115 return 1; /* return error */
116 }
117 handle->delay_us(X9CXX_STEP_DELAY_US); /* delay */
118 res = handle->inc_gpio_write(0); /* inc set low */
119 if (res != 0) /* check the result */
120 {
121 return 1; /* return error */
122 }
123 handle->delay_us(X9CXX_STEP_DELAY_US); /* delay */
124
125 if (inc != 0) /* up */
126 {
127 handle->step++; /* step++ */
128 if (handle->step > 99) /* check over 99 */
129 {
130 handle->step = 99; /* set 99 */
131 }
132 }
133 else /* down */
134 {
135 if (handle->step != 0) /* check 0 */
136 {
137 handle->step--; /* step-- */
138 }
139 }
140
141 return 0; /* success return 0 */
142}
143
153static uint8_t a_x9cxx_reset(x9cxx_handle_t *handle, uint8_t inc)
154{
155 uint8_t res;
156 uint8_t i;
157
158 res = handle->inc_gpio_write(1); /* inc set high */
159 if (res != 0) /* check the result */
160 {
161 return 1; /* return error */
162 }
163 handle->delay_us(X9CXX_OPERATE_DELAY_US); /* delay */
164
165 if (inc != 0) /* up */
166 {
167 res = handle->up_down_gpio_write(1); /* set up */
168 if (res != 0) /* check the result */
169 {
170 return 1; /* return error */
171 }
172 }
173 else /* down */
174 {
175 res = handle->up_down_gpio_write(0); /* set down */
176 if (res != 0) /* check the result */
177 {
178 return 1; /* return error */
179 }
180 }
181 handle->delay_us(X9CXX_OPERATE_DELAY_US); /* delay */
182
183 res = handle->cs_gpio_write(0); /* cs set low */
184 if (res != 0) /* check the result */
185 {
186 return 1; /* return error */
187 }
188 handle->delay_us(X9CXX_OPERATE_DELAY_US); /* delay */
189
190 for (i = 0; i < 100; i++) /* 100 steps */
191 {
192 res = handle->inc_gpio_write(1); /* inc set high */
193 if (res != 0) /* check the result */
194 {
195 return 1; /* return error */
196 }
197 handle->delay_us(X9CXX_STEP_DELAY_US); /* delay */
198 res = handle->inc_gpio_write(0); /* inc set low */
199 if (res != 0) /* check the result */
200 {
201 return 1; /* return error */
202 }
203 handle->delay_us(X9CXX_STEP_DELAY_US); /* delay */
204 }
205
206 if (inc != 0) /* up */
207 {
208 handle->step = 99; /* set 99 */
209 }
210 else /* down */
211 {
212 handle->step = 0; /* set 0 */
213 }
214 handle->valid = 1; /* set valid */
215
216 return 0; /* success return 0 */
217}
218
227static uint8_t a_x9cxx_store(x9cxx_handle_t *handle)
228{
229 uint8_t res;
230
231 res = handle->inc_gpio_write(1); /* inc set high */
232 if (res != 0) /* check the result */
233 {
234 return 1; /* return error */
235 }
236 handle->delay_us(X9CXX_OPERATE_DELAY_US); /* delay */
237 res = handle->cs_gpio_write(1); /* cs set high */
238 if (res != 0) /* check the result */
239 {
240 return 1; /* return error */
241 }
242 handle->delay_ms(X9CXX_STORE_DELAY_MS); /* delay */
243
244 return 0; /* success return 0 */
245}
246
255static uint8_t a_x9cxx_no_store(x9cxx_handle_t *handle)
256{
257 uint8_t res;
258
259 res = handle->inc_gpio_write(0); /* inc set low */
260 if (res != 0) /* check the result */
261 {
262 return 1; /* return error */
263 }
264 handle->delay_us(X9CXX_OPERATE_DELAY_US); /* delay */
265 res = handle->cs_gpio_write(1); /* cs set high */
266 if (res != 0) /* check the result */
267 {
268 return 1; /* return error */
269 }
270 handle->delay_ms(X9CXX_STORE_DELAY_MS); /* delay */
271
272 return 0; /* success return 0 */
273}
274
286{
287 uint8_t res;
288
289 if (handle == NULL) /* check handle */
290 {
291 return 2; /* return error */
292 }
293 if (handle->debug_print == NULL) /* check debug_print */
294 {
295 return 3; /* return error */
296 }
297 if (handle->cs_gpio_init == NULL) /* check cs_gpio_init */
298 {
299 handle->debug_print("x9cxx: cs_gpio_init is null.\n"); /* cs_gpio_init is null */
300
301 return 3; /* return error */
302 }
303 if (handle->cs_gpio_deinit == NULL) /* check cs_gpio_deinit */
304 {
305 handle->debug_print("x9cxx: cs_gpio_deinit is null.\n"); /* cs_gpio_deinit is null */
306
307 return 3; /* return error */
308 }
309 if (handle->cs_gpio_write == NULL) /* check cs_gpio_write */
310 {
311 handle->debug_print("x9cxx: cs_gpio_write is null.\n"); /* cs_gpio_write is null */
312
313 return 3; /* return error */
314 }
315 if (handle->up_down_gpio_init == NULL) /* check up_down_gpio_init */
316 {
317 handle->debug_print("x9cxx: up_down_gpio_init is null.\n"); /* up_down_gpio_init is null */
318
319 return 3; /* return error */
320 }
321 if (handle->up_down_gpio_deinit == NULL) /* check up_down_gpio_deinit */
322 {
323 handle->debug_print("x9cxx: up_down_gpio_deinit is null.\n"); /* up_down_gpio_deinit is null */
324
325 return 3; /* return error */
326 }
327 if (handle->up_down_gpio_write == NULL) /* check up_down_gpio_write */
328 {
329 handle->debug_print("x9cxx: up_down_gpio_write is null.\n"); /* up_down_gpio_write is null */
330
331 return 3; /* return error */
332 }
333 if (handle->inc_gpio_init == NULL) /* check inc_gpio_init */
334 {
335 handle->debug_print("x9cxx: inc_gpio_init is null.\n"); /* inc_gpio_init is null */
336
337 return 3; /* return error */
338 }
339 if (handle->inc_gpio_deinit == NULL) /* check inc_gpio_deinit */
340 {
341 handle->debug_print("x9cxx: inc_gpio_deinit is null.\n"); /* inc_gpio_deinit is null */
342
343 return 3; /* return error */
344 }
345 if (handle->inc_gpio_write == NULL) /* check inc_gpio_write */
346 {
347 handle->debug_print("x9cxx: inc_gpio_write is null.\n"); /* inc_gpio_write is null */
348
349 return 3; /* return error */
350 }
351 if (handle->delay_ms == NULL) /* check delay_ms */
352 {
353 handle->debug_print("x9cxx: delay_ms is null.\n"); /* delay_ms is null */
354
355 return 3; /* return error */
356 }
357 if (handle->delay_us == NULL) /* check delay_us */
358 {
359 handle->debug_print("x9cxx: delay_us is null.\n"); /* delay_us is null */
360
361 return 3; /* return error */
362 }
363
364 if (handle->cs_gpio_init() != 0) /* cs gpio init */
365 {
366 handle->debug_print("x9cxx: cs gpio init failed.\n"); /* cs gpio init failed */
367
368 return 1; /* return error */
369 }
370 if (handle->up_down_gpio_init() != 0) /* up down gpio init */
371 {
372 handle->debug_print("x9cxx: up down gpio init failed.\n"); /* up down gpio init failed */
373 (void)handle->cs_gpio_deinit(); /* cs gpio deinit */
374
375 return 1; /* return error */
376 }
377 if (handle->inc_gpio_init() != 0) /* inc gpio init */
378 {
379 handle->debug_print("x9cxx: inc gpio init failed.\n"); /* inc gpio init failed */
380 (void)handle->cs_gpio_deinit(); /* cs gpio deinit */
381 (void)handle->up_down_gpio_deinit(); /* up down gpio deinit */
382
383 return 1; /* return error */
384 }
385 res = handle->up_down_gpio_write(1); /* up down set low */
386 if (res != 0) /* check the result */
387 {
388 handle->debug_print("x9cxx: up down gpio write failed.\n"); /* up down gpio write failed */
389 (void)handle->cs_gpio_deinit(); /* cs gpio deinit */
390 (void)handle->up_down_gpio_deinit(); /* up down gpio deinit */
391 (void)handle->inc_gpio_deinit(); /* inc gpio deinit */
392
393 return 1; /* return error */
394 }
395 res = handle->inc_gpio_write(1); /* inc set high */
396 if (res != 0) /* check the result */
397 {
398 handle->debug_print("x9cxx: inc gpio write failed.\n"); /* inc gpio write failed */
399 (void)handle->cs_gpio_deinit(); /* cs gpio deinit */
400 (void)handle->up_down_gpio_deinit(); /* up down gpio deinit */
401 (void)handle->inc_gpio_deinit(); /* inc gpio deinit */
402
403 return 1; /* return error */
404 }
405 res = handle->cs_gpio_write(1); /* cs set high */
406 if (res != 0) /* check the result */
407 {
408 handle->debug_print("x9cxx: cs gpio write failed.\n"); /* cs gpio write failed */
409 (void)handle->cs_gpio_deinit(); /* cs gpio deinit */
410 (void)handle->up_down_gpio_deinit(); /* up down gpio deinit */
411 (void)handle->inc_gpio_deinit(); /* inc gpio deinit */
412
413 return 1; /* return error */
414 }
415 handle->step = 0; /* init 0 */
416 handle->valid = 0; /* set invalid */
417 handle->inited = 1; /* flag initialization */
418
419 return 0; /* success return 0 */
420}
421
433{
434 if (handle == NULL) /* check handle */
435 {
436 return 2; /* return error */
437 }
438 if (handle->inited != 1) /* check handle initialization */
439 {
440 return 3; /* return error */
441 }
442
443 if (handle->cs_gpio_deinit() != 0) /* cs gpio deinit */
444 {
445 handle->debug_print("x9cxx: cs gpio deinit failed.\n"); /* cs gpio deinit failed */
446
447 return 1; /* return error */
448 }
449 if (handle->up_down_gpio_deinit() != 0) /* up down gpio deinit */
450 {
451 handle->debug_print("x9cxx: up down gpio deinit failed.\n"); /* up down gpio deinit failed */
452
453 return 1; /* return error */
454 }
455 if (handle->inc_gpio_deinit() != 0) /* inc gpio deinit */
456 {
457 handle->debug_print("x9cxx: inc gpio deinit failed.\n"); /* inc gpio deinit failed */
458
459 return 1; /* return error */
460 }
461 handle->inited = 0; /* flag closed */
462
463 return 0; /* success return 0 */
464}
465
477uint8_t x9cxx_reset_to_min(x9cxx_handle_t *handle, x9cxx_bool_t store_enable)
478{
479 uint8_t res;
480
481 if (handle == NULL) /* check handle */
482 {
483 return 2; /* return error */
484 }
485 if (handle->inited != 1) /* check handle initialization */
486 {
487 return 3; /* return error */
488 }
489
490 res = a_x9cxx_reset(handle, 0); /* reset */
491 if (res != 0) /* check the result */
492 {
493 handle->debug_print("x9cxx: reset failed.\n"); /* reset failed */
494
495 return 1; /* return error */
496 }
497
498 if (store_enable != X9CXX_BOOL_FALSE) /* store */
499 {
500 res = a_x9cxx_store(handle); /* store */
501 if (res != 0) /* check the result */
502 {
503 handle->debug_print("x9cxx: store failed.\n"); /* store failed */
504
505 return 1; /* return error */
506 }
507 }
508 else /* no store */
509 {
510 res = a_x9cxx_no_store(handle); /* no store */
511 if (res != 0) /* check the result */
512 {
513 handle->debug_print("x9cxx: no store failed.\n"); /* no store failed */
514
515 return 1; /* return error */
516 }
517 }
518
519 return 0; /* success return 0 */
520}
521
533uint8_t x9cxx_reset_to_max(x9cxx_handle_t *handle, x9cxx_bool_t store_enable)
534{
535 uint8_t res;
536
537 if (handle == NULL) /* check handle */
538 {
539 return 2; /* return error */
540 }
541 if (handle->inited != 1) /* check handle initialization */
542 {
543 return 3; /* return error */
544 }
545
546 res = a_x9cxx_reset(handle, 1); /* reset */
547 if (res != 0) /* check the result */
548 {
549 handle->debug_print("x9cxx: reset failed.\n"); /* reset failed */
550
551 return 1; /* return error */
552 }
553
554 if (store_enable != X9CXX_BOOL_FALSE) /* store */
555 {
556 res = a_x9cxx_store(handle); /* store */
557 if (res != 0) /* check the result */
558 {
559 handle->debug_print("x9cxx: store failed.\n"); /* store failed */
560
561 return 1; /* return error */
562 }
563 }
564 else /* no store */
565 {
566 res = a_x9cxx_no_store(handle); /* no store */
567 if (res != 0) /* check the result */
568 {
569 handle->debug_print("x9cxx: no store failed.\n"); /* no store failed */
570
571 return 1; /* return error */
572 }
573 }
574
575 return 0; /* success return 0 */
576}
577
590uint8_t x9cxx_increment(x9cxx_handle_t *handle, uint8_t step, x9cxx_bool_t store_enable)
591{
592 uint8_t res;
593 uint8_t i;
594
595 if (handle == NULL) /* check handle */
596 {
597 return 2; /* return error */
598 }
599 if (handle->inited != 1) /* check handle initialization */
600 {
601 return 3; /* return error */
602 }
603 if (step == 0) /* if 0 */
604 {
605 return 0; /* success return 0 */
606 }
607
608 res = a_x9cxx_step_prev(handle, 1); /* step prev */
609 if (res != 0) /* check the result */
610 {
611 handle->debug_print("x9cxx: step prev failed.\n"); /* step prev failed */
612
613 return 1; /* return error */
614 }
615 for (i = 0; i < step; i++) /* run step */
616 {
617 res = a_x9cxx_step(handle, 1); /* step */
618 if (res != 0) /* check the result */
619 {
620 handle->debug_print("x9cxx: step failed.\n"); /* step failed */
621
622 return 1; /* return error */
623 }
624 }
625
626 if (store_enable != X9CXX_BOOL_FALSE) /* store */
627 {
628 res = a_x9cxx_store(handle); /* store */
629 if (res != 0) /* check the result */
630 {
631 handle->debug_print("x9cxx: store failed.\n"); /* store failed */
632
633 return 1; /* return error */
634 }
635 }
636 else /* no store */
637 {
638 res = a_x9cxx_no_store(handle); /* no store */
639 if (res != 0) /* check the result */
640 {
641 handle->debug_print("x9cxx: no store failed.\n"); /* no store failed */
642
643 return 1; /* return error */
644 }
645 }
646
647 return 0; /* success return 0 */
648}
649
662uint8_t x9cxx_decrement(x9cxx_handle_t *handle, uint8_t step, x9cxx_bool_t store_enable)
663{
664 uint8_t res;
665 uint8_t i;
666
667 if (handle == NULL) /* check handle */
668 {
669 return 2; /* return error */
670 }
671 if (handle->inited != 1) /* check handle initialization */
672 {
673 return 3; /* return error */
674 }
675 if (step == 0) /* if 0 */
676 {
677 return 0; /* success return 0 */
678 }
679
680 res = a_x9cxx_step_prev(handle, 0); /* step prev */
681 if (res != 0) /* check the result */
682 {
683 handle->debug_print("x9cxx: step prev failed.\n"); /* step prev failed */
684
685 return 1; /* return error */
686 }
687 for (i = 0; i < step; i++) /* run step */
688 {
689 res = a_x9cxx_step(handle, 0); /* step */
690 if (res != 0) /* check the result */
691 {
692 handle->debug_print("x9cxx: step failed.\n"); /* step failed */
693
694 return 1; /* return error */
695 }
696 }
697
698 if (store_enable != X9CXX_BOOL_FALSE) /* store */
699 {
700 res = a_x9cxx_store(handle); /* store */
701 if (res != 0) /* check the result */
702 {
703 handle->debug_print("x9cxx: store failed.\n"); /* store failed */
704
705 return 1; /* return error */
706 }
707 }
708 else /* no store */
709 {
710 res = a_x9cxx_no_store(handle); /* no store */
711 if (res != 0) /* check the result */
712 {
713 handle->debug_print("x9cxx: no store failed.\n"); /* no store failed */
714
715 return 1; /* return error */
716 }
717 }
718
719 return 0; /* success return 0 */
720}
721
733uint8_t x9cxx_get_step_counter(x9cxx_handle_t *handle, uint8_t *counter)
734{
735 if (handle == NULL) /* check handle */
736 {
737 return 2; /* return error */
738 }
739 if (handle->inited != 1) /* check handle initialization */
740 {
741 return 3; /* return error */
742 }
743 if (handle->valid == 0) /* check valid flag */
744 {
745 handle->debug_print("x9cxx: step counter is invalid.\n"); /* step counter is invalid */
746
747 return 1; /* return error */
748 }
749
750 *counter = handle->step; /* set step counter */
751
752 return 0; /* success return 0 */
753}
754
771uint8_t x9cxx_set_absolute_step_counter(x9cxx_handle_t *handle, uint8_t counter, x9cxx_bool_t store_enable)
772{
773 uint8_t res;
774
775 if (handle == NULL) /* check handle */
776 {
777 return 2; /* return error */
778 }
779 if (handle->inited != 1) /* check handle initialization */
780 {
781 return 3; /* return error */
782 }
783 if (handle->valid == 0) /* check valid flag */
784 {
785 handle->debug_print("x9cxx: step counter is invalid.\n"); /* step counter is invalid */
786
787 return 4; /* return error */
788 }
789 if (counter > 99) /* check counter */
790 {
791 handle->debug_print("x9cxx: counter > 99.\n"); /* counter > 100 */
792
793 return 5; /* return error */
794 }
795 if (counter == handle->step) /* check counter */
796 {
797 return 0; /* success return 0 */
798 }
799
800 if (counter < handle->step) /* decrement */
801 {
802 res = a_x9cxx_step_prev(handle, 0); /* step prev */
803 if (res != 0) /* check the result */
804 {
805 handle->debug_print("x9cxx: step prev failed.\n"); /* step prev failed */
806
807 return 1; /* return error */
808 }
809 while (counter < handle->step) /* loop */
810 {
811 res = a_x9cxx_step(handle, 0); /* step */
812 if (res != 0) /* check the result */
813 {
814 handle->debug_print("x9cxx: step failed.\n"); /* step failed */
815
816 return 1; /* return error */
817 }
818 }
819 }
820 else /* increment */
821 {
822 res = a_x9cxx_step_prev(handle, 1); /* step prev */
823 if (res != 0) /* check the result */
824 {
825 handle->debug_print("x9cxx: step prev failed.\n"); /* step prev failed */
826
827 return 1; /* return error */
828 }
829 while (counter > handle->step) /* loop */
830 {
831 res = a_x9cxx_step(handle, 1); /* step */
832 if (res != 0) /* check the result */
833 {
834 handle->debug_print("x9cxx: step failed.\n"); /* step failed */
835
836 return 1; /* return error */
837 }
838 }
839 }
840
841 if (store_enable != X9CXX_BOOL_FALSE) /* store */
842 {
843 res = a_x9cxx_store(handle); /* store */
844 if (res != 0) /* check the result */
845 {
846 handle->debug_print("x9cxx: store failed.\n"); /* store failed */
847
848 return 1; /* return error */
849 }
850 }
851 else /* no store */
852 {
853 res = a_x9cxx_no_store(handle); /* no store */
854 if (res != 0) /* check the result */
855 {
856 handle->debug_print("x9cxx: no store failed.\n"); /* no store failed */
857
858 return 1; /* return error */
859 }
860 }
861
862 return 0; /* success return 0 */
863}
864
875{
876 if (handle == NULL) /* check handle */
877 {
878 return 2; /* return error */
879 }
880
881 handle->type = (uint32_t)type; /* set type */
882
883 return 0; /* success return 0 */
884}
885
896{
897 if (handle == NULL) /* check handle */
898 {
899 return 2; /* return error */
900 }
901
902 *type = (x9cxx_type_t)(handle->type); /* set type */
903
904 return 0; /* success return 0 */
905}
906
918uint8_t x9cxx_resistor_convert_to_register(x9cxx_handle_t *handle, float ohm, uint8_t *step)
919{
920 if (handle == NULL) /* check handle */
921 {
922 return 2; /* return error */
923 }
924 if (handle->inited != 1) /* check handle initialization */
925 {
926 return 3; /* return error */
927 }
928
929 *step = (uint8_t)(ohm / ((float)(handle->type) / 99.0f)); /* convert real data to register data */
930
931 return 0; /* success return 0 */
932}
933
945uint8_t x9cxx_resistor_convert_to_data(x9cxx_handle_t *handle, uint8_t step, float *ohm)
946{
947 if (handle == NULL) /* check handle */
948 {
949 return 2; /* return error */
950 }
951 if (handle->inited != 1) /* check handle initialization */
952 {
953 return 3; /* return error */
954 }
955
956 *ohm = (float)(step) * ((float)(handle->type) / 99.0f); /* convert raw data to real data */
957
958 return 0; /* success return 0 */
959}
960
970{
971 if (info == NULL) /* check handle */
972 {
973 return 2; /* return error */
974 }
975
976 memset(info, 0, sizeof(x9cxx_info_t)); /* initialize x9cxx info structure */
977 strncpy(info->chip_name, CHIP_NAME, 32); /* copy chip name */
978 strncpy(info->manufacturer_name, MANUFACTURER_NAME, 32); /* copy manufacturer name */
979 strncpy(info->interface, "GPIO", 8); /* copy interface name */
980 info->supply_voltage_min_v = SUPPLY_VOLTAGE_MIN; /* set minimal supply voltage */
981 info->supply_voltage_max_v = SUPPLY_VOLTAGE_MAX; /* set maximum supply voltage */
982 info->max_current_ma = MAX_CURRENT; /* set maximum current */
983 info->temperature_max = TEMPERATURE_MAX; /* set minimal temperature */
984 info->temperature_min = TEMPERATURE_MIN; /* set maximum temperature */
985 info->driver_version = DRIVER_VERSION; /* set driver version */
986
987 return 0; /* success return 0 */
988}
#define MAX_CURRENT
#define SUPPLY_VOLTAGE_MAX
#define TEMPERATURE_MAX
#define MANUFACTURER_NAME
#define TEMPERATURE_MIN
#define SUPPLY_VOLTAGE_MIN
#define CHIP_NAME
chip information definition
#define DRIVER_VERSION
driver x9cxx header file
struct x9cxx_handle_s x9cxx_handle_t
x9cxx handle structure definition
uint8_t x9cxx_set_absolute_step_counter(x9cxx_handle_t *handle, uint8_t counter, x9cxx_bool_t store_enable)
set absolute step counter
uint8_t x9cxx_increment(x9cxx_handle_t *handle, uint8_t step, x9cxx_bool_t store_enable)
increment
struct x9cxx_info_s x9cxx_info_t
x9cxx information structure definition
uint8_t x9cxx_set_type(x9cxx_handle_t *handle, x9cxx_type_t type)
set chip type
x9cxx_type_t
x9cxx type enumeration definition
uint8_t x9cxx_get_step_counter(x9cxx_handle_t *handle, uint8_t *counter)
get step counter
#define X9CXX_STORE_DELAY_MS
x9cxx store delay definition
uint8_t x9cxx_decrement(x9cxx_handle_t *handle, uint8_t step, x9cxx_bool_t store_enable)
decrement
uint8_t x9cxx_get_type(x9cxx_handle_t *handle, x9cxx_type_t *type)
get chip type
uint8_t x9cxx_resistor_convert_to_register(x9cxx_handle_t *handle, float ohm, uint8_t *step)
resistor convert to register
uint8_t x9cxx_reset_to_min(x9cxx_handle_t *handle, x9cxx_bool_t store_enable)
reset to min
x9cxx_bool_t
x9cxx bool enumeration definition
#define X9CXX_OPERATE_DELAY_US
x9cxx operate delay definition
uint8_t x9cxx_info(x9cxx_info_t *info)
get chip's information
uint8_t x9cxx_init(x9cxx_handle_t *handle)
initialize the chip
uint8_t x9cxx_resistor_convert_to_data(x9cxx_handle_t *handle, uint8_t step, float *ohm)
resistor convert to data
#define X9CXX_STEP_DELAY_US
x9cxx step delay definition
uint8_t x9cxx_reset_to_max(x9cxx_handle_t *handle, x9cxx_bool_t store_enable)
reset to max
uint8_t x9cxx_deinit(x9cxx_handle_t *handle)
close the chip
@ X9CXX_BOOL_FALSE
uint8_t(* inc_gpio_init)(void)
void(* delay_ms)(uint32_t ms)
uint8_t(* cs_gpio_deinit)(void)
void(* debug_print)(const char *const fmt,...)
uint8_t(* inc_gpio_write)(uint8_t value)
void(* delay_us)(uint32_t us)
uint8_t(* up_down_gpio_write)(uint8_t value)
uint8_t(* cs_gpio_init)(void)
uint8_t(* up_down_gpio_deinit)(void)
uint8_t(* up_down_gpio_init)(void)
uint8_t(* inc_gpio_deinit)(void)
uint8_t(* cs_gpio_write)(uint8_t value)
float temperature_max
float supply_voltage_max_v
uint32_t driver_version
float temperature_min
float max_current_ma
char manufacturer_name[32]
float supply_voltage_min_v
char interface[8]
char chip_name[32]