|
| 1 | +/* |
| 2 | + If you don't use an nRF5 board, you can ignore this file. |
| 3 | + |
| 4 | + This file was part of the "My Sensors nRF5 Boards" board repository |
| 5 | + available at https://github.com/mysensors/ArduinoBoards If you have |
| 6 | + questions, please refer the documentation at |
| 7 | + https://github.com/mysensors/ArduinoHwNRF5 first. |
| 8 | + |
| 9 | + This file is compatible with ArduinoHwNRF5 >= 0.2.0 |
| 10 | +
|
| 11 | + This file allows you to change the relation between pins referenced in |
| 12 | + the Arduino IDE (0..31) and pins of the nRF5 MCU (P0.00..P0.31). |
| 13 | + |
| 14 | + If you can live with addressing the GPIO pins by using the Arduino pins |
| 15 | + 0..31 instead of a custom mapping, don't change this file. If you have |
| 16 | + a lot of Arduino code with fixed pin numbers and you need to map these |
| 17 | + pins to specific pins of the nRF5 MCU; you need to change this file. |
| 18 | + |
| 19 | + If you fill the "g_APinDescription" Array with numbers between 0..31, |
| 20 | + the Arduino pins 0..31 are assigned to pins P0.00..P0.31 of the MCU. |
| 21 | + |
| 22 | + As an example, if you need to change the pin mapping for Arduino pin 5 |
| 23 | + to P0.12 of the MCU, you have to write the 12 after PORT0 into the sixth |
| 24 | + position in the "g_APinDescription" Array. |
| 25 | + |
| 26 | + The extended attributes only affects the nRF5 variants provided with |
| 27 | + official Arduino boards. The arduino-nrf5 variant ignores the extended |
| 28 | + attributes. |
| 29 | + |
| 30 | + The pin mapping effects commands like "pinMode()", "digitalWrite()", |
| 31 | + "analogRead()" and "analogWrite()". |
| 32 | + |
| 33 | + If you change the pin mapping, you have to modify the pins in |
| 34 | + "MyBoardNRF5.h". Especially the analog pin mapping must be replaced with |
| 35 | + your pin numbers by replacing PIN_AIN0..7 with a number of your mapping |
| 36 | + array. You can use the constants PIN_AIN0..7 in the "g_APinDescription" |
| 37 | + Array if you want to reference analog ports MCU independent. You cannot |
| 38 | + use the pins P0.00 and P0.01 for GPIO, when the 32kHz crystal is connected. |
| 39 | +
|
| 40 | + |
| 41 | + ########################################################################### |
| 42 | +
|
| 43 | + Copyright (c) 2014-2015 Arduino LLC. All right reserved. |
| 44 | + Copyright (c) 2016 Arduino Srl. All right reserved. |
| 45 | + Copyright (c) 2017 Sensnology AB. All right reserved. |
| 46 | +
|
| 47 | + This library is free software; you can redistribute it and/or |
| 48 | + modify it under the terms of the GNU Lesser General Public |
| 49 | + License as published by the Free Software Foundation; either |
| 50 | + version 2.1 of the License, or (at your option) any later version. |
| 51 | +
|
| 52 | + This library is distributed in the hope that it will be useful, |
| 53 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 54 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 55 | + See the GNU Lesser General Public License for more details. |
| 56 | +
|
| 57 | + You should have received a copy of the GNU Lesser General Public |
| 58 | + License along with this library; if not, write to the Free Software |
| 59 | + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 60 | +*/ |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | +#ifdef MYNRF5BOARD |
| 65 | +#include <variant.h> |
| 66 | + |
| 67 | +/* |
| 68 | + * Pins descriptions. Attributes are ignored by arduino-nrf5 variant. |
| 69 | + * Definition taken from Arduino Primo Core with ordered ports |
| 70 | + */ |
| 71 | +const PinDescription g_APinDescription[]= |
| 72 | +{ |
| 73 | + { NOT_A_PORT, 0, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER}, // LFCLK |
| 74 | + { NOT_A_PORT, 1, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER}, // LFCLK |
| 75 | + { PORT0, 2, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), ADC_A0, PWM4, NOT_ON_TIMER}, |
| 76 | + { PORT0, 3, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), ADC_A1, PWM5, NOT_ON_TIMER}, |
| 77 | + { PORT0, 4, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), ADC_A2, PWM6, NOT_ON_TIMER}, |
| 78 | + { PORT0, 5, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), ADC_A3, PWM7, NOT_ON_TIMER}, |
| 79 | + { PORT0, 6, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER}, // INT3 |
| 80 | + { PORT0, 7, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER}, // INT4 |
| 81 | + { PORT0, 8, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), No_ADC_Channel, PWM10, NOT_ON_TIMER}, //USER_LED |
| 82 | + { PORT0, 9, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER}, // NFC1 |
| 83 | + { PORT0, 10, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER}, // NFC2 |
| 84 | + { PORT0, 11, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER}, // TX |
| 85 | + { PORT0, 12, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER}, // RX |
| 86 | + { PORT0, 13, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER}, // SDA |
| 87 | + { PORT0, 14, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER}, // SCL |
| 88 | + { PORT0, 15, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER}, // SDA1 |
| 89 | + { PORT0, 16, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER}, // SCL1 |
| 90 | + { PORT0, 17, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER}, // TP4 |
| 91 | + { PORT0, 18, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER}, // TP5 |
| 92 | + { PORT0, 19, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER}, // INT2 |
| 93 | + { PORT0, 20, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER}, // INT1 |
| 94 | + { PORT0, 21, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER}, // INT1 |
| 95 | + { PORT0, 22, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), No_ADC_Channel, PWM9, NOT_ON_TIMER}, |
| 96 | + { PORT0, 23, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), No_ADC_Channel, PWM8, NOT_ON_TIMER}, |
| 97 | + { PORT0, 24, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER}, // INT |
| 98 | + { PORT0, 25, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), No_ADC_Channel, PWM11, NOT_ON_TIMER}, //RED_LED |
| 99 | + { PORT0, 26, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), No_ADC_Channel, PWM11, NOT_ON_TIMER}, //GREEN_LED |
| 100 | + { PORT0, 27, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), No_ADC_Channel, PWM11, NOT_ON_TIMER}, //BLUE_LED |
| 101 | + { PORT0, 28, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), ADC_A4, PWM3, NOT_ON_TIMER}, |
| 102 | + { PORT0, 29, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), ADC_A5, PWM2, NOT_ON_TIMER}, |
| 103 | + { PORT0, 30, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), ADC_A6, PWM1, NOT_ON_TIMER}, |
| 104 | + { PORT0, 31, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), ADC_A7, PWM0, NOT_ON_TIMER} |
| 105 | +}; |
| 106 | + |
| 107 | +#endif |
0 commit comments