|
| 1 | + /* |
| 2 | + Copyright (c) 2014-2015 Arduino LLC. All right reserved. |
| 3 | + Copyright (c) 2016 Sandeep Mistry All right reserved. |
| 4 | + This library is free software; you can redistribute it and/or |
| 5 | + modify it under the terms of the GNU Lesser General Public |
| 6 | + License as published by the Free Software Foundation; either |
| 7 | + version 2.1 of the License, or (at your option) any later version. |
| 8 | + This library is distributed in the hope that it will be useful, |
| 9 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 11 | + See the GNU Lesser General Public License for more details. |
| 12 | + You should have received a copy of the GNU Lesser General Public |
| 13 | + License along with this library; if not, write to the Free Software |
| 14 | + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 15 | +*/ |
| 16 | + |
| 17 | +#ifndef _VARIANT_FEATHER52_ |
| 18 | +#define _VARIANT_FEATHER52_ |
| 19 | + |
| 20 | +/** Master clock frequency */ |
| 21 | +#define VARIANT_MCK (64000000ul) |
| 22 | + |
| 23 | +/*---------------------------------------------------------------------------- |
| 24 | + * Headers |
| 25 | + *----------------------------------------------------------------------------*/ |
| 26 | + |
| 27 | +#include "WVariant.h" |
| 28 | + |
| 29 | +#ifdef __cplusplus |
| 30 | +extern "C" |
| 31 | +{ |
| 32 | +#endif // __cplusplus |
| 33 | + |
| 34 | +// Number of pins defined in PinDescription array |
| 35 | +#define PINS_COUNT (32u) |
| 36 | +#define NUM_DIGITAL_PINS (32u) |
| 37 | +#define NUM_ANALOG_INPUTS (8u) |
| 38 | +#define NUM_ANALOG_OUTPUTS (0u) |
| 39 | + |
| 40 | +// LEDs |
| 41 | +#define PIN_LED1 (17) |
| 42 | +#define PIN_LED2 (19) |
| 43 | + |
| 44 | +#define LED_BUILTIN PIN_LED1 |
| 45 | +#define LED_CONN PIN_LED2 |
| 46 | + |
| 47 | +#define LED_RED PIN_LED1 |
| 48 | +#define LED_BLUE PIN_LED2 |
| 49 | + |
| 50 | +#define LED_STATE_ON 1 // State when LED is litted |
| 51 | + |
| 52 | +// Buttons |
| 53 | +/* |
| 54 | +#define PIN_BUTTON1 (2) |
| 55 | +#define PIN_BUTTON2 (3) |
| 56 | +#define PIN_BUTTON3 (4) |
| 57 | +#define PIN_BUTTON4 (5) |
| 58 | +*/ |
| 59 | + |
| 60 | +/* |
| 61 | + * Analog pins |
| 62 | + */ |
| 63 | +#define PIN_A0 (2) |
| 64 | +#define PIN_A1 (3) |
| 65 | +#define PIN_A2 (4) |
| 66 | +#define PIN_A3 (5) |
| 67 | +#define PIN_A4 (28) |
| 68 | +#define PIN_A5 (29) |
| 69 | +#define PIN_A6 (30) |
| 70 | +#define PIN_A7 (31) |
| 71 | + |
| 72 | +static const uint8_t A0 = PIN_A0 ; |
| 73 | +static const uint8_t A1 = PIN_A1 ; |
| 74 | +static const uint8_t A2 = PIN_A2 ; |
| 75 | +static const uint8_t A3 = PIN_A3 ; |
| 76 | +static const uint8_t A4 = PIN_A4 ; |
| 77 | +static const uint8_t A5 = PIN_A5 ; |
| 78 | +static const uint8_t A6 = PIN_A6 ; |
| 79 | +static const uint8_t A7 = PIN_A7 ; |
| 80 | +#define ADC_RESOLUTION 14 |
| 81 | + |
| 82 | +// Other pins |
| 83 | +#define PIN_AREF (24) |
| 84 | +#define PIN_DFU (20) |
| 85 | +#define PIN_NFC1 (9) |
| 86 | +#define PIN_NFC2 (10) |
| 87 | + |
| 88 | +static const uint8_t AREF = PIN_AREF; |
| 89 | + |
| 90 | +/* |
| 91 | + * Serial interfaces |
| 92 | + */ |
| 93 | +// Serial |
| 94 | +#define PIN_SERIAL_RX (8) |
| 95 | +#define PIN_SERIAL_TX (6) |
| 96 | + |
| 97 | +/* |
| 98 | + * SPI Interfaces |
| 99 | + */ |
| 100 | +#define SPI_INTERFACES_COUNT 1 |
| 101 | + |
| 102 | +#define PIN_SPI_MISO (14) |
| 103 | +#define PIN_SPI_MOSI (13) |
| 104 | +#define PIN_SPI_SCK (12) |
| 105 | + |
| 106 | +static const uint8_t SS = 18 ; |
| 107 | +static const uint8_t MOSI = PIN_SPI_MOSI ; |
| 108 | +static const uint8_t MISO = PIN_SPI_MISO ; |
| 109 | +static const uint8_t SCK = PIN_SPI_SCK ; |
| 110 | + |
| 111 | +/* |
| 112 | + * Wire Interfaces |
| 113 | + */ |
| 114 | +#define WIRE_INTERFACES_COUNT 1 |
| 115 | + |
| 116 | +#define PIN_WIRE_SDA (25u) |
| 117 | +#define PIN_WIRE_SCL (26u) |
| 118 | + |
| 119 | + |
| 120 | +static inline bool isPinValid(uint32_t pin) |
| 121 | +{ |
| 122 | + return (pin < PINS_COUNT) && (pin != PIN_SERIAL_RX) && (pin != PIN_SERIAL_TX); |
| 123 | +} |
| 124 | + |
| 125 | +#ifdef __cplusplus |
| 126 | +} |
| 127 | +#endif |
| 128 | + |
| 129 | +/*---------------------------------------------------------------------------- |
| 130 | + * Arduino objects - C++ only |
| 131 | + *----------------------------------------------------------------------------*/ |
| 132 | + |
| 133 | +#endif |
0 commit comments