variant.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * variant.h
  3. * Copyright (C) 2023 Seeed K.K.
  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 (2)
  13. ////////////////////////////////////////////////////////////////////////////////
  14. // Power
  15. #define NRF_APM
  16. #define PIN_3V3_EN (38)
  17. #define BATTERY_PIN (3)
  18. #define ADC_MULTIPLIER (4.90F)
  19. #define ADC_RESOLUTION (14)
  20. #define BATTERY_SENSE_RES (12)
  21. #define AREF_VOLTAGE (3.0)
  22. #define MV_LSB (3000.0F / 4096.0F) // 12-bit ADC with 3.0V input range
  23. // Power management boot protection threshold (millivolts)
  24. // Set to 0 to disable boot protection
  25. #define PWRMGT_VOLTAGE_BOOTLOCK 3300 // Won't boot below this voltage (mV)
  26. // LPCOMP wake configuration (voltage recovery from SYSTEMOFF)
  27. // AIN1 = P0.03 = BATTERY_PIN / PIN_VBAT_READ
  28. #define PWRMGT_LPCOMP_AIN 1
  29. #define PWRMGT_LPCOMP_REFSEL 1 // 2/8 VDD (~3.68-4.04V)
  30. ////////////////////////////////////////////////////////////////////////////////
  31. // Number of pins
  32. #define PINS_COUNT (48)
  33. #define NUM_DIGITAL_PINS (48)
  34. #define NUM_ANALOG_INPUTS (1)
  35. #define NUM_ANALOG_OUTPUTS (0)
  36. // I2C pin definition
  37. #define PIN_WIRE_SDA (0 + 7)
  38. #define PIN_WIRE_SCL (0 + 8)
  39. // I2C bus 1
  40. // Available on header pins, for general use
  41. #define PIN_WIRE1_SDA (0 + 4)
  42. #define PIN_WIRE1_SCL (0 + 27)
  43. ////////////////////////////////////////////////////////////////////////////////
  44. // Builtin LEDs
  45. #define LED_BUILTIN (28)
  46. #define PIN_LED LED_BUILTIN
  47. #define LED_RED LED_BUILTIN
  48. #define LED_BLUE (-1) // No blue led, prevents Bluefruit flashing the green LED during advertising
  49. #define LED_PIN LED_BUILTIN
  50. #define LED_STATE_ON 1
  51. // #define PIN_NEOPIXEL (-1)
  52. // #define NEOPIXEL_NUM (2)
  53. ////////////////////////////////////////////////////////////////////////////////
  54. // Builtin buttons
  55. #define PIN_BUTTON1 (32 + 10)
  56. #define BUTTON_PIN PIN_BUTTON1
  57. // #define PIN_BUTTON2 (11)
  58. // #define BUTTON_PIN2 PIN_BUTTON2
  59. #define PIN_USER_BTN BUTTON_PIN
  60. ////////////////////////////////////////////////////////////////////////////////
  61. // Lora
  62. #define USE_SX1262
  63. #define LORA_CS (0 + 5)
  64. #define SX126X_DIO1 (0 + 21)
  65. #define SX126X_BUSY (0 + 19)
  66. #define SX126X_RESET (0 + 16)
  67. #define SX126X_DIO2_AS_RF_SWITCH
  68. #define SX126X_DIO3_TCXO_VOLTAGE 1.8
  69. ////////////////////////////////////////////////////////////////////////////////
  70. // SPI pin definition
  71. #define SPI_INTERFACES_COUNT (2)
  72. #define PIN_SPI_MISO (0 + 14)
  73. #define PIN_SPI_MOSI (0 + 11)
  74. #define PIN_SPI_SCK (32 + 8)
  75. #define PIN_SPI_NSS LORA_CS
  76. #define PIN_SPI1_MISO (-1)
  77. #define PIN_SPI1_MOSI (0+17)
  78. #define PIN_SPI1_SCK (0+20)
  79. ////////////////////////////////////////////////////////////////////////////////
  80. // GPS
  81. #define GPS_EN (0 + 6)
  82. #define GPS_RESET (32 + 14)
  83. #define PIN_SERIAL1_RX (0 + 23)
  84. #define PIN_SERIAL1_TX (0 + 25)
  85. #define PIN_SERIAL2_RX (0 + 9)
  86. #define PIN_SERIAL2_TX (0 + 10)
  87. ////////////////////////////////////////////////////////////////////////////////
  88. // TFT
  89. #define PIN_TFT_SCL (0 + 20)
  90. #define PIN_TFT_SDA (0 + 17)
  91. #define PIN_TFT_RST (0 + 13)
  92. // #define PIN_TFT_VDD_CTL (0 + 26)
  93. #define PIN_TFT_LEDA_CTL (32 + 12)
  94. #define PIN_TFT_LEDA_CTL_ACTIVE LOW
  95. #define PIN_TFT_CS (0 + 22)
  96. #define PIN_TFT_DC (0 + 15)