Merge pull request #10 from keyboardio/f/plugin-v2

Updated to use the new plugin APIs
pull/365/head
Gergely Nagy 7 years ago committed by GitHub
commit 8459e50815
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -40,9 +40,12 @@ We can then update the keymap via [Focus][plugin:focus].
#include <Kaleidoscope-EEPROM-Settings.h> #include <Kaleidoscope-EEPROM-Settings.h>
#include <Kaleidoscope-Focus.h> #include <Kaleidoscope-Focus.h>
KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings,
EEPROMKeymap,
Focus);
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
Kaleidoscope.use(&EEPROMKeymap, &Focus);
Kaleidoscope.setup(); Kaleidoscope.setup();

@ -1,6 +1,6 @@
/* -*- mode: c++ -*- /* -*- mode: c++ -*-
* Kaleidoscope-EEPROM-Keymap -- EEPROM-based keymap support. * Kaleidoscope-EEPROM-Keymap -- EEPROM-based keymap support.
* Copyright (C) 2017 Gergely Nagy * Copyright (C) 2017, 2018 Gergely Nagy
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -20,6 +20,7 @@
#include <Kaleidoscope-EEPROM-Keymap.h> #include <Kaleidoscope-EEPROM-Keymap.h>
#include <Kaleidoscope-Focus.h> #include <Kaleidoscope-Focus.h>
// *INDENT-OFF*
const Key keymaps[][ROWS][COLS] PROGMEM = { const Key keymaps[][ROWS][COLS] PROGMEM = {
[0] = KEYMAP_STACKED [0] = KEYMAP_STACKED
(Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, (Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey,
@ -38,12 +39,13 @@ const Key keymaps[][ROWS][COLS] PROGMEM = {
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_skip), Key_skip),
}; };
// *INDENT-ON*
KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings, EEPROMKeymap, Focus);
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
Kaleidoscope.use(&EEPROMKeymap, &Focus);
Kaleidoscope.setup(); Kaleidoscope.setup();
Focus.addHook(FOCUS_HOOK_SETTINGS); Focus.addHook(FOCUS_HOOK_SETTINGS);

@ -1,6 +1,6 @@
/* -*- mode: c++ -*- /* -*- mode: c++ -*-
* Kaleidoscope-EEPROM-Keymap -- EEPROM-based keymap support. * Kaleidoscope-EEPROM-Keymap -- EEPROM-based keymap support.
* Copyright (C) 2017 Gergely Nagy * Copyright (C) 2017, 2018 Gergely Nagy
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -24,13 +24,6 @@ namespace kaleidoscope {
uint16_t EEPROMKeymap::keymap_base_; uint16_t EEPROMKeymap::keymap_base_;
uint8_t EEPROMKeymap::max_layers_; uint8_t EEPROMKeymap::max_layers_;
EEPROMKeymap::EEPROMKeymap(void) {
}
void EEPROMKeymap::begin(void) {
Kaleidoscope.use(&::EEPROMSettings);
}
void EEPROMKeymap::max_layers(uint8_t max) { void EEPROMKeymap::max_layers(uint8_t max) {
max_layers_ = max; max_layers_ = max;
keymap_base_ = ::EEPROMSettings.requestSlice(max_layers_ * ROWS * COLS * 2); keymap_base_ = ::EEPROMSettings.requestSlice(max_layers_ * ROWS * COLS * 2);

@ -1,6 +1,6 @@
/* -*- mode: c++ -*- /* -*- mode: c++ -*-
* Kaleidoscope-EEPROM-Keymap -- EEPROM-based keymap support. * Kaleidoscope-EEPROM-Keymap -- EEPROM-based keymap support.
* Copyright (C) 2017 Gergely Nagy * Copyright (C) 2017, 2018 Gergely Nagy
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -22,14 +22,12 @@
#include <Kaleidoscope-EEPROM-Settings.h> #include <Kaleidoscope-EEPROM-Settings.h>
namespace kaleidoscope { namespace kaleidoscope {
class EEPROMKeymap : public KaleidoscopePlugin { class EEPROMKeymap : public kaleidoscope::Plugin {
public: public:
EEPROMKeymap(void); EEPROMKeymap(void) {}
static void max_layers(uint8_t max); static void max_layers(uint8_t max);
void begin(void) final;
static uint16_t keymap_base(void); static uint16_t keymap_base(void);
static Key getKey(uint8_t layer, byte row, byte col); static Key getKey(uint8_t layer, byte row, byte col);

Loading…
Cancel
Save