|
| 1 | +/* |
| 2 | + This file is part of the WiFiNINA library. |
| 3 | + Copyright (c) 2021 Arduino SA. All rights reserved. |
| 4 | +
|
| 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 | +
|
| 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. See the GNU |
| 13 | + Lesser General Public License for more details. |
| 14 | +
|
| 15 | + You should have received a copy of the GNU Lesser General Public |
| 16 | + License along with this library; if not, write to the Free Software |
| 17 | + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | +*/ |
| 19 | + |
| 20 | +#ifdef ARDUINO_NANO_RP2040_CONNECT |
| 21 | + |
| 22 | +/****************************************************************************** |
| 23 | + * INCLUDE |
| 24 | + ******************************************************************************/ |
| 25 | + |
| 26 | +#include "nina_pins.h" /* variants/NANO_RP2040_CONNECT/ninaPins.h */ |
| 27 | +#include "wifi_drv.h" |
| 28 | + |
| 29 | +/****************************************************************************** |
| 30 | + * FUNCTION DEFINITION |
| 31 | + ******************************************************************************/ |
| 32 | + |
| 33 | +void pinMode(NinaPin pin, PinMode mode) |
| 34 | +{ |
| 35 | + WiFiDrv::wifiDriverInit(); |
| 36 | + Serial.print(__FUNCTION__); |
| 37 | + Serial.print(": pin = "); |
| 38 | + Serial.print(pin); |
| 39 | + Serial.print(", mode = "); |
| 40 | + Serial.println(mode); |
| 41 | + WiFiDrv::pinMode(static_cast<uint8_t>(pin), static_cast<uint8_t>(mode)); |
| 42 | +} |
| 43 | + |
| 44 | +PinStatus digitalRead(NinaPin pin) |
| 45 | +{ |
| 46 | + WiFiDrv::wifiDriverInit(); |
| 47 | + return WiFiDrv::digitalRead(static_cast<uint8_t>(pin)); |
| 48 | +} |
| 49 | + |
| 50 | +void digitalWrite(NinaPin pin, PinStatus value) |
| 51 | +{ |
| 52 | + WiFiDrv::wifiDriverInit(); |
| 53 | + Serial.print(__FUNCTION__); |
| 54 | + Serial.print(": pin = "); |
| 55 | + Serial.print(pin); |
| 56 | + Serial.print(", value = "); |
| 57 | + Serial.println(value); |
| 58 | + WiFiDrv::digitalWrite(static_cast<uint8_t>(pin), static_cast<uint8_t>(value)); |
| 59 | +} |
| 60 | + |
| 61 | +int analogRead(NinaPin pin) |
| 62 | +{ |
| 63 | + WiFiDrv::wifiDriverInit(); |
| 64 | + return WiFiDrv::analogRead(static_cast<uint8_t>(pin)); |
| 65 | +} |
| 66 | + |
| 67 | +void analogWrite(NinaPin pin, int value) |
| 68 | +{ |
| 69 | + WiFiDrv::wifiDriverInit(); |
| 70 | + WiFiDrv::analogWrite(static_cast<uint8_t>(pin), static_cast<uint8_t>(value)); |
| 71 | +} |
| 72 | + |
| 73 | +#endif /* ARDUINO_NANO_RP2040_CONNECT */ |
0 commit comments