From f527591b57f5700326479949e295e72a28cab028 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Sat, 17 Nov 2018 10:04:27 +0100 Subject: [PATCH] New hardware: SOFT/HRUF Splitography Signed-off-by: Gergely Nagy --- NEWS.md | 1 + doc/plugin/Hardware-SOFTHRUF-Splitography.md | 5 + .../Splitography/.kaleidoscope-builder.conf | 25 +++++ examples/Devices/Splitography/Makefile | 52 +++++++++++ .../Devices/Splitography/Splitography.ino | 59 ++++++++++++ ...eidoscope-Hardware-SOFTHRUF-Splitography.h | 22 +++++ .../hardware/softhruf/Splitography.cpp | 44 +++++++++ .../hardware/softhruf/Splitography.h | 92 +++++++++++++++++++ 8 files changed, 300 insertions(+) create mode 100644 doc/plugin/Hardware-SOFTHRUF-Splitography.md create mode 100644 examples/Devices/Splitography/.kaleidoscope-builder.conf create mode 100644 examples/Devices/Splitography/Makefile create mode 100644 examples/Devices/Splitography/Splitography.ino create mode 100644 src/Kaleidoscope-Hardware-SOFTHRUF-Splitography.h create mode 100644 src/kaleidoscope/hardware/softhruf/Splitography.cpp create mode 100644 src/kaleidoscope/hardware/softhruf/Splitography.h diff --git a/NEWS.md b/NEWS.md index aa916be3..e5254938 100644 --- a/NEWS.md +++ b/NEWS.md @@ -90,6 +90,7 @@ Kaleidoscope has been ported to the following devices: - [Atreus](doc/plugin/Hardware-Technomancy-Atreus.md), post-2016 PCB variants with an A* MCU, and the handwired with Teensy from FalbaTech are supported, PCBs prior to 2016 and the legacy teensy2 variants are not. - [ErgoDox](doc/plugin/Hardware-EZ-ErgoDox.md): Originally developed to support the ErgoDox EZ, but all other compatible hardware is supported, such as the original ErgoDox and anything else wired like it, like some Dactyls. - [Planck](doc/plugin/Hardware-OLKB-Planck.md): AVR-based Plancks, and anything else wired similarly should be supported, as long as they use a Teensy. +- [Splitography](doc/plugin/Hardware-SOFTHRUF-Splitography.md): Initial support for the Splitography Steno keyboard. For more information, please see the hardware plugins' documentation. diff --git a/doc/plugin/Hardware-SOFTHRUF-Splitography.md b/doc/plugin/Hardware-SOFTHRUF-Splitography.md new file mode 100644 index 00000000..dacc942c --- /dev/null +++ b/doc/plugin/Hardware-SOFTHRUF-Splitography.md @@ -0,0 +1,5 @@ +# Kaleidoscope-Hardware-SOFTHRUF-Splitography + +Hardware support for the [SOFTHRUF Splitography][splitography] Steno keyboard. + + [splitography]: https://softhruf.love/collections/writers diff --git a/examples/Devices/Splitography/.kaleidoscope-builder.conf b/examples/Devices/Splitography/.kaleidoscope-builder.conf new file mode 100644 index 00000000..13de0eea --- /dev/null +++ b/examples/Devices/Splitography/.kaleidoscope-builder.conf @@ -0,0 +1,25 @@ +flash_over_usb() { + sleep 1s + + dfu-programmer ${MCU} erase + dfu-programmer ${MCU} flash "${HEX_FILE_PATH}" + dfu-programmer ${MCU} start +} + +flash () { + prepare_to_flash + + # This is defined in the (optional) user config. + # shellcheck disable=SC2154 + ${preFlash_HOOKS} + + flash_over_usb || flash_over_usb + + # This is defined in the (optional) user config. + # shellcheck disable=SC2154 + ${postFlash_HOOKS} +} + +NO_RESET=1 +DEFAULT_SKETCH="Splitography" +BOARD="splitography" diff --git a/examples/Devices/Splitography/Makefile b/examples/Devices/Splitography/Makefile new file mode 100644 index 00000000..5d721383 --- /dev/null +++ b/examples/Devices/Splitography/Makefile @@ -0,0 +1,52 @@ +# This stub makefile for a Kaleidoscope example pulls in all the targets +# required to build the example + +UNAME_S := $(shell uname -s) + +ifeq ($(UNAME_S),Darwin) +SKETCHBOOK_DIR ?= $(HOME)/Documents/Arduino +PACKAGE_DIR ?= $(HOME)/Library/Arduino15 +else +SKETCHBOOK_DIR ?= $(HOME)/Arduino +PACKAGE_DIR ?= $(HOME)/.arduino15 +endif + + +ARDUINO_INSTALLED_ENV=$(shell ls -dt $(PACKAGE_DIR)/packages/keyboardio/hardware/avr 2>/dev/null |head -n 1) +MANUALLY_INSTALLED_ENV=$(shell ls -dt $(SKETCHBOOK_DIR)/hardware/keyboardio/avr 2>/dev/null |head -n 1) + + + +ifneq ("$(wildcard $(ARDUINO_INSTALLED_ENV)/boards.txt)","") + +ifneq ("$(wildcard $(MANUALLY_INSTALLED_ENV)/boards.txt)","") + +$(info ***************************************************************************) +$(info It appears that you have installed two copies of Kaleidoscope. One copy was) +$(info installed using Arduino's "Board Manager", while the other was installed by) +$(info hand, probably using "git".) +$(info ) +$(info This will likely cause some trouble as you try to build keyboard firmware) +$(info using Kaleidoscope. You may want to remove either: ) +$(info ) +$(info $(PACKAGE_DIR)/packages/keyboardio/ which was installed using Arduino) +$(info ) +$(info or) +$(info ) +$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.) +$(info ) +$(info ***************************************************************************) +$(info ) + +endif + +BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV) +KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/ +KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/ + +endif + +BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware +KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/avr/build-tools/makefiles/ + +include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk diff --git a/examples/Devices/Splitography/Splitography.ino b/examples/Devices/Splitography/Splitography.ino new file mode 100644 index 00000000..83ac4e44 --- /dev/null +++ b/examples/Devices/Splitography/Splitography.ino @@ -0,0 +1,59 @@ +/* -*- mode: c++ -*- + * Splitography -- A very basic Kaleidoscope example for the SOFT/HRUF Splitography keyboard + * Copyright (C) 2018 Keyboard.io, Inc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTabILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "Kaleidoscope.h" +#include "Kaleidoscope-Steno.h" + +enum { + _STENO, +}; + +/* *INDENT-OFF* */ +KEYMAPS( + +/* Steno (GeminiPR) + * ,-----------------------. ,-----------------------. + * | # | # | # | # | # | # | | # | # | # | # | # | # | + * |---+---+---+---+---+---| |---+---+---+---+---+---| + * | | S | T | P | H | * | | * | F | P | L | T | D | + * |---+---+---+---+---+---| |---+---+---+---+---+---| + * | | S | K | W | R | * | | * | R | B | G | S | Z | + * `-------------+---+---+-' `-+---+---+-------------' + * | A | O | | E | U | + * `-------' `-------' + */ + [_STENO] = KEYMAP( + S(N1) ,S(N2) ,S(N3) ,S(N4) ,S(N5) ,S(N6) ,S(N7) ,S(N8) ,S(N9) ,S(NA) ,S(NB) ,S(NC) + ,XXX ,S(S1) ,S(TL) ,S(PL) ,S(HL) ,S(ST1) ,S(ST3) ,S(FR) ,S(PR) ,S(LR) ,S(TR) ,S(DR) + ,XXX ,S(S2) ,S(KL) ,S(WL) ,S(RL) ,S(ST2) ,S(ST4) ,S(RR) ,S(BR) ,S(GR) ,S(SR) ,S(ZR) + ,S(A) ,S(O) ,S(E) ,S(U) + ) +); +/* *INDENT-ON* */ + +KALEIDOSCOPE_INIT_PLUGINS(GeminiPR); + +void setup() { + Serial.begin(9600); + Kaleidoscope.setup(); +} + +void loop() { + Kaleidoscope.loop(); +} diff --git a/src/Kaleidoscope-Hardware-SOFTHRUF-Splitography.h b/src/Kaleidoscope-Hardware-SOFTHRUF-Splitography.h new file mode 100644 index 00000000..e6f1447b --- /dev/null +++ b/src/Kaleidoscope-Hardware-SOFTHRUF-Splitography.h @@ -0,0 +1,22 @@ +/* -*- mode: c++ -*- + * Kaleidoscope-Hardware-SOFTHRUF-Splitography -- Splitography hardware support for Kaleidoscope + * Copyright (C) 2018 Keyboard.io, Inc + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#define KALEIDOSCOPE_WITH_ATMEGA_KEYBOARD 1 +#include "kaleidoscope/hardware/softhruf/Splitography.h" diff --git a/src/kaleidoscope/hardware/softhruf/Splitography.cpp b/src/kaleidoscope/hardware/softhruf/Splitography.cpp new file mode 100644 index 00000000..d646551e --- /dev/null +++ b/src/kaleidoscope/hardware/softhruf/Splitography.cpp @@ -0,0 +1,44 @@ +/* -*- mode: c++ -*- + * Kaleidoscope-Hardware-SOFTHRUF-Splitography -- Splitography hardware support for Kaleidoscope + * Copyright (C) 2018 Keyboard.io, Inc + * + * Based on QMK (commit e9a67f8fd) and sdothum's fork (commit 8616b44) + * (C) Jack Humbert, Jun Wako, Steven Hum, and others + * Original QMK sources: + * - keyboards/splitography/config.h + * - keyboards/splitography/splitography.h + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifdef ARDUINO_AVR_SPLITOGRAPHY + +#include +#include + +namespace kaleidoscope { +namespace hardware { +namespace softhruf { + +ATMEGA_KEYBOARD_DATA(Splitography); +constexpr int8_t Splitography::led_count; + +} +} +} + +HARDWARE_IMPLEMENTATION KeyboardHardware; +kaleidoscope::hardware::softhruf::Splitography &Splitography = KeyboardHardware; + +#endif diff --git a/src/kaleidoscope/hardware/softhruf/Splitography.h b/src/kaleidoscope/hardware/softhruf/Splitography.h new file mode 100644 index 00000000..895ad160 --- /dev/null +++ b/src/kaleidoscope/hardware/softhruf/Splitography.h @@ -0,0 +1,92 @@ +/* -*- mode: c++ -*- + * Kaleidoscope-Hardware-SOFTHRUF-Splitography -- Splitography hardware support for Kaleidoscope + * Copyright (C) 2018 Keyboard.io, Inc + * + * Based on QMK (commit e9a67f8fd) and sdothum's fork (commit 8616b44) + * (C) Jack Humbert, Jun Wako, Steven Hum, and others + * Original QMK sources: + * - keyboards/splitography/config.h + * - keyboards/splitography/splitography.h + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#ifdef ARDUINO_AVR_SPLITOGRAPHY + +#include +#define HARDWARE_IMPLEMENTATION kaleidoscope::hardware::softhruf::Splitography +#include "Kaleidoscope-HIDAdaptor-KeyboardioHID.h" + +#include "kaleidoscope/macro_helpers.h" +#include "kaleidoscope/hardware/avr/pins_and_ports.h" + +#include "kaleidoscope/hardware/ATMegaKeyboard.h" + +namespace kaleidoscope { +namespace hardware { +namespace softhruf { +class Splitography: public kaleidoscope::hardware::ATMegaKeyboard { + public: + Splitography(void) {} + + ATMEGA_KEYBOARD_CONFIG( + ROW_PIN_LIST({ PIN_D0, PIN_D1, PIN_D2, PIN_D3 }), + COL_PIN_LIST({ PIN_F0, PIN_F1, PIN_F4, PIN_F5, PIN_F6, PIN_F7, PIN_C7, PIN_C6, PIN_B6, PIN_B5, PIN_B4, PIN_D7 }) + ); + + static constexpr int8_t led_count = 0; +}; + +#define KEYMAP( \ + r0c0 ,r0c1 ,r0c2 ,r0c3 ,r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