aboutsummaryrefslogtreecommitdiff
path: root/tests/BlinkInAVRC
diff options
context:
space:
mode:
authorChristopher Peplin <chris.peplin@rhubarbtech.com>2014-09-09 23:09:35 -0400
committerChristopher Peplin <chris.peplin@rhubarbtech.com>2014-09-09 23:17:15 -0400
commitc86ce093ce93eb8da1136acd1e81973ef0bb54fc (patch)
tree9113fe08113c3548b84ba02b4d55db8cee49395f /tests/BlinkInAVRC
parente30bb5c28a42152007d70325477f364605b73f34 (diff)
Add a script to compile examples as an automated test suite.
* Added script/boostrap.sh to download the Arduino IDE and MPIDE (for chipKIT). Tested in Linux, should work in Cygwin and OS X too. * Added script/runtests.sh to run "make" in each example project and collect the results. The script returns -1 if any fails. * Moved currently testable examples to a "tests" directory, separate from examples that require alternative cores.
Diffstat (limited to 'tests/BlinkInAVRC')
-rw-r--r--tests/BlinkInAVRC/Makefile17
-rw-r--r--tests/BlinkInAVRC/blink.c38
2 files changed, 55 insertions, 0 deletions
diff --git a/tests/BlinkInAVRC/Makefile b/tests/BlinkInAVRC/Makefile
new file mode 100644
index 0000000..9080b24
--- /dev/null
+++ b/tests/BlinkInAVRC/Makefile
@@ -0,0 +1,17 @@
+# This sample Makefile, explains how you can compile plain AVR C file.
+#
+# Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile
+
+NO_CORE = Yes
+
+BOARD_TAG = atmega16
+MCU = atmega16
+F_CPU = 8000000L
+
+ISP_PROG = stk500v1
+AVRDUDE_ISP_BAUDRATE = 19200
+
+include ../TestSuiteCommon.mk
+include $(ARDMK_DIR)/Arduino.mk
+
+# !!! Important. You have to use make ispload to upload when using ISP programmer
diff --git a/tests/BlinkInAVRC/blink.c b/tests/BlinkInAVRC/blink.c
new file mode 100644
index 0000000..d8b7c8f
--- /dev/null
+++ b/tests/BlinkInAVRC/blink.c
@@ -0,0 +1,38 @@
+/*
+ * © Anil Kumar Pugalia, 2010. Email: email@sarika-pugs.com
+ *
+ * ATmega48/88/168, ATmega16/32
+ *
+ * Example Blink. Toggles all IO pins at 1Hz
+ */
+
+#include <avr/io.h>
+#include <util/delay.h>
+
+void init_io(void)
+{
+ // 1 = output, 0 = input
+ DDRB = 0b11111111; // All outputs
+ DDRC = 0b11111111; // All outputs
+ DDRD = 0b11111110; // PORTD (RX on PD0). Just for demo
+}
+
+int main(void)
+{
+ init_io();
+
+ while (1)
+ {
+ PORTC = 0xFF;
+ PORTB = 0xFF;
+ PORTD = 0xFF;
+ _delay_ms(500);
+
+ PORTC = 0x00;
+ PORTB = 0x00;
+ PORTD = 0x00;
+ _delay_ms(500);
+ }
+
+ return 0;
+}