summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Schodet2010-07-17 17:46:42 +0200
committerNicolas Schodet2010-07-17 17:46:42 +0200
commit6a5e19e6077b1dd1f5d2076b0a63dfef1c04de1d (patch)
tree184ef4405693fade94b613bc5a7aed5759da8d6c
parentf32ef700f277704a8eb89aebf7099d19853364f1 (diff)
add simple counter program
-rw-r--r--src/binwatch/Makefile15
-rw-r--r--src/binwatch/avrconfig.h33
-rw-r--r--src/binwatch/counter.c37
3 files changed, 85 insertions, 0 deletions
diff --git a/src/binwatch/Makefile b/src/binwatch/Makefile
new file mode 100644
index 0000000..cf20b6d
--- /dev/null
+++ b/src/binwatch/Makefile
@@ -0,0 +1,15 @@
+BASE = $b/digital/avr
+AVR_PROGS = counter
+counter_SOURCES = counter.c led.c
+MODULES = utils
+CONFIGFILE = avrconfig.h
+# atmega8, atmega8535, atmega128...
+AVR_MCU = attiny85
+# -O2 : speed
+# -Os : size
+OPTIMIZE = -Os
+
+INCLUDES = -I.. -I.
+vpath %.c ../common
+
+include $(BASE)/make/Makefile.gen
diff --git a/src/binwatch/avrconfig.h b/src/binwatch/avrconfig.h
new file mode 100644
index 0000000..eae41be
--- /dev/null
+++ b/src/binwatch/avrconfig.h
@@ -0,0 +1,33 @@
+#ifndef avrconfig_h
+#define avrconfig_h
+/* avrconfig.h */
+/* binwatch - Tiny binary wristwatch. {{{
+ *
+ * Copyright (C) 2010 Nicolas Schodet
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Contact :
+ * Web: http://ni.fr.eu.org/
+ * Email: <nico@ni.fr.eu.org>
+ * }}} */
+
+/* utils */
+/** AVR Frequency : 1000000, 1843200, 2000000, 3686400, 4000000, 7372800,
+ * 8000000, 11059200, 14745600, 16000000, 18432000, 20000000. */
+#define AC_FREQ 1000000
+
+
+#endif /* avrconfig_h */
diff --git a/src/binwatch/counter.c b/src/binwatch/counter.c
new file mode 100644
index 0000000..fe1bd1f
--- /dev/null
+++ b/src/binwatch/counter.c
@@ -0,0 +1,37 @@
+/* main.c */
+/* binwatch - Tiny binary wristwatch. {{{
+ *
+ * Copyright (C) 2010 Nicolas Schodet
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Contact :
+ * Web: http://ni.fr.eu.org/
+ * Email: <nico at ni.fr.eu.org>
+ * }}} */
+#include "common.h"
+#include "common/led.h"
+
+int
+main (void)
+{
+ uint16_t i;
+ while (1)
+ {
+ for (i = 0; i < 1024; i++)
+ led_display (i, 20);
+ }
+}
+