variant.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. * variant.h
  3. * MIT License
  4. */
  5. #pragma once
  6. #include "WVariant.h"
  7. ////////////////////////////////////////////////////////////////////////////////
  8. // Low frequency clock source
  9. #define USE_LFXO // 32.768 kHz crystal oscillator
  10. #define VARIANT_MCK (64000000ul)
  11. ////////////////////////////////////////////////////////////////////////////////
  12. // Power
  13. #define BATTERY_PIN (0 + 29)
  14. #define PIN_BAT_CTRL (32 + 2)
  15. #define ADC_MULTIPLIER (4.90F)
  16. #define ADC_RESOLUTION (14)
  17. #define BATTERY_SENSE_RES (12)
  18. #define AREF_VOLTAGE (3.0)
  19. ////////////////////////////////////////////////////////////////////////////////
  20. // Number of pins
  21. #define PINS_COUNT (48)
  22. #define NUM_DIGITAL_PINS (48)
  23. #define NUM_ANALOG_INPUTS (1)
  24. #define NUM_ANALOG_OUTPUTS (0)
  25. ////////////////////////////////////////////////////////////////////////////////
  26. // UART pin definition
  27. #define PIN_SERIAL1_RX (37)
  28. #define PIN_SERIAL1_TX (39)
  29. #define PIN_SERIAL2_RX (7)
  30. #define PIN_SERIAL2_TX (8)
  31. ////////////////////////////////////////////////////////////////////////////////
  32. // I2C pin definition
  33. #define WIRE_INTERFACES_COUNT (1)
  34. #define PIN_WIRE_SDA (32+15)
  35. #define PIN_WIRE_SCL (32+13)
  36. ////////////////////////////////////////////////////////////////////////////////
  37. // Builtin LEDs
  38. #define LED_BUILTIN (13)
  39. #define PIN_LED LED_BUILTIN
  40. #define LED_RED LED_BUILTIN
  41. #define LED_BLUE (-1) // No blue led, prevents Bluefruit flashing the green LED during advertising
  42. #define PIN_STATUS_LED LED_BUILTIN
  43. #define LED_STATE_ON LOW
  44. ////////////////////////////////////////////////////////////////////////////////
  45. // Builtin buttons
  46. #define PIN_BUTTON1 (32 + 10)
  47. #define BUTTON_PIN PIN_BUTTON1
  48. // #define PIN_BUTTON2 (0 + 18)
  49. // #define BUTTON_PIN2 PIN_BUTTON2
  50. #define PIN_USER_BTN BUTTON_PIN
  51. ////////////////////////////////////////////////////////////////////////////////
  52. // SPI pin definition
  53. #define SPI_INTERFACES_COUNT (2)
  54. // Lora
  55. #define USE_SX1262
  56. #define SX126X_CS (0 + 26)
  57. #define SX126X_DIO1 (0 + 16)
  58. #define SX126X_BUSY (0 + 15)
  59. #define SX126X_RESET (0 + 12)
  60. #define SX126X_DIO2_AS_RF_SWITCH true
  61. #define SX126X_DIO3_TCXO_VOLTAGE 1.8
  62. #define PIN_SPI_MISO (32 + 9)
  63. #define PIN_SPI_MOSI (0 + 5)
  64. #define PIN_SPI_SCK (0 + 4)
  65. #define LORA_CS SX126X_CS
  66. #define P_LORA_DIO_1 SX126X_DIO1
  67. #define P_LORA_NSS SX126X_CS
  68. #define P_LORA_RESET SX126X_RESET
  69. #define P_LORA_BUSY SX126X_BUSY
  70. #define P_LORA_SCLK PIN_SPI_SCK
  71. #define P_LORA_MISO PIN_SPI_MISO
  72. #define P_LORA_MOSI PIN_SPI_MOSI
  73. ////////////////////////////////////////////////////////////////////////////////
  74. // EInk
  75. #define PIN_DISPLAY_CS (24)
  76. #define PIN_DISPLAY_BUSY (32 + 6)
  77. #define PIN_DISPLAY_DC (31)
  78. #define PIN_DISPLAY_RST (32 + 4)
  79. #define PIN_SPI1_MISO (-1)
  80. #define PIN_SPI1_MOSI (20)
  81. #define PIN_SPI1_SCK (22)
  82. // GxEPD2 needs that for a panel that is not even used !
  83. extern const int MISO;
  84. extern const int MOSI;
  85. extern const int SCK;
  86. #undef HAS_GPS
  87. #define HAS_GPS 0
  88. #define HAS_RTC 0