[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[paparazzi-commits] [6210] Moe the LED flasher to a better place
From: |
Martin Mueller |
Subject: |
[paparazzi-commits] [6210] Moe the LED flasher to a better place |
Date: |
Sat, 23 Oct 2010 21:11:01 +0000 |
Revision: 6210
http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=6210
Author: mmm
Date: 2010-10-23 21:11:01 +0000 (Sat, 23 Oct 2010)
Log Message:
-----------
Moe the LED flasher to a better place
Added Paths:
-----------
paparazzi3/trunk/sw/airborne/firmwares/helper/led_flasher/
paparazzi3/trunk/sw/airborne/firmwares/helper/led_flasher/Makefile
paparazzi3/trunk/sw/airborne/firmwares/helper/led_flasher/blitzer.c
Removed Paths:
-------------
paparazzi3/trunk/sw/in_progress/blitzer/
Copied: paparazzi3/trunk/sw/airborne/firmwares/helper/led_flasher/Makefile
(from rev 6206, paparazzi3/trunk/sw/in_progress/blitzer/Makefile)
===================================================================
--- paparazzi3/trunk/sw/airborne/firmwares/helper/led_flasher/Makefile
(rev 0)
+++ paparazzi3/trunk/sw/airborne/firmwares/helper/led_flasher/Makefile
2010-10-23 21:11:01 UTC (rev 6210)
@@ -0,0 +1,56 @@
+
+MCU = attiny25
+
+PROG = dragon_isp
+DEV = usb
+#PROG = stk200
+#DEV = /dev/parport0
+
+APPNAME = blitzer
+
+CC = avr-gcc
+OBJCOPY = avr-objcopy
+RM = rm
+
+CFLAGS = -Wall -g -mmcu=$(MCU) -Os -fpack-struct -fshort-enums -Wall
-Wstrict-prototypes
+
+SOURCES = blitzer.c
+
+all: $(APPNAME)
+
+clean:
+ $(RM) -f core $(APPNAME).o $(APPNAME) $(APPNAME).elf $(APPNAME).hex
+
+app: $(APPNAME)
+
+$(APPNAME): $(SOURCES) Makefile
+ $(CC) $(CFLAGS) $(SOURCES) -o $(APPNAME).elf
+ $(OBJCOPY) -O ihex -R .eeprom $(APPNAME).elf $(APPNAME).hex
+
+flash: $(APPNAME)
+ avrdude -c $(PROG) -P $(DEV) -p $(MCU) -B 10 -U flash:w:$(APPNAME).hex
+
+flash_fuses:
+ avrdude -c $(PROG) -P $(DEV) -p $(MCU) -B 10 -U hfuse:w:0xdf:m
+ sleep 2
+ avrdude -c $(PROG) -P $(DEV) -p $(MCU) -B 10 -U lfuse:w:0x62:m
+
+# (this is the default on new chips)
+#
+# Fuse high byte:
+# 0xdf = 1 1 0 1 1 1 1 1 <-- BODLEVEL0 (Brown out trigger level bit 0)
+# ^ ^ ^ ^ ^ ^ ^------ BODLEVEL1 (Brown out trigger level bit 1)
+# | | | | | +-------- BODLEVEL2 (Brown out trigger level bit 2)
+# | | | | + --------- EESAVE (don't preserve EEPROM over chip erase)
+# | | | +-------------- WDTON (WDT not always on)
+# | | +---------------- SPIEN (allow serial programming)
+# | +------------------ DWEN (debug wire is enabled)
+# +-------------------- RSTDISBL (reset pin is enabled)
+# Fuse low byte:
+# 0x62 = 0 1 1 0 0 0 1 0
+# ^ ^ \ / \--+--/
+# | | | +------- CKSEL 3..0 (internal calibrated osc)
+# | | +--------------- SUT 1..0 (slowly rising power)
+# | +------------------ CKOUT (clock output disabled)
+# +-------------------- CKDIV8 (divide clock by eight enabled)
+
Copied: paparazzi3/trunk/sw/airborne/firmwares/helper/led_flasher/blitzer.c
(from rev 6206, paparazzi3/trunk/sw/in_progress/blitzer/blitzer.c)
===================================================================
--- paparazzi3/trunk/sw/airborne/firmwares/helper/led_flasher/blitzer.c
(rev 0)
+++ paparazzi3/trunk/sw/airborne/firmwares/helper/led_flasher/blitzer.c
2010-10-23 21:11:01 UTC (rev 6210)
@@ -0,0 +1,70 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2009 Martin Mueller
+ *
+ * This file is part of paparazzi.
+ *
+ * paparazzi 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, or (at your option)
+ * any later version.
+ *
+ * paparazzi 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 paparazzi; see the file COPYING. If not, write to
+ * the Free Software Foundation, 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+/** \file blitzer.c
+ * \brief LED flasher
+ *
+ * Flashes a LED connected to PB1 (pin 6) and PB2 (pin 7) of an
+ * ATTINY25 through an IRML2502 transistor, PBx low -> LED off.
+ *
+ * fuse high byte: 0xdf, fuse low byte: 0x62
+ *
+ */
+
+#include <avr/pgmspace.h>
+
+void wait(int msec_time)
+{
+ volatile unsigned short cnta, cntb;
+
+ /* roughly based on internal oscillator with divider by 8 enabled */
+ for (cnta = 0; cnta < msec_time; cnta++) {
+ for (cntb = 0; cntb < 38;cntb++) cntb=cntb;
+ }
+}
+
+int main(void)
+{
+ DDRB |= (1 << PB2); // PB2 output
+ DDRB |= (1 << PB1); // PB1 output
+ DDRB &= ~(1 << PB0); // PB0 input
+
+ while (1)
+ {
+ PORTB |= (1 << PB2);
+ PORTB |= (1 << PB1);
+ wait(25);
+ PORTB &= ~(1 << PB2);
+ PORTB &= ~(1 << PB1);
+ wait(110);
+ PORTB |= (1 << PB2);
+ PORTB |= (1 << PB1);
+ wait(25);
+ PORTB &= ~(1 << PB2);
+ PORTB &= ~(1 << PB1);
+ wait(780);
+ }
+
+ return(0);
+}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [paparazzi-commits] [6210] Moe the LED flasher to a better place,
Martin Mueller <=