variant.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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_FEATHER52840_
  18. #define _VARIANT_FEATHER52840_
  19. /** Master clock frequency */
  20. #define VARIANT_MCK (64000000ul)
  21. // OpenPuck: verbatim copy of the core's feather_nrf52840_express variant with ONLY the LF clock
  22. // source flipped to the internal RC oscillator. The Pro Micro / SuperMini nRF52840 CLONES this firmware
  23. // targets have NO 32.768 kHz crystal, so the SoftDevice's LFXO config makes Bluefruit.begin() fail. RC works
  24. // on every board (incl. genuine Feathers); 250 ppm is well within BLE tolerance. Selected via build.variant.path
  25. // in the Makefile so the stock feather52840 pin map / USB identity are otherwise unchanged.
  26. // #define USE_LFXO -- disabled: no crystal on the clone boards
  27. #define USE_LFRC
  28. /*----------------------------------------------------------------------------
  29. * Headers
  30. *----------------------------------------------------------------------------*/
  31. #include "WVariant.h"
  32. #ifdef __cplusplus
  33. extern "C"
  34. {
  35. #endif // __cplusplus
  36. // Number of pins defined in PinDescription array
  37. #define PINS_COUNT (35)
  38. #define NUM_DIGITAL_PINS (35)
  39. #define NUM_ANALOG_INPUTS (6) // A6 is used for battery, A7 is analog reference
  40. #define NUM_ANALOG_OUTPUTS (0)
  41. // LEDs
  42. #define PIN_LED1 (3)
  43. #define PIN_LED2 (4)
  44. #define PIN_NEOPIXEL_POWER (34)
  45. #define PIN_NEOPIXEL (8)
  46. #define NEOPIXEL_NUM 1
  47. #define LED_BUILTIN PIN_LED1
  48. #define LED_CONN PIN_LED2
  49. #define LED_RED PIN_LED1
  50. #define LED_BLUE PIN_LED2
  51. #define LED_STATE_ON 1 // State when LED is litted
  52. /*
  53. * Buttons
  54. */
  55. #define PIN_BUTTON1 (7)
  56. /*
  57. * Analog pins
  58. */
  59. #define PIN_A0 (14)
  60. #define PIN_A1 (15)
  61. #define PIN_A2 (16)
  62. #define PIN_A3 (17)
  63. #define PIN_A4 (18)
  64. #define PIN_A5 (19)
  65. #define PIN_A6 (20)
  66. #define PIN_A7 (21)
  67. static const uint8_t A0 = PIN_A0 ;
  68. static const uint8_t A1 = PIN_A1 ;
  69. static const uint8_t A2 = PIN_A2 ;
  70. static const uint8_t A3 = PIN_A3 ;
  71. static const uint8_t A4 = PIN_A4 ;
  72. static const uint8_t A5 = PIN_A5 ;
  73. static const uint8_t A6 = PIN_A6 ;
  74. static const uint8_t A7 = PIN_A7 ;
  75. #define ADC_RESOLUTION 14
  76. // Other pins
  77. #define PIN_AREF PIN_A7
  78. #define PIN_VBAT PIN_A6
  79. #define PIN_NFC1 (33)
  80. #define PIN_NFC2 (2)
  81. static const uint8_t AREF = PIN_AREF;
  82. /*
  83. * Serial interfaces
  84. */
  85. #define PIN_SERIAL1_RX (1)
  86. #define PIN_SERIAL1_TX (0)
  87. /*
  88. * SPI Interfaces
  89. */
  90. #define SPI_INTERFACES_COUNT 1
  91. #define PIN_SPI_MISO (24)
  92. #define PIN_SPI_MOSI (25)
  93. #define PIN_SPI_SCK (26)
  94. static const uint8_t SS = (5);
  95. static const uint8_t MOSI = PIN_SPI_MOSI ;
  96. static const uint8_t MISO = PIN_SPI_MISO ;
  97. static const uint8_t SCK = PIN_SPI_SCK ;
  98. /*
  99. * Wire Interfaces
  100. */
  101. #define WIRE_INTERFACES_COUNT 1
  102. #define PIN_WIRE_SDA (22)
  103. #define PIN_WIRE_SCL (23)
  104. // QSPI Pins
  105. #define PIN_QSPI_SCK 27
  106. #define PIN_QSPI_CS 28
  107. #define PIN_QSPI_IO0 29
  108. #define PIN_QSPI_IO1 30
  109. #define PIN_QSPI_IO2 31
  110. #define PIN_QSPI_IO3 32
  111. // On-board QSPI Flash
  112. #define EXTERNAL_FLASH_DEVICES GD25Q16C
  113. #define EXTERNAL_FLASH_USE_QSPI
  114. #ifdef __cplusplus
  115. }
  116. #endif
  117. /*----------------------------------------------------------------------------
  118. * Arduino objects - C++ only
  119. *----------------------------------------------------------------------------*/
  120. #endif