variant.h 4.1 KB

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