From e6bfdccc611ddc22e8fddb62f9740ba54d3e2199 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Thu, 17 Dec 2020 15:53:34 +1300 Subject: [PATCH] Working --- makefile | 12 ++++++++---- src/photointerrupter.cpp | 32 +++++++++++++++++++++----------- test/main.cpp | 6 +----- 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/makefile b/makefile index 3e8e556..81547d4 100644 --- a/makefile +++ b/makefile @@ -3,12 +3,13 @@ F_CPU=8000000 PROG=dragon_jtag DEBUGGER = dragon PORT=/dev/ttyUSB0 +TYPE?=DEBUG CC=avr-g++ OBJCOPY=avr-objcopy -CFLAGS=-Wall -g -mmcu=${MCU} -DF_CPU=${F_CPU} -I. +CFLAGS=-Wall -g -O -mmcu=${MCU} -DF_CPU=${F_CPU} -I. -std=gnu++11 -D${TYPE} -Wno-write-strings TARGET=main -SRCS=src/*.cpp test/main.cpp +SRCS=src/*.cpp test/main.cpp default: build flash @@ -24,8 +25,11 @@ clean: rm -f bin/* debug: flash avarice - sleep 1 avr-gdb -ex "target remote :4242" bin/main.elf avarice: - avarice --file bin/main.elf --part ${MCU} --${DEBUGGER} :4242 + sleep 1 + avarice --file bin/main.elf --part ${MCU} --${DEBUGGER} :4242 & + +term: + screen /dev/ttyUSB0 1000000 \ No newline at end of file diff --git a/src/photointerrupter.cpp b/src/photointerrupter.cpp index 7cb647b..7dc9539 100644 --- a/src/photointerrupter.cpp +++ b/src/photointerrupter.cpp @@ -10,22 +10,32 @@ namespace photointerrupter { TCCR2 |= (1< 600) { - TCCR2 |= (1< 660) { + // TCCR2 |= (1<< COM20); + // GICR |= (1<