|
| 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_MESHTINY_ |
| 20 | +#define _VARIANT_MESHTINY_ |
| 21 | + |
| 22 | +#define MESHTINY |
| 23 | + |
| 24 | +// #define RAK4630 |
| 25 | + |
| 26 | +/** Master clock frequency */ |
| 27 | +#define VARIANT_MCK (64000000ul) |
| 28 | + |
| 29 | +#define USE_LFXO // Board uses 32khz crystal for LF |
| 30 | +// define USE_LFRC // Board uses RC for LF |
| 31 | + |
| 32 | +/*---------------------------------------------------------------------------- |
| 33 | + * Headers |
| 34 | + *----------------------------------------------------------------------------*/ |
| 35 | + |
| 36 | +#include "WVariant.h" |
| 37 | + |
| 38 | +#ifdef __cplusplus |
| 39 | +extern "C" { |
| 40 | +#endif // __cplusplus |
| 41 | + |
| 42 | +// Number of pins defined in PinDescription array |
| 43 | +#define PINS_COUNT (48) |
| 44 | +#define NUM_DIGITAL_PINS (48) |
| 45 | +#define NUM_ANALOG_INPUTS (6) |
| 46 | +#define NUM_ANALOG_OUTPUTS (0) |
| 47 | + |
| 48 | +// LEDs |
| 49 | +#define PIN_LED1 (35) |
| 50 | +#define PIN_LED2 (36) |
| 51 | + |
| 52 | +#define LED_BUILTIN PIN_LED1 |
| 53 | +#define LED_CONN PIN_LED2 |
| 54 | + |
| 55 | +#define LED_GREEN PIN_LED1 |
| 56 | +#define LED_BLUE PIN_LED2 |
| 57 | + |
| 58 | +#define LED_STATE_ON 1 // State when LED is litted |
| 59 | + |
| 60 | +/* |
| 61 | + * Encoder |
| 62 | + */ |
| 63 | +#define INPUTDRIVER_ENCODER_TYPE 2 |
| 64 | +#define INPUTDRIVER_ENCODER_UP 26 |
| 65 | +#define INPUTDRIVER_ENCODER_DOWN 4 |
| 66 | +#define INPUTDRIVER_ENCODER_BTN 28 |
| 67 | + |
| 68 | +#define CANNED_MESSAGE_MODULE_ENABLE 1 |
| 69 | + |
| 70 | +/* |
| 71 | + * Buzzer - PWM |
| 72 | + */ |
| 73 | +#define PIN_BUZZER 30 |
| 74 | + |
| 75 | +/* |
| 76 | + * Buttons |
| 77 | + */ |
| 78 | + |
| 79 | +#define PIN_BUTTON1 9 |
| 80 | +#define BUTTON_NEED_PULLUP |
| 81 | +#define PIN_BUTTON2 12 |
| 82 | +#define PIN_BUTTON3 24 |
| 83 | +#define PIN_BUTTON4 25 |
| 84 | + |
| 85 | +/* |
| 86 | + * Analog pins |
| 87 | + */ |
| 88 | +#define PIN_A0 (5) |
| 89 | +#define PIN_A1 (31) |
| 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 | +#define PIN_SERIAL1_RX (15) |
| 118 | +#define PIN_SERIAL1_TX (16) |
| 119 | + |
| 120 | +// Connected to Jlink CDC |
| 121 | +#define PIN_SERIAL2_RX (8) |
| 122 | +#define PIN_SERIAL2_TX (6) |
| 123 | + |
| 124 | +/* |
| 125 | + * SPI Interfaces |
| 126 | + */ |
| 127 | +#define SPI_INTERFACES_COUNT 2 |
| 128 | + |
| 129 | +#define PIN_SPI_MISO (45) |
| 130 | +#define PIN_SPI_MOSI (44) |
| 131 | +#define PIN_SPI_SCK (43) |
| 132 | + |
| 133 | +#define PIN_SPI1_MISO (29) // (0 + 29) |
| 134 | +#define PIN_SPI1_MOSI (30) // (0 + 30) |
| 135 | +#define PIN_SPI1_SCK (3) // (0 + 3) |
| 136 | + |
| 137 | +static const uint8_t SS = 42; |
| 138 | +static const uint8_t MOSI = PIN_SPI_MOSI; |
| 139 | +static const uint8_t MISO = PIN_SPI_MISO; |
| 140 | +static const uint8_t SCK = PIN_SPI_SCK; |
| 141 | + |
| 142 | +#define HAS_SCREEN 1 |
| 143 | +#define USE_SSD1306 |
| 144 | + |
| 145 | +/* |
| 146 | + * Wire Interfaces |
| 147 | + */ |
| 148 | +#define WIRE_INTERFACES_COUNT 1 |
| 149 | + |
| 150 | +#define PIN_WIRE_SDA (13) |
| 151 | +#define PIN_WIRE_SCL (14) |
| 152 | + |
| 153 | +// QSPI Pins |
| 154 | +#define PIN_QSPI_SCK 3 |
| 155 | +#define PIN_QSPI_CS 22 // Changed from 26 to avoid conflict with encoder |
| 156 | +#define PIN_QSPI_IO0 27 // Changed from 30 to avoid conflict with buzzer |
| 157 | +#define PIN_QSPI_IO1 29 |
| 158 | +#define PIN_QSPI_IO2 21 // Changed from 28 to avoid conflict with encoder button |
| 159 | +#define PIN_QSPI_IO3 2 |
| 160 | + |
| 161 | +// On-board QSPI Flash |
| 162 | +#define EXTERNAL_FLASH_DEVICES IS25LP080D |
| 163 | +#define EXTERNAL_FLASH_USE_QSPI |
| 164 | + |
| 165 | +#define USE_SX1262 |
| 166 | +#define SX126X_CS (42) |
| 167 | +#define SX126X_DIO1 (47) |
| 168 | +#define SX126X_BUSY (46) |
| 169 | +#define SX126X_RESET (38) |
| 170 | +#define SX126X_POWER_EN (37) |
| 171 | +// DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3 |
| 172 | +#define SX126X_DIO2_AS_RF_SWITCH |
| 173 | +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 |
| 174 | + |
| 175 | +// Testing USB detection |
| 176 | +#define NRF_APM |
| 177 | + |
| 178 | +#define PIN_3V3_EN (34) |
| 179 | + |
| 180 | +// Battery |
| 181 | +// The battery sense is hooked to pin A0 (5) |
| 182 | +#define BATTERY_PIN PIN_A0 |
| 183 | +// and has 12 bit resolution |
| 184 | +#define BATTERY_SENSE_RESOLUTION_BITS 12 |
| 185 | +#define BATTERY_SENSE_RESOLUTION 4096.0 |
| 186 | +#undef AREF_VOLTAGE |
| 187 | +#define AREF_VOLTAGE 3.0 |
| 188 | +#define VBAT_AR_INTERNAL AR_INTERNAL_3_0 |
| 189 | +#define ADC_MULTIPLIER 1.73 |
| 190 | + |
| 191 | +#ifdef __cplusplus |
| 192 | +} |
| 193 | +#endif |
| 194 | + |
| 195 | +/*---------------------------------------------------------------------------- |
| 196 | + * Arduino objects - C++ only |
| 197 | + *----------------------------------------------------------------------------*/ |
| 198 | + |
| 199 | +#endif |
0 commit comments