variant.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /*
  2. * Heltec Mesh Node T1 nRF52840 variant.
  3. */
  4. #pragma once
  5. #include "WVariant.h"
  6. #define USE_LFXO
  7. #define VARIANT_MCK (64000000ul)
  8. ////////////////////////////////////////////////////////////////////////////////
  9. // Number of pins
  10. #define PINS_COUNT (48)
  11. #define NUM_DIGITAL_PINS (48)
  12. #define NUM_ANALOG_INPUTS (1)
  13. #define NUM_ANALOG_OUTPUTS (0)
  14. ////////////////////////////////////////////////////////////////////////////////
  15. // Display
  16. #define ST7735_CS (0 + 12)
  17. #define ST7735_RS (0 + 22)
  18. #define ST7735_SDA (0 + 24)
  19. #define ST7735_SCK (32 + 0)
  20. #define ST7735_RESET (0 + 20)
  21. #define ST7735_MISO (-1)
  22. #define ST7735_BUSY (-1)
  23. #define ST7735_BL (0 + 15)
  24. #define VTFT_CTRL (0 + 13)
  25. #define PIN_TFT_CS ST7735_CS
  26. #define PIN_TFT_DC ST7735_RS
  27. #define PIN_TFT_SDA ST7735_SDA
  28. #define PIN_TFT_SCL ST7735_SCK
  29. #define PIN_TFT_RST ST7735_RESET
  30. #define PIN_TFT_LEDA_CTL ST7735_BL
  31. #define PIN_TFT_LEDA_CTL_ACTIVE LOW
  32. #define PIN_TFT_VDD_CTL VTFT_CTRL
  33. #define PIN_TFT_VDD_CTL_ACTIVE LOW
  34. #define DISPLAY_ROTATION 3
  35. ////////////////////////////////////////////////////////////////////////////////
  36. // Builtin LEDs
  37. #define PIN_LED1 (0 + 16)
  38. #define LED_BUILTIN PIN_LED1
  39. #define PIN_LED LED_BUILTIN
  40. #define LED_RED (-1)
  41. #define LED_BLUE (-1)
  42. #define LED_GREEN (-1)
  43. #define LED_PIN LED_BUILTIN
  44. #define LED_STATE_ON LOW
  45. ////////////////////////////////////////////////////////////////////////////////
  46. // Builtin buttons
  47. #define PIN_BUTTON1 (32 + 10)
  48. #define PIN_BUTTON2 (0 + 14)
  49. #define BUTTON_PIN PIN_BUTTON1
  50. #define BUTTON_PIN2 PIN_BUTTON2
  51. #define PIN_USER_BTN BUTTON_PIN
  52. ////////////////////////////////////////////////////////////////////////////////
  53. // UART
  54. // No longer populated on PCB.
  55. #define PIN_SERIAL2_RX (-1)
  56. #define PIN_SERIAL2_TX (-1)
  57. ////////////////////////////////////////////////////////////////////////////////
  58. // I2C
  59. #define WIRE_INTERFACES_COUNT (1)
  60. #define PIN_WIRE_SDA (32 + 3)
  61. #define PIN_WIRE_SCL (0 + 10)
  62. #define PIN_SENSOR_EN (32 + 6)
  63. #define PIN_SENSOR_EN_ACTIVE LOW
  64. ////////////////////////////////////////////////////////////////////////////////
  65. // LoRa
  66. #define USE_SX1262
  67. #define SX126X_CS (32 + 11)
  68. #define LORA_CS SX126X_CS
  69. #define SX126X_DIO1 (0 + 31)
  70. #define SX126X_BUSY (0 + 29)
  71. #define SX126X_RESET (0 + 2)
  72. #define SX126X_DIO2_AS_RF_SWITCH true
  73. #define SX126X_DIO3_TCXO_VOLTAGE 1.8
  74. #define SX126X_CURRENT_LIMIT 140
  75. #define SX126X_RX_BOOSTED_GAIN 1
  76. #define P_LORA_DIO_1 SX126X_DIO1
  77. #define P_LORA_NSS LORA_CS
  78. #define P_LORA_RESET SX126X_RESET
  79. #define P_LORA_BUSY SX126X_BUSY
  80. #define P_LORA_TX_LED PIN_LED1
  81. ////////////////////////////////////////////////////////////////////////////////
  82. // SPI
  83. #define SPI_INTERFACES_COUNT (2)
  84. #define PIN_SPI_MISO (0 + 3)
  85. #define PIN_SPI_MOSI (32 + 14)
  86. #define PIN_SPI_SCK (32 + 13)
  87. #define PIN_SPI_NSS LORA_CS
  88. #define PIN_SPI1_MISO ST7735_MISO
  89. #define PIN_SPI1_MOSI ST7735_SDA
  90. #define PIN_SPI1_SCK ST7735_SCK
  91. #define P_LORA_SCLK PIN_SPI_SCK
  92. #define P_LORA_MISO PIN_SPI_MISO
  93. #define P_LORA_MOSI PIN_SPI_MOSI
  94. ////////////////////////////////////////////////////////////////////////////////
  95. // GPS
  96. #define GPS_UC6580
  97. #define GPS_BAUD_RATE 115200
  98. #define PIN_GPS_RESET (0 + 26)
  99. #define GPS_RESET PIN_GPS_RESET
  100. #define GPS_RESET_MODE LOW
  101. #define PIN_GPS_RESET_ACTIVE LOW
  102. #define PIN_GPS_EN (0 + 4)
  103. #define GPS_EN PIN_GPS_EN
  104. #define GPS_EN_ACTIVE LOW
  105. #define PIN_GPS_EN_ACTIVE LOW
  106. #define PIN_GPS_PPS (32 + 9)
  107. #define GPS_TX_PIN (0 + 8)
  108. #define GPS_RX_PIN (0 + 7)
  109. #define PIN_GPS_TX GPS_TX_PIN
  110. #define PIN_GPS_RX GPS_RX_PIN
  111. #define PIN_SERIAL1_RX GPS_RX_PIN
  112. #define PIN_SERIAL1_TX GPS_TX_PIN
  113. ////////////////////////////////////////////////////////////////////////////////
  114. // Buzzer
  115. #define PIN_BUZZER (0 + 9)
  116. #define PIN_BUZZER_VOLTAGE_MULTIPLIER_1 (32 + 2)
  117. #define PIN_BUZZER_VOLTAGE_MULTIPLIER_2 (32 + 5)
  118. ////////////////////////////////////////////////////////////////////////////////
  119. // Battery
  120. #define ADC_CTRL (0 + 11)
  121. #define PIN_BAT_CTL ADC_CTRL
  122. #define ADC_CTRL_ENABLED HIGH
  123. #define BATTERY_PIN (0 + 5)
  124. #define PIN_VBAT_READ BATTERY_PIN
  125. #define ADC_RESOLUTION (14)
  126. #define AREF_VOLTAGE (3.0)
  127. #define VBAT_AR_INTERNAL AR_INTERNAL_3_0
  128. #define ADC_MULTIPLIER (4.916F)
  129. #define MV_LSB (3000.0F / 4096.0F)
  130. #define PWRMGT_VOLTAGE_BOOTLOCK 3100
  131. #define PWRMGT_LPCOMP_AIN 3
  132. #define PWRMGT_LPCOMP_REFSEL 1
  133. #define HAS_RTC 0