Skip to content

Commit

Permalink
v1.6.0
Browse files Browse the repository at this point in the history
rp2040 support
  • Loading branch information
Trusty77 committed Apr 28, 2021
1 parent b26fef4 commit 92eeb72
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 13 deletions.
Binary file modified DIO2.zip
Binary file not shown.
Binary file added History/DIO2.1.6.0.zip
Binary file not shown.
7 changes: 3 additions & 4 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file added VStudio/.vs/DIO2/v16/Browse.VC.db
Binary file not shown.
13 changes: 13 additions & 0 deletions VStudio/DIO2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
47 changes: 44 additions & 3 deletions VStudio/DIO2.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion VStudio/DIO2.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_LIB;VISUALSTUDIO;_DIO2_EXPORTING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_LIB;VISUALSTUDIO;ARDUINO=150;_DIO2_EXPORTING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(VisualStudioDir)\..\Arduino\ArduiEmulatorWin\ArduiEmulatorLib</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
Expand Down
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -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
7 changes: 5 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/DIO2.h
Original file line number Diff line number Diff line change
Expand Up @@ -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...

Expand Down

0 comments on commit 92eeb72

Please sign in to comment.