diff --git a/doc/plugin/LED-AlphaSquare.md b/doc/plugin/LED-AlphaSquare.md new file mode 100644 index 00000000..cb9384f9 --- /dev/null +++ b/doc/plugin/LED-AlphaSquare.md @@ -0,0 +1,109 @@ +# Kaleidoscope-LED-AlphaSquare + +An alphabet for your per-key LEDs, `AlphaSquare` provides a way to display 4x4 +"pixel" symbols on your keyboard. With this building block, one can build some +sweet animations, or just show off - the possibilities are almost endless! + +## Using the plugin + +To use the plugin, one needs to include the header in their Sketch, tell the +firmware to `use` the plugin, and one way or another, call the `display` method. +This can be done from a macro, or via the `AlphaSquareEffect` LED mode. + +```c++ +#include +#include +#include + +KALEIDOSCOPE_INIT_PLUGINS(LEDControl, + AlphaSquare, + AlphaSquareEffect); + +void setup() { + Kaleidoscope.setup(); + + AlphaSquare.display (Key_A); +} +``` + +## Plugin methods + +The plugin provides the `AlphaSquare` object, which has its methods and +properties listed below, and an `AlphaSquareEffect` LED mode, which has no +methods or properties other than those provided by all LED modes. + +### `.display(key)` +### `.display(key, col)` +### `.display(key, row, col)` +### `.display(key, row, col, color)` + +> Display the symbol for `key` at the given row or column, with pixels set to +> the specified `color`. If `row` is omitted, the first row - `0` is assumed. If +> the column is omitted, then the third column - `2` - is used. +> If the `color` is omitted, the plugin will use the global `.color` property. +> +> The plugin can display the English alphabet, and the numbers from 0 to 9. The +> symbol will be drawn with the top-left corner at the given position. +> +> Please consult the appropriate hardware library of your keyboard to see how +> keys are laid out in rows and columns. + +### `.display(symbol)` +### `.display(symbol, col)` +### `.display(symbol, row, col)` +### `.display(symbol, row, col, color)` + +> As the previous function, but instead of a key, it expects a 4x4 bitmap in +> the form of a 16-bit unsigned integer, where the low bit is the top-right +> corner, the second-lowest bit is to the right of that, and so on. +> +> The `SYM4x4` macro can be used to simplify creating these bitmaps. + +### `.clear(key)`, `.clear(symbol)` +### `.clear(key, col)`, `.clear(symbol, col)` +### `.clear(key, col, row)`, `.clear(symbol, col, row)` + +> Just like the `.display()` counterparts, except these clear the symbol, by +> turning the LED pixels it is made up from off. + +### `.color` + +> The color to use to draw the pixels. +> +> Defaults to `{ 0x80, 0x80, 0x80 }` (light gray). + +## Plugin helpers + +### `SYM4x4(...)` + +> A helper macro, which can be used to set up custom bitmaps. It expects 16 +> values, a 4x4 square of zeroes and ones. Zeroes are transparent pixels, ones +> will be colored. + +## Extra symbols + +There is a growing number of pre-defined symbols available in the +`kaleidoscope::plugin::alpha_square::symbols` namespace. Ok, growing may have +been an exaggeration, there is only one as of this writing: + +### `Lambda` + +> A lambda (`λ`) symbol. + +## Dependencies + +* [Kaleidoscope-LEDControl](LEDControl.md) + +## Further reading + +Starting from the [example][plugin:example] is the recommended way of getting +started with the plugin. + + [plugin:example]: ../../examples/LED-AlphaSquare/LED-AlphaSquare.ino + +## Upgrading + +Former versions of the plugin used to have extra symbols in the +`kaleidoscope::alpha_square::symbols` namespace, while current versions have +them under `kaleidoscope::plugin::alpha_square::symbols`. The old name is +deprecated, and will be removed by 2019-01-14. diff --git a/examples/LED-AlphaSquare/LED-AlphaSquare.ino b/examples/LED-AlphaSquare/LED-AlphaSquare.ino new file mode 100644 index 00000000..c4a3eb51 --- /dev/null +++ b/examples/LED-AlphaSquare/LED-AlphaSquare.ino @@ -0,0 +1,110 @@ +/* -*- mode: c++ -*- + * Kaleidoscope-LED-AlphaSquare -- 4x4 pixel LED alphabet + * Copyright (C) 2017, 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, version 3. + * + * 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 . + */ + +#include +#include +#include +#include + +// *INDENT-OFF* +const Key keymaps[][ROWS][COLS] PROGMEM = { + [0] = KEYMAP_STACKED + ( + Key_LEDEffectNext, Key_1, Key_2, Key_3, Key_4, Key_5, M(0), + Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab, + Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G, + Key_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape, + + Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift, + Key_skip, + + Key_skip, Key_6, Key_7, Key_8, Key_9, Key_0, Key_skip, + Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals, + Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote, + Key_skip, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus, + + Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, + Key_skip), +}; +// *INDENT-ON* + +const macro_t *macroAction(uint8_t macro_index, uint8_t key_state) { + if (!keyToggledOn(key_state)) + return MACRO_NONE; + + if (macro_index == 0) { + for (uint8_t i = Key_A.keyCode; i <= Key_0.keyCode; i++) { + LEDControl.set_all_leds_to(0, 0, 0); + LEDControl.syncLeds(); + delay(100); + + uint8_t col = 2; + if (i % 2) + col = 10; + + for (uint8_t step = 0; step <= 0xf0; step += 8) { + AlphaSquare.color = { step, step, step }; + AlphaSquare.display({i, 0}, col); + delay(10); + } + for (uint8_t step = 0xff; step >= 8; step -= 8) { + AlphaSquare.color = { step, step, step }; + AlphaSquare.display({i, 0}, col); + delay(10); + } + delay(100); + } + + LEDControl.set_all_leds_to(0, 0, 0); + LEDControl.syncLeds(); + delay(100); + + for (uint8_t step = 0; step <= 0xf0; step += 8) { + AlphaSquare.color = { step, step, step }; + AlphaSquare.display(kaleidoscope::plugin::alpha_square::symbols::Lambda, 2); + AlphaSquare.display(kaleidoscope::plugin::alpha_square::symbols::Lambda, 10); + delay(10); + } + + for (uint8_t step = 0xff; step >= 8; step -= 8) { + AlphaSquare.color = { step, step, step }; + AlphaSquare.display(kaleidoscope::plugin::alpha_square::symbols::Lambda, 2); + AlphaSquare.display(kaleidoscope::plugin::alpha_square::symbols::Lambda, 10); + delay(10); + } + delay(100); + } + + LEDControl.set_all_leds_to(0, 0, 0); + + return MACRO_NONE; +} + +KALEIDOSCOPE_INIT_PLUGINS(LEDControl, + AlphaSquare, + AlphaSquareEffect, + Macros); + +void setup() { + Kaleidoscope.setup(); + + AlphaSquare.color = { 0xcb, 0xc0, 0xff }; +} + +void loop() { + Kaleidoscope.loop(); +} diff --git a/src/Kaleidoscope-LED-AlphaSquare.h b/src/Kaleidoscope-LED-AlphaSquare.h new file mode 100644 index 00000000..2a279780 --- /dev/null +++ b/src/Kaleidoscope-LED-AlphaSquare.h @@ -0,0 +1,22 @@ +/* -*- mode: c++ -*- + * Kaleidoscope-LED-AlphaSquare -- 4x4 pixel LED alphabet + * Copyright (C) 2017 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, version 3. + * + * 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 + +#include +#include +#include diff --git a/src/kaleidoscope/plugin/LED-AlphaSquare.cpp b/src/kaleidoscope/plugin/LED-AlphaSquare.cpp new file mode 100644 index 00000000..0eadb246 --- /dev/null +++ b/src/kaleidoscope/plugin/LED-AlphaSquare.cpp @@ -0,0 +1,101 @@ +/* -*- mode: c++ -*- + * Kaleidoscope-LED-AlphaSquare -- 4x4 pixel LED alphabet + * Copyright (C) 2017 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, version 3. + * + * 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 . + */ + +#include +#include + +namespace kaleidoscope { +namespace plugin { + +static const uint16_t alphabet[] PROGMEM = { + ALPHASQUARE_SYMBOL_A, + ALPHASQUARE_SYMBOL_B, + ALPHASQUARE_SYMBOL_C, + ALPHASQUARE_SYMBOL_D, + ALPHASQUARE_SYMBOL_E, + ALPHASQUARE_SYMBOL_F, + ALPHASQUARE_SYMBOL_G, + ALPHASQUARE_SYMBOL_H, + ALPHASQUARE_SYMBOL_I, + ALPHASQUARE_SYMBOL_J, + ALPHASQUARE_SYMBOL_K, + ALPHASQUARE_SYMBOL_L, + ALPHASQUARE_SYMBOL_M, + ALPHASQUARE_SYMBOL_N, + ALPHASQUARE_SYMBOL_O, + ALPHASQUARE_SYMBOL_P, + ALPHASQUARE_SYMBOL_Q, + ALPHASQUARE_SYMBOL_R, + ALPHASQUARE_SYMBOL_S, + ALPHASQUARE_SYMBOL_T, + ALPHASQUARE_SYMBOL_U, + ALPHASQUARE_SYMBOL_V, + ALPHASQUARE_SYMBOL_W, + ALPHASQUARE_SYMBOL_X, + ALPHASQUARE_SYMBOL_Y, + ALPHASQUARE_SYMBOL_Z, + ALPHASQUARE_SYMBOL_1, + ALPHASQUARE_SYMBOL_2, + ALPHASQUARE_SYMBOL_3, + ALPHASQUARE_SYMBOL_4, + ALPHASQUARE_SYMBOL_5, + ALPHASQUARE_SYMBOL_6, + ALPHASQUARE_SYMBOL_7, + ALPHASQUARE_SYMBOL_8, + ALPHASQUARE_SYMBOL_9, + ALPHASQUARE_SYMBOL_0 +}; + + +cRGB AlphaSquare::color = {0x80, 0x80, 0x80}; + +void AlphaSquare::display(Key key, uint8_t row, uint8_t col, cRGB key_color) { + if (key < Key_A || key > Key_0) + return; + + uint8_t index = key.keyCode - Key_A.keyCode; + uint16_t symbol = pgm_read_word(&alphabet[index]); + + display(symbol, row, col, key_color); +} + +void AlphaSquare::display(Key key, uint8_t row, uint8_t col) { + display(key, row, col, color); +} + +void AlphaSquare::display(uint16_t symbol, uint8_t row, uint8_t col, cRGB key_color) { + for (uint8_t r = 0; r < 4; r++) { + for (uint8_t c = 0; c < 4; c++) { + uint8_t pixel = bitRead(symbol, r * 4 + c); + if (!pixel) + continue; + + ::LEDControl.setCrgbAt(row + r, col + c, key_color); + } + } + + ::LEDControl.syncLeds(); +} + +void AlphaSquare::display(uint16_t symbol, uint8_t row, uint8_t col) { + display(symbol, row, col, color); +} + +} +} + +kaleidoscope::plugin::AlphaSquare AlphaSquare; diff --git a/src/kaleidoscope/plugin/LED-AlphaSquare.h b/src/kaleidoscope/plugin/LED-AlphaSquare.h new file mode 100644 index 00000000..296a7ca7 --- /dev/null +++ b/src/kaleidoscope/plugin/LED-AlphaSquare.h @@ -0,0 +1,84 @@ +/* -*- mode: c++ -*- + * Kaleidoscope-LED-AlphaSquare -- 4x4 pixel LED alphabet + * Copyright (C) 2017 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, version 3. + * + * 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 + +#include +#include + +#define SYM4x4( \ + p00, p01, p02, p03, \ + p10, p11, p12, p13, \ + p20, p21, p22, p23, \ + p30, p31, p32, p33) \ + (uint16_t) ( \ + p00 << 0 | p01 << 1 | p02 << 2 | p03 << 3 | \ + p10 << 4 | p11 << 5 | p12 << 6 | p13 << 7 | \ + p20 << 8 | p21 << 9 | p22 << 10 | p23 << 11 | \ + p30 << 12 | p31 << 13 | p32 << 14 | p33 << 15 ) + +namespace kaleidoscope { +namespace plugin { +class AlphaSquare : public kaleidoscope::Plugin { + public: + AlphaSquare(void) {} + + static void display(Key key, uint8_t row, uint8_t col, cRGB key_color); + static void display(Key key, uint8_t row, uint8_t col); + static void display(Key key) { + display(key, 0, 2); + } + static void display(Key key, uint8_t col) { + display(key, 0, col); + } + + static void display(uint16_t symbol, uint8_t row, uint8_t col, cRGB key_color); + static void display(uint16_t symbol, uint8_t row, uint8_t col); + static void display(uint16_t symbol) { + display(symbol, 0, 2); + } + static void display(uint16_t symbol, uint8_t col) { + display(symbol, 0, col); + } + + static void clear(Key key, uint8_t row, uint8_t col) { + display(key, row, col, {0, 0, 0}); + } + static void clear(Key key, uint8_t col) { + clear(key, 0, col); + } + static void clear(Key key) { + clear(key, 0, 2); + } + + static void clear(uint16_t symbol, uint8_t row, uint8_t col) { + display(symbol, row, col, {0, 0, 0}); + } + static void clear(uint16_t symbol, uint8_t col) { + clear(symbol, 0, col); + } + static void clear(uint16_t symbol) { + clear(symbol, 0, 2); + } + + static cRGB color; +}; + +} +} + +extern kaleidoscope::plugin::AlphaSquare AlphaSquare; diff --git a/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.cpp b/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.cpp new file mode 100644 index 00000000..025ec20d --- /dev/null +++ b/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.cpp @@ -0,0 +1,74 @@ +/* -*- mode: c++ -*- + * Kaleidoscope-LED-AlphaSquare -- 4x4 pixel LED alphabet + * Copyright (C) 2017, 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, version 3. + * + * 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 . + */ + +#include + +namespace kaleidoscope { +namespace plugin { + +uint16_t AlphaSquareEffect::length = 1000; +uint32_t AlphaSquareEffect::end_time_left_, AlphaSquareEffect::end_time_right_; +Key AlphaSquareEffect::last_key_left_, AlphaSquareEffect::last_key_right_; + +void AlphaSquareEffect::update(void) { + if (end_time_left_ && millis() > end_time_left_) { + ::AlphaSquare.clear(last_key_left_); + end_time_left_ = 0; + } + if (end_time_right_ && millis() > end_time_right_) { + ::AlphaSquare.clear(last_key_right_, 10); + end_time_right_ = 0; + } +} + +EventHandlerResult AlphaSquareEffect::onKeyswitchEvent(Key &mappedKey, byte row, byte col, uint8_t keyState) { + if (::LEDControl.get_mode() != &::AlphaSquareEffect) + return EventHandlerResult::OK; + + if (keyState & INJECTED) + return EventHandlerResult::OK; + + if (mappedKey < Key_A || mappedKey > Key_0) + return EventHandlerResult::OK; + + if (!keyIsPressed(keyState)) + return EventHandlerResult::OK; + + uint8_t display_col = 2; + Key prev_key = last_key_left_; + + if (col < COLS / 2) { + last_key_left_ = mappedKey; + end_time_left_ = millis() + length; + } else { + prev_key = last_key_right_; + last_key_right_ = mappedKey; + end_time_right_ = millis() + length; + display_col = 10; + } + + if (prev_key != mappedKey) + ::AlphaSquare.clear(prev_key, display_col); + ::AlphaSquare.display(mappedKey, display_col); + + return EventHandlerResult::OK; +} + +} +} + +kaleidoscope::plugin::AlphaSquareEffect AlphaSquareEffect; diff --git a/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h b/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h new file mode 100644 index 00000000..3227afdf --- /dev/null +++ b/src/kaleidoscope/plugin/LED-AlphaSquare/Effect.h @@ -0,0 +1,43 @@ +/* -*- mode: c++ -*- + * Kaleidoscope-LED-AlphaSquare -- 4x4 pixel LED alphabet + * Copyright (C) 2017, 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, version 3. + * + * 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 + +#include +#include + +namespace kaleidoscope { +namespace plugin { +class AlphaSquareEffect : public LEDMode { + public: + AlphaSquareEffect(void) {} + + static uint16_t length; + + EventHandlerResult onKeyswitchEvent(Key &mappedKey, byte row, byte col, uint8_t keyState); + + protected: + void update(void) final; + + private: + static uint32_t end_time_left_, end_time_right_; + static Key last_key_left_, last_key_right_; +}; +} +} + +extern kaleidoscope::plugin::AlphaSquareEffect AlphaSquareEffect; diff --git a/src/kaleidoscope/plugin/LED-AlphaSquare/Font-3x4.h b/src/kaleidoscope/plugin/LED-AlphaSquare/Font-3x4.h new file mode 100644 index 00000000..2fae3bf0 --- /dev/null +++ b/src/kaleidoscope/plugin/LED-AlphaSquare/Font-3x4.h @@ -0,0 +1,169 @@ +/* Kaleidoscope-LED-AlphaSquare -- 3x4 pixel LED alphabet + * Copyright (C) 2017 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, version 3. + * + * 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 + +#ifndef KALEIDOSCOPE_LED_FONT +#define KALEIDOSCOPE_LED_FONT + +#define ALPHASQUARE_SYMBOL_A SYM4x4(0, 1, 0, 0, \ + 1, 0, 1, 0, \ + 1, 1, 1, 0, \ + 1, 0, 1, 0) +#define ALPHASQUARE_SYMBOL_B SYM4x4(1, 1, 0, 0, \ + 1, 1, 1, 0, \ + 1, 0, 1, 0, \ + 1, 1, 0, 0) +#define ALPHASQUARE_SYMBOL_C SYM4x4(0, 1, 1, 0, \ + 1, 0, 0, 0, \ + 1, 0, 0, 0, \ + 0, 1, 1, 0) +#define ALPHASQUARE_SYMBOL_D SYM4x4(1, 1, 0, 0, \ + 1, 0, 1, 0, \ + 1, 0, 1, 0, \ + 1, 1, 0, 0) +#define ALPHASQUARE_SYMBOL_E SYM4x4(1, 1, 1, 0, \ + 1, 1, 0, 0, \ + 1, 0, 0, 0, \ + 1, 1, 1, 0) +#define ALPHASQUARE_SYMBOL_F SYM4x4(1, 1, 1, 0, \ + 1, 0, 0, 0, \ + 1, 1, 0, 0, \ + 1, 0, 0, 0) +#define ALPHASQUARE_SYMBOL_G SYM4x4(0, 1, 1, 0, \ + 1, 0, 0, 0, \ + 1, 0, 1, 0, \ + 0, 1, 1, 0) +#define ALPHASQUARE_SYMBOL_H SYM4x4(1, 0, 1, 0, \ + 1, 1, 1, 0, \ + 1, 0, 1, 0, \ + 1, 0, 1, 0) +#define ALPHASQUARE_SYMBOL_I SYM4x4(1, 1, 1, 0, \ + 0, 1, 0, 0, \ + 0, 1, 0, 0, \ + 1, 1, 1, 0) +#define ALPHASQUARE_SYMBOL_J SYM4x4(1, 1, 1, 0, \ + 0, 0, 1, 0, \ + 1, 0, 1, 0, \ + 0, 1, 0, 0) +#define ALPHASQUARE_SYMBOL_K SYM4x4(1, 0, 1, 0, \ + 1, 1, 0, 0, \ + 1, 1, 0, 0, \ + 1, 0, 1, 0) +#define ALPHASQUARE_SYMBOL_L SYM4x4(1, 0, 0, 0, \ + 1, 0, 0, 0, \ + 1, 0, 0, 0, \ + 1, 1, 1, 0) +#define ALPHASQUARE_SYMBOL_M SYM4x4(1, 0, 1, 0, \ + 1, 1, 1, 0, \ + 1, 1, 1, 0, \ + 1, 0, 1, 0) +#define ALPHASQUARE_SYMBOL_N SYM4x4(1, 0, 1, 0, \ + 1, 1, 1, 0, \ + 1, 0, 1, 0, \ + 1, 0, 1, 0) +#define ALPHASQUARE_SYMBOL_O SYM4x4(0, 1, 0, 0, \ + 1, 0, 1, 0, \ + 1, 0, 1, 0, \ + 0, 1, 0, 0) +#define ALPHASQUARE_SYMBOL_P SYM4x4(1, 1, 0, 0, \ + 1, 0, 1, 0, \ + 1, 1, 0, 0, \ + 1, 0, 0, 0) +#define ALPHASQUARE_SYMBOL_Q SYM4x4(0, 1, 0, 0, \ + 1, 0, 1, 0, \ + 1, 0, 1, 0, \ + 0, 1, 1, 0) +#define ALPHASQUARE_SYMBOL_R SYM4x4(1, 1, 0, 0, \ + 1, 0, 1, 0, \ + 1, 1, 0, 0, \ + 1, 0, 1, 0) +#define ALPHASQUARE_SYMBOL_S SYM4x4(1, 1, 1, 0, \ + 1, 1, 0, 0, \ + 0, 0, 1, 0, \ + 1, 1, 1, 0) +#define ALPHASQUARE_SYMBOL_T SYM4x4(1, 1, 1, 0, \ + 0, 1, 0, 0, \ + 0, 1, 0, 0, \ + 0, 1, 0, 0) +#define ALPHASQUARE_SYMBOL_U SYM4x4(1, 0, 1, 0, \ + 1, 0, 1, 0, \ + 1, 0, 1, 0, \ + 1, 1, 1, 0) +#define ALPHASQUARE_SYMBOL_V SYM4x4(1, 0, 1, 0, \ + 1, 0, 1, 0, \ + 1, 0, 1, 0, \ + 0, 1, 0, 0) +#define ALPHASQUARE_SYMBOL_W SYM4x4(1, 0, 0, 0, \ + 1, 0, 1, 0, \ + 1, 1, 1, 0, \ + 1, 0, 1, 0) +#define ALPHASQUARE_SYMBOL_X SYM4x4(1, 0, 1, 0, \ + 0, 1, 0, 0, \ + 0, 1, 0, 0, \ + 1, 0, 1, 0) +#define ALPHASQUARE_SYMBOL_Y SYM4x4(1, 0, 1, 0, \ + 0, 1, 0, 0, \ + 0, 1, 0, 0, \ + 0, 1, 0, 0) +#define ALPHASQUARE_SYMBOL_Z SYM4x4(1, 1, 1, 0, \ + 0, 0, 1, 0, \ + 0, 1, 0, 0, \ + 1, 1, 1, 0) +// --------------------- +#define ALPHASQUARE_SYMBOL_1 SYM4x4(1, 1, 0, 0, \ + 0, 1, 0, 0, \ + 0, 1, 0, 0, \ + 1, 1, 1, 0) +#define ALPHASQUARE_SYMBOL_2 SYM4x4(1, 1, 0, 0, \ + 0, 0, 1, 0, \ + 0, 1, 0, 0, \ + 1, 1, 1, 0) +#define ALPHASQUARE_SYMBOL_3 SYM4x4(1, 1, 1, 0, \ + 0, 1, 1, 0, \ + 0, 0, 1, 0, \ + 1, 1, 1, 0) +#define ALPHASQUARE_SYMBOL_4 SYM4x4(1, 0, 1, 0, \ + 1, 1, 1, 0, \ + 0, 0, 1, 0, \ + 0, 0, 1, 0) +#define ALPHASQUARE_SYMBOL_5 SYM4x4(1, 1, 1, 0, \ + 1, 1, 0, 0, \ + 0, 0, 1, 0, \ + 1, 1, 1, 0) +#define ALPHASQUARE_SYMBOL_6 SYM4x4(0, 1, 1, 0, \ + 1, 0, 0, 0, \ + 1, 1, 1, 0, \ + 0, 1, 1, 0) +#define ALPHASQUARE_SYMBOL_7 SYM4x4(1, 1, 1, 0, \ + 0, 0, 1, 0, \ + 0, 0, 1, 0, \ + 0, 0, 1, 0) +#define ALPHASQUARE_SYMBOL_8 SYM4x4(1, 1, 1, 0, \ + 1, 1, 1, 0, \ + 1, 0, 1, 0, \ + 1, 1, 1, 0) +#define ALPHASQUARE_SYMBOL_9 SYM4x4(1, 1, 1, 0, \ + 1, 0, 1, 0, \ + 1, 1, 1, 0, \ + 0, 0, 1, 0) +#define ALPHASQUARE_SYMBOL_0 SYM4x4(1, 1, 1, 0, \ + 1, 0, 1, 0, \ + 1, 0, 1, 0, \ + 1, 1, 1, 0) + +#endif diff --git a/src/kaleidoscope/plugin/LED-AlphaSquare/Font-4x4.h b/src/kaleidoscope/plugin/LED-AlphaSquare/Font-4x4.h new file mode 100644 index 00000000..f33e3388 --- /dev/null +++ b/src/kaleidoscope/plugin/LED-AlphaSquare/Font-4x4.h @@ -0,0 +1,168 @@ +/* Kaleidoscope-LED-AlphaSquare -- 4x4 pixel LED alphabet + * Copyright (C) 2017 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, version 3. + * + * 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 + +#ifndef KALEIDOSCOPE_LED_FONT +#define KALEIDOSCOPE_LED_FONT + +#define ALPHASQUARE_SYMBOL_A SYM4x4(1, 1, 1, 1, \ + 1, 0, 0, 1, \ + 1, 1, 1, 1, \ + 1, 0, 0, 1) +#define ALPHASQUARE_SYMBOL_B SYM4x4(1, 1, 1, 1, \ + 1, 0, 1, 1, \ + 1, 1, 0, 1, \ + 1, 1, 1, 1) +#define ALPHASQUARE_SYMBOL_C SYM4x4(1, 1, 1, 1, \ + 1, 0, 0, 0, \ + 1, 0, 0, 0, \ + 1, 1, 1, 1) +#define ALPHASQUARE_SYMBOL_D SYM4x4(1, 1, 1, 0, \ + 1, 0, 0, 1, \ + 1, 0, 0, 1, \ + 1, 1, 1, 0) +#define ALPHASQUARE_SYMBOL_E SYM4x4(1, 1, 1, 1, \ + 1, 1, 0, 0, \ + 1, 0, 0, 0, \ + 1, 1, 1, 1) +#define ALPHASQUARE_SYMBOL_F SYM4x4(1, 1, 1, 1, \ + 1, 0, 0, 0, \ + 1, 1, 1, 0, \ + 1, 0, 0, 0) +#define ALPHASQUARE_SYMBOL_G SYM4x4(1, 1, 1, 0, \ + 1, 0, 0, 0, \ + 1, 0, 0, 1, \ + 1, 1, 1, 1) +#define ALPHASQUARE_SYMBOL_H SYM4x4(1, 0, 0, 1, \ + 1, 1, 1, 1, \ + 1, 0, 0, 1, \ + 1, 0, 0, 1) +#define ALPHASQUARE_SYMBOL_I SYM4x4(1, 1, 1, 1, \ + 0, 1, 1, 0, \ + 0, 1, 1, 0, \ + 1, 1, 1, 1) +#define ALPHASQUARE_SYMBOL_J SYM4x4(1, 1, 1, 1, \ + 0, 0, 0, 1, \ + 1, 0, 0, 1, \ + 0, 1, 1, 0) +#define ALPHASQUARE_SYMBOL_K SYM4x4(1, 0, 0, 1, \ + 1, 1, 0, 0, \ + 1, 1, 0, 0, \ + 1, 0, 1, 1) +#define ALPHASQUARE_SYMBOL_L SYM4x4(1, 0, 0, 0, \ + 1, 0, 0, 0, \ + 1, 0, 0, 0, \ + 1, 1, 1, 1) +#define ALPHASQUARE_SYMBOL_M SYM4x4(1, 0, 1, 1, \ + 1, 1, 1, 1, \ + 1, 1, 0, 1, \ + 1, 0, 0, 1) +#define ALPHASQUARE_SYMBOL_N SYM4x4(1, 0, 0, 1, \ + 1, 1, 0, 1, \ + 1, 0, 1, 1, \ + 1, 0, 0, 1) +#define ALPHASQUARE_SYMBOL_O SYM4x4(1, 1, 1, 1, \ + 1, 0, 0, 1, \ + 1, 0, 0, 1, \ + 1, 1, 1, 1) +#define ALPHASQUARE_SYMBOL_P SYM4x4(1, 1, 1, 1, \ + 1, 0, 0, 1, \ + 1, 1, 1, 1, \ + 1, 0, 0, 0) +#define ALPHASQUARE_SYMBOL_Q SYM4x4(1, 1, 1, 1, \ + 1, 0, 0, 1, \ + 1, 0, 1, 1, \ + 1, 1, 1, 1) +#define ALPHASQUARE_SYMBOL_R SYM4x4(1, 1, 1, 1, \ + 1, 0, 0, 1, \ + 1, 1, 1, 0, \ + 1, 0, 1, 1) +#define ALPHASQUARE_SYMBOL_S SYM4x4(1, 1, 1, 1, \ + 1, 1, 0, 0, \ + 0, 0, 1, 1, \ + 1, 1, 1, 1) +#define ALPHASQUARE_SYMBOL_T SYM4x4(1, 1, 1, 1, \ + 0, 1, 1, 0, \ + 0, 1, 1, 0, \ + 0, 1, 1, 0) +#define ALPHASQUARE_SYMBOL_U SYM4x4(1, 0, 0, 1, \ + 1, 0, 0, 1, \ + 1, 0, 0, 1, \ + 1, 1, 1, 1) +#define ALPHASQUARE_SYMBOL_V SYM4x4(1, 0, 0, 1, \ + 1, 0, 0, 1, \ + 1, 0, 0, 1, \ + 0, 1, 1, 0) +#define ALPHASQUARE_SYMBOL_W SYM4x4(1, 0, 0, 1, \ + 1, 0, 1, 1, \ + 1, 1, 1, 1, \ + 1, 0, 1, 1) +#define ALPHASQUARE_SYMBOL_X SYM4x4(1, 0, 0, 1, \ + 0, 1, 1, 0, \ + 0, 1, 1, 0, \ + 1, 0, 0, 1) +#define ALPHASQUARE_SYMBOL_Y SYM4x4(1, 0, 0, 1, \ + 1, 1, 1, 1, \ + 0, 1, 1, 0, \ + 0, 1, 1, 0) +#define ALPHASQUARE_SYMBOL_Z SYM4x4(1, 1, 1, 1, \ + 0, 0, 1, 1, \ + 1, 1, 0, 0, \ + 1, 1, 1, 1) +// --------------------- +#define ALPHASQUARE_SYMBOL_1 SYM4x4(0, 1, 1, 0, \ + 1, 0, 1, 0, \ + 0, 0, 1, 0, \ + 1, 1, 1, 1) +#define ALPHASQUARE_SYMBOL_2 SYM4x4(0, 1, 1, 0, \ + 1, 0, 0, 1, \ + 0, 0, 1, 0, \ + 1, 1, 0, 1) +#define ALPHASQUARE_SYMBOL_3 SYM4x4(1, 1, 1, 1, \ + 0, 0, 1, 1, \ + 0, 0, 0, 1, \ + 1, 1, 1, 1) +#define ALPHASQUARE_SYMBOL_4 SYM4x4(1, 0, 0, 1, \ + 1, 1, 1, 1, \ + 0, 0, 0, 1, \ + 0, 0, 0, 1) +#define ALPHASQUARE_SYMBOL_5 SYM4x4(1, 1, 1, 1, \ + 1, 0, 0, 0, \ + 0, 1, 1, 1, \ + 1, 1, 1, 1) +#define ALPHASQUARE_SYMBOL_6 SYM4x4(0, 1, 1, 0, \ + 1, 0, 0, 0, \ + 1, 1, 1, 1, \ + 1, 1, 1, 1) +#define ALPHASQUARE_SYMBOL_7 SYM4x4(1, 1, 1, 1, \ + 0, 0, 0, 1, \ + 0, 0, 1, 0, \ + 0, 1, 0, 0) +#define ALPHASQUARE_SYMBOL_8 SYM4x4(1, 1, 1, 0, \ + 1, 0, 1, 1, \ + 1, 1, 0, 1, \ + 0, 1, 1, 1) +#define ALPHASQUARE_SYMBOL_9 SYM4x4(1, 1, 1, 1, \ + 1, 0, 0, 1, \ + 1, 1, 1, 1, \ + 0, 0, 0, 1) +#define ALPHASQUARE_SYMBOL_0 SYM4x4(0, 1, 1, 0, \ + 1, 0, 0, 1, \ + 1, 0, 0, 1, \ + 0, 1, 1, 0) + +#endif diff --git a/src/kaleidoscope/plugin/LED-AlphaSquare/Symbols.h b/src/kaleidoscope/plugin/LED-AlphaSquare/Symbols.h new file mode 100644 index 00000000..e829a81d --- /dev/null +++ b/src/kaleidoscope/plugin/LED-AlphaSquare/Symbols.h @@ -0,0 +1,39 @@ +/* -*- mode: c++ -*- + * Kaleidoscope-LED-AlphaSquare -- 4x4 pixel LED alphabet + * Copyright (C) 2017 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, version 3. + * + * 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 + +#include + +namespace kaleidoscope { +namespace plugin { +namespace alpha_square { +namespace symbols { + +/* λ */ +static constexpr uint16_t Lambda = SYM4x4(1, 0, 0, 0, + 0, 1, 0, 0, + 0, 1, 1, 0, + 1, 0, 0, 1); +} +} +} + +// Backwards compatibility +namespace alpha_square = kaleidoscope::plugin::alpha_square; + +}