Works on both platforms now
This commit is contained in:
parent
dccbe8a47e
commit
5ac5333879
11
Makefile.avr
11
Makefile.avr
|
@ -1,11 +1,15 @@
|
|||
PROG = main
|
||||
|
||||
MCU = atmega328p
|
||||
|
||||
CC = avr-gcc
|
||||
CFLAGS += -mmcu=atmega328p
|
||||
CFLAGS += -mmcu=$(MCU)
|
||||
CFLAGS += -DF_CPU=16000000UL
|
||||
CFLAGS += -Os
|
||||
CFLAGS += -w
|
||||
|
||||
LDFLAGS += -mmcu=$(MCU)
|
||||
|
||||
AVDFLAGS += -p m328p
|
||||
AVDFLAGS += -c arduino
|
||||
AVDFLAGS += -b 115200
|
||||
|
@ -23,8 +27,11 @@ $(PROG).hex: $(PROG)
|
|||
|
||||
main: main.o avr.o
|
||||
|
||||
#main.o: avr.h
|
||||
#avr.o: avr.h
|
||||
|
||||
clean:
|
||||
rm -f $(PROG) *.hex .upload
|
||||
rm -f $(PROG) *.o *.hex .upload
|
||||
|
||||
|
||||
|
||||
|
|
2
avr.h
2
avr.h
|
@ -9,6 +9,8 @@
|
|||
#define JIFFIES_PER_SECOND 50
|
||||
#define JIFFY_uS (1000000 / JIFFIES_PER_SECOND)
|
||||
|
||||
#define bit(pin, bit, on) pin = (on ? (pin | bit) : (pin & ~bit))
|
||||
|
||||
#define mode(on) bit(PORTD, _BV(0), on)
|
||||
#define sin(on) bit(PORTD, _BV(1), on)
|
||||
#define sclk(on) bit(PORTD, _BV(2), on)
|
||||
|
|
13
main.c
13
main.c
|
@ -1,7 +1,15 @@
|
|||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include "ti.h"
|
||||
|
||||
#include <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
|
||||
#if defined (__AVR_ATmega328P__)
|
||||
# include "avr.h"
|
||||
#else
|
||||
# include "ti.h"
|
||||
#endif
|
||||
|
||||
// Number of shift registers in your scoreboard
|
||||
// If you want scores to go over 199, you need 8
|
||||
|
@ -40,9 +48,6 @@ enum {
|
|||
#define BTN_LEFT _BV(1)
|
||||
#define BTN_RIGHT _BV(0)
|
||||
|
||||
|
||||
#define bit(pin, bit, on) pin = (on ? (pin | bit) : (pin & ~bit))
|
||||
|
||||
const uint8_t seven_segment_digits[] = {
|
||||
0x7b, 0x60, 0x37, 0x76, 0x6c, 0x5e, 0x5f, 0x70, 0x7f, 0x7e
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue