|
| 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 | +
|
| 6 | + This library is free software; you can redistribute it and/or |
| 7 | + modify it under the terms of the GNU Lesser General Public |
| 8 | + License as published by the Free Software Foundation; either |
| 9 | + version 2.1 of the License, or (at your option) any later version. |
| 10 | + This library is distributed in the hope that it will be useful, |
| 11 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 | + See the GNU Lesser General Public License for more details. |
| 14 | + You should have received a copy of the GNU Lesser General Public |
| 15 | + License along with this library; if not, write to the Free Software |
| 16 | + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 17 | +*/ |
| 18 | + |
| 19 | +#ifndef _VARIANT_RAK4630_ |
| 20 | +#define _VARIANT_RAK4630_ |
| 21 | + |
| 22 | +#define RAK4630 |
| 23 | + |
| 24 | +/** Master clock frequency */ |
| 25 | +#define VARIANT_MCK (64000000ul) |
| 26 | + |
| 27 | +#define USE_LFXO // Board uses 32khz crystal for LF |
| 28 | +// define USE_LFRC // Board uses RC for LF |
| 29 | + |
| 30 | +/*---------------------------------------------------------------------------- |
| 31 | + * Headers |
| 32 | + *----------------------------------------------------------------------------*/ |
| 33 | + |
| 34 | +#include "WVariant.h" |
| 35 | + |
| 36 | +#ifdef __cplusplus |
| 37 | +extern "C" |
| 38 | +{ |
| 39 | +#endif // __cplusplus |
| 40 | + |
| 41 | + /* |
| 42 | + * WisBlock Base GPIO definitions |
| 43 | + */ |
| 44 | + static const uint8_t WB_IO1 = 17; // SLOT_A SLOT_B |
| 45 | + static const uint8_t WB_IO2 = 34; // SLOT_A SLOT_B |
| 46 | + static const uint8_t WB_IO3 = 21; // SLOT_C |
| 47 | + static const uint8_t WB_IO4 = 4; // SLOT_C |
| 48 | + static const uint8_t WB_IO5 = 9; // SLOT_D |
| 49 | + static const uint8_t WB_IO6 = 10; // SLOT_D |
| 50 | + static const uint8_t WB_SW1 = 33; // IO_SLOT |
| 51 | + static const uint8_t WB_A0 = 5; // IO_SLOT |
| 52 | + static const uint8_t WB_A1 = 31; // IO_SLOT |
| 53 | + static const uint8_t WB_I2C1_SDA = 13; // SENSOR_SLOT IO_SLOT |
| 54 | + static const uint8_t WB_I2C1_SCL = 14; // SENSOR_SLOT IO_SLOT |
| 55 | + static const uint8_t WB_I2C2_SDA = 24; // IO_SLOT |
| 56 | + static const uint8_t WB_I2C2_SCL = 25; // IO_SLOT |
| 57 | + static const uint8_t WB_SPI_CS = 26; // IO_SLOT |
| 58 | + static const uint8_t WB_SPI_CLK = 3; // IO_SLOT |
| 59 | + static const uint8_t WB_SPI_MISO = 29; // IO_SLOT |
| 60 | + static const uint8_t WB_SPI_MOSI = 30; // IO_SLOT |
| 61 | + |
| 62 | +// Number of pins defined in PinDescription array |
| 63 | +#define PINS_COUNT (48) |
| 64 | +#define NUM_DIGITAL_PINS (48) |
| 65 | +#define NUM_ANALOG_INPUTS (6) |
| 66 | +#define NUM_ANALOG_OUTPUTS (0) |
| 67 | + |
| 68 | +// LEDs |
| 69 | +#define PIN_LED1 (35) |
| 70 | +#define PIN_LED2 (36) |
| 71 | + |
| 72 | +#define LED_BUILTIN PIN_LED1 |
| 73 | +#define LED_CONN PIN_LED2 |
| 74 | + |
| 75 | +#define LED_GREEN PIN_LED1 |
| 76 | +#define LED_BLUE PIN_LED2 |
| 77 | + |
| 78 | +#define LED_STATE_ON 1 // State when LED is litted |
| 79 | + |
| 80 | +/* |
| 81 | + * Buttons |
| 82 | + */ |
| 83 | +// RAK4631 has no buttons |
| 84 | + |
| 85 | +/* |
| 86 | + * Analog pins |
| 87 | + */ |
| 88 | +#define PIN_A0 (5) //(3) |
| 89 | +#define PIN_A1 (31) //(4) |
| 90 | +#define PIN_A2 (28) |
| 91 | +#define PIN_A3 (29) |
| 92 | +#define PIN_A4 (30) |
| 93 | +#define PIN_A5 (31) |
| 94 | +#define PIN_A6 (0xff) |
| 95 | +#define PIN_A7 (0xff) |
| 96 | + |
| 97 | + static const uint8_t A0 = PIN_A0; |
| 98 | + static const uint8_t A1 = PIN_A1; |
| 99 | + static const uint8_t A2 = PIN_A2; |
| 100 | + static const uint8_t A3 = PIN_A3; |
| 101 | + static const uint8_t A4 = PIN_A4; |
| 102 | + static const uint8_t A5 = PIN_A5; |
| 103 | + static const uint8_t A6 = PIN_A6; |
| 104 | + static const uint8_t A7 = PIN_A7; |
| 105 | +#define ADC_RESOLUTION 14 |
| 106 | + |
| 107 | +// Other pins |
| 108 | +#define PIN_AREF (2) |
| 109 | +#define PIN_NFC1 (9) |
| 110 | +#define PIN_NFC2 (10) |
| 111 | + |
| 112 | + static const uint8_t AREF = PIN_AREF; |
| 113 | + |
| 114 | +/* |
| 115 | + * Serial interfaces |
| 116 | + */ |
| 117 | +// TXD1 RXD1 on Base Board |
| 118 | +#define PIN_SERIAL1_RX (15) |
| 119 | +#define PIN_SERIAL1_TX (16) |
| 120 | + |
| 121 | +// TXD0 RXD0 on Base Board |
| 122 | +#define PIN_SERIAL2_RX (19) |
| 123 | +#define PIN_SERIAL2_TX (20) |
| 124 | + |
| 125 | +/* |
| 126 | + * SPI Interfaces |
| 127 | + */ |
| 128 | +#define SPI_INTERFACES_COUNT 1 |
| 129 | + |
| 130 | +#define PIN_SPI_MISO (29) |
| 131 | +#define PIN_SPI_MOSI (30) |
| 132 | +#define PIN_SPI_SCK (3) |
| 133 | + |
| 134 | + static const uint8_t SS = 26; |
| 135 | + static const uint8_t MOSI = PIN_SPI_MOSI; |
| 136 | + static const uint8_t MISO = PIN_SPI_MISO; |
| 137 | + static const uint8_t SCK = PIN_SPI_SCK; |
| 138 | + |
| 139 | +/* |
| 140 | + * Wire Interfaces |
| 141 | + */ |
| 142 | +#define WIRE_INTERFACES_COUNT 2 |
| 143 | + |
| 144 | +#define PIN_WIRE_SDA (13) |
| 145 | +#define PIN_WIRE_SCL (14) |
| 146 | + |
| 147 | +#define PIN_WIRE1_SDA (24) |
| 148 | +#define PIN_WIRE1_SCL (25) |
| 149 | + |
| 150 | + // QSPI Pins |
| 151 | + // QSPI occupied by GPIO's |
| 152 | + #define PIN_QSPI_SCK 3 // 19 |
| 153 | + #define PIN_QSPI_CS 26 // 17 |
| 154 | + #define PIN_QSPI_IO0 30 // 20 |
| 155 | + #define PIN_QSPI_IO1 29 // 21 |
| 156 | + #define PIN_QSPI_IO2 28 // 22 |
| 157 | + #define PIN_QSPI_IO3 2 // 23 |
| 158 | + |
| 159 | + // On-board QSPI Flash |
| 160 | + // No onboard flash |
| 161 | + #define EXTERNAL_FLASH_DEVICES IS25LP080D |
| 162 | + #define EXTERNAL_FLASH_USE_QSPI |
| 163 | + |
| 164 | +#ifdef __cplusplus |
| 165 | +} |
| 166 | +#endif |
| 167 | + |
| 168 | +/*---------------------------------------------------------------------------- |
| 169 | + * Arduino objects - C++ only |
| 170 | + *----------------------------------------------------------------------------*/ |
| 171 | + |
| 172 | +#endif |
0 commit comments