mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-12-27 03:49:54 +00:00
8fe3864fe7
* [Keyboard] Add "Uno" rev2 Adds support for the second revision of Uno, courtesy of @Snipeye. * Update keyboards/uno/rev2/rules.mk * Update keyboards/uno/rev1/rules.mk * Update keyboards/uno/uno.h * Update keyboards/uno/rev2/rules.mk * Update keyboards/uno/rev1/rules.mk * Update keyboards/uno/keymaps/demo/keymap.c * Update keyboards/uno/keymaps/demo/keymap.c * Update keyboards/uno/keymaps/demo/keymap.c * Update keyboards/uno/rev2/rules.mk * Update keyboards/uno/rev1/rules.mk * Align rules.mk comments * Update keyboards/uno/info.json * Update keyboards/uno/rev1/config.h * Update keyboards/uno/rev2/config.h * Update keyboards/uno/rev2/config.h * Update keyboards/uno/rev2/config.h * Update keyboards/uno/rev1/config.h
86 lines
4.4 KiB
C
86 lines
4.4 KiB
C
/* Copyright 2020 Snipeye
|
|
*
|
|
* 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, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include QMK_KEYBOARD_H
|
|
|
|
enum uno_keycode
|
|
{
|
|
UNO = SAFE_RANGE
|
|
};
|
|
|
|
static uint16_t pressTimer = 0xFFFF;
|
|
#define CUSTOM_LONGPRESS 1000
|
|
#define PASTA_COUNT 4
|
|
|
|
const char *pasta[PASTA_COUNT] = {
|
|
"Hey - I'm Uno... V2. This time, I have uno more features: I support a rotary encoder, too. That's it. That's the only difference.",
|
|
"Did you ever hear the tragedy of Darth Plagueis the Wise? I thought not. It's not a story the Jedi would tell you. It's a Sith legend. Darth Plagueis was a Dark Lord of the Sith, so powerful and so wise he could use the Force to influence the midichlorians to create life... He had such a knowledge of the dark side that he could even keep the ones he cared about from dying. The dark side of the Force is a pathway to many abilities some consider to be unnatural. He became so powerful... the only thing he was afraid of was losing his power, which eventually, of course, he did. Unfortunately, he taught his apprentice everything he knew, then his apprentice killed him in his sleep. Ironic, he could save others from death, but not himself.",
|
|
"The intent is to provide players with a sense of pride and accomplishment for unlocking different heroes. As for cost, we selected initial values based upon data from the Open Beta and other adjustments made to milestone rewards before launch. Among other things, we're looking at average per-player credit earn rates on a daily basis, and we'll be making constant adjustments to ensure that players have challenges that are compelling, rewarding, and of course attainable via gameplay. We appreciate the candid feedback, and the passion the community has put forth around the current topics here on Reddit, our forums and across numerous social media outlets. Our team will continue to make changes and monitor community feedback and update everyone as soon and as often as we can.",
|
|
"The FitnessGram Pacer Test is a multistage aerobic capacity test that progressively gets more difficult as it continues. The 20 meter pacer test will begin in 30 seconds. Line up at the start. The running speed starts slowly, but gets faster each minute after you hear this signal. [beep] A single lap should be completed each time you hear this sound. [ding] Remember to run in a straight line, and run as long as possible. The second time you fail to complete a lap before the sound, your test is over. The test will begin on the word start. On your mark, get ready, start.",
|
|
};
|
|
|
|
uint8_t pastaIndex = 0;
|
|
|
|
enum encoder_names {
|
|
_ENCODER,
|
|
};
|
|
|
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
[0] = LAYOUT(
|
|
UNO
|
|
)
|
|
};
|
|
|
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|
switch (keycode) {
|
|
case UNO:
|
|
if (record->event.pressed) {
|
|
pressTimer = timer_read();
|
|
} else {
|
|
uint16_t timeElapsed = timer_elapsed(pressTimer);
|
|
if (timeElapsed < CUSTOM_LONGPRESS) {
|
|
send_string(pasta[pastaIndex]);
|
|
} else {
|
|
reset_keyboard();
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
void keyboard_post_init_user(void) {
|
|
rgblight_enable_noeeprom();
|
|
rgblight_sethsv_noeeprom(0, 255, 255);
|
|
rgblight_mode_noeeprom(1);
|
|
//rgblight_mode_noeeprom(RGBLIGHT_MODE_RAINBOW_MOOD);
|
|
}
|
|
|
|
void encoder_update_user(uint8_t index, bool clockwise) {
|
|
if (index == _ENCODER) { /* First encoder */
|
|
if (clockwise) {
|
|
pastaIndex++;
|
|
pastaIndex %= PASTA_COUNT;
|
|
} else {
|
|
pastaIndex += PASTA_COUNT;
|
|
pastaIndex--;
|
|
pastaIndex %= PASTA_COUNT;
|
|
}
|
|
rgblight_sethsv_noeeprom((255/PASTA_COUNT)*pastaIndex, 255, 255);
|
|
rgblight_mode_noeeprom(1);
|
|
}
|
|
}
|