/ bf16-brd-control.h
bf16-brd-control.h
1 #ifndef BF16_BRD_CONTROL_H 2 #define BF16_BRD_CONTROL_H 3 4 #include <stdint.h> 5 6 #include "bf16-gpiodevice.h" 7 8 #define BIT_STATE(data, pin) ( (data & BV(pin)) >> pin ) 9 #define BIT_INV_STATE(data, pin) ( BIT_STATE(data, pin) ^ 1 ) 10 11 #define BUZZER_PIN 2 // GPIO2[2], GPIO_66, X8.7 12 #define BRD_VER0_PIN 3 // GPIO2[3], GPIO_67, X8.8 13 #define BRD_VER1_PIN 5 // GPIO2[5], GPIO_69, X8.9 14 #define BRD_VER2_PIN 4 // GPIO2[4], GPIO_68, X8.10 15 #define BRD_VER3_PIN 13 // GPIO1[13], GPIO_45, X8.11 16 #define BRD_DET2_PIN 12 // GPIO1[12], GPIO_44, X8.12 17 #define BRD_DET1_PIN 23 // GPIO0[23], GPIO_23, X8.13 18 #define LED_GREEN_PIN 26 // GPIO0[26], GPIO_26, X8.14 19 #define LED_RED_PIN 15 // GPIO1[15], GPIO_47, X8.15 20 #define CH2_MSP_RST_PIN 14 // GPIO1[14], GPIO_46, X8.16 21 #define CH1_MSP_RST_PIN 27 // GPIO0[27], GPIO_27, X8.17 22 #define BRD_BUT1_PIN 1 // GPIO2[1], GPIO_65, X8.18 23 #define BRD_BUT2_PIN 22 // GPIO0[22], GPIO_22, X8.19 24 #define CH1_SPI_RES_PIN 22 // GPIO2[22], GPIO_86, X8.27 25 #define CH2_SPI_RES_PIN 29 // GPIO1[29], GPIO_61, X8.26 26 27 28 void brd_init(void); 29 30 int get_hw_ver(void); 31 int get_btn_fr(void); 32 int get_btn_discovery(void); 33 int get_ch1_det(void); 34 int get_ch2_det(void); 35 int8_t set_buzzer(uint8_t state); 36 int8_t set_led_green(uint8_t state); 37 int8_t set_led_red(uint8_t state); 38 int8_t set_ch1_rst(uint8_t state); 39 int8_t set_ch2_rst(uint8_t state); 40 int8_t set_ch1_spi(uint8_t state); 41 int8_t set_ch2_spi(uint8_t state); 42 43 #endif /* BF16_BRD_CONTROL_H */