1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #ifndef A1_BOARD_SELECTOR_H
- #define A1_BOARD_SELECTOR_H
- #include <stdbool.h>
- #include <stdint.h>
- #define RESET_LOW_TIME_MS 200
- #define RESET_HI_TIME_MS 100
- struct board_selector {
-
- void (*exit)(void);
-
- bool (*select)(uint8_t chain);
-
- void (*release)(void);
-
- bool (*reset)(void);
-
- bool (*reset_all)(void);
-
- uint8_t (*get_temp)(uint8_t sensor);
-
- bool (*prepare_clock)(int clock_khz);
- };
- static bool dummy_select(uint8_t b) { (void)b; return true; }
- static void dummy_void(void) { };
- static bool dummy_bool(void) { return true; }
- static uint8_t dummy_get_temp(uint8_t s) { (void)s; return 0; }
- static bool dummy_prepare_clock(int c) { (void)c; return true; }
- static const struct board_selector dummy_board_selector = {
- .exit = dummy_void,
- .select = dummy_select,
- .release = dummy_void,
- .reset = dummy_bool,
- .reset_all = dummy_bool,
- .get_temp = dummy_get_temp,
- .prepare_clock = dummy_prepare_clock,
- };
- #define CCD_MAX_CHAINS 5
- #define CCR_MAX_CHAINS 16
- extern struct board_selector *ccd_board_selector_init(void);
- extern struct board_selector *ccr_board_selector_init(void);
- #endif
|