Skip to content

Commit

Permalink
snapshot sketch and infrastructure from the Kaleidoscope example
Browse files Browse the repository at this point in the history
  • Loading branch information
obra committed Feb 20, 2017
1 parent 12f774d commit a0e03fa
Show file tree
Hide file tree
Showing 7 changed files with 592 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*~
.#*
/output/
3 changes: 3 additions & 0 deletions .kaleidoscope-builder.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- mode: sh -*-

DEFAULT_SKETCH=Model01-Firmware
31 changes: 31 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
language: c
before_install:
- pushd ..
- wget http://downloads.arduino.cc/arduino-1.6.11-linux64.tar.xz
- tar xf arduino-1.6.11-linux64.tar.xz
- popd
install:
- pushd ..
- mkdir -p arduino-local/hardware/keyboardio
- git clone https://github.com/keyboardio/Arduino-Boards arduino-local/hardware/keyboardio/avr
- cd arduino-local/hardware/keyboardio/avr
- git submodule sync --recursive
- git submodule update --init --recursive
- popd
script:
- make ARDUINO_PATH=../arduino-1.6.11 ARDUINO_LOCAL_LIB_PATH=../arduino-local build-all
notifications:
irc:
channels:
- "chat.freenode.net#keyboardio"
use_notice: true
skip_join: true
template:
- "%{repository_name}/%{branch} %{commit} by %{author}: %{commit_subject} %{build_url} %{message}"
email:
on_success: change
on_failure: change
slack:
secure: geVAHVhYQ5bY7ja5vx1Tgxc5y64WLuXVEWKmw4LqiThFYCjtpdWkHGiZJfhUwkVI11u5w8w1FUmrB7ZP4EUGoXhCK/z1mvVMVJ9+fS+WoaqcTHFJi0hGbvXaFPD7QA+ef7TLrFcU643kf6KHN/P+dVVndLyhctXZqOZHHwXmKZNMt8qM5Gh5h41HOi0YjT9yFafSU0qf5jphF5qvjlxKsVJF+WxtMSU4xMYxzq7rf80bPi2pu4ijgqR5+Haaa71DJ1V2TA4wZ+BFTBo2YUJIGZ8qDlqmb7RdF/u72G/8HbT/Hzj55blrpBXU/BPkokGOPJlIGHPV76ESpJI0ZUILRifmkZY6ylMjl/hutDYPNjhMq8Z/UKSLN6pJQAq0PjqAoHCtPsXTbRMT0lhVt2itkCPwAXVgszTrE6INsNylY/soaDu66Sjmz2zQH8sC6hbL8SrZ0xGs1Q+e3q5WMETPIAS9f4n2YCxkIz4ORoL9IrOXUcebVNriiWKzOBt6bleWPJlGc6yVYkkUhvURH+jEp6v2Y5SqsaJVTD3I5Gq/H/0PJBtPdzu470yQ3/FD4g6M0AmWx8DCuvl1O295QOZbUtujpIowTm7PynFrAgW3ptSidjzWjzZaHc0iQJBiNi86dg3GomoEEOPzx8hnX7fhFgsR+Ixqfzx0srrQYqleQGY=
cache:
ccache: true
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# default action for `make` is `build`
build:

astyle:
find . -type f -name \*.cpp |xargs -n 1 astyle --style=google
find . -type f -name \*.ino |xargs -n 1 astyle --style=google
find . -type f -name \*.h |xargs -n 1 astyle --style=google

%:
@tools/kaleidoscope-builder $@
148 changes: 148 additions & 0 deletions Model01-Firmware.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
// -*- mode: c++ -*-
// Copyright 2016 Keyboardio, inc. <[email protected]>
// See "LICENSE" for license details

#define DEBUG_SERIAL false

#include "Kaleidoscope-MouseKeys.h"
#include "Kaleidoscope-Macros.h"
#include "Kaleidoscope-LEDControl.h"
#include "Kaleidoscope-Numlock.h"
#include "Kaleidoscope.h"

#include "LED-Off.h"
#include "Kaleidoscope-LEDEffect-SolidColor.h"
#include "Kaleidoscope-LEDEffect-Breathe.h"
#include "Kaleidoscope-LEDEffect-Chase.h"
#include "Kaleidoscope-LEDEffect-Rainbow.h"
#include "Kaleidoscope-Model01-TestMode.h"

uint8_t primary_keymap = 0;
uint8_t temporary_keymap = 0;

#define NUMPAD_KEYMAP 2

#define COLEMAK KEYMAP ( \
___, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext, ___, Key_6, Key_7, Key_8, Key_9, Key_0, Key_ToggleNumlock, \
Key_Backtick, Key_Q, Key_W, Key_F, Key_P, Key_G, Key_Tab, Key_Enter, Key_J, Key_L, Key_U, Key_Y, Key_Semicolon, Key_Equals, \
Key_PageUp, Key_A, Key_R, Key_S, Key_T, Key_D, Key_H, Key_N, Key_E, Key_I, Key_O, Key_Quote, \
Key_PageDn, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Esc, ___, Key_K, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,\
Key_LCtrl, Key_Backspace, Key_LGUI, Key_LShift, Key_RShift, Key_RAlt, Key_Space, Key_RCtrl,\
Key_Keymap1_Momentary, Key_Keymap1_Momentary,\
)

#define DVORAK KEYMAP ( \
___, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext, ___, Key_6, Key_7, Key_8, Key_9, Key_0, Key_ToggleNumlock, \
Key_Backtick, Key_Quote, Key_Comma, Key_Period, Key_P, Key_Y, Key_Tab, Key_Enter, Key_F, Key_G, Key_C, Key_R, Key_L, Key_Slash, \
Key_PageUp, Key_A, Key_O, Key_E, Key_U, Key_I, Key_D, Key_H, Key_T, Key_N, Key_S, Key_Minus, \
Key_PageDn, Key_Semicolon, Key_Q, Key_J, Key_K, Key_X, Key_Esc, ___, Key_B, Key_M, Key_W, Key_V, Key_Z, Key_Equals, \
Key_LCtrl, Key_Backspace, Key_LGUI, Key_LShift, Key_RShift, Key_RAlt, Key_Space, Key_RCtrl, \
Key_KeymapNext_Momentary, Key_KeymapNext_Momentary \
)

#define GENERIC_FN2 KEYMAP_STACKED ( \
___, Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, XXX, \
Key_Tab, Key_mouseBtnM, Key_mouseUp, ___, Key_mouseWarpNW, Key_mouseWarpNE, Key_nextTrack, \
Key_Home, Key_mouseL, Key_mouseDn, Key_mouseR, Key_mouseWarpSW, Key_mouseWarpSE, \
Key_End, Key_Z, Key_X, Key_C, Key_V, Key_mouseWarpEnd, ___, \
Key_LCtrl, Key_mouseBtnL, Key_LGUI, Key_LShift, \
___,\
\
XXX, Key_F6, Key_F7, Key_F8, Key_F9, ___, ___,\
Key_Delete, Key_playPause, Key_LCurlyBracket, Key_RCurlyBracket, Key_LSquareBracket, Key_RSquareBracket, Key_sleep,\
Key_LArrow, Key_DnArrow, Key_UpArrow, Key_RArrow, Key_F11, Key_F12,\
___, Key_volumeDown, Key_volumeUp, Key_BacklightDn, Key_BacklightUp, Key_Backslash, Key_Pipe,\
Key_RShift, Key_RAlt, Key_mouseBtnR, Key_RCtrl,\
___\
)



#define MALTRON KEYMAP ( \
___, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext, ___, Key_6, Key_7, Key_8, Key_9, Key_0, Key_ToggleNumlock, \
Key_Backtick, Key_Q, Key_P, Key_Y, Key_C, Key_B, Key_Tab, Key_Enter, Key_V, Key_M, Key_U, Key_Z, Key_L, Key_Equals, \
Key_PageUp, Key_A, Key_N, Key_I, Key_S, Key_F, Key_D, Key_T, Key_H, Key_O, Key_R, Key_Quote, \
Key_PageDn, Key_Comma, Key_Period, Key_J, Key_G, Key_Slash, Key_Esc, ___, Key_Semicolon, Key_W, Key_K, Key_Minus, Key_X, Key_LSquareBracket, \
Key_E, Key_Backspace, Key_LGUI, Key_LShift, Key_RShift, Key_RAlt, Key_Space, Key_RCtrl, \
Key_KeymapNext_Momentary, Key_KeymapNext_Momentary \
)

#define NUMPAD KEYMAP (\
___, ___, ___, ___, ___, ___, ___, ___, ___, Key_Keypad7, Key_Keypad8, Key_Keypad9, Key_KeypadMinus, ___, \
___, ___, ___, ___, ___, ___, ___, ___, ___, Key_Keypad4, Key_Keypad5, Key_Keypad6, Key_KeypadPlus, ___, \
___, ___, ___, ___, ___, ___, ___, Key_Keypad1, Key_Keypad2, Key_Keypad3, Key_Equals, Key_Quote, \
___, ___, ___, ___, ___, ___, ___, ___, ___, Key_Keypad0, Key_KeypadDot, Key_KeypadMultiply, Key_KeypadSlash, Key_Enter, \
Key_LCtrl, Key_Backspace, Key_LGUI, Key_LShift, Key_RShift, Key_RAlt, Key_Space, Key_RCtrl, \
Key_Keymap1_Momentary, Key_Keymap1_Momentary \
)

#define QWERTY KEYMAP ( \
___, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext, ___, Key_6, Key_7, Key_8, Key_9, Key_0, Key_ToggleNumlock, \
Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab, Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals, \
Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G, Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote, \
Key_PageDn, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Esc, ___, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus, \
Key_LCtrl, Key_Backspace, Key_LGUI, Key_LShift, Key_RShift, Key_RAlt, Key_Space, Key_RCtrl, \
Key_KeymapNext_Momentary, Key_KeymapNext_Momentary \
)

#define WORKMAN KEYMAP ( \
___, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext, ___, Key_6, Key_7, Key_8, Key_9, Key_0, Key_ToggleNumlock, \
Key_Backtick, Key_Q, Key_D, Key_R, Key_W, Key_B, Key_Tab, Key_Enter, Key_J, Key_F, Key_U, Key_P, Key_Semicolon, Key_Equals, \
Key_PageUp, Key_A, Key_S, Key_H, Key_T, Key_G, Key_Y, Key_N, Key_E, Key_O, Key_I, Key_Quote, \
Key_PageDn, Key_Z, Key_X, Key_M, Key_C, Key_V, Key_Esc, ___, Key_K, Key_L, Key_Comma, Key_Period, Key_Slash, Key_Minus, \
Key_LCtrl, Key_Backspace, Key_LGUI, Key_LShift, Key_RShift, Key_RAlt, Key_Space, Key_RCtrl, \
Key_KeymapNext_Momentary, Key_KeymapNext_Momentary \
)

const Key keymaps[][ROWS][COLS] PROGMEM = {
QWERTY,
GENERIC_FN2,
NUMPAD


};

static LEDSolidColor solidRed (60, 0, 0);
static LEDSolidColor solidOrange (60, 20, 0);
static LEDSolidColor solidYellow (40, 35, 0);
static LEDSolidColor solidGreen (0, 100, 0);
static LEDSolidColor solidBlue (0, 15, 100);
static LEDSolidColor solidIndigo (0, 0, 100);
static LEDSolidColor solidViolet (70, 0, 60);

const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
if (macroIndex == TOGGLENUMLOCK && key_toggled_on(keyState)) {
return NumLock.toggle (Macros.row, Macros.col, NUMPAD_KEYMAP);
}

if (macroIndex == 1 && key_toggled_on(keyState)) {
Serial.print("Keyboard.IO keyboard driver v0.00");
return MACRO(I(25),
D(LShift), T(M), U(LShift), T(O), T(D), T(E), T(L),
T(Space),
W(100),
T(0), T(1),
END);
}
return MACRO_NONE;
}

void setup() {
Kaleidoscope.setup(KEYMAP_SIZE);

Kaleidoscope.use(&TestMode,
&LEDControl, &LEDOff,
&solidRed, &solidOrange, &solidYellow, &solidGreen, &solidBlue, &solidIndigo, &solidViolet,
&LEDBreatheEffect, &LEDRainbowEffect, &LEDChaseEffect, &NumLock,

&Macros,
&MouseKeys,
NULL);

LEDOff.activate();
}


void loop() {
Kaleidoscope.loop();
}
Loading

0 comments on commit a0e03fa

Please sign in to comment.