variant.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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_T_IMPULSE_PLUS_NRF52840_
  18. #define _VARIANT_T_IMPULSE_PLUS_NRF52840_
  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 RC for LF
  23. /*----------------------------------------------------------------------------
  24. * Headers
  25. *----------------------------------------------------------------------------*/
  26. #include "WVariant.h"
  27. #ifdef __cplusplus
  28. extern "C"
  29. {
  30. #endif // __cplusplus
  31. #define _PINNUM(port, pin) ((port) * 32 + (pin))
  32. // IIC
  33. #define IIC_SDA_1 _PINNUM(1, 8)
  34. #define IIC_SCL_1 _PINNUM(0, 11)
  35. #define IIC_SDA_2 _PINNUM(0, 20)
  36. #define IIC_SCL_2 _PINNUM(0, 15)
  37. // TTP223
  38. #define TTP223_KEY _PINNUM(1, 4)
  39. // SSD1315
  40. #define SCREEN_WIDTH 128
  41. #define SCREEN_HEIGHT 64
  42. #define SCREEN_ADDRESS 0x3C
  43. #define SCREEN_RST -1
  44. #define SCREEN_SDA IIC_SDA_2
  45. #define SCREEN_SCL IIC_SCL_2
  46. // Lora S62F(SX1262)
  47. #define SX1262_CS _PINNUM(1, 14)
  48. #define SX1262_RST _PINNUM(0, 2)
  49. #define SX1262_SCLK _PINNUM(0, 3)
  50. #define SX1262_MOSI _PINNUM(0, 28)
  51. #define SX1262_MISO _PINNUM(0, 30)
  52. #define SX1262_BUSY _PINNUM(0, 31)
  53. #define SX1262_INT _PINNUM(0, 29)
  54. #define SX1262_DIO1 _PINNUM(0, 29)
  55. #define SX1262_DIO2 _PINNUM(1, 15)
  56. #define SX1262_RF_VC1 _PINNUM(1, 13)
  57. #define SX1262_RF_VC2 _PINNUM(1, 7)
  58. #define SX126X_TXEN SX1262_RF_VC1
  59. #define SX126X_RXEN SX1262_RF_VC2
  60. #define P_LORA_NSS SX1262_CS
  61. #define P_LORA_DIO_1 SX1262_DIO1
  62. #define P_LORA_RESET SX1262_RST
  63. #define P_LORA_BUSY SX1262_BUSY
  64. #define P_LORA_DIO_0 RADIOLIB_NC
  65. #define P_LORA_DIO_2 SX1262_DIO2
  66. #define P_LORA_SCLK SX1262_SCLK
  67. #define P_LORA_MISO SX1262_MISO
  68. #define P_LORA_MOSI SX1262_MOSI
  69. // RT9080
  70. #define RT9080_EN _PINNUM(0, 14)
  71. // GPS
  72. #define GPS_EN _PINNUM(1, 10)
  73. #define GPS_UART_RX _PINNUM(1, 11)
  74. #define GPS_UART_TX _PINNUM(1, 12)
  75. #define PIN_GPS_RX GPS_UART_TX
  76. #define PIN_GPS_TX GPS_UART_RX
  77. #define PIN_GPS_EN GPS_EN
  78. #define GPS_BAUD_RATE 38400
  79. #define PIN_GPS_EN_ACTIVE LOW
  80. // Battery
  81. #define BATTERY_MEASUREMENT_CONTROL _PINNUM(0, 25)
  82. #define BATTERY_ADC_DATA _PINNUM(0, 5)
  83. // Number of pins defined in PinDescription array
  84. #define PINS_COUNT (48)
  85. #define NUM_DIGITAL_PINS (48)
  86. #define NUM_ANALOG_INPUTS (6)
  87. #define NUM_ANALOG_OUTPUTS (0)
  88. // LEDs
  89. #define PIN_LED1 (_PINNUM(0, 17))
  90. // #define PIN_LED2 (_PINNUM(1, 5))
  91. // #define PIN_LED3 (15)
  92. // #define PIN_LED4 (16)
  93. #define LED_BUILTIN PIN_LED1
  94. // #define LED_CONN PIN_LED2
  95. // #define LED_RED PIN_LED1
  96. #define LED_BLUE PIN_LED1
  97. #define LED_STATE_ON 0 // State when LED is litted
  98. /*
  99. * Buttons
  100. */
  101. #define PIN_BUTTON1 _PINNUM(0, 24)
  102. // #define PIN_BUTTON2 12
  103. // #define PIN_BUTTON3 24
  104. // #define PIN_BUTTON4 25
  105. /*
  106. * Analog pins
  107. */
  108. #define PIN_A0 (3)
  109. #define PIN_A1 (4)
  110. #define PIN_A2 (28)
  111. #define PIN_A3 (29)
  112. #define PIN_A4 (30)
  113. #define PIN_A5 (31)
  114. #define PIN_A6 (0xff)
  115. #define PIN_A7 (0xff)
  116. static const uint8_t A0 = PIN_A0 ;
  117. static const uint8_t A1 = PIN_A1 ;
  118. static const uint8_t A2 = PIN_A2 ;
  119. static const uint8_t A3 = PIN_A3 ;
  120. static const uint8_t A4 = PIN_A4 ;
  121. static const uint8_t A5 = PIN_A5 ;
  122. static const uint8_t A6 = PIN_A6 ;
  123. static const uint8_t A7 = PIN_A7 ;
  124. #define ADC_RESOLUTION 14
  125. // Other pins
  126. #define PIN_AREF (2)
  127. #define PIN_NFC1 (9)
  128. #define PIN_NFC2 (10)
  129. static const uint8_t AREF = PIN_AREF;
  130. /*
  131. * Serial interfaces
  132. */
  133. // Arduino Header D0, D1
  134. #define PIN_SERIAL1_RX (33) // P1.01
  135. #define PIN_SERIAL1_TX (34) // P1.02
  136. // Connected to Jlink CDC
  137. #define PIN_SERIAL2_RX (8)
  138. #define PIN_SERIAL2_TX (6)
  139. /*
  140. * SPI Interfaces
  141. */
  142. #define SPI_INTERFACES_COUNT 1
  143. #define PIN_SPI_MISO (46)
  144. #define PIN_SPI_MOSI (45)
  145. #define PIN_SPI_SCK (47)
  146. static const uint8_t SS = 44 ;
  147. static const uint8_t MOSI = PIN_SPI_MOSI ;
  148. static const uint8_t MISO = PIN_SPI_MISO ;
  149. static const uint8_t SCK = PIN_SPI_SCK ;
  150. /*
  151. * Wire Interfaces
  152. */
  153. #define WIRE_INTERFACES_COUNT 2
  154. #define PIN_WIRE_SDA (26)
  155. #define PIN_WIRE_SCL (27)
  156. #define PIN_WIRE1_SDA (26)
  157. #define PIN_WIRE1_SCL (27)
  158. // ZD25WQ32CEIGR SPI
  159. #define ZD25WQ32C_CS _PINNUM(0, 12)
  160. #define ZD25WQ32C_SCLK _PINNUM(0, 4)
  161. #define ZD25WQ32C_MOSI _PINNUM(0, 6)
  162. #define ZD25WQ32C_MISO _PINNUM(1, 9)
  163. #define ZD25WQ32C_IO0 _PINNUM(0, 6)
  164. #define ZD25WQ32C_IO1 _PINNUM(1, 9)
  165. #define ZD25WQ32C_IO2 _PINNUM(0, 8)
  166. #define ZD25WQ32C_IO3 _PINNUM(0, 26)
  167. #define PIN_QSPI_SCK ZD25WQ32C_SCLK
  168. #define PIN_QSPI_CS ZD25WQ32C_CS
  169. #define PIN_QSPI_IO0 ZD25WQ32C_IO0
  170. #define PIN_QSPI_IO1 ZD25WQ32C_IO1
  171. #define PIN_QSPI_IO2 ZD25WQ32C_IO2
  172. #define PIN_QSPI_IO3 ZD25WQ32C_IO3
  173. // On-board QSPI Flash
  174. #define EXTERNAL_FLASH_DEVICES MX25R6435F
  175. #define EXTERNAL_FLASH_USE_QSPI
  176. #ifdef __cplusplus
  177. }
  178. #endif
  179. /*----------------------------------------------------------------------------
  180. * Arduino objects - C++ only
  181. *----------------------------------------------------------------------------*/
  182. #endif