summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile7
-rw-r--r--main.c5
-rw-r--r--main.h2
-rw-r--r--master_clock_addon.schbin0 -> 94954 bytes
-rw-r--r--master_clock_tn26.brdbin0 -> 33895 bytes
-rw-r--r--master_clock_tn26.schbin0 -> 287827 bytes
-rw-r--r--timebase.c8
7 files changed, 12 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 38b4e72..aa38b02 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
.PHONY: love flash
love: sublab77.ihex
-CFLAGS=-Wall -Wextra -pedantic -std=c99 -Os -DF_CPU=1000000 -mmcu=attiny26
+CFLAGS=-Wall -Wextra -pedantic -std=c99 -DF_CPU=1000000UL -Os -fshort-enums -fno-move-loop-invariants -fno-tree-loop-optimize -mmcu=attiny26
%.o: %.c
avr-gcc $(CFLAGS) -c -o $@ $<
@@ -16,4 +16,7 @@ sublab77.elf: clock.o dcf77.o lcd.o main.o timebase.o
endif
sublab77.ihex: sublab77.elf
- objcopy -Oihex $^ $@
+ avr-objcopy -Oihex $^ $@
+
+clean:
+ rm *.o *.elf *.ihex
diff --git a/main.c b/main.c
index c5e4bd2..eec2401 100644
--- a/main.c
+++ b/main.c
@@ -186,7 +186,7 @@ static void perform(void)
extern void __vectors(void) __attribute__((noreturn));
__attribute__ ((noreturn))
-SIGNAL (ANA_COMP_vect)
+ISR (ANA_COMP_vect)
{
PORTA = 0xff;
@@ -200,7 +200,8 @@ SIGNAL (ANA_COMP_vect)
__vectors();
}
-int main( void )
+int __attribute__((OS_main))
+main( void )
{
PORTA = 0xFF; // enable pull ups
diff --git a/main.h b/main.h
index 0fdba17..db5aeca 100644
--- a/main.h
+++ b/main.h
@@ -2,8 +2,6 @@
#include <avr/interrupt.h>
#include "types.h"
-#define XTAL 1000000L
-
// Hardware Definitions
diff --git a/master_clock_addon.sch b/master_clock_addon.sch
new file mode 100644
index 0000000..b8f1f3a
--- /dev/null
+++ b/master_clock_addon.sch
Binary files differ
diff --git a/master_clock_tn26.brd b/master_clock_tn26.brd
new file mode 100644
index 0000000..4381f1e
--- /dev/null
+++ b/master_clock_tn26.brd
Binary files differ
diff --git a/master_clock_tn26.sch b/master_clock_tn26.sch
new file mode 100644
index 0000000..a992b7b
--- /dev/null
+++ b/master_clock_tn26.sch
Binary files differ
diff --git a/timebase.c b/timebase.c
index ea8f8b9..07a5fe7 100644
--- a/timebase.c
+++ b/timebase.c
@@ -2,10 +2,10 @@
#include "timebase.h"
// at 12MHz:
-#define T0COUNT (XTAL / 1024 / 64) // 183
-#define T0SECERR (XTAL - 1024L * 64 * T0COUNT) // 6912
+#define T0COUNT (F_CPU / 1024 / 64) // 183
+#define T0SECERR (F_CPU - 1024L * 64 * T0COUNT) // 6912
#define T0COUNTSEC (T0COUNT + T0SECERR / 1024) // 189
-#define T0MINERR (XTAL - 1024 * (63 * T0COUNT + T0COUNTSEC)) // 768
+#define T0MINERR (F_CPU - 1024 * (63 * T0COUNT + T0COUNTSEC)) // 768
#define T0COUNTMIN (T0COUNTSEC + (T0MINERR * 60 + 512) / 1024) // 234
// 234 = 12000000 Hz
@@ -26,7 +26,7 @@ void timebase_init( void )
extern uint8_t waitctr;
-SIGNAL (TIMER0_OVF0_vect)
+ISR (TIMER0_OVF0_vect)
{
static u8 dcf77_time, old_dcf77;
// DCF77 receive