parent
0d9550a5cb
commit
6db44b88ba
@ -0,0 +1,48 @@
|
||||
# This makefile for a Kaleidoscope sketch pulls in all the targets
|
||||
# required to build the example
|
||||
|
||||
|
||||
|
||||
|
||||
ifneq ($(KALEIDOSCOPE_DIR),)
|
||||
search_path += $(KALEIDOSCOPE_DIR)
|
||||
endif
|
||||
|
||||
ifneq ($(ARDUINO_DIRECTORIES_USER),)
|
||||
search_path += $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/libraries/Kaleidoscope
|
||||
endif
|
||||
|
||||
ifeq ($(shell uname -s),Darwin)
|
||||
search_path += $(HOME)/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
|
||||
else
|
||||
search_path += $(HOME)/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
|
||||
endif
|
||||
|
||||
sketch_makefile := etc/makefiles/sketch.mk
|
||||
|
||||
$(foreach candidate, $(search_path), $(if $(wildcard $(candidate)/$(sketch_makefile)), $(eval ks_dir ?= $(candidate))))
|
||||
|
||||
ifneq ($(ks_dir),)
|
||||
|
||||
$(info Using Kaleidoscope from $(ks_dir))
|
||||
|
||||
export KALEIDOSCOPE_DIR := $(ks_dir)
|
||||
include $(ks_dir)/$(sketch_makefile)
|
||||
|
||||
else
|
||||
|
||||
$(info I can't find your Kaleidoscope installation.)
|
||||
$(info )
|
||||
$(info I tried looking in:)
|
||||
$(info )
|
||||
$(foreach candidate, $(search_path), $(info $(candidate)))
|
||||
$(info )
|
||||
$(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment)
|
||||
$(info variable to the location of your Kaleidoscope directory.)
|
||||
|
||||
endif
|
||||
|
||||
|
||||
null-target:
|
||||
$(info You should never see this message)
|
||||
@:
|
@ -0,0 +1,65 @@
|
||||
// -*- mode: c++ -*-
|
||||
|
||||
#include "Kaleidoscope.h"
|
||||
#include "Kaleidoscope-FocusSerial.h"
|
||||
#include "Kaleidoscope-EEPROM-Settings.h"
|
||||
#include "Kaleidoscope-EEPROM-Keymap.h"
|
||||
#include "Kaleidoscope-MouseKeys.h"
|
||||
#include "Kaleidoscope-Macros.h"
|
||||
|
||||
KEYMAPS(
|
||||
[0] = KEYMAP(M(0), Key_B, Key_C, Key_D, Key_E, Key_NoKey),
|
||||
);
|
||||
|
||||
#define OPT_ENC1 PIN_F0
|
||||
#define OPT_ENC2 PIN_F4
|
||||
#define OPT_ENC1_MUX 0
|
||||
#define OPT_ENC2_MUX 4
|
||||
|
||||
void handleEncoder() {
|
||||
uint16_t p1 = analogRead(OPT_ENC1_MUX);
|
||||
uint16_t p2 = analogRead(OPT_ENC2_MUX);
|
||||
|
||||
if (p1 != 0 || p2 != 0) {
|
||||
Focus.send("p1=", p1, "p2=", p2, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
|
||||
if (!keyToggledOn(event.state)) {
|
||||
return MACRO_NONE;
|
||||
}
|
||||
|
||||
switch (macro_id) {
|
||||
case 0:
|
||||
handleEncoder();
|
||||
break;
|
||||
}
|
||||
|
||||
return MACRO_NONE;
|
||||
}
|
||||
|
||||
KALEIDOSCOPE_INIT_PLUGINS(
|
||||
Focus,
|
||||
EEPROMSettings,
|
||||
EEPROMKeymap,
|
||||
MouseKeys,
|
||||
Macros
|
||||
);
|
||||
|
||||
void setup() {
|
||||
Kaleidoscope.setup();
|
||||
EEPROMKeymap.setup(5);
|
||||
|
||||
DDR_INPUT(OPT_ENC1);
|
||||
ENABLE_PULLUP(OPT_ENC1);
|
||||
DDR_INPUT(OPT_ENC2);
|
||||
ENABLE_PULLUP(OPT_ENC2);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
Kaleidoscope.loop();
|
||||
|
||||
handleEncoder();
|
||||
delay(10);
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
#! /bin/sh
|
||||
set -e
|
||||
|
||||
echo "* Building"
|
||||
make OUTPUT_PATH=$(pwd)/_build
|
||||
|
||||
echo "* Jumping to bootloader..."
|
||||
DEVICE=/dev/ttyACM1 focus device.reset
|
||||
sleep 2s
|
||||
|
||||
echo "* Flashing..."
|
||||
dfu-programmer atmega32u4 erase && dfu-programmer atmega32u4 flash _build/*-latest.hex && dfu-programmer atmega32u4 start
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"cpu": {
|
||||
"fqbn": "keyboardio:avr:ploopy_mini",
|
||||
"port": ""
|
||||
}
|
||||
}
|
Loading…
Reference in new issue