You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
2.0 KiB
70 lines
2.0 KiB
6 years ago
|
/* Kaleidoscope - Firmware for computer input devices
|
||
|
* Copyright (C) 2013-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, version 3.
|
||
|
*
|
||
|
* 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/>.
|
||
|
*/
|
||
|
|
||
6 years ago
|
#include "kaleidoscope/Kaleidoscope.h"
|
||
8 years ago
|
#include <stdarg.h>
|
||
8 years ago
|
|
||
7 years ago
|
namespace kaleidoscope {
|
||
|
|
||
7 years ago
|
uint32_t Kaleidoscope_::millis_at_cycle_start_;
|
||
8 years ago
|
|
||
8 years ago
|
Kaleidoscope_::Kaleidoscope_(void) {
|
||
8 years ago
|
}
|
||
|
|
||
|
void
|
||
8 years ago
|
Kaleidoscope_::setup(void) {
|
||
7 years ago
|
kaleidoscope::Hooks::onSetup();
|
||
|
|
||
8 years ago
|
KeyboardHardware.setup();
|
||
7 years ago
|
|
||
|
kaleidoscope::hid::initializeKeyboard();
|
||
|
kaleidoscope::hid::initializeConsumerControl();
|
||
|
kaleidoscope::hid::initializeSystemControl();
|
||
8 years ago
|
|
||
7 years ago
|
// A workaround, so that the compiler does not optimize handleKeyswitchEvent out...
|
||
7 years ago
|
// This is a no-op, but tricks the compiler into not being too helpful
|
||
7 years ago
|
// TODO(anyone): figure out how to hint the compiler in a more reasonable way
|
||
8 years ago
|
handleKeyswitchEvent(Key_NoKey, 255, 255, 0);
|
||
7 years ago
|
|
||
7 years ago
|
// Update the keymap cache, so we start with a non-empty state.
|
||
7 years ago
|
Layer.updateActiveLayers();
|
||
7 years ago
|
for (byte row = 0; row < ROWS; row++) {
|
||
|
for (byte col = 0; col < COLS; col++) {
|
||
|
Layer.updateLiveCompositeKeymap(row, col);
|
||
|
}
|
||
|
}
|
||
8 years ago
|
}
|
||
|
|
||
|
void
|
||
8 years ago
|
Kaleidoscope_::loop(void) {
|
||
7 years ago
|
millis_at_cycle_start_ = millis();
|
||
|
|
||
7 years ago
|
kaleidoscope::Hooks::beforeEachCycle();
|
||
|
|
||
8 years ago
|
KeyboardHardware.scanMatrix();
|
||
8 years ago
|
|
||
7 years ago
|
kaleidoscope::Hooks::beforeReportingState();
|
||
|
|
||
8 years ago
|
kaleidoscope::hid::sendKeyboardReport();
|
||
|
kaleidoscope::hid::releaseAllKeys();
|
||
8 years ago
|
|
||
7 years ago
|
kaleidoscope::Hooks::afterEachCycle();
|
||
|
}
|
||
|
|
||
|
Kaleidoscope_ Kaleidoscope;
|
||
|
|
||
|
} // namespace kaleidoscope
|