Signed-off-by: Gergely Nagy <algernon@keyboard.io>hardware/ploopy
parent
0944fc3b1e
commit
2464ef59db
@ -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,27 @@
|
|||||||
|
// -*- mode: c++ -*-
|
||||||
|
|
||||||
|
#include "Kaleidoscope.h"
|
||||||
|
#include "Kaleidoscope-FocusSerial.h"
|
||||||
|
#include "Kaleidoscope-EEPROM-Settings.h"
|
||||||
|
#include "Kaleidoscope-EEPROM-Keymap.h"
|
||||||
|
#include "Kaleidoscope-MouseKeys.h"
|
||||||
|
|
||||||
|
KEYMAPS(
|
||||||
|
[0] = KEYMAP(Key_A, Key_B, Key_C, Key_D, Key_E, Key_NoKey),
|
||||||
|
);
|
||||||
|
|
||||||
|
KALEIDOSCOPE_INIT_PLUGINS(
|
||||||
|
Focus,
|
||||||
|
EEPROMSettings,
|
||||||
|
EEPROMKeymap,
|
||||||
|
MouseKeys
|
||||||
|
);
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Kaleidoscope.setup();
|
||||||
|
EEPROMKeymap.setup(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
Kaleidoscope.loop();
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"cpu": {
|
||||||
|
"fqbn": "keyboardio:avr:ploopy_mini",
|
||||||
|
"port": ""
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
name=Kaleidoscope-Hardware-Ploopy-Trackball-Mini
|
||||||
|
version=0.0.0
|
||||||
|
sentence=Ploopy Trackball Mini hardware support for Kaleidoscope
|
||||||
|
maintainer=Kaleidoscope's Developers <jesse@keyboard.io>
|
||||||
|
url=https://github.com/keyboardio/Kaleidoscope
|
||||||
|
author=Keyboardio
|
||||||
|
paragraph=
|
@ -0,0 +1,21 @@
|
|||||||
|
/* -*- mode: c++ -*-
|
||||||
|
* Kaleidoscope - Firmware for computer input devices
|
||||||
|
* Copyright (C) 2022 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/ploopy/TrackballMini.h" // IWYU pragma: export
|
@ -0,0 +1,67 @@
|
|||||||
|
/* -*- mode: c++ -*-
|
||||||
|
* Kaleidoscope - Firmware for computer input devices
|
||||||
|
* Copyright (C) 2022 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
|
||||||
|
#ifdef ARDUINO_AVR_PLOOPY_MINI
|
||||||
|
|
||||||
|
#include "kaleidoscope/Runtime.h"
|
||||||
|
#include "kaleidoscope/driver/keyscanner/Base_Impl.h"
|
||||||
|
|
||||||
|
// Here, we set up aliases to the device's KeyScanner and KeyScannerProps
|
||||||
|
// in the global namespace within the scope of this file. We'll use these
|
||||||
|
// aliases to simplify some template initialization code below.
|
||||||
|
using KeyScannerProps = typename kaleidoscope::device::ploopy::TrackballMiniProps::KeyScannerProps;
|
||||||
|
using KeyScanner = typename kaleidoscope::device::ploopy::TrackballMiniProps::KeyScanner;
|
||||||
|
|
||||||
|
namespace kaleidoscope {
|
||||||
|
namespace device {
|
||||||
|
namespace ploopy {
|
||||||
|
|
||||||
|
// `KeyScannerProps` here refers to the alias set up above. We do not need to
|
||||||
|
// prefix the `matrix_rows` and `matrix_columns` names within the array
|
||||||
|
// declaration, because those are resolved within the context of the class, so
|
||||||
|
// the `matrix_rows` in `KeyScannerProps::matrix_row_pins[matrix_rows]` gets
|
||||||
|
// resolved as `KeyScannerProps::matrix_rows`.
|
||||||
|
const uint8_t KeyScannerProps::matrix_rows;
|
||||||
|
const uint8_t KeyScannerProps::matrix_columns;
|
||||||
|
constexpr uint8_t KeyScannerProps::direct_pins[];
|
||||||
|
constexpr uint8_t KeyScannerProps::unused_pins[];
|
||||||
|
|
||||||
|
// `KeyScanner` here refers to the alias set up above, just like in the
|
||||||
|
// `KeyScannerProps` case above.
|
||||||
|
template<>
|
||||||
|
KeyScanner::pin_state_t KeyScanner::pin_state_ = {};
|
||||||
|
|
||||||
|
// We set up the TIMER1 interrupt vector here. Due to dependency reasons, this
|
||||||
|
// cannot be in a header-only driver, and must be placed here.
|
||||||
|
//
|
||||||
|
// Timer1 is responsible for setting a property on the KeyScanner, which will
|
||||||
|
// tell it to do a scan. We use this to make sure that scans happen at roughly
|
||||||
|
// the intervals we want. We do the scan outside of the interrupt scope for
|
||||||
|
// practical reasons: guarding every codepath against interrupts that can be
|
||||||
|
// reached from the scan is far too tedious, for very little gain.
|
||||||
|
ISR(TIMER1_OVF_vect) {
|
||||||
|
Runtime.device().keyScanner().do_scan_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ploop
|
||||||
|
} // namespace device
|
||||||
|
} // namespace kaleidoscope
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
|
@ -0,0 +1,84 @@
|
|||||||
|
/* -*- mode: c++ -*-
|
||||||
|
* Kaleidoscope - Firmware for computer input devices
|
||||||
|
* Copyright (C) 2022 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
|
||||||
|
|
||||||
|
#ifdef ARDUINO_AVR_PLOOPY_MINI
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
#define KALEIDOSCOPE_BOOTLOADER_FLIP_WORKAROUND 1
|
||||||
|
|
||||||
|
#include "kaleidoscope/device/ATmega32U4Keyboard.h"
|
||||||
|
#include "kaleidoscope/driver/bootloader/avr/FLIP.h"
|
||||||
|
#include "kaleidoscope/driver/keyscanner/ATmegaDirect.h"
|
||||||
|
|
||||||
|
namespace kaleidoscope {
|
||||||
|
namespace device {
|
||||||
|
namespace ploopy {
|
||||||
|
|
||||||
|
struct TrackballMiniProps : kaleidoscope::device::ATmega32U4KeyboardProps {
|
||||||
|
struct MCUProps : public kaleidoscope::driver::mcu::ATmega32U4Props {
|
||||||
|
static constexpr bool disable_jtag = true;
|
||||||
|
static constexpr bool disable_clock_division = true;
|
||||||
|
};
|
||||||
|
typedef kaleidoscope::driver::mcu::ATmega32U4<MCUProps> MCU;
|
||||||
|
|
||||||
|
struct KeyScannerProps : public kaleidoscope::driver::keyscanner::ATmegaDirectProps {
|
||||||
|
static constexpr uint8_t matrix_rows = 1;
|
||||||
|
static constexpr uint8_t matrix_columns = 6;
|
||||||
|
typedef MatrixAddr<matrix_rows, matrix_columns> KeyAddr;
|
||||||
|
|
||||||
|
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
|
||||||
|
static constexpr uint8_t direct_pins[5] = {PIN_D4, PIN_D2, PIN_E6, PIN_B6, PIN_D7};
|
||||||
|
static constexpr uint8_t unused_pins[12] = {PIN_B5, PIN_C7, PIN_D0, PIN_D1, PIN_D3, PIN_D5, PIN_D6, PIN_F1, PIN_F3, PIN_F5, PIN_F6, PIN_F7};
|
||||||
|
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef kaleidoscope::driver::keyscanner::ATmegaDirect<KeyScannerProps> KeyScanner;
|
||||||
|
typedef kaleidoscope::driver::bootloader::avr::FLIP Bootloader;
|
||||||
|
static constexpr const char *short_name = "ploopy_mini";
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
|
||||||
|
class TrackballMini : public kaleidoscope::device::ATmega32U4Keyboard<TrackballMiniProps> {};
|
||||||
|
#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
|
||||||
|
/* Device definition omitted for virtual device builds.
|
||||||
|
* We need to forward declare the device name, though, as there are
|
||||||
|
* some legacy extern references to boards whose definition
|
||||||
|
* depends on this.
|
||||||
|
*/
|
||||||
|
class TrackballMini;
|
||||||
|
|
||||||
|
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
|
||||||
|
#define PER_KEY_DATA(dflt, P1, P2, P3, P4, P5, SENSOR) \
|
||||||
|
P1, P2, P3, P4, P5, SENSOR
|
||||||
|
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
} // namespace keyboardio
|
||||||
|
} // namespace device
|
||||||
|
|
||||||
|
EXPORT_DEVICE(kaleidoscope::device::ploopy::TrackballMini)
|
||||||
|
|
||||||
|
} // namespace kaleidoscope
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in new issue