variant.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. * variant.h
  3. * Copyright (C) 2023 Seeed K.K.
  4. * MIT License
  5. */
  6. #pragma once
  7. #define _PINNUM(port, pin) ((port) * 32 + (pin))
  8. #include "WVariant.h"
  9. ////////////////////////////////////////////////////////////////////////////////
  10. // Low frequency clock source
  11. #define USE_LFXO // 32.768 kHz crystal oscillator
  12. #define VARIANT_MCK (64000000ul)
  13. #define WIRE_INTERFACES_COUNT (1)
  14. ////////////////////////////////////////////////////////////////////////////////
  15. // Power
  16. #define PIN_PWR_EN (30) // RT9080_EN
  17. #define BATTERY_PIN (0 + 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 (4) // (SDA)
  35. #define PIN_WIRE_SCL (2) // (SCL)
  36. ////////////////////////////////////////////////////////////////////////////////
  37. // SPI pin definition
  38. #define SPI_INTERFACES_COUNT (2)
  39. #define PIN_SPI_MISO (17) // (MISO)
  40. #define PIN_SPI_MOSI (15) // (MOSI)
  41. #define PIN_SPI_SCK (13) // (SCK)
  42. #define PIN_SPI_NSS (-1)
  43. ////////////////////////////////////////////////////////////////////////////////
  44. // QSPI FLASH
  45. #define PIN_QSPI_SCK (4)
  46. #define PIN_QSPI_CS (12)
  47. #define PIN_QSPI_IO0 (6)
  48. #define PIN_QSPI_IO1 (8)
  49. #define PIN_QSPI_IO2 (32 + 9)
  50. #define PIN_QSPI_IO3 (26)
  51. #define EXTERNAL_FLASH_DEVICES ZD25WQ32CEIGR
  52. #define EXTERNAL_FLASH_USE_QSPI
  53. ////////////////////////////////////////////////////////////////////////////////
  54. // Builtin LEDs
  55. #define LED_RED (32 + 14) // LED_3
  56. #define LED_BLUE (32 + 5) // LED_2
  57. #define LED_GREEN (32 + 7) // LED_1
  58. //#define PIN_STATUS_LED LED_BLUE
  59. #define LED_BUILTIN (-1)
  60. #define LED_PIN LED_BUILTIN
  61. #define LED_STATE_ON LOW
  62. ////////////////////////////////////////////////////////////////////////////////
  63. // Builtin buttons
  64. #define PIN_BUTTON1 (24) // BOOT
  65. #define BUTTON_PIN PIN_BUTTON1
  66. #define PIN_USER_BTN BUTTON_PIN
  67. #define PIN_BUTTON2 (18)
  68. #define BUTTON_PIN2 PIN_BUTTON2
  69. #define EXTERNAL_FLASH_DEVICES MX25R1635F
  70. #define EXTERNAL_FLASH_USE_QSPI
  71. ////////////////////////////////////////////////////////////////////////////////
  72. // Lora
  73. #define USE_SX1262
  74. #define LORA_CS (11)
  75. #define SX126X_POWER_EN (30)
  76. #define SX126X_DIO1 (32 + 8)
  77. #define SX126X_BUSY (14)
  78. #define SX126X_RESET (7)
  79. #define SX126X_RF_VC1 (27)
  80. #define SX126X_RF_VC2 (33)
  81. ////////////////////////////////////////////////////////////////////////////////
  82. // SPI1
  83. #define PIN_SPI1_MISO (-1)
  84. #define PIN_SPI1_MOSI (20)
  85. #define PIN_SPI1_SCK (19)
  86. // GxEPD2 needs that for a panel that is not even used !
  87. extern const int MISO;
  88. extern const int MOSI;
  89. extern const int SCK;
  90. ////////////////////////////////////////////////////////////////////////////////
  91. // Display
  92. // #define DISP_MISO (-1)
  93. #define DISP_MOSI (20)
  94. #define DISP_SCLK (19)
  95. #define DISP_CS (22)
  96. #define DISP_DC (21)
  97. #define DISP_RST (28)
  98. #define DISP_BUSY (3)
  99. #define DISP_POWER (32 + 12)
  100. // #define DISP_BACKLIGHT (-1)
  101. #define PIN_DISPLAY_CS DISP_CS
  102. #define PIN_DISPLAY_DC DISP_DC
  103. #define PIN_DISPLAY_RST DISP_RST
  104. #define PIN_DISPLAY_BUSY DISP_BUSY
  105. ////////////////////////////////////////////////////////////////////////////////
  106. // GPS
  107. #define PIN_GPS_RX (32 + 13) // RXD
  108. #define PIN_GPS_TX (32 + 15) // TXD
  109. #define GPS_EN (32 + 11) // POWER_RT9080_EN
  110. #define PIN_GPS_STANDBY (32 + 10)
  111. #define PIN_GPS_PPS (29) // 1PPS