From 6a5e19e6077b1dd1f5d2076b0a63dfef1c04de1d Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Sat, 17 Jul 2010 17:46:42 +0200 Subject: add simple counter program --- src/binwatch/Makefile | 15 +++++++++++++++ src/binwatch/avrconfig.h | 33 +++++++++++++++++++++++++++++++++ src/binwatch/counter.c | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 src/binwatch/Makefile create mode 100644 src/binwatch/avrconfig.h create mode 100644 src/binwatch/counter.c 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: + * }}} */ + +/* 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: + * }}} */ +#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); + } +} + -- cgit v1.2.3