api-hal-resources.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. * Standard Mode @100kHz with I2CCLK = 64 MHz,
  16. * rise time = 0ns, fall time = 0ns
  17. */
  18. #define POWER_I2C_TIMINGS_100 0x10707DBC
  19. /** Timing register value is computed with the STM32CubeMX Tool,
  20. * Fast Mode @400kHz with I2CCLK = 64 MHz,
  21. * rise time = 0ns, fall time = 0ns
  22. */
  23. #define POWER_I2C_TIMINGS_400 0x00602173
  24. /* Input Related Constants */
  25. #define INPUT_DEBOUNCE_TICKS 20
  26. /* Input Keys */
  27. typedef enum {
  28. InputKeyUp,
  29. InputKeyDown,
  30. InputKeyRight,
  31. InputKeyLeft,
  32. InputKeyOk,
  33. InputKeyBack,
  34. } InputKey;
  35. /* Light */
  36. typedef enum {
  37. LightRed,
  38. LightGreen,
  39. LightBlue,
  40. LightBacklight,
  41. } Light;
  42. typedef struct {
  43. const GPIO_TypeDef* port;
  44. const uint16_t pin;
  45. const InputKey key;
  46. const bool inverted;
  47. } InputPin;
  48. extern const InputPin input_pins[];
  49. extern const size_t input_pins_count;
  50. extern const GpioPin vibro_gpio;
  51. extern const GpioPin ibutton_gpio;
  52. extern const GpioPin gpio_cc1101_g0;
  53. extern const GpioPin gpio_rf_sw_0;
  54. extern const GpioPin gpio_subghz_cs;
  55. extern const GpioPin gpio_display_cs;
  56. extern const GpioPin gpio_display_rst;
  57. extern const GpioPin gpio_display_di;
  58. extern const GpioPin gpio_sdcard_cs;
  59. extern const GpioPin gpio_nfc_cs;
  60. extern const GpioPin gpio_spi_d_miso;
  61. extern const GpioPin gpio_spi_d_mosi;
  62. extern const GpioPin gpio_spi_d_sck;
  63. extern const GpioPin gpio_spi_r_miso;
  64. extern const GpioPin gpio_spi_r_mosi;
  65. extern const GpioPin gpio_spi_r_sck;
  66. extern const GpioPin gpio_ext_pc0;
  67. extern const GpioPin gpio_ext_pc1;
  68. extern const GpioPin gpio_ext_pc3;
  69. extern const GpioPin gpio_ext_pb2;
  70. extern const GpioPin gpio_ext_pb3;
  71. extern const GpioPin gpio_ext_pa4;
  72. extern const GpioPin gpio_ext_pa6;
  73. extern const GpioPin gpio_ext_pa7;
  74. extern const GpioPin gpio_rfid_pull;
  75. extern const GpioPin gpio_rfid_carrier_out;
  76. extern const GpioPin gpio_rfid_data_in;
  77. extern const GpioPin gpio_irda_rx;
  78. extern const GpioPin gpio_irda_tx;
  79. extern const GpioPin gpio_usart_tx;
  80. extern const GpioPin gpio_usart_rx;
  81. #ifdef __cplusplus
  82. }
  83. #endif