variant.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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_RAK4630_
  18. #define _VARIANT_RAK4630_
  19. #define RAK4630
  20. /** Master clock frequency */
  21. #define VARIANT_MCK (64000000ul)
  22. #define USE_LFXO // Board uses 32khz crystal for LF
  23. // define USE_LFRC // Board uses RC for LF
  24. /*----------------------------------------------------------------------------
  25. * Headers
  26. *----------------------------------------------------------------------------*/
  27. #include "WVariant.h"
  28. #ifdef __cplusplus
  29. extern "C"
  30. {
  31. #endif // __cplusplus
  32. /*
  33. * WisBlock Base GPIO definitions
  34. */
  35. static const uint8_t WB_IO1 = 17; // SLOT_A SLOT_B
  36. static const uint8_t WB_IO2 = 34; // SLOT_A SLOT_B
  37. static const uint8_t WB_IO3 = 21; // SLOT_C
  38. static const uint8_t WB_IO4 = 4; // SLOT_C
  39. static const uint8_t WB_IO5 = 9; // SLOT_D
  40. static const uint8_t WB_IO6 = 10; // SLOT_D
  41. static const uint8_t WB_SW1 = 33; // IO_SLOT
  42. static const uint8_t WB_A0 = 5; // IO_SLOT
  43. static const uint8_t WB_A1 = 31; // IO_SLOT
  44. static const uint8_t WB_I2C1_SDA = 13; // SENSOR_SLOT IO_SLOT
  45. static const uint8_t WB_I2C1_SCL = 14; // SENSOR_SLOT IO_SLOT
  46. static const uint8_t WB_I2C2_SDA = 24; // IO_SLOT
  47. static const uint8_t WB_I2C2_SCL = 25; // IO_SLOT
  48. static const uint8_t WB_SPI_CS = 26; // IO_SLOT
  49. static const uint8_t WB_SPI_CLK = 3; // IO_SLOT
  50. static const uint8_t WB_SPI_MISO = 29; // IO_SLOT
  51. static const uint8_t WB_SPI_MOSI = 30; // IO_SLOT
  52. // Number of pins defined in PinDescription array
  53. #define PINS_COUNT (48)
  54. #define NUM_DIGITAL_PINS (48)
  55. #define NUM_ANALOG_INPUTS (6)
  56. #define NUM_ANALOG_OUTPUTS (0)
  57. // LEDs
  58. #define PIN_LED1 (35)
  59. #define PIN_LED2 (36)
  60. #define LED_BUILTIN PIN_LED1
  61. #define LED_CONN PIN_LED2
  62. #define LED_GREEN PIN_LED1
  63. #define LED_BLUE PIN_LED2
  64. #define LED_STATE_ON 1 // State when LED is litted
  65. /*
  66. * Buttons
  67. */
  68. // RAK4631 has no buttons
  69. /*
  70. * Analog pins
  71. */
  72. #define PIN_A0 (5) //(3)
  73. #define PIN_A1 (31) //(4)
  74. #define PIN_A2 (28)
  75. #define PIN_A3 (29)
  76. #define PIN_A4 (30)
  77. #define PIN_A5 (31)
  78. #define PIN_A6 (0xff)
  79. #define PIN_A7 (0xff)
  80. static const uint8_t A0 = PIN_A0;
  81. static const uint8_t A1 = PIN_A1;
  82. static const uint8_t A2 = PIN_A2;
  83. static const uint8_t A3 = PIN_A3;
  84. static const uint8_t A4 = PIN_A4;
  85. static const uint8_t A5 = PIN_A5;
  86. static const uint8_t A6 = PIN_A6;
  87. static const uint8_t A7 = PIN_A7;
  88. #define ADC_RESOLUTION 14
  89. // Other pins
  90. #define PIN_AREF (2)
  91. #define PIN_NFC1 (9)
  92. #define PIN_NFC2 (10)
  93. static const uint8_t AREF = PIN_AREF;
  94. /*
  95. * Serial interfaces
  96. */
  97. // TXD1 RXD1 on Base Board
  98. #define PIN_SERIAL1_RX (15)
  99. #define PIN_SERIAL1_TX (16)
  100. // TXD0 RXD0 on Base Board
  101. #define PIN_SERIAL2_RX (19)
  102. #define PIN_SERIAL2_TX (20)
  103. /*
  104. * SPI Interfaces
  105. */
  106. #define SPI_INTERFACES_COUNT 1
  107. #define PIN_SPI_MISO (29)
  108. #define PIN_SPI_MOSI (30)
  109. #define PIN_SPI_SCK (3)
  110. static const uint8_t SS = 26;
  111. static const uint8_t MOSI = PIN_SPI_MOSI;
  112. static const uint8_t MISO = PIN_SPI_MISO;
  113. static const uint8_t SCK = PIN_SPI_SCK;
  114. /*
  115. * Wire Interfaces
  116. */
  117. #define WIRE_INTERFACES_COUNT 2
  118. #define PIN_WIRE_SDA (13)
  119. #define PIN_WIRE_SCL (14)
  120. #define PIN_WIRE1_SDA (24)
  121. #define PIN_WIRE1_SCL (25)
  122. // QSPI Pins
  123. // QSPI occupied by GPIO's
  124. #define PIN_QSPI_SCK 3 // 19
  125. #define PIN_QSPI_CS 26 // 17
  126. #define PIN_QSPI_IO0 30 // 20
  127. #define PIN_QSPI_IO1 29 // 21
  128. #define PIN_QSPI_IO2 28 // 22
  129. #define PIN_QSPI_IO3 2 // 23
  130. // On-board QSPI Flash
  131. // No onboard flash
  132. #define EXTERNAL_FLASH_DEVICES IS25LP080D
  133. #define EXTERNAL_FLASH_USE_QSPI
  134. #ifdef __cplusplus
  135. }
  136. #endif
  137. /*----------------------------------------------------------------------------
  138. * Arduino objects - C++ only
  139. *----------------------------------------------------------------------------*/
  140. #endif