From a241446b46a9331892e67ac82e3389fd55e83939 Mon Sep 17 00:00:00 2001 From: heck Date: Fri, 6 Sep 2024 23:13:28 +0200 Subject: [PATCH] stale changes (> 2 years) --- .gitignore | 5 +++++ LICENSE | 5 ----- Makefile | 8 +++----- README.md | 6 +++++- led.c | 27 +++++++++++++++------------ 5 files changed, 28 insertions(+), 23 deletions(-) create mode 100644 .gitignore delete mode 100644 LICENSE diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bd86033 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.idea + +/led.elf +/led.hex +/led.o diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 0b8ae76..0000000 --- a/LICENSE +++ /dev/null @@ -1,5 +0,0 @@ -Copyright (C) YEAR by AUTHOR EMAIL - -Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/Makefile b/Makefile index 5960bfe..11d4fa1 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,12 @@ - - - MMCU=atmega32u4 MMCU_DUDE=m32u4 + .PHONY: all clean all: flash compile: - avr-gcc -g -Os -mmcu=$(MMCU) -c led.c + avr-gcc -g -O1 -mmcu=$(MMCU) -c led.c link: compile avr-gcc -g -mmcu=$(MMCU) -o led.elf led.o @@ -17,7 +15,7 @@ assemble: link avr-objcopy -j .text -j .data -O ihex led.elf led.hex flash: assemble - avrdude -p $(MMCU_DUDE) -c stk500 -P /dev/cu.usbserial-1220 -U flash:w:led.hex:i + avrdude -p $(MMCU_DUDE) -c stk500 -P /dev/cu.usbserial-114230 -U flash:w:led.hex:i clean: rm *.o diff --git a/README.md b/README.md index 139597f..29d097b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,6 @@ +# Hecks AVR project template - +port install: +* avr-gcc +* avr-libc +* avr-dude diff --git a/led.c b/led.c index 0071928..e52ef03 100644 --- a/led.c +++ b/led.c @@ -1,18 +1,21 @@ -#ifndef F_CPU -#define F_CPU 16000000UL // or whatever may be your frequency -#endif - #include -//#include -#include // for _delay_ms() -int main(void) { - DDRD = 0xff; +#define F_CPU 1600000 +#include + +void setup() { DDRB |= (1 << PB0); } + +void loop() { while (1) { - PORTD = 0xff; - _delay_ms(100); + PORTB = PORTB ^ (1 << PORTB0); + _delay_ms(1000); - PORTD = 0x00; - _delay_ms(100); + for (long i = 0; i < 80000; i++) { + } } } + +int main() { + setup(); + loop(); +}