variant.h 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #ifndef _MESHTINY_H_
  2. #define _MESHTINY_H_
  3. /** Master clock frequency */
  4. #define VARIANT_MCK (64000000ul)
  5. #define USE_LFXO // Board uses 32khz crystal for LF
  6. /*----------------------------------------------------------------------------
  7. * Headers
  8. *----------------------------------------------------------------------------*/
  9. #include "WVariant.h"
  10. #define PINS_COUNT (48)
  11. #define NUM_DIGITAL_PINS (48)
  12. #define NUM_ANALOG_INPUTS (6)
  13. #define NUM_ANALOG_OUTPUTS (0)
  14. // LEDs
  15. #define PIN_LED1 (35) // Green LED
  16. #define PIN_LED2 (36) // Blue LED
  17. #define LED_RED (-1)
  18. #define LED_GREEN PIN_LED1
  19. #define LED_BLUE (-1) // Disable annoying flashing caused by Bluefruit
  20. #define P_LORA_TX_LED PIN_LED2 // Blue LED
  21. // #define PIN_STATUS_LED LED_GREEN // disable status led.
  22. #define LED_BUILTIN LED_GREEN
  23. #define PIN_LED LED_BUILTIN
  24. #define LED_PIN LED_BUILTIN
  25. #define LED_STATE_ON HIGH
  26. // Buttons
  27. #define PIN_BUTTON1 (9) // side button
  28. #define PIN_BUTTON2 (4) // encoder left
  29. #define PIN_BUTTON3 (26) // encoder right
  30. #define PIN_BUTTON4 (28) // encoder press
  31. #define PIN_SIDE_BUTTON PIN_BUTTON1
  32. #define ENCODER_LEFT PIN_BUTTON2
  33. #define ENCODER_RIGHT PIN_BUTTON3
  34. #define ENCODER_PRESS PIN_BUTTON4
  35. #define PIN_USER_BTN PIN_SIDE_BUTTON
  36. // VBAT sensing
  37. #define PIN_VBAT_READ (5)
  38. #define BATTERY_SENSE_RESOLUTION_BITS 12
  39. #define BATTERY_SENSE_RESOLUTION 4096.0
  40. #define AREF_VOLTAGE 3.0
  41. #define VBAT_AR_INTERNAL AR_INTERNAL_3_0
  42. #define ADC_MULTIPLIER 1.73
  43. #define ADC_RESOLUTION 14
  44. // Serial interfaces
  45. #define PIN_SERIAL1_RX (15)
  46. #define PIN_SERIAL1_TX (16)
  47. #define PIN_SERIAL2_RX (8) // Connected to Jlink CDC
  48. #define PIN_SERIAL2_TX (6)
  49. // SPI Interfaces
  50. #define SPI_INTERFACES_COUNT 2
  51. #define PIN_SPI_MISO (45)
  52. #define PIN_SPI_MOSI (44)
  53. #define PIN_SPI_SCK (43)
  54. #define PIN_SPI1_MISO (29)
  55. #define PIN_SPI1_MOSI (30)
  56. #define PIN_SPI1_SCK (3)
  57. // LoRa SX1262 module pins
  58. #define P_LORA_SCLK PIN_SPI_SCK
  59. #define P_LORA_MISO PIN_SPI_MISO
  60. #define P_LORA_MOSI PIN_SPI_MOSI
  61. #define P_LORA_DIO_1 (47)
  62. #define P_LORA_RESET (38)
  63. #define P_LORA_BUSY (46)
  64. #define P_LORA_NSS (42)
  65. #define SX126X_POWER_EN (37)
  66. #define SX126X_RXEN RADIOLIB_NC
  67. #define SX126X_TXEN RADIOLIB_NC
  68. #define SX126X_DIO2_AS_RF_SWITCH true
  69. #define SX126X_DIO3_TCXO_VOLTAGE (1.8f)
  70. // Wire Interfaces
  71. #define WIRE_INTERFACES_COUNT 1
  72. #define PIN_WIRE_SDA (13)
  73. #define PIN_WIRE_SCL (14)
  74. #define PIN_BOARD_SDA (13)
  75. #define PIN_BOARD_SCL (14)
  76. // Power control
  77. #define PIN_3V3_EN (34) // nothing connected on meshtiny board
  78. #endif // _MESHTINY_H_