variant.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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 USE_LFRC // 32.768 kHz RC oscillator
  13. ////////////////////////////////////////////////////////////////////////////////
  14. // Number of pins
  15. #define PINS_COUNT (48)
  16. #define NUM_DIGITAL_PINS (48)
  17. #define NUM_ANALOG_INPUTS (1)
  18. #define NUM_ANALOG_OUTPUTS (0)
  19. ////////////////////////////////////////////////////////////////////////////////
  20. // Power
  21. #define NRF_APM // detect usb power
  22. #define EXT_CHRG_DETECT (32) // P1.3
  23. #define EXT_PWR_DETECT (31) // P0.5
  24. #define PIN_VBAT_READ (5)
  25. #define AREF_VOLTAGE (2.4f)
  26. #define ADC_MULTIPLIER (2.0) //(1.75f)
  27. // 2.0 gives more coherent value, 4.2V when charged, needs tweaking
  28. #define ADC_RESOLUTION (12)
  29. #define ADC_MAX (4096)
  30. #define EEPROM_POWER (7)
  31. #define BAT_POWER (17)
  32. #define PIN_PWR_EN (16)
  33. ////////////////////////////////////////////////////////////////////////////////
  34. // UART pin definition
  35. #define PIN_SERIAL1_RX PIN_GPS_TX
  36. #define PIN_SERIAL1_TX PIN_GPS_RX
  37. ////////////////////////////////////////////////////////////////////////////////
  38. // I2C pin definition
  39. #define HAS_WIRE (1)
  40. #define WIRE_INTERFACES_COUNT (1)
  41. #define PIN_WIRE_SDA (26) // P0.26
  42. #define PIN_WIRE_SCL (27) // P0.27
  43. #define I2C_NO_RESCAN
  44. ////////////////////////////////////////////////////////////////////////////////
  45. // SPI pin definition
  46. #define SPI_INTERFACES_COUNT (1)
  47. #define PIN_SPI_MISO (47) // P1.15
  48. #define PIN_SPI_MOSI (46) // P1.14
  49. #define PIN_SPI_SCK (45) // P1.13
  50. #define PIN_SPI_NSS (44) // P1.12
  51. ////////////////////////////////////////////////////////////////////////////////
  52. // Builtin LEDs
  53. #define LED_POWER (29)
  54. #define LED_BLUE (-1) // No blue led
  55. #define PIN_LED_BLUE (37)
  56. #define PIN_LED_GREEN (35) // P0.24
  57. #define PIN_LED_RED (33)
  58. #define LED_PIN PIN_LED_GREEN
  59. #define LED_BUILTIN PIN_LED_BLUE
  60. #define LED_STATE_ON LOW
  61. ////////////////////////////////////////////////////////////////////////////////
  62. // Builtin buttons
  63. #define PIN_BUTTON1 (12) // P0.12
  64. #define BUTTON_PIN PIN_BUTTON1
  65. ////////////////////////////////////////////////////////////////////////////////
  66. // GPS
  67. #define HAS_GPS 1
  68. #define PIN_GPS_RX (22)
  69. #define PIN_GPS_TX (20)
  70. #define PIN_GPS_POWER (14)
  71. #define PIN_GPS_EN (21) // STANDBY
  72. #define PIN_GPS_RESET (25) // REINIT
  73. #define GPS_RESET_ACTIVE LOW
  74. #define GPS_EN_ACTIVE HIGH
  75. #define GPS_BAUDRATE 9600
  76. ////////////////////////////////////////////////////////////////////////////////
  77. // Buzzer
  78. #define BUZZER_EN (37) // P1.5
  79. #define BUZZER_PIN (25) // P0.25