Skip to content

Commit

Permalink
Add a developer affordance, ".kaleidoscope_board"
Browse files Browse the repository at this point in the history
in the sketch directory that contains the name of the KALEIDOSCOPE_HARDWARE_H
file. This allows a developer building a sketch for hardware using an
arduino core that doesn't "announce" the KALEIDOSCOPE_HARDWARE_H
environment variable to actually be able to build a sketch.

Unfortunately, this feature doesn't work in the arduino ide because it
requires our makefiles to run
  • Loading branch information
obra committed Nov 15, 2023
1 parent 73a2efa commit 2f9abe8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
12 changes: 10 additions & 2 deletions etc/makefiles/sketch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,20 @@ ifneq ($(KALEIDOSCOPE_LOCAL_LIB_DIR),)
_arduino_local_libraries_prop = --libraries "${KALEIDOSCOPE_LOCAL_LIB_DIR}"
endif

compile: kaleidoscope-hardware-configured
# Check if the .kaleidoscope_board file exists
ifneq ("$(wildcard ${SKETCH_DIR}/.kaleidoscope_board)","")
# Read the content of the file
KALEIDOSCOPE_BOARD_CONTENT := $(shell cat ${SKETCH_DIR}/.kaleidoscope_board)

# Set the kaleidoscope_board_config variable
kaleidoscope_board_config := --build-property compiler.cpp.extra_flags=-DKALEIDOSCOPE_HARDWARE_H=\"$(KALEIDOSCOPE_BOARD_CONTENT)\"
endif


compile: kaleidoscope-hardware-configured
-$(QUIET) install -d "${OUTPUT_PATH}"
$(QUIET) $(ARDUINO_CLI) compile --fqbn "${FQBN}" ${ARDUINO_VERBOSE} ${ccache_wrapper_property} ${local_cflags_property} \
${_arduino_local_libraries_prop} ${_ARDUINO_CLI_COMPILE_CUSTOM_FLAGS} \
${_arduino_local_libraries_prop} ${_ARDUINO_CLI_COMPILE_CUSTOM_FLAGS} ${kaleidoscope_board_config}\
--library "${KALEIDOSCOPE_DIR}" \
--libraries "${KALEIDOSCOPE_DIR}/plugins/" \
--build-path "${BUILD_PATH}" \
Expand Down
1 change: 1 addition & 0 deletions examples/Devices/Keyboardio/Model101/.kaleidoscope_board
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Kaleidoscope-Hardware-Keyboardio-Model101.h
2 changes: 2 additions & 0 deletions examples/Devices/Keyboardio/Model101/Model101.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
* as well as the Kaleidoscope plugins we use in the Model 100's firmware
*/


// The Kaleidoscope core

#include "Kaleidoscope.h"

// Support for storing the keymap in EEPROM
Expand Down

0 comments on commit 2f9abe8

Please sign in to comment.