2014-12-04 04:00:25 +00:00
|
|
|
MCU=atmega32u4
|
|
|
|
F_CPU=16000000
|
|
|
|
|
2021-06-06 00:05:28 +00:00
|
|
|
MODEL?=LEO
|
2020-03-22 17:52:33 +00:00
|
|
|
LAYOUT?=qwerty
|
2014-12-04 04:00:25 +00:00
|
|
|
|
2019-07-03 04:43:13 +00:00
|
|
|
USB=/dev/ttyACM0
|
2014-12-04 04:00:25 +00:00
|
|
|
|
2020-03-22 17:52:33 +00:00
|
|
|
build: $(LAYOUT).hex
|
2014-12-04 04:00:25 +00:00
|
|
|
|
2020-03-22 17:52:33 +00:00
|
|
|
upload: $(LAYOUT).hex
|
2020-03-23 03:27:33 +00:00
|
|
|
@echo "Put your device in bootloader mode now..."
|
2020-04-01 02:08:52 +00:00
|
|
|
@echo "Classic Atreus: press reset key (usually fn+esc -> B)."
|
2020-03-23 03:27:33 +00:00
|
|
|
@echo "Keyboardio Atreus: press the button on the underside of the board."
|
2019-07-03 04:43:13 +00:00
|
|
|
while [ ! -r $(USB) ]; do sleep 1; done; \
|
2020-03-22 17:52:33 +00:00
|
|
|
avrdude -p $(MCU) -c avr109 -U flash:w:$(LAYOUT).hex -P $(USB)
|
2014-12-04 04:00:25 +00:00
|
|
|
|
2019-07-02 03:01:10 +00:00
|
|
|
test: ; racket test.rkt
|
|
|
|
|
2020-03-22 17:52:33 +00:00
|
|
|
clean: ; -rm -f $(LAYOUT){,.hex} *.o *.elf *.s
|
2019-07-03 01:11:04 +00:00
|
|
|
|
2020-03-22 17:52:33 +00:00
|
|
|
count: ; cloc menelaus.scm keycodes.scm $(LAYOUT).scm
|
2014-12-04 04:00:25 +00:00
|
|
|
|
2020-03-22 17:52:33 +00:00
|
|
|
$(LAYOUT).hex: $(LAYOUT).elf
|
|
|
|
avr-size $(LAYOUT).elf
|
|
|
|
avr-objcopy --output-target=ihex $(LAYOUT).elf $(LAYOUT).hex
|
2014-12-04 04:00:25 +00:00
|
|
|
|
2020-03-22 17:52:33 +00:00
|
|
|
$(LAYOUT).s: $(LAYOUT).scm menelaus.scm keycodes.scm
|
2021-06-06 00:05:28 +00:00
|
|
|
microscheme -m $(MODEL) $(LAYOUT).scm
|
2014-12-04 04:00:25 +00:00
|
|
|
|
|
|
|
%.elf: %.s usb_keyboard.s
|
2020-03-22 17:52:33 +00:00
|
|
|
avr-gcc -mmcu=$(MCU) -o $(LAYOUT).elf $(LAYOUT).s usb_keyboard.s
|
2014-12-04 04:00:25 +00:00
|
|
|
|
|
|
|
usb_keyboard.s: usb_keyboard.h usb_keyboard.c
|
2021-12-23 14:49:01 +00:00
|
|
|
avr-gcc -std=gnu99 -S -D F_CPU=$(F_CPU)UL -mmcu=$(MCU) -c \
|
2014-12-04 04:00:25 +00:00
|
|
|
-o usb_keyboard.s usb_keyboard.c
|
2019-07-02 03:01:10 +00:00
|
|
|
|
2020-03-21 02:38:34 +00:00
|
|
|
udev: /etc/udev/rules.d/a-star.rules
|
|
|
|
|
|
|
|
/etc/udev/rules.d/a-star.rules:
|
|
|
|
echo "SUBSYSTEM==\"usb\", ATTRS{idVendor}==\"1ffb\", \
|
|
|
|
ATTRS{idProduct}==\"0101\", ENV{ID_MM_DEVICE_IGNORE}=\"1\"" > $@
|
|
|
|
echo "SUBSYSTEM==\"usb\", ATTRS{idVendor}==\"1ffb\", \
|
|
|
|
ATTRS{idProduct}==\"2300\", ENV{ID_MM_DEVICE_IGNORE}=\"1\"" >> $@
|
|
|
|
|
|
|
|
.PHONY: build upload test clean count udev
|