From a285810cb53bf454aa6133cbb589bcd3559c0e5d Mon Sep 17 00:00:00 2001 From: Pieter du Preez Date: Tue, 2 Oct 2018 23:00:14 +0200 Subject: Added a test case for moving CORE_LIB in PR #583. This patch is meant to test the link order, if the OTHER_OBJS variable gets used to add 3rd party archives, that depend on the Arduino core lib (the archive pointed to by the CORE_LIB variable). The examples/Blink3rdPartyLib directory contains a stripped down Blink and includes a library in the examples/Blink3rdPartyLib/Toggle sub-directory. The archive, built inside the Toggle directory mimics a 3rd party library. The archive gets built and linked in by using the OTHER_OBS variable in examples/Blink3rdPartyLib/Makefile. --- examples/Blink3rdPartyLib/Toggle/TogglePin.cpp | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 examples/Blink3rdPartyLib/Toggle/TogglePin.cpp (limited to 'examples/Blink3rdPartyLib/Toggle/TogglePin.cpp') diff --git a/examples/Blink3rdPartyLib/Toggle/TogglePin.cpp b/examples/Blink3rdPartyLib/Toggle/TogglePin.cpp new file mode 100644 index 0000000..fd6925d --- /dev/null +++ b/examples/Blink3rdPartyLib/Toggle/TogglePin.cpp @@ -0,0 +1,27 @@ +// This program is free software and is licensed under the same conditions as +// describe in https://github.com/sudar/Arduino-Makefile/blob/master/licence.txt + +#include "TogglePin.h" + +#ifdef ARDUINO +#if ARDUINO >= 100 +#include "Arduino.h" +#else +#include "WProgram.h" +#endif +#endif // ARDUINO + +TogglePin::TogglePin(int pinNumber, bool state) + : _pinNumber(pinNumber), _state(state) +{ + pinMode(_pinNumber, OUTPUT); + digitalWrite(_pinNumber, _state ? HIGH : LOW); +} + +bool +TogglePin::toggle() +{ + _state = !_state; + digitalWrite(_pinNumber, _state ? HIGH : LOW); + return _state; +} -- cgit v1.2.3