variant.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. /*
  2. Copyright (c) 2014-2015 Arduino LLC. All right reserved.
  3. Copyright (c) 2016 Sandeep Mistry All right reserved.
  4. Copyright (c) 2018, Adafruit Industries (adafruit.com)
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. This library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. See the GNU Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. */
  17. #ifndef _VARIANT_Nano_G2_
  18. #define _VARIANT_Nano_G2_
  19. /** Master clock frequency */
  20. #define VARIANT_MCK (64000000ul)
  21. #define USE_LFXO // Board uses 32khz crystal for LF
  22. // #define USE_LFRC // Board uses 32khz RC for LF
  23. /*----------------------------------------------------------------------------
  24. * Headers
  25. *----------------------------------------------------------------------------*/
  26. #include "WVariant.h"
  27. #ifdef __cplusplus
  28. extern "C"
  29. {
  30. #endif // __cplusplus
  31. // Number of pins defined in PinDescription array
  32. #define PINS_COUNT (48)
  33. #define NUM_DIGITAL_PINS (48)
  34. #define NUM_ANALOG_INPUTS (1)
  35. #define NUM_ANALOG_OUTPUTS (0)
  36. // LEDs
  37. #define PIN_LED1 (-1)
  38. #define PIN_LED2 (-1)
  39. #define PIN_LED3 (-1)
  40. #define LED_RED PIN_LED3
  41. #define LED_BLUE PIN_LED1
  42. #define LED_GREEN PIN_LED2
  43. #define LED_BUILTIN LED_BLUE
  44. #define LED_CONN PIN_GREEN
  45. #define LED_STATE_ON 0 // State when LED is lit
  46. /*
  47. * Buttons
  48. */
  49. #define PIN_BUTTON1 (32 + 6)
  50. #define EXT_NOTIFY_OUT (0 + 4) // Default pin to use for Ext Notify Module.
  51. /*
  52. * Analog pins
  53. */
  54. #define PIN_A4 (0 + 2) // Battery ADC
  55. #define BATTERY_PIN PIN_A4
  56. static const uint8_t A4 = PIN_A4;
  57. #define ADC_RESOLUTION 14
  58. /*
  59. * Serial interfaces
  60. */
  61. #define PIN_SERIAL2_RX (0 + 22)
  62. #define PIN_SERIAL2_TX (0 + 20)
  63. /**
  64. Wire Interfaces
  65. */
  66. #define WIRE_INTERFACES_COUNT 1
  67. #define PIN_WIRE_SDA (0 + 17)
  68. #define PIN_WIRE_SCL (0 + 15)
  69. #define PIN_RTC_INT (0 + 14) // Interrupt from the PCF8563 RTC
  70. /*
  71. External serial flash W25Q16JV_IQ
  72. */
  73. // QSPI Pins
  74. #define PIN_QSPI_SCK (0 + 8)
  75. #define PIN_QSPI_CS (32 + 7)
  76. #define PIN_QSPI_IO0 (0 + 6) // MOSI if using two bit interface
  77. #define PIN_QSPI_IO1 (0 + 26) // MISO if using two bit interface
  78. #define PIN_QSPI_IO2 (32 + 4) // WP if using two bit interface (i.e. not used)
  79. #define PIN_QSPI_IO3 (32 + 2) // HOLD if using two bit interface (i.e. not used)
  80. // On-board QSPI Flash
  81. #define EXTERNAL_FLASH_DEVICES W25Q16JV_IQ
  82. #define EXTERNAL_FLASH_USE_QSPI
  83. /*
  84. * Lora radio
  85. */
  86. #define USE_SX1262
  87. #define SX126X_CS (32 + 13) // FIXME - we really should define LORA_CS instead
  88. #define SX126X_DIO1 (32 + 10)
  89. // Note DIO2 is attached internally to the module to an analog switch for TX/RX switching
  90. // #define SX1262_DIO3 (0 + 21)
  91. // This is used as an *output* from the sx1262 and connected internally to power the tcxo, do not drive from the main CPU?
  92. #define SX126X_BUSY (32 + 11)
  93. #define SX126X_RESET (32 + 15)
  94. // DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3
  95. #define SX126X_DIO2_AS_RF_SWITCH
  96. #define SX126X_DIO3_TCXO_VOLTAGE 1.8
  97. // #define LORA_DISABLE_SENDING // Define this to disable transmission for testing (power testing etc...)
  98. // #undef SX126X_CS
  99. /*
  100. * GPS pins
  101. */
  102. #define GPS_L76K
  103. #define PIN_GPS_STANDBY (0 + 13) // An output to wake GPS, low means allow sleep, high means force wake STANDBY
  104. #define PIN_GPS_TX (0 + 9) // This is for bits going TOWARDS the CPU
  105. #define PIN_GPS_RX (0 + 10) // This is for bits going TOWARDS the GPS
  106. // #define GPS_THREAD_INTERVAL 50
  107. #define PIN_SERIAL1_RX PIN_GPS_TX
  108. #define PIN_SERIAL1_TX PIN_GPS_RX
  109. // PCF8563 RTC Module
  110. #define PCF8563_RTC 0x51
  111. /*
  112. * SPI Interfaces
  113. */
  114. #define SPI_INTERFACES_COUNT 1
  115. // For LORA, spi 0
  116. #define PIN_SPI_MISO (32 + 9)
  117. #define PIN_SPI_MOSI (0 + 11)
  118. #define PIN_SPI_SCK (0 + 12)
  119. // #define PIN_PWR_EN (0 + 6)
  120. // To debug via the segger JLINK console rather than the CDC-ACM serial device
  121. // #define USE_SEGGER
  122. // Battery
  123. // The battery sense is hooked to pin A0 (2)
  124. // it is defined in the anlaolgue pin section of this file
  125. // and has 12 bit resolution
  126. #define BATTERY_SENSE_RESOLUTION_BITS 12
  127. #define BATTERY_SENSE_RESOLUTION 4096.0
  128. #undef AREF_VOLTAGE
  129. #define AREF_VOLTAGE 3.0
  130. #define VBAT_AR_INTERNAL AR_INTERNAL_3_0
  131. #define ADC_MULTIPLIER (2.0F)
  132. #define HAS_RTC 1
  133. /**
  134. OLED Screen Model
  135. */
  136. #define ARDUINO_ARCH_AVR
  137. #define USE_SH1107_128_64
  138. #ifdef __cplusplus
  139. }
  140. #endif
  141. /*----------------------------------------------------------------------------
  142. * Arduino objects - C++ only
  143. *----------------------------------------------------------------------------*/
  144. #endif