Compare commits
1 Commits
main
...
device/nor
Author | SHA1 | Date |
---|---|---|
Jesse Vincent | d8c5b089b0 | 5 years ago |
@ -0,0 +1,2 @@
|
|||||||
|
BOARD="keyboardio_normcore"
|
||||||
|
SKETCH="Normcore"
|
@ -0,0 +1,55 @@
|
|||||||
|
# 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
|
@ -0,0 +1,190 @@
|
|||||||
|
/* 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-Macros.h"
|
||||||
|
|
||||||
|
// Support for controlling the keyboard's LEDs
|
||||||
|
#include "Kaleidoscope-LEDControl.h"
|
||||||
|
|
||||||
|
// Support for the "Boot greeting" effect, which pulses the 'LED' button for 10s
|
||||||
|
// when the keyboard is connected to a computer (or that computer is powered on)
|
||||||
|
#include "Kaleidoscope-LEDEffect-BootGreeting.h"
|
||||||
|
|
||||||
|
// Support for LED modes that set all LEDs to a single color
|
||||||
|
#include "Kaleidoscope-LEDEffect-SolidColor.h"
|
||||||
|
|
||||||
|
// Support for an LED mode that makes all the LEDs 'breathe'
|
||||||
|
#include "Kaleidoscope-LEDEffect-Breathe.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "Kaleidoscope-LEDEffect-Chase.h"
|
||||||
|
|
||||||
|
// Support for LED modes that pulse the keyboard's LED in a rainbow pattern
|
||||||
|
#include "Kaleidoscope-LEDEffect-Rainbow.h"
|
||||||
|
|
||||||
|
|
||||||
|
// Support for host power management (suspend & wakeup)
|
||||||
|
#include "Kaleidoscope-HostPowerManagement.h"
|
||||||
|
|
||||||
|
// Support for magic combos (key chords that trigger an action)
|
||||||
|
#include "Kaleidoscope-MagicCombo.h"
|
||||||
|
|
||||||
|
// Support for USB quirks, like changing the key state report protocol
|
||||||
|
#include "Kaleidoscope-USB-Quirks.h"
|
||||||
|
|
||||||
|
|
||||||
|
enum { _QWERTY,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* *INDENT-OFF* */
|
||||||
|
KEYMAPS(
|
||||||
|
|
||||||
|
[_QWERTY] = KEYMAP(
|
||||||
|
|
||||||
|
Key_F1, Key_Escape, Key_Backtick, Key_1, Key_2, Key_3, Key_4, Key_5, Key_6, Key_7, Key_8, Key_9, Key_0, Key_Minus, Key_Equals, Key_Backspace,
|
||||||
|
Key_F2, Key_Tab, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_LeftBracket, Key_RightBracket, Key_Backslash,
|
||||||
|
Key_F3, Key_Escape, Key_A, Key_S, Key_D, Key_F, Key_G, Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote, Key_Enter,
|
||||||
|
Key_F4, Key_LeftShift, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_UpArrow, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_RightShift, Key_LEDEffectNext,
|
||||||
|
Key_F5, Key_LeftControl,Key_LeftAlt, Key_LeftGui, Key_Backspace, Key_LeftArrow, Key_DownArrow, Key_RightArrow, Key_Space, Key_RightAlt, Key_Menu, Key_RightControl, Key_LEDEffectNext
|
||||||
|
|
||||||
|
|
||||||
|
));
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// These 'solid' color effect definitions define a rainbow of
|
||||||
|
// LED color modes calibrated to draw 500mA or less on the
|
||||||
|
// Keyboardio Model 01.
|
||||||
|
|
||||||
|
|
||||||
|
static kaleidoscope::plugin::LEDSolidColor solidRed(160, 0, 0);
|
||||||
|
static kaleidoscope::plugin::LEDSolidColor solidOrange(140, 70, 0);
|
||||||
|
static kaleidoscope::plugin::LEDSolidColor solidYellow(130, 100, 0);
|
||||||
|
static kaleidoscope::plugin::LEDSolidColor solidGreen(0, 160, 0);
|
||||||
|
static kaleidoscope::plugin::LEDSolidColor solidBlue(0, 70, 130);
|
||||||
|
static kaleidoscope::plugin::LEDSolidColor solidIndigo(0, 0, 170);
|
||||||
|
static kaleidoscope::plugin::LEDSolidColor solidViolet(130, 0, 120);
|
||||||
|
|
||||||
|
|
||||||
|
/** toggleLedsOnSuspendResume toggles the LEDs off when the host goes to sleep,
|
||||||
|
* and turns them back on when it wakes up.
|
||||||
|
*/
|
||||||
|
void toggleLedsOnSuspendResume(kaleidoscope::plugin::HostPowerManagement::Event event) {
|
||||||
|
switch (event) {
|
||||||
|
case kaleidoscope::plugin::HostPowerManagement::Suspend:
|
||||||
|
LEDControl.set_all_leds_to({0, 0, 0});
|
||||||
|
LEDControl.syncLeds();
|
||||||
|
LEDControl.paused = true;
|
||||||
|
break;
|
||||||
|
case kaleidoscope::plugin::HostPowerManagement::Resume:
|
||||||
|
LEDControl.paused = false;
|
||||||
|
LEDControl.refreshAll();
|
||||||
|
break;
|
||||||
|
case kaleidoscope::plugin::HostPowerManagement::Sleep:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** hostPowerManagementEventHandler dispatches power management events (suspend,
|
||||||
|
* resume, and sleep) to other functions that perform action based on these
|
||||||
|
* events.
|
||||||
|
*/
|
||||||
|
void hostPowerManagementEventHandler(kaleidoscope::plugin::HostPowerManagement::Event event) {
|
||||||
|
toggleLedsOnSuspendResume(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** This 'enum' is a list of all the magic combos used by the Model 01's
|
||||||
|
* firmware The names aren't particularly important. What is important is that
|
||||||
|
* each is unique.
|
||||||
|
*
|
||||||
|
* These are the names of your magic combos. They will be used by the
|
||||||
|
* `USE_MAGIC_COMBOS` call below.
|
||||||
|
*/
|
||||||
|
enum {
|
||||||
|
// Toggle between Boot (6-key rollover; for BIOSes and early boot) and NKRO
|
||||||
|
// mode.
|
||||||
|
COMBO_TOGGLE_NKRO_MODE
|
||||||
|
};
|
||||||
|
|
||||||
|
/** A tiny wrapper, to be used by MagicCombo.
|
||||||
|
* This simply toggles the keyboard protocol via USBQuirks, and wraps it within
|
||||||
|
* a function with an unused argument, to match what MagicCombo expects.
|
||||||
|
*/
|
||||||
|
static void toggleKeyboardProtocol(uint8_t combo_index) {
|
||||||
|
USBQuirks.toggleKeyboardProtocol();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Magic combo list, a list of key combo and action pairs the firmware should
|
||||||
|
* recognise.
|
||||||
|
*/
|
||||||
|
USE_MAGIC_COMBOS({.action = toggleKeyboardProtocol,
|
||||||
|
// Left Fn + Esc + Shift
|
||||||
|
.keys = { R3C6, R2C6, R3C7 }
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
KALEIDOSCOPE_INIT_PLUGINS(Macros,
|
||||||
|
|
||||||
|
// LEDControl provides support for other LED modes
|
||||||
|
LEDControl,
|
||||||
|
|
||||||
|
|
||||||
|
// The rainbow effect changes the color of all of the keyboard's keys at the same time
|
||||||
|
// running through all the colors of the rainbow.
|
||||||
|
LEDRainbowEffect,
|
||||||
|
|
||||||
|
// The rainbow wave effect lights up your keyboard with all the colors of a rainbow
|
||||||
|
// and slowly moves the rainbow across your keyboard
|
||||||
|
LEDRainbowWaveEffect,
|
||||||
|
|
||||||
|
// The chase effect follows the adventure of a blue pixel which chases a red pixel across
|
||||||
|
// your keyboard. Spoiler: the blue pixel never catches the red pixel
|
||||||
|
LEDChaseEffect,
|
||||||
|
|
||||||
|
// These static effects turn your keyboard's LEDs a variety of colors
|
||||||
|
solidRed, solidOrange, solidYellow, solidGreen, solidBlue, solidIndigo, solidViolet,
|
||||||
|
|
||||||
|
// The breathe effect slowly pulses all of the LEDs on your keyboard
|
||||||
|
LEDBreatheEffect,
|
||||||
|
|
||||||
|
// The HostPowerManagement plugin allows us to turn LEDs off when then host
|
||||||
|
// goes to sleep, and resume them when it wakes up.
|
||||||
|
HostPowerManagement,
|
||||||
|
|
||||||
|
// The MagicCombo plugin lets you use key combinations to trigger custom
|
||||||
|
// actions - a bit like Macros, but triggered by pressing multiple keys at the
|
||||||
|
// same time.
|
||||||
|
MagicCombo,
|
||||||
|
|
||||||
|
// The USBQuirks plugin lets you do some things with USB that we aren't
|
||||||
|
// comfortable - or able - to do automatically, but can be useful
|
||||||
|
// nevertheless. Such as toggling the key report protocol between Boot (used
|
||||||
|
// by BIOSes) and Report (NKRO).
|
||||||
|
USBQuirks
|
||||||
|
);
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Kaleidoscope.setup();
|
||||||
|
Serial.begin(9600);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
Kaleidoscope.loop();
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
/* -*- mode: c++ -*-
|
||||||
|
* Kaleidoscope-Hardware-Keyboardio-Normcore -- Keyboardio Normcore 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "kaleidoscope/device/keyboardio/Normcore.h"
|
@ -0,0 +1,38 @@
|
|||||||
|
/* -*- mode: c++ -*-
|
||||||
|
* Kaleidoscope-Hardware-Keyboardio-Normcore -- Normcore hardware support for Kaleidoscope
|
||||||
|
* Copyright (C) 2018, 2019 Keyboard.io, Inc
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of version 3 of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef ARDUINO_AVR_KEYBOARDIO_NORMCORE
|
||||||
|
|
||||||
|
#include <Kaleidoscope.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace kaleidoscope {
|
||||||
|
namespace device {
|
||||||
|
namespace keyboardio {
|
||||||
|
|
||||||
|
AVR_KEYSCANNER_BOILERPLATE
|
||||||
|
|
||||||
|
|
||||||
|
void Normcore::setup() {
|
||||||
|
kaleidoscope::device::ATMega32U4Keyboard<NormcoreProps>::setup();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,70 @@
|
|||||||
|
/* -*- mode: c++ -*-
|
||||||
|
* Kaleidoscope-Hardware-Keyboardio-Normcore -- Normcore hardware support for Kaleidoscope
|
||||||
|
* Copyright (C) 2018, 2019 Keyboard.io, Inc
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of version 3 of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef ARDUINO_AVR_KEYBOARDIO_NORMCORE
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
#include "kaleidoscope/driver/keyscanner/AVR.h"
|
||||||
|
#include "kaleidoscope/driver/led/None.h"
|
||||||
|
#include "kaleidoscope/driver/bootloader/avr/Caterina.h"
|
||||||
|
#include "kaleidoscope/device/ATMega32U4Keyboard.h"
|
||||||
|
|
||||||
|
namespace kaleidoscope {
|
||||||
|
namespace device {
|
||||||
|
namespace keyboardio {
|
||||||
|
|
||||||
|
struct NormcoreProps : kaleidoscope::device::ATMega32U4KeyboardProps {
|
||||||
|
struct KeyScannerProps : public kaleidoscope::driver::keyscanner::AVRProps {
|
||||||
|
AVR_KEYSCANNER_PROPS(
|
||||||
|
ROW_PIN_LIST({ PIN_F6, PIN_F5, PIN_F4, PIN_F1, PIN_F0}),
|
||||||
|
COL_PIN_LIST({ PIN_F7, PIN_E2, PIN_C7, PIN_C6, PIN_B6, PIN_B5, PIN_B4, PIN_D7, PIN_D6, PIN_D4, PIN_D5, PIN_D3, PIN_D2, PIN_B7, PIN_B2, PIN_B1})
|
||||||
|
);
|
||||||
|
};
|
||||||
|
typedef kaleidoscope::driver::keyscanner::AVR<KeyScannerProps> KeyScanner;
|
||||||
|
typedef kaleidoscope::driver::led::None LEDDriver;
|
||||||
|
typedef kaleidoscope::driver::bootloader::avr::Caterina BootLoader;
|
||||||
|
};
|
||||||
|
|
||||||
|
class Normcore: public kaleidoscope::device::ATMega32U4Keyboard<NormcoreProps> {
|
||||||
|
public:
|
||||||
|
void setup();
|
||||||
|
};
|
||||||
|
|
||||||
|
#define PER_KEY_DATA(dflt, \
|
||||||
|
R0C0, R0C1, R0C2, R0C3, R0C4, R0C5, R0C6, R0C7, R0C8, R0C9, R0C10, R0C11, R0C12, R0C13, R0C14, R0C15, \
|
||||||
|
R1C0, R1C1, R1C3, R1C4, R1C5, R1C6, R1C7, R1C8, R1C9, R1C10, R1C11, R1C12, R1C13, R1C14, R1C15, \
|
||||||
|
R2C0, R2C1, R2C2, R2C3, R2C4, R2C5, R2C6, R2C8, R2C9, R2C10, R2C11, R2C12, R2C13, R2C14, \
|
||||||
|
R3C0, R3C1, R3C2, R3C3, R3C4, R3C5, R3C6, R3C7, R3C8, R3C9, R3C10, R3C11, R3C12, R3C13, R3C15, \
|
||||||
|
R4C0, R4C1, R4C2, R4C3, R4C5, R4C6, R4C7, R4C8, R4C10, R4C11, R4C12, R4C13, R4C15 \
|
||||||
|
,... ) \
|
||||||
|
R0C0, R0C1, R0C2, R0C3, R0C4, R0C5, R0C6, R0C7, R0C8, R0C9, R0C10, R0C11, R0C12, R0C13, R0C14, R0C15, \
|
||||||
|
R1C0, R1C1, XXX, R1C3, R1C4, R1C5, R1C6, R1C7, R1C8, R1C9, R1C10, R1C11, R1C12, R1C13, R1C14, R1C15, \
|
||||||
|
R2C0, R2C1, R2C2, R2C3, R2C4, R2C5, R2C6, XXX, R2C8, R2C9, R2C10, R2C11, R2C12, R2C13, R2C14, XXX , \
|
||||||
|
R3C0, R3C1, R3C2, R3C3, R3C4, R3C5, R3C6, R3C7, R3C8, R3C9, R3C10, R3C11, R3C12, R3C13, XXX, R3C15, \
|
||||||
|
R4C0, R4C1, R4C2, R4C3, XXX, R4C5, R4C6, R4C7, R4C8, XXX, R4C10, R4C11, R4C12, R4C13, XXX, R4C15
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef kaleidoscope::device::keyboardio::Normcore Device;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in new issue