File tree Expand file tree Collapse file tree 7 files changed +115
-0
lines changed
examples/Blink3rdPartyLib Expand file tree Collapse file tree 7 files changed +115
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ The following is the rough list of changes that went into different versions.
55I tried to give credit whenever possible. If I have missed anyone, kindly add it to the list.
66
77### In Development
8+ - Fix: Moved CORE_LIB to the last position of the defined linked objects. (https://github.com/wingunder )
89- Fix: Moved ATtiny examples to ATtinyBlink, updated alternate core instructions (issue #537 ) (https://github.com/sej7278 )
910- Fix: Add -fno-devirtualize flag to workaround g++ segfault bug (issue #486 ). (https://github.com/sej7278 )
1011- Fix: Quote the prefix tag in the space_pad_to function
Original file line number Diff line number Diff line change 1+ // A derived Blink, that uses an example 3rd party library.
2+ // Turns on an LED on for one second, then off for one second, repeatedly.
3+ // This example code is in the public domain.
4+
5+ #include < TogglePin.h>
6+
7+ #ifdef ARDUINO
8+ #if ARDUINO >= 100
9+ #include " Arduino.h"
10+ #else
11+ #include " WProgram.h"
12+ #endif
13+ #endif // ARDUINO
14+
15+ int main ()
16+ {
17+ init ();
18+ TogglePin led (13 , false );
19+ while (true ) {
20+ delay (1000 );
21+ led.toggle ();
22+ }
23+ }
Original file line number Diff line number Diff line change 1+ # This program is free software and is licensed under the same conditions as
2+ # describe in https://github.com/sudar/Arduino-Makefile/blob/master/licence.txt
3+
4+ # This is an example Makefile, that demonstrates the linking of a third party
5+ # library. In this case the third party library resides in the ./Toggle
6+ # sub-directory. Note that the archive TOGGLE_ARCHIVE _only_ contains the
7+ # compiled Toggle.c.o object. The TOGGLE_ARCHIVE is thus very lean, but it
8+ # requires the Arduino libraries, which are being build in this directory,
9+ # together with Blink, the 'main' program.
10+
11+ include board.mk
12+
13+ TOGGLE_ARCHIVE = build-$(BOARD_TAG ) /libtoggle.a
14+
15+ CXXFLAGS += -IToggle
16+ OTHER_OBJS = Toggle/$(TOGGLE_ARCHIVE )
17+
18+ include ../../Arduino.mk
19+
20+ Toggle/$(TOGGLE_ARCHIVE ) :
21+ $(MAKE ) -C Toggle $(TOGGLE_ARCHIVE )
22+
23+ clean ::
24+ $(MAKE ) -C Toggle clean
Original file line number Diff line number Diff line change 1+ # This program is free software and is licensed under the same conditions as
2+ # describe in https://github.com/sudar/Arduino-Makefile/blob/master/licence.txt
3+
4+ # This is an example Makefile, that is being used to build an archive
5+ # from locally compiled objects.
6+ #
7+ # All source files in this directory will automatically get compiled
8+ # and archived into the build-$(BOARD_TAG)/libtoggle.a target.
9+
10+ include ../board.mk
11+ include ../../../Arduino.mk
12+
13+ build-$(BOARD_TAG ) /libtoggle.a : $(LOCAL_OBJS )
14+ $(AR ) rcs $@ $(LOCAL_OBJS )
Original file line number Diff line number Diff line change 1+ // This program is free software and is licensed under the same conditions as
2+ // describe in https://github.com/sudar/Arduino-Makefile/blob/master/licence.txt
3+
4+ #include " TogglePin.h"
5+
6+ #ifdef ARDUINO
7+ #if ARDUINO >= 100
8+ #include " Arduino.h"
9+ #else
10+ #include " WProgram.h"
11+ #endif
12+ #endif // ARDUINO
13+
14+ TogglePin::TogglePin (int pinNumber, bool state)
15+ : _pinNumber(pinNumber), _state(state)
16+ {
17+ pinMode (_pinNumber, OUTPUT);
18+ digitalWrite (_pinNumber, _state ? HIGH : LOW);
19+ }
20+
21+ bool
22+ TogglePin::toggle ()
23+ {
24+ _state = !_state;
25+ digitalWrite (_pinNumber, _state ? HIGH : LOW);
26+ return _state;
27+ }
Original file line number Diff line number Diff line change 1+ // This program is free software and is licensed under the same conditions as
2+ // describe in https://github.com/sudar/Arduino-Makefile/blob/master/licence.txt
3+
4+ #ifndef TOGGLEPIN_H_
5+ #define TOGGLEPIN_H_
6+
7+ class TogglePin
8+ {
9+ public:
10+ TogglePin (int pinNumber, bool state);
11+
12+ bool toggle ();
13+
14+ private:
15+ const int _pinNumber;
16+ bool _state;
17+ };
18+
19+ #endif
Original file line number Diff line number Diff line change 1+ # This program is free software and is licensed under the same conditions as
2+ # describe in https://github.com/sudar/Arduino-Makefile/blob/master/licence.txt
3+
4+ # The following can be overridden at make-time, by setting an environment
5+ # variable with the same name. eg. BOARD_TAG=pro5v328 make
6+
7+ BOARD_TAG ?= uno
You can’t perform that action at this time.
0 commit comments