api-hal-resources.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #pragma once
  2. #include "main.h"
  3. #include <furi.h>
  4. #include <stm32wbxx.h>
  5. #include <stm32wbxx_ll_gpio.h>
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. #define POWER_I2C_SCL_Pin LL_GPIO_PIN_9
  10. #define POWER_I2C_SCL_GPIO_Port GPIOA
  11. #define POWER_I2C_SDA_Pin LL_GPIO_PIN_10
  12. #define POWER_I2C_SDA_GPIO_Port GPIOA
  13. #define POWER_I2C I2C1
  14. /* Timing register value is computed with the STM32CubeMX Tool,
  15. * Fast Mode @100kHz with I2CCLK = 64 MHz,
  16. * rise time = 0ns, fall time = 0ns
  17. */
  18. #define POWER_I2C_TIMINGS 0x10707DBC
  19. /* Input Related Constants */
  20. #define INPUT_DEBOUNCE_TICKS 20
  21. /* Input Keys */
  22. typedef enum {
  23. InputKeyUp,
  24. InputKeyDown,
  25. InputKeyRight,
  26. InputKeyLeft,
  27. InputKeyOk,
  28. InputKeyBack,
  29. } InputKey;
  30. /* Light */
  31. typedef enum {
  32. LightRed,
  33. LightGreen,
  34. LightBlue,
  35. LightBacklight,
  36. } Light;
  37. typedef struct {
  38. const GPIO_TypeDef* port;
  39. const uint16_t pin;
  40. const InputKey key;
  41. const bool inverted;
  42. } InputPin;
  43. extern const InputPin input_pins[];
  44. extern const size_t input_pins_count;
  45. extern const GpioPin sd_cs_gpio;
  46. extern const GpioPin vibro_gpio;
  47. extern const GpioPin ibutton_gpio;
  48. extern const GpioPin cc1101_g0_gpio;
  49. #ifdef __cplusplus
  50. }
  51. #endif