mirror of
https://github.com/vale981/KSP-30-Hack
synced 2025-03-04 08:51:38 -05:00
makefile
This commit is contained in:
parent
8056e28589
commit
376cbef377
7 changed files with 45 additions and 3 deletions
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[submodule "keyboard/lib/Arduino-USBMIDI"]
|
||||
path = keyboard/lib/Arduino-USBMIDI
|
||||
url = https://github.com/lathoub/Arduino-USBMIDI.git
|
2
config.mk
Normal file
2
config.mk
Normal file
|
@ -0,0 +1,2 @@
|
|||
FQBN = arduino:avr:micro
|
||||
PORT = /dev/ttyACM0
|
26
makefile
Normal file
26
makefile
Normal file
|
@ -0,0 +1,26 @@
|
|||
.POSIX:
|
||||
|
||||
include config.mk
|
||||
|
||||
ARDCLI = arduino-cli
|
||||
|
||||
SRCS = $(wildcard *.c) $(wildcard *.cpp) $(wildcard *.ino)
|
||||
PRG = $(shell basename `pwd`)
|
||||
B_PATH = $(shell pwd)/build
|
||||
HEX = $(PRG).$(subst :,.,$(FQBN)).hex
|
||||
ELF = $(PRG).$(subst :,.,$(FQBN)).elf
|
||||
ARDLIBS = USB-MIDI@1.1.2
|
||||
|
||||
$(HEX): $(SRCS)
|
||||
$(ARDCLI) compile --fqbn $(FQBN) --build-path $(B_PATH) $(CURDIR)
|
||||
|
||||
upload: $(HEX)
|
||||
sudo $(ARDCLI) upload -v --fqbn $(FQBN) --input-dir $(B_PATH) -p $(PORT) $(CURDIR)
|
||||
|
||||
deps:
|
||||
@$(foreach lib,$(ARDLIBS),$(ARDCLI) lib install $(lib) || true; )
|
||||
|
||||
clean:
|
||||
$(RM) $(HEX) $(ELF)
|
||||
|
||||
.PHONY: all upload deps clean
|
|
@ -1,3 +1,7 @@
|
|||
#include <USB-MIDI.h>
|
||||
|
||||
USBMIDI_CREATE_DEFAULT_INSTANCE();
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Pins */
|
||||
/*****************************************************************************/
|
||||
|
@ -106,7 +110,7 @@ void setup() {
|
|||
/***************************************************************************/
|
||||
/* Serial */
|
||||
/***************************************************************************/
|
||||
Serial.begin(9600);
|
||||
Serial.begin(115200);
|
||||
|
||||
/***************************************************************************/
|
||||
/* Pins */
|
||||
|
@ -131,6 +135,12 @@ void setup() {
|
|||
digitalWrite(SEL_A, LOW);
|
||||
digitalWrite(SEL_B, LOW);
|
||||
digitalWrite(SEL_C, LOW);
|
||||
|
||||
/***************************************************************************/
|
||||
/* Midi */
|
||||
/***************************************************************************/
|
||||
MIDI.begin();
|
||||
Serial.println("Keyboard ready.");
|
||||
}
|
||||
|
||||
void send_note_down(int key, double velocity) {
|
||||
|
@ -138,6 +148,7 @@ void send_note_down(int key, double velocity) {
|
|||
Serial.print(key);
|
||||
Serial.print(" ");
|
||||
Serial.println(midi_velocity(velocity), DEC);
|
||||
MIDI.sendNoteOn(midi_base + key, midi_velocity(velocity), 1);
|
||||
}
|
||||
|
||||
void send_note_up(int key) {
|
|
@ -1,3 +1,3 @@
|
|||
#! /usr/bin/env bash
|
||||
sudo arduino-cli compile -v -p /dev/ttyACM0 -b arduino:avr:micro keyboard
|
||||
sudo arduino-cli upload -v -p /dev/ttyACM0 -b arduino:avr:micro keyboard
|
||||
sudo arduino-cli compile -v -p /dev/ttyACM0 -b arduino:avr:micro .
|
||||
sudo arduino-cli upload -v -p /dev/ttyACM0 -b arduino:avr:micro .
|
||||
|
|
Loading…
Add table
Reference in a new issue