variant.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * variant.h
  3. *
  4. * MIT License
  5. */
  6. #pragma once
  7. #include "WVariant.h"
  8. ////////////////////////////////////////////////////////////////////////////////
  9. // Low frequency clock source
  10. #define USE_LFXO // 32.768 kHz crystal oscillator
  11. #define VARIANT_MCK (64000000ul)
  12. #define WIRE_INTERFACES_COUNT (1)
  13. ////////////////////////////////////////////////////////////////////////////////
  14. // Power
  15. #define PIN_PWR_EN (30) // RT9080 LDO enable pin for 3v3 rail
  16. #define PIN_BAT_CTL (31) // vdiv enable
  17. #define PIN_VBAT_READ (2)
  18. #define ADC_MULTIPLIER (4.90F)
  19. #define ADC_RESOLUTION (14)
  20. #define BATTERY_SENSE_RES (12)
  21. #define AREF_VOLTAGE (3.0)
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // Number of pins
  24. #define PINS_COUNT (48)
  25. #define NUM_DIGITAL_PINS (48)
  26. #define NUM_ANALOG_INPUTS (1)
  27. #define NUM_ANALOG_OUTPUTS (0)
  28. ////////////////////////////////////////////////////////////////////////////////
  29. // UART pin definition
  30. #define PIN_SERIAL1_RX PIN_GPS_TX
  31. #define PIN_SERIAL1_TX PIN_GPS_RX
  32. ////////////////////////////////////////////////////////////////////////////////
  33. // I2C pin definition
  34. #define PIN_WIRE_SDA (36) // P1.04
  35. #define PIN_WIRE_SCL (34) // P1.02
  36. #define I2C_NO_RESCAN
  37. #define DISABLE_DS3231_PROBE // DS3231 lives at 0x68 but this board has ICM20948 at that address, causing broken clock.
  38. ////////////////////////////////////////////////////////////////////////////////
  39. // SPI pin definition
  40. #define SPI_INTERFACES_COUNT (1)
  41. #define PIN_SPI_MISO (17)
  42. #define PIN_SPI_MOSI (15)
  43. #define PIN_SPI_SCK (13)
  44. ////////////////////////////////////////////////////////////////////////////////
  45. // QSPI FLASH
  46. #define PIN_QSPI_SCK (4)
  47. #define PIN_QSPI_CS (12)
  48. #define PIN_QSPI_IO0 (6)
  49. #define PIN_QSPI_IO1 (8)
  50. #define PIN_QSPI_IO2 (41) // P1.09
  51. #define PIN_QSPI_IO3 (26)
  52. #define EXTERNAL_FLASH_DEVICES ZD25WQ32CEIGR
  53. #define EXTERNAL_FLASH_USE_QSPI
  54. ////////////////////////////////////////////////////////////////////////////////
  55. // Builtin LEDs (only WS2812, no traditional LEDs available)
  56. // WS1812 data lines
  57. #define WS2812_DATA_1 (39) // P1.07
  58. #define WS2812_DATA_2 (44) // P1.12
  59. #define WS2812_DATA_3 (28) // P0.28
  60. #define LED_BLUE (-1)
  61. #define LED_BUILTIN (-1)
  62. #define LED_PIN LED_BUILTIN
  63. #define LED_STATE_ON LOW
  64. ////////////////////////////////////////////////////////////////////////////////
  65. // Builtin buttons
  66. #define PIN_BUTTON1 (42) // P1.10
  67. #define BUTTON_PIN PIN_BUTTON1 // BUTTON A
  68. #define PIN_USER_BTN BUTTON_PIN
  69. #define PIN_BUTTON2 (24)
  70. #define BUTTON_PIN2 PIN_BUTTON2 // BUTTON C
  71. ////////////////////////////////////////////////////////////////////////////////
  72. // Lora (Acsip S62F)
  73. #define USE_SX1262
  74. #define P_LORA_SCLK PIN_SPI_SCK
  75. #define P_LORA_MISO PIN_SPI_MISO
  76. #define P_LORA_MOSI PIN_SPI_MOSI
  77. #define P_LORA_DIO_1 (40) // P1.08
  78. #define P_LORA_RESET (7) // P0.07
  79. #define P_LORA_BUSY (14) // P0.14
  80. #define P_LORA_NSS (11) // P0.11
  81. #define SX126X_RXEN (33) // P1.01
  82. #define SX126X_TXEN (27) // P0.27
  83. #define SX126X_DIO3_TCXO_VOLTAGE (1.8f)
  84. ////////////////////////////////////////////////////////////////////////////////
  85. // GPS
  86. // NOTE: these pins are defined differently to how lilygo does them but they
  87. // seem to work properly for how EnvironmentSensorManager operates.
  88. // TODO: MAYBE? migrate to board based sensor manager / add GPS_WAKE_UP to ESM
  89. #define PIN_GPS_RX (21) // GPS_UART_RX in lilygo pin defs
  90. #define PIN_GPS_TX (19) // GPS_UART_TX in lilygo pin defs
  91. #define PIN_GPS_EN (25) // GPS_WAKE_UP in lilygo pin defs
  92. #define PIN_GPS_RESET (47) // GPS_EN in lilygo pin defs
  93. #define PIN_GPS_STANDBY (29) // GPS_RF_EN in lilygo pin defs
  94. #define PIN_GPS_PPS (23) // GPS_1PPS in lilygo pin defs
  95. // buzzer - enabled in platformio.ini so it can be easily turned off if not wanted.
  96. // #define PIN_BUZZER (38) // P1.06
  97. // microphone
  98. #define MICROPHONE_SCLK (35) // P1.03
  99. #define MICROPHONE_DATA (37) // P1.05
  100. // speaker
  101. #define SPEAKER_EN (43) // P1.11
  102. #define SPEAKER_EN_2 (3) // P0.03
  103. #define SPEAKER_BCLK (16) // P0.16
  104. #define SPEAKER_DATA (20) // P0.20
  105. #define SPEAKER_WS_LRCK (22) // P0.22
  106. // ICM20948 9dof motion sensor (accelerometer and magnetometer)
  107. #define ICM20948_SDA PIN_WIRE_SDA // P1.4
  108. #define ICM20948_SCL PIN_WIRE_SCL // P1.2
  109. #define ICM20948_ADDRESS 0x68