From 374a3e136c05897189ef04b0e3da87b7812d7b72 Mon Sep 17 00:00:00 2001 From: Craig Disselkoen Date: Thu, 28 Sep 2017 12:35:04 -0700 Subject: [PATCH] Support for Kaleidoscope-Hardware-Virtual plugin --- bin/kaleidoscope-builder | 6 +++++- etc/kaleidoscope-builder.conf | 7 +++++-- src/kaleidoscope/hid.cpp | 5 +++++ src/key_defs.h | 5 ++++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/bin/kaleidoscope-builder b/bin/kaleidoscope-builder index 9be38507..a58d415d 100755 --- a/bin/kaleidoscope-builder +++ b/bin/kaleidoscope-builder @@ -3,6 +3,11 @@ set -e firmware_size () { + if [ "${BOARD}" = "virtual" ]; then + echo "[Size not computed for virtual build]" + return + fi + ## This is a terrible hack, please don't hurt me. - algernon MAX_PROG_SIZE=28672 @@ -137,7 +142,6 @@ compile () { -ide-version "${ARDUINO_IDE_VERSION}" \ -warnings all \ ${ARDUINO_VERBOSE} \ - -prefs "compiler.cpp.extra_flags=-std=c++11 -Woverloaded-virtual -Wno-unused-parameter -Wno-unused-variable -Wno-ignored-qualifiers ${ARDUINO_CFLAGS} ${LOCAL_CFLAGS}" \ ${ARDUINO_AVR_GCC_PREFIX_PARAM} \ "$(find_sketch)/${SKETCH}.ino" diff --git a/etc/kaleidoscope-builder.conf b/etc/kaleidoscope-builder.conf index 88158704..2a30b9de 100644 --- a/etc/kaleidoscope-builder.conf +++ b/etc/kaleidoscope-builder.conf @@ -21,8 +21,11 @@ LIBRARY="${LIBRARY:-${SKETCH}}" BOARD="${BOARD:-model01}" MCU="${MCU:-atmega32u4}" -FQBN="${FQBN:-keyboardio:avr:${BOARD}}" - +if [ "${BOARD}" = "virtual" ]; then + FQBN="${FQBN:-keyboardio:x86:${BOARD}}" +else + FQBN="${FQBN:-keyboardio:avr:${BOARD}}" +fi ######## diff --git a/src/kaleidoscope/hid.cpp b/src/kaleidoscope/hid.cpp index 59fe8c02..a2ca542d 100644 --- a/src/kaleidoscope/hid.cpp +++ b/src/kaleidoscope/hid.cpp @@ -1,5 +1,10 @@ #include "hid.h" + +#ifdef ARDUINO_VIRTUAL +#include "VirtualHID/VirtualHID.h" +#else #include "KeyboardioHID.h" +#endif namespace kaleidoscope { namespace hid { diff --git a/src/key_defs.h b/src/key_defs.h index 6a7587ef..aa2bceb0 100644 --- a/src/key_defs.h +++ b/src/key_defs.h @@ -9,8 +9,11 @@ #include "key_defs_aliases.h" - +#ifdef ARDUINO_VIRTUAL +#include "VirtualHID/VirtualHID.h" +#else #include "KeyboardioHID.h" +#endif typedef union Key_ {