diff --git a/examples/Devices/Keyboardio/m100test-serial/Makefile b/examples/Devices/Keyboardio/m100test-serial/Makefile new file mode 100644 index 00000000..19019b31 --- /dev/null +++ b/examples/Devices/Keyboardio/m100test-serial/Makefile @@ -0,0 +1,48 @@ +# This makefile for a Kaleidoscope sketch pulls in all the targets +# required to build the example + + + + +ifneq ($(KALEIDOSCOPE_DIR),) +search_path += $(KALEIDOSCOPE_DIR) +endif + +ifneq ($(ARDUINO_DIRECTORIES_USER),) +search_path += $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/libraries/Kaleidoscope +endif + +ifeq ($(shell uname -s),Darwin) +search_path += $(HOME)/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope +else +search_path += $(HOME)/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope +endif + +sketch_makefile := etc/makefiles/sketch.mk + +$(foreach candidate, $(search_path), $(if $(wildcard $(candidate)/$(sketch_makefile)), $(eval ks_dir ?= $(candidate)))) + +ifneq ($(ks_dir),) + +$(info Using Kaleidoscope from $(ks_dir)) + +export KALEIDOSCOPE_DIR := $(ks_dir) +include $(ks_dir)/$(sketch_makefile) + +else + +$(info I can't find your Kaleidoscope installation.) +$(info ) +$(info I tried looking in:) +$(info ) +$(foreach candidate, $(search_path), $(info $(candidate))) +$(info ) +$(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment) +$(info variable to the location of your Kaleidoscope directory.) + +endif + + +null-target: + $(info You should never see this message) + @: diff --git a/examples/Devices/Keyboardio/m100test-serial/m100test-serial.ino b/examples/Devices/Keyboardio/m100test-serial/m100test-serial.ino new file mode 100644 index 00000000..4efb89b5 --- /dev/null +++ b/examples/Devices/Keyboardio/m100test-serial/m100test-serial.ino @@ -0,0 +1,27 @@ +// -*- mode: c++ -*- + +#include +#include +#include + +KALEIDOSCOPE_INIT_PLUGINS(Macros); + +void setup() { + Kaleidoscope.setup(); +} + +void loop() { + auto s = Kaleidoscope.device().serialPort(); + + if (s.available()) { + uint8_t r = s.read(); + + if (r == '1') { + s.println("Hello"); + Kaleidoscope.device().hid().keyboard().pressKey(Key_H); + Kaleidoscope.device().hid().keyboard().sendReport(); + Kaleidoscope.device().hid().keyboard().releaseKey(Key_H); + Kaleidoscope.device().hid().keyboard().sendReport(); + } + } +} diff --git a/examples/Devices/Keyboardio/m100test-serial/sketch.json b/examples/Devices/Keyboardio/m100test-serial/sketch.json new file mode 100644 index 00000000..3fba2eeb --- /dev/null +++ b/examples/Devices/Keyboardio/m100test-serial/sketch.json @@ -0,0 +1,6 @@ +{ + "cpu": { + "fqbn": "keyboardio:STM32F1:keyboardio_model_100", + "port": "" + } +}