bf16-brd-control.h 1.5 KB

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