From bd35e8dfed6123501804b096b880d39876f3d0dc Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Sat, 12 Nov 2016 22:51:22 +0100 Subject: [PATCH] Source code rearrangement Moved the library sources into src/, and the sketch into examples/. This makes it easier to use the project as a library, and the default firmware sketch shows up in Arduino IDE's Files/Examples menu. This in turn, has a very neat side effect: an end user can start from this example, and when they save it, it will be saved to their Sketchbook, and the library can be updated independently, without having to worry about conflicts. Having the Sketch separate from the sources also paves the way for moving the keymap there. As far as Arduino IDE dependencies go: this requires Arduino IDE 1.6.7+, the same minimum version required previously. Signed-off-by: Gergely Nagy --- Makefile | 7 ++++--- .../KeyboardioFirmware/KeyboardioFirmware.ino | 0 library.properties | 10 ++++++++++ KeyboardConfig.cpp => src/KeyboardConfig.cpp | 0 KeyboardConfig.h => src/KeyboardConfig.h | 0 KeyboardioFirmware.h => src/KeyboardioFirmware.h | 0 LEDControl.cpp => src/LEDControl.cpp | 0 LEDControl.h => src/LEDControl.h | 0 Model01.cpp => src/Model01.cpp | 0 Model01.h => src/Model01.h | 0 MouseWrapper.cpp => src/MouseWrapper.cpp | 0 MouseWrapper.h => src/MouseWrapper.h | 0 Storage.cpp => src/Storage.cpp | 0 Storage.h => src/Storage.h | 0 TestMode.cpp => src/TestMode.cpp | 0 TestMode.h => src/TestMode.h | 0 {generated => src/generated}/keymaps.h | 0 key_defs.h => src/key_defs.h | 0 key_events.cpp => src/key_events.cpp | 0 key_events.h => src/key_events.h | 0 keymap_metadata.h => src/keymap_metadata.h | 0 keyswitch_state.cpp => src/keyswitch_state.cpp | 0 keyswitch_state.h => src/keyswitch_state.h | 0 utils.cpp => src/utils.cpp | 0 utils.h => src/utils.h | 0 25 files changed, 14 insertions(+), 3 deletions(-) rename KeyboardioFirmware.ino => examples/KeyboardioFirmware/KeyboardioFirmware.ino (100%) create mode 100644 library.properties rename KeyboardConfig.cpp => src/KeyboardConfig.cpp (100%) rename KeyboardConfig.h => src/KeyboardConfig.h (100%) rename KeyboardioFirmware.h => src/KeyboardioFirmware.h (100%) rename LEDControl.cpp => src/LEDControl.cpp (100%) rename LEDControl.h => src/LEDControl.h (100%) rename Model01.cpp => src/Model01.cpp (100%) rename Model01.h => src/Model01.h (100%) rename MouseWrapper.cpp => src/MouseWrapper.cpp (100%) rename MouseWrapper.h => src/MouseWrapper.h (100%) rename Storage.cpp => src/Storage.cpp (100%) rename Storage.h => src/Storage.h (100%) rename TestMode.cpp => src/TestMode.cpp (100%) rename TestMode.h => src/TestMode.h (100%) rename {generated => src/generated}/keymaps.h (100%) rename key_defs.h => src/key_defs.h (100%) rename key_events.cpp => src/key_events.cpp (100%) rename key_events.h => src/key_events.h (100%) rename keymap_metadata.h => src/keymap_metadata.h (100%) rename keyswitch_state.cpp => src/keyswitch_state.cpp (100%) rename keyswitch_state.h => src/keyswitch_state.h (100%) rename utils.cpp => src/utils.cpp (100%) rename utils.h => src/utils.h (100%) diff --git a/Makefile b/Makefile index 09930b5e..f322553b 100644 --- a/Makefile +++ b/Makefile @@ -38,8 +38,8 @@ astyle: find . -type f -name \*.h |xargs -n 1 astyle --style=google generate-keymaps: - -rm generated/keymaps.h - cd layouts && ( find . -type f |xargs -n 1 -I % sh -c 'perl ../tools/generate_keymaps.pl < % >> ../generated/keymaps.h' ) + -rm src/generated/keymaps.h + cd layouts && ( find . -type f |xargs -n 1 -I % sh -c 'perl ../tools/generate_keymaps.pl < % >> ../src/generated/keymaps.h' ) dirs: mkdir -p $(OUTPUT_PATH) @@ -52,10 +52,11 @@ compile: dirs -tools $(ARDUINO_PATH)/tools-builder \ -fqbn $(FQBN) \ -libraries $(ARDUINO_LOCAL_LIB_PATH) \ + -libraries . \ $(VERBOSE) \ -build-path $(BUILD_PATH) \ -ide-version $(ARDUINO_IDE_VERSION) \ - $(SKETCH) + examples/KeyboardioFirmware/$(SKETCH) @cp $(BUILD_PATH)/$(SKETCH).hex $(HEX_FILE_PATH) @cp $(BUILD_PATH)/$(SKETCH).elf $(ELF_FILE_PATH) @echo "Firmware is available at $(HEX_FILE_PATH)" diff --git a/KeyboardioFirmware.ino b/examples/KeyboardioFirmware/KeyboardioFirmware.ino similarity index 100% rename from KeyboardioFirmware.ino rename to examples/KeyboardioFirmware/KeyboardioFirmware.ino diff --git a/library.properties b/library.properties new file mode 100644 index 00000000..2f1c8d32 --- /dev/null +++ b/library.properties @@ -0,0 +1,10 @@ +name=KeyboardioFirmware +version=0.0.1 +author=Jesse Vincent +maintainer=Jesse Vincent +sentence=Firmware for the Keyboardio Model 01. +paragraph=... +category=Communication +url=https://github.com/keyboardio/KeyboardioFirmware +architectures=avr +dot_a_linkage=true diff --git a/KeyboardConfig.cpp b/src/KeyboardConfig.cpp similarity index 100% rename from KeyboardConfig.cpp rename to src/KeyboardConfig.cpp diff --git a/KeyboardConfig.h b/src/KeyboardConfig.h similarity index 100% rename from KeyboardConfig.h rename to src/KeyboardConfig.h diff --git a/KeyboardioFirmware.h b/src/KeyboardioFirmware.h similarity index 100% rename from KeyboardioFirmware.h rename to src/KeyboardioFirmware.h diff --git a/LEDControl.cpp b/src/LEDControl.cpp similarity index 100% rename from LEDControl.cpp rename to src/LEDControl.cpp diff --git a/LEDControl.h b/src/LEDControl.h similarity index 100% rename from LEDControl.h rename to src/LEDControl.h diff --git a/Model01.cpp b/src/Model01.cpp similarity index 100% rename from Model01.cpp rename to src/Model01.cpp diff --git a/Model01.h b/src/Model01.h similarity index 100% rename from Model01.h rename to src/Model01.h diff --git a/MouseWrapper.cpp b/src/MouseWrapper.cpp similarity index 100% rename from MouseWrapper.cpp rename to src/MouseWrapper.cpp diff --git a/MouseWrapper.h b/src/MouseWrapper.h similarity index 100% rename from MouseWrapper.h rename to src/MouseWrapper.h diff --git a/Storage.cpp b/src/Storage.cpp similarity index 100% rename from Storage.cpp rename to src/Storage.cpp diff --git a/Storage.h b/src/Storage.h similarity index 100% rename from Storage.h rename to src/Storage.h diff --git a/TestMode.cpp b/src/TestMode.cpp similarity index 100% rename from TestMode.cpp rename to src/TestMode.cpp diff --git a/TestMode.h b/src/TestMode.h similarity index 100% rename from TestMode.h rename to src/TestMode.h diff --git a/generated/keymaps.h b/src/generated/keymaps.h similarity index 100% rename from generated/keymaps.h rename to src/generated/keymaps.h diff --git a/key_defs.h b/src/key_defs.h similarity index 100% rename from key_defs.h rename to src/key_defs.h diff --git a/key_events.cpp b/src/key_events.cpp similarity index 100% rename from key_events.cpp rename to src/key_events.cpp diff --git a/key_events.h b/src/key_events.h similarity index 100% rename from key_events.h rename to src/key_events.h diff --git a/keymap_metadata.h b/src/keymap_metadata.h similarity index 100% rename from keymap_metadata.h rename to src/keymap_metadata.h diff --git a/keyswitch_state.cpp b/src/keyswitch_state.cpp similarity index 100% rename from keyswitch_state.cpp rename to src/keyswitch_state.cpp diff --git a/keyswitch_state.h b/src/keyswitch_state.h similarity index 100% rename from keyswitch_state.h rename to src/keyswitch_state.h diff --git a/utils.cpp b/src/utils.cpp similarity index 100% rename from utils.cpp rename to src/utils.cpp diff --git a/utils.h b/src/utils.h similarity index 100% rename from utils.h rename to src/utils.h