-
-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #195 from facchinm/mbed_library_compatibility
Restore compatibility as mbed library
- Loading branch information
Showing
9 changed files
with
102 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#pragma once | ||
|
||
/* Define mock symbols to nullify PinMode definitions */ | ||
#define PullNone TempPullNone | ||
#define PullUp TempPullUp | ||
#define PullDown TempPullDown | ||
#define OpenDrainPullUp TempOpenDrainPullUp | ||
#define OpenDrainNoPull TempOpenDrainNoPull | ||
#define OpenDrainPullDown TempOpenDrainPullDown | ||
#define PushPullNoPull TempPushPullNoPull | ||
#define PushPullPullUp TempPushPullPullUp | ||
#define PushPullPullDown TempPushPullPullDown | ||
#define OpenDrain TempOpenDrain | ||
#define PullDefault TempPullDefault | ||
|
||
#define INPUT TempINPUT | ||
#define OUTPUT TempOUTPUT | ||
#define INPUT_PULLUP TempINPUT_PULLUP | ||
#define INPUT_PULLDOWN TempINPUT_PULLDOWN | ||
|
||
/* Rename symbol PinMode into MbedPinMode for all the file PinNamesTypes.h | ||
* Functions using PinMode should be redeclared with the correct PinMode symbol */ | ||
#define PinMode MbedPinMode | ||
#include "PeripheralNames.h" | ||
#include "PinNamesTypes.h" | ||
#undef PinMode | ||
|
||
/* Rename symbol PinMode into ArduinoPinMode for all the file Common.h | ||
* Functions using PinMode should be redeclared with the correct PinMode symbol */ | ||
#define PinMode ArduinoPinMode | ||
#include "api/Common.h" | ||
#undef PinMode | ||
|
||
#undef PullNone | ||
#undef PullUp | ||
#undef PullDown | ||
#undef OpenDrainPullUp | ||
#undef OpenDrainNoPull | ||
#undef OpenDrainPullDown | ||
#undef PushPullNoPull | ||
#undef PushPullPullUp | ||
#undef PushPullPullDown | ||
#undef OpenDrain | ||
#undef PullDefault | ||
|
||
#undef INPUT | ||
#undef OUTPUT | ||
#undef INPUT_PULLUP | ||
#undef INPUT_PULLDOWN | ||
|
||
/* Define the PinName symbol to be used in all the contexts */ | ||
typedef enum { | ||
PullNone = TempPullNone, | ||
PullUp = TempPullUp, | ||
PullDown = TempPullDown, | ||
OpenDrainPullUp = TempOpenDrainPullUp, | ||
OpenDrainNoPull = TempOpenDrainNoPull, | ||
OpenDrainPullDown = TempOpenDrainPullDown, | ||
PushPullNoPull = TempPushPullNoPull, | ||
PushPullPullUp = TempPushPullPullUp, | ||
PushPullPullDown = TempPushPullPullDown, | ||
OpenDrain = TempOpenDrain, | ||
PullDefault = TempPullDefault, | ||
INPUT = TempINPUT, | ||
OUTPUT = TempOUTPUT, | ||
INPUT_PULLUP = TempINPUT_PULLUP, | ||
INPUT_PULLDOWN = TempINPUT_PULLDOWN | ||
} PinMode; | ||
|
||
/* Redeclare Common.h functions with the updated PinMode */ | ||
void pinMode(pin_size_t pinNumber, PinMode pinMode); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#define PINS_COUNT 255 | ||
#define NUM_ANALOG_INPUTS 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifdef ARDUINO_AS_MBED_LIBRARY | ||
|
||
#include "Arduino.h" | ||
#include "pinDefinitions.h" | ||
|
||
// generic variant | ||
|
||
PinDescription g_APinDescription[PINS_COUNT]; | ||
|
||
void initVariant() { | ||
for (int i = 0; i<PINS_COUNT; i++) { | ||
g_APinDescription[i].name = (PinName)i; | ||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,9 +30,8 @@ | |
*/ | ||
#pragma once | ||
|
||
#include <mbed.h> | ||
#include <pinDefinitions.h> | ||
|
||
#include <mbed.h> | ||
|
||
namespace arduino { | ||
|
||
|