From 0dd3fbc9911576be9f0f9eab9c6aea02ba9371ac Mon Sep 17 00:00:00 2001 From: Owen L - SFE Date: Thu, 26 Sep 2019 10:21:05 -0600 Subject: [PATCH] add wiring --- cores/arduino/ard_sup/Arduino.h | 2 + cores/arduino/ard_sup/ard_supers/hooks.c | 37 +++++++++++++++++++ cores/arduino/ard_sup/ard_supers/hooks.h | 27 ++++++++++++++ .../ard_sup/{ => ard_supers}/pins_arduino.h | 2 + .../ard_sup/ard_supers/wiring_private.h | 27 ++++++++++++++ 5 files changed, 95 insertions(+) create mode 100644 cores/arduino/ard_sup/ard_supers/hooks.c create mode 100644 cores/arduino/ard_sup/ard_supers/hooks.h rename cores/arduino/ard_sup/{ => ard_supers}/pins_arduino.h (93%) create mode 100644 cores/arduino/ard_sup/ard_supers/wiring_private.h diff --git a/cores/arduino/ard_sup/Arduino.h b/cores/arduino/ard_sup/Arduino.h index b155f6ab..162afe1b 100644 --- a/cores/arduino/ard_sup/Arduino.h +++ b/cores/arduino/ard_sup/Arduino.h @@ -41,6 +41,8 @@ extern "C" #include "am_util.h" // #include "am_bsp.h" +#include "hooks.h" + #include //Gets us pow() #ifdef ARDUINO_REDEFINE_OVERFLOW diff --git a/cores/arduino/ard_sup/ard_supers/hooks.c b/cores/arduino/ard_sup/ard_supers/hooks.c new file mode 100644 index 00000000..0bedd609 --- /dev/null +++ b/cores/arduino/ard_sup/ard_supers/hooks.c @@ -0,0 +1,37 @@ +/* +Copyright (c) 2019 SparkFun Electronics + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +#include "hooks.h" + +/** + * Empty yield() hook. + * + * This function is intended to be used by library writers to build + * libraries or sketches that supports cooperative threads. + * + * Its defined as a weak symbol and it can be redefined to implement a + * real cooperative scheduler. + */ +static void __empty() { + // Empty +} +void yield(void) __attribute__ ((weak, alias("__empty"))); \ No newline at end of file diff --git a/cores/arduino/ard_sup/ard_supers/hooks.h b/cores/arduino/ard_sup/ard_supers/hooks.h new file mode 100644 index 00000000..1bb10e96 --- /dev/null +++ b/cores/arduino/ard_sup/ard_supers/hooks.h @@ -0,0 +1,27 @@ +/* +Copyright (c) 2019 SparkFun Electronics + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +#ifndef _HOOKS_H_ +#define _HOOKS_H_ + +void yield( void ) ; + +#endif // _HOOKS_H_ \ No newline at end of file diff --git a/cores/arduino/ard_sup/pins_arduino.h b/cores/arduino/ard_sup/ard_supers/pins_arduino.h similarity index 93% rename from cores/arduino/ard_sup/pins_arduino.h rename to cores/arduino/ard_sup/ard_supers/pins_arduino.h index 64dcd829..483c6f5b 100644 --- a/cores/arduino/ard_sup/pins_arduino.h +++ b/cores/arduino/ard_sup/ard_supers/pins_arduino.h @@ -22,4 +22,6 @@ SOFTWARE. #ifndef _PINS_ARDUINO_H_ #define _PINS_ARDUINO_H_ +// This file exists solely for compilation compatibility with legacy libraries + #endif // _PINS_ARDUINO_H_ \ No newline at end of file diff --git a/cores/arduino/ard_sup/ard_supers/wiring_private.h b/cores/arduino/ard_sup/ard_supers/wiring_private.h new file mode 100644 index 00000000..ece906da --- /dev/null +++ b/cores/arduino/ard_sup/ard_supers/wiring_private.h @@ -0,0 +1,27 @@ +/* +Copyright (c) 2019 SparkFun Electronics + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +#ifndef _WIRING_PRIVATE_H_ +#define _WIRING_PRIVATE_H_ + +// This file exists solely for compilation compatibility with legacy libraries + +#endif // _WIRING_PRIVATE_H_ \ No newline at end of file