diff --git a/DIO2.zip b/DIO2.zip index dcce940..74080a0 100644 Binary files a/DIO2.zip and b/DIO2.zip differ diff --git a/History/DIO2.1.6.0.zip b/History/DIO2.1.6.0.zip new file mode 100644 index 0000000..74080a0 Binary files /dev/null and b/History/DIO2.1.6.0.zip differ diff --git a/README.adoc b/README.adoc index 602b31a..ffaf5dc 100644 --- a/README.adoc +++ b/README.adoc @@ -7,14 +7,13 @@ Originaly written by Jan Dolinay, updated by Thierry Paris. Original sources from Jan available here: https://github.com/jdolinay/Arduino_DIO2 . Article here https://www.codeproject.com/Articles/732646/Fast-digital-I-O-for-Arduino For more information about this library please visit us at -http://www.locoduino.org/spip.php?article165 in french or -http://git.framasoft.org/locoduino.org/DIO2/wikis/home for both french and english. +http://www.locoduino.org/spip.php?article165 in french == License == Copyright (c) Jan Dolinay, All right reserved. -Copyright (c) 2016-2019 Locoduino.org. All right reserved. -Copyright (c) 2016-2019 Thierry Paris. All right reserved. +Copyright (c) 2016-2021 Locoduino.org. All right reserved. +Copyright (c) 2016-2021 Thierry Paris. All right reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/VStudio/.vs/DIO2/v16/Browse.VC.db b/VStudio/.vs/DIO2/v16/Browse.VC.db new file mode 100644 index 0000000..ae45766 Binary files /dev/null and b/VStudio/.vs/DIO2/v16/Browse.VC.db differ diff --git a/VStudio/DIO2.cpp b/VStudio/DIO2.cpp index 8a0ae1b..1b1e529 100644 --- a/VStudio/DIO2.cpp +++ b/VStudio/DIO2.cpp @@ -5,6 +5,7 @@ #include "DIO2.h" #include "ArduiEmulator.hpp" +#ifdef ARDUINO_ARCH_AVR void pinMode2(uint8_t pin, uint8_t mode) { pinMode(pin, mode); @@ -51,3 +52,15 @@ GPIO_pin_t Arduino_to_GPIO_pin(int inPin) { return gpio_pins_progmem[inPin]; } +#else +int GPIO_to_Arduino_pin(GPIO_pin_t inPin) +{ + return inPin; +} + +GPIO_pin_t Arduino_to_GPIO_pin(int inPin) +{ + return inPin; +} + +#endif diff --git a/VStudio/DIO2.h b/VStudio/DIO2.h index df215b4..5096dea 100644 --- a/VStudio/DIO2.h +++ b/VStudio/DIO2.h @@ -4,10 +4,9 @@ //------------------------------------------------------------------- #include "stdafx.h" - #include "Arduino.h" -//#include "ArduiEmulator.hpp" +#if defined(ARDUINO_ARCH_AVR) // Definitions specific for selected board #if defined(__AVR_ATmega2560__) @@ -34,8 +33,50 @@ extern void pinMode2f(GPIO_pin_t pin, uint8_t mode); extern uint8_t digitalRead2f(GPIO_pin_t pin); extern void digitalWrite2f(GPIO_pin_t pin, uint8_t value); -extern GPIO_pin_t Arduino_to_GPIO_pin(int aa); +#else + +// ARM / ESP / STM / RP2040 versions +// These procs are probably fast enough to access ports very efficiency (and i dont know how to make better !) . +// So the functions are dummies, and conduct to original wiring functions... + +typedef int GPIO_pin_t; + +/* For RP2040, these functions can also be coded like this: + static inline void pinMode2(uint8_t pin, uint8_t val) { pinMode(pin, val);} + static inline void digitalWrite2(uint8_t pin, uint8_t val) { uint32_t mask = 1ul << pin; if (val) gpio_set_mask(mask); else gpio_clr_mask(mask); } + static inline uint8_t digitalRead2(uint8_t pin) { return gpio_get(pin);} +*/ + +#define pinMode2(P, M) pinMode(P, M) +#define digitalWrite2(P, V) digitalWrite(P, V) +#define digitalRead2(P) digitalRead(P) + +#define pinMode2f(P, M) pinMode(P, M) +#define digitalWrite2f(P, V) digitalWrite(P, V) +#define digitalRead2f(P) digitalRead(P) + +#define DP_INVALID 0xFFFF +#define DP0 0 +#define DP1 1 +#define DP2 2 +#define DP3 3 +#define DP4 4 +#define DP5 5 +#define DP6 6 +#define DP7 7 + +//#include "Arduino.h" + +#ifdef F +#undef F +#endif + +#define F(str) str +#define __FlashStringHelper char +#endif + extern int GPIO_to_Arduino_pin(GPIO_pin_t aa); +extern GPIO_pin_t Arduino_to_GPIO_pin(int aa); //------------------------------------------------------------------- #endif diff --git a/VStudio/DIO2.vcxproj b/VStudio/DIO2.vcxproj index 7289034..f67047e 100644 --- a/VStudio/DIO2.vcxproj +++ b/VStudio/DIO2.vcxproj @@ -103,7 +103,7 @@ Level3 Disabled true - _DEBUG;_LIB;VISUALSTUDIO;_DIO2_EXPORTING;%(PreprocessorDefinitions) + _DEBUG;_LIB;VISUALSTUDIO;ARDUINO=150;_DIO2_EXPORTING;%(PreprocessorDefinitions) true $(VisualStudioDir)\..\Arduino\ArduiEmulatorWin\ArduiEmulatorLib MultiThreadedDebug diff --git a/library.properties b/library.properties index a11d149..2ecc6f2 100644 --- a/library.properties +++ b/library.properties @@ -1,9 +1,9 @@ name=DIO2 -version=1.5.1 +version=1.6.0 author=Thierry Paris - Locoduino maintainer=Thierry Paris - Locoduino sentence=Fast digital input/output functions. paragraph=From a work of Jan Dolinay category=Device Control url=https://github.com/Locoduino/DIO2 -architectures=avr,sam,esp32,STM32F1 +architectures=avr,sam,esp32,STM32F1,rp2040 diff --git a/readme.txt b/readme.txt index 0584db3..8c1156f 100644 --- a/readme.txt +++ b/readme.txt @@ -2,11 +2,14 @@ Fast digital I/O functions for Arduino. Created by Jan Dolinay, Feb. 2014 [https://www.codeproject.com/Articles/732646/Fast-digital-I-O-for-Arduino] Works for Arduino Uno and Arduino Mega -Version 1.1 from Thierry Paris, -Works also for Nano R3, Leonardo and Due (only for compatibility). +Version 1.x.y from Thierry Paris, +Works also for Nano R3, Leonardo, and STM32, ESP32, rp2040 (Raspberry Pi Pico) and Due only for compatibility. Revision History ---------------- +Mai 2021 - Version 1.6.0 +- Add Raspberry Pi Pico support by a bypass. + Mai 2019 - Version 1.5.1 - Change Visual Studio project to be conform to ArduiEmulator 2.0.0 diff --git a/src/DIO2.h b/src/DIO2.h index c7cadfc..7b6ab77 100644 --- a/src/DIO2.h +++ b/src/DIO2.h @@ -393,7 +393,7 @@ int GPIO_to_Arduino_pin(GPIO_pin_t inPin); #else -// ARM / ESP / STM versions +// ARM / ESP / STM / DUE / RP2040 versions // These procs are probably fast enough to access ports very efficiency (and i dont know how to make better !) . // So the functions are dummies, and conduct to original wiring functions...