[Keyboard] add 1upkeyboards 1upslider8 (#21546)
Co-authored-by: Duncan Sutherland <dunk2k_2000@hotmail.com> Co-authored-by: jack <0x6a73@protonmail.com> Co-authored-by: Drashna Jaelre <drashna@live.com>
This commit is contained in:
parent
e7ae5ec07c
commit
29d1a2cc51
11 changed files with 658 additions and 0 deletions
400
keyboards/1upkeyboards/1upslider8/1upslider8.c
Normal file
400
keyboards/1upkeyboards/1upslider8/1upslider8.c
Normal file
|
@ -0,0 +1,400 @@
|
|||
/* Copyright 2022 ziptyze
|
||||
*
|
||||
* 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 "analog.h"
|
||||
#include "qmk_midi.h"
|
||||
|
||||
#include "quantum.h"
|
||||
#include "quantum/midi/midi.h"
|
||||
#include "quantum/midi/midi_device.h"
|
||||
|
||||
uint8_t divisor = 0;
|
||||
void slider(void) {
|
||||
if (divisor++) { // only run the slider function 1/256 times it's called
|
||||
return;
|
||||
}
|
||||
midi_send_cc(&midi_device, 2, 0x3E, 0x7F - (analogReadPin(SLIDER_PIN) >> 3));
|
||||
uprintf("%d string", analogReadPin(SLIDER_PIN));
|
||||
}
|
||||
|
||||
void housekeeping_task_kb(void) {
|
||||
slider();
|
||||
housekeeping_task_user();
|
||||
}
|
||||
|
||||
static uint32_t oled_logo_timer = 0;
|
||||
static bool clear_logo = true;
|
||||
static const char PROGMEM my_logo[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xC0,
|
||||
0xE0, 0xF0, 0x70, 0x70, 0x70, 0x70,
|
||||
0xF0, 0xE0, 0xC0, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x63, 0xE7, 0xE7, 0xCE, 0xCE,
|
||||
0xCE, 0xCE, 0xFC, 0xFC, 0x78, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xC0, 0xC0, 0xC1,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
|
||||
0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x07, 0x07, 0x07, 0x07, 0x07,
|
||||
0x07, 0x07, 0x07, 0x07, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xFC, 0xFC, 0xFC, 0x1C, 0x1C, 0x1C,
|
||||
0x1C, 0x3C, 0xF8, 0xF8, 0xE0, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x70,
|
||||
0x70, 0x70, 0x70, 0x78, 0x3F, 0x3F,
|
||||
0x0F, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xF0,
|
||||
0xF0, 0xF0, 0x70, 0x70, 0x70, 0x70,
|
||||
0x70, 0x70, 0x70, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xFF, 0xFF, 0xFF, 0xCE, 0xCE,
|
||||
0xCE, 0xCE, 0xCE, 0xCE, 0xCE, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xC0, 0xC1, 0xC1, 0xC1,
|
||||
0xC1, 0xC1, 0xC1, 0xC1, 0xC1, 0x81,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
|
||||
0xFF, 0x39, 0x39, 0x79, 0xF9, 0xF9,
|
||||
0xDF, 0x9F, 0x0F, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x07, 0x07, 0x07, 0x00, 0x00, 0x00,
|
||||
0x00, 0x03, 0x07, 0x07, 0x06, 0x04,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x1C, 0xBE,
|
||||
0xFF, 0x63, 0x63, 0xFF, 0xBE, 0x1C,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x07, 0x0F, 0x1F, 0x18, 0x18, 0x1F,
|
||||
0x0F, 0x07, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00
|
||||
};
|
||||
|
||||
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
|
||||
return OLED_ROTATION_270;
|
||||
}
|
||||
|
||||
|
||||
static const char PROGMEM ou_logo[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xFC, 0xFC, 0xCF, 0xCF,
|
||||
0x03, 0x03, 0x03, 0x03, 0xFF, 0xFF,
|
||||
0x03, 0x03, 0xFF, 0xFF, 0x03, 0x03,
|
||||
0x03, 0x03, 0xFF, 0xFF, 0x03, 0x03,
|
||||
0x03, 0x03, 0xF3, 0xF3, 0x03, 0x03,
|
||||
0x0C, 0x0C, 0xFC, 0xFC, 0x00, 0x00,
|
||||
0xFF, 0xFF, 0xC0, 0xC0, 0xC0, 0xC0,
|
||||
0xFF, 0xFF, 0xF0, 0xF0, 0xC3, 0xC3,
|
||||
0xC0, 0xC0, 0xF0, 0xF0, 0xFF, 0xFF,
|
||||
0xC0, 0xC0, 0xC0, 0xC0, 0xFC, 0xFC,
|
||||
0x0C, 0x0C, 0x0F, 0x0F, 0x03, 0x03,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00
|
||||
};
|
||||
|
||||
|
||||
static char PROGMEM caps_on[] = {
|
||||
0x00, 0x00, 0x00, 0xF8, 0x04, 0x04,
|
||||
0x04, 0x88, 0x00, 0x00, 0xE0, 0x58,
|
||||
0x44, 0x58, 0xE0, 0x00, 0x00, 0xFC,
|
||||
0x24, 0x24, 0x24, 0x18, 0x00, 0x00,
|
||||
0x98, 0x24, 0x24, 0x24, 0xC8, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0x01, 0x01, 0x00, 0x00, 0x81,
|
||||
0xC0, 0xE0, 0xF0, 0xF0, 0xF0, 0xF1,
|
||||
0xF0, 0xF1, 0xF0, 0xF0, 0xE0, 0xC0,
|
||||
0x80, 0x00, 0x00, 0x01, 0x01, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x03, 0x07, 0x0F, 0x1F,
|
||||
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
|
||||
0x3F, 0x3F, 0x1F, 0x0F, 0x07, 0x03,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00
|
||||
};
|
||||
|
||||
static char PROGMEM caps_off[] = {
|
||||
0x00, 0x00, 0x00, 0xF8, 0x04, 0x04,
|
||||
0x04, 0x88, 0x00, 0x00, 0xE0, 0x58,
|
||||
0x44, 0x58, 0xE0, 0x00, 0x00, 0xFC,
|
||||
0x24, 0x24, 0x24, 0x18, 0x00, 0x00,
|
||||
0x98, 0x24, 0x24, 0x24, 0xC8, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0x01, 0x01, 0x00, 0x00, 0x81,
|
||||
0xC0, 0xE0, 0xF0, 0x70, 0x30, 0x31,
|
||||
0x30, 0x31, 0x70, 0xF0, 0xE0, 0xC0,
|
||||
0x80, 0x00, 0x00, 0x01, 0x01, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xFF, 0xFF, 0x03, 0x01, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0x03, 0xFF, 0xFF, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x03, 0x07, 0x0F, 0x1E,
|
||||
0x3C, 0x38, 0x30, 0x30, 0x30, 0x30,
|
||||
0x38, 0x3C, 0x1E, 0x0F, 0x07, 0x03,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00
|
||||
};
|
||||
|
||||
static const char PROGMEM num_on[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xFC,
|
||||
0x18, 0x20, 0xC0, 0xFC, 0x00, 0x00,
|
||||
0x00, 0xFC, 0x00, 0x00, 0x00, 0xFC,
|
||||
0x00, 0x00, 0xFC, 0x18, 0x60, 0x80,
|
||||
0x60, 0x18, 0xFC, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x81,
|
||||
0xC0, 0xE0, 0xF0, 0xF0, 0xF1, 0xF1,
|
||||
0xF1, 0xF0, 0xF0, 0xF0, 0xE1, 0xC0,
|
||||
0x80, 0x01, 0x00, 0x00, 0x01, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x03, 0x07, 0x0F, 0x1F,
|
||||
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
|
||||
0x3F, 0x3F, 0x1F, 0x0F, 0x07, 0x03,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00
|
||||
};
|
||||
|
||||
static const char PROGMEM num_off[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xFC,
|
||||
0x18, 0x20, 0xC0, 0xFC, 0x00, 0x00,
|
||||
0x00, 0xFC, 0x00, 0x00, 0x00, 0xFC,
|
||||
0x00, 0x00, 0xFC, 0x18, 0x60, 0x80,
|
||||
0x60, 0x18, 0xFC, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x81,
|
||||
0xC0, 0xE0, 0xF0, 0x70, 0x31, 0x31,
|
||||
0x31, 0x30, 0x70, 0xF0, 0xE1, 0xC0,
|
||||
0x80, 0x01, 0x00, 0x00, 0x01, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xFF, 0xFF, 0x03, 0x01, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0x03, 0xFF, 0xFF, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x03, 0x07, 0x0F, 0x1E,
|
||||
0x3C, 0x38, 0x30, 0x30, 0x30, 0x30,
|
||||
0x38, 0x3C, 0x1E, 0x0F, 0x07, 0x03,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00
|
||||
};
|
||||
|
||||
static const char PROGMEM scrl_on[] = {
|
||||
0x00, 0x00, 0x00, 0x98, 0x24, 0x24,
|
||||
0x24, 0xC8, 0x00, 0x00, 0xF8, 0x04,
|
||||
0x04, 0x04, 0x88, 0x00, 0x00, 0xFC,
|
||||
0x24, 0x24, 0xE4, 0x18, 0x00, 0x00,
|
||||
0x00, 0xFC, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0x01, 0x01, 0x00, 0x00, 0x80,
|
||||
0xC0, 0xE1, 0xF1, 0xF1, 0xF0, 0xF0,
|
||||
0xF0, 0xF1, 0xF0, 0xF0, 0xE0, 0xC1,
|
||||
0x80, 0x00, 0x00, 0x01, 0x01, 0x01,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x03, 0x07, 0x0F, 0x1F,
|
||||
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
|
||||
0x3F, 0x3F, 0x1F, 0x0F, 0x07, 0x03,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00
|
||||
};
|
||||
|
||||
static const char PROGMEM scrl_off[] = {
|
||||
0x00, 0x00, 0x00, 0x98, 0x24, 0x24,
|
||||
0x24, 0xC8, 0x00, 0x00, 0xF8, 0x04,
|
||||
0x04, 0x04, 0x88, 0x00, 0x00, 0xFC,
|
||||
0x24, 0x24, 0xE4, 0x18, 0x00, 0x00,
|
||||
0x00, 0xFC, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0x01, 0x01, 0x00, 0x00, 0x80,
|
||||
0xC0, 0xE1, 0xF1, 0x71, 0x30, 0x30,
|
||||
0x30, 0x31, 0x70, 0xF0, 0xE0, 0xC1,
|
||||
0x80, 0x00, 0x00, 0x01, 0x01, 0x01,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xFF, 0xFF, 0x03, 0x01, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0x03, 0xFF, 0xFF, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x03, 0x07, 0x0F, 0x1E,
|
||||
0x3C, 0x38, 0x30, 0x30, 0x30, 0x30,
|
||||
0x38, 0x3C, 0x1E, 0x0F, 0x07, 0x03,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00
|
||||
};
|
||||
|
||||
static void render_oled(void) {
|
||||
const int combined_size = sizeof(ou_logo) + sizeof(caps_off) + sizeof(num_off) + sizeof(scrl_off);
|
||||
char combined[combined_size];
|
||||
led_t led_state = host_keyboard_led_state();
|
||||
|
||||
memcpy_P(combined, ou_logo, sizeof(ou_logo));
|
||||
|
||||
if (led_state.caps_lock) {
|
||||
memcpy_P(combined + sizeof(ou_logo), caps_on, sizeof(caps_off));
|
||||
}
|
||||
else {
|
||||
memcpy_P(combined + sizeof(ou_logo), caps_off, sizeof(caps_off));
|
||||
}
|
||||
|
||||
if (led_state.num_lock) {
|
||||
memcpy_P(combined + sizeof(ou_logo) + sizeof(caps_off), num_on, sizeof(num_off));
|
||||
}
|
||||
else {
|
||||
memcpy_P(combined + sizeof(ou_logo) + sizeof(caps_off), num_off, sizeof(num_off));
|
||||
}
|
||||
|
||||
if (led_state.scroll_lock) {
|
||||
memcpy_P(combined + sizeof(ou_logo) + sizeof(caps_off) + sizeof(num_off), scrl_on, sizeof(scrl_off));
|
||||
}
|
||||
else {
|
||||
memcpy_P(combined + sizeof(ou_logo) + sizeof(caps_off) + sizeof(num_off), scrl_off, sizeof(scrl_off));
|
||||
}
|
||||
|
||||
oled_write_raw_P(combined, sizeof(combined));
|
||||
}
|
||||
|
||||
void render_logo(void) {
|
||||
oled_write_raw_P(my_logo, sizeof(my_logo));
|
||||
}
|
||||
|
||||
void clear_screen(void) {
|
||||
if (clear_logo){
|
||||
for (uint8_t i = 0; i < OLED_DISPLAY_HEIGHT; ++i) {
|
||||
for (uint8_t j = 0; j < OLED_DISPLAY_WIDTH; ++j) {
|
||||
oled_write_raw_byte(0x0, i*OLED_DISPLAY_WIDTH + j);
|
||||
}
|
||||
}
|
||||
clear_logo = false;
|
||||
}
|
||||
}
|
||||
|
||||
#define MIDI_CONTROL_CHANGE 0xB0
|
||||
|
||||
MidiDevice _midi_device;
|
||||
|
||||
void midi_callback(uint8_t cable, uint8_t *midi_data, uint16_t length) {
|
||||
// Check if this is a MIDI CC message on channel 2
|
||||
if ((midi_data[0] & 0xF0) == MIDI_CONTROL_CHANGE && midi_data[0] & (0x0F == 1)) {
|
||||
uprintf("%s string", midi_data );
|
||||
// ...
|
||||
}
|
||||
}
|
||||
|
||||
void slider8_cc_callback(struct _midi_device *dev, uint8_t cable, uint8_t code_index, uint8_t value) {
|
||||
midi_callback(MIDI_CONTROL_CHANGE, &value, 1);
|
||||
}
|
||||
|
||||
void init_timer(void){
|
||||
oled_logo_timer = timer_read32();
|
||||
};
|
||||
|
||||
void keyboard_post_init_kb(void) {
|
||||
init_timer();
|
||||
|
||||
keyboard_post_init_user();
|
||||
}
|
||||
|
||||
void matrix_init_kb(void) {
|
||||
midi_register_cc_callback(&_midi_device, slider8_cc_callback);
|
||||
matrix_init_user();
|
||||
}
|
||||
|
||||
#ifndef SHOW_LOGO
|
||||
# define SHOW_LOGO 5000
|
||||
#endif
|
||||
bool oled_task_kb(void) {
|
||||
if (!oled_task_user()) { return false; }
|
||||
if ((timer_elapsed32(oled_logo_timer) < SHOW_LOGO)){
|
||||
render_logo();
|
||||
}else{
|
||||
clear_screen();
|
||||
render_oled();
|
||||
}
|
||||
return false;
|
||||
}
|
29
keyboards/1upkeyboards/1upslider8/config.h
Normal file
29
keyboards/1upkeyboards/1upslider8/config.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
/* Copyright 2023 Ziptyze
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define I2C1_SCL_PIN GP11
|
||||
#define I2C1_SDA_PIN GP10
|
||||
#define OLED_BRIGHTNESS 128
|
||||
|
||||
#define SLIDER_PIN GP28
|
||||
#define MIDI_ADVANCED
|
||||
|
||||
#define RGB_MATRIX_LED_COUNT 8
|
||||
#define RGB_MATRIX_KEYPRESSES // reacts to keypresses
|
||||
#define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
|
||||
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
|
9
keyboards/1upkeyboards/1upslider8/halconf.h
Normal file
9
keyboards/1upkeyboards/1upslider8/halconf.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
// Copyright 2023 ziptyze
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later#pragma once
|
||||
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_I2C TRUE
|
||||
#define HAL_USE_ADC TRUE
|
||||
|
||||
#include_next <halconf.h>
|
115
keyboards/1upkeyboards/1upslider8/info.json
Normal file
115
keyboards/1upkeyboards/1upslider8/info.json
Normal file
|
@ -0,0 +1,115 @@
|
|||
{
|
||||
"manufacturer": "1upkeyboards",
|
||||
"keyboard_name": "1upslider8",
|
||||
"maintainer": "ziptyze",
|
||||
"processor": "RP2040",
|
||||
"bootloader": "rp2040",
|
||||
"usb": {
|
||||
"device_version": "1.0.0",
|
||||
"pid": "0x5611",
|
||||
"vid": "0x6F75"
|
||||
},
|
||||
"dynamic_keymap": {
|
||||
"layer_count": 10
|
||||
},
|
||||
"features": {
|
||||
"bootmagic": true,
|
||||
"command": false,
|
||||
"console": false,
|
||||
"extrakey": true,
|
||||
"mousekey": true,
|
||||
"nkro": false,
|
||||
"oled": true,
|
||||
"midi":true,
|
||||
"rgb_matrix": true,
|
||||
"encoder": true
|
||||
},
|
||||
"encoder": {
|
||||
"rotary": [
|
||||
{
|
||||
"pin_a": "GP21",
|
||||
"pin_b": "GP22"
|
||||
}
|
||||
]
|
||||
},
|
||||
"matrix_pins": {
|
||||
"direct": [
|
||||
["GP27", "GP17", "GP18", "GP19", "GP20", "GP15", "GP14", "GP13", "GP16"]
|
||||
]
|
||||
},
|
||||
"bootmagic": {
|
||||
"matrix": [0, 1]
|
||||
},
|
||||
"ws2812": {
|
||||
"pin": "GP26",
|
||||
"driver": "vendor"
|
||||
},
|
||||
"rgb_matrix": {
|
||||
"animations": {
|
||||
"gradient_up_down": true,
|
||||
"gradient_left_right": true,
|
||||
"breathing": true,
|
||||
"band_sat": true,
|
||||
"band_val": true,
|
||||
"band_pinwheel_sat": true,
|
||||
"band_pinwheel_val": true,
|
||||
"band_spiral_sat": true,
|
||||
"band_spiral_val": true,
|
||||
"cycle_all": true,
|
||||
"cycle_left_right": true,
|
||||
"cycle_up_down": true,
|
||||
"rainbow_moving_chevron":true,
|
||||
"cycle_out_in": true,
|
||||
"cycle_out_in_dual": true,
|
||||
"cycle_pinwheel": true,
|
||||
"cycle_spiral": true,
|
||||
"dual_beacon": true,
|
||||
"rainbow_beacon": true,
|
||||
"rainbow_pinwheels": true,
|
||||
"raindrops": true,
|
||||
"jellybean_raindrops": true,
|
||||
"hue_breathing": true,
|
||||
"hue_pendulum": true,
|
||||
"hue_wave": true,
|
||||
"typing_heatmap": true,
|
||||
"solid_reactive_simple": true,
|
||||
"solid_reactive": true,
|
||||
"solid_reactive_wide": true,
|
||||
"solid_reactive_multiwide": true,
|
||||
"solid_reactive_cross": true,
|
||||
"solid_reactive_multicross": true,
|
||||
"solid_reactive_nexus": true,
|
||||
"solid_reactive_multinexus": true,
|
||||
"splash": true,
|
||||
"multisplash": true,
|
||||
"solid_splash": true,
|
||||
"solid_multisplash": true
|
||||
},
|
||||
"driver": "ws2812",
|
||||
"layout": [
|
||||
{ "flags": 4, "matrix": [0, 1], "x": 28, "y": 16 },
|
||||
{ "flags": 4, "matrix": [0, 2], "x": 84, "y": 16 },
|
||||
{ "flags": 4, "matrix": [0, 3], "x": 140, "y": 16 },
|
||||
{ "flags": 4, "matrix": [0, 4], "x": 196, "y": 16 },
|
||||
{ "flags": 4, "matrix": [0, 5], "x": 28, "y": 48 },
|
||||
{ "flags": 4, "matrix": [0, 6], "x": 84, "y": 48 },
|
||||
{ "flags": 4, "matrix": [0, 7], "x": 140, "y": 48 },
|
||||
{ "flags": 4, "matrix": [0, 8], "x": 196, "y": 48 }
|
||||
]
|
||||
},
|
||||
"layouts": {
|
||||
"LAYOUT": {
|
||||
"layout": [
|
||||
{ "label": "enc", "matrix": [0, 0], "x": 3, "y": 0 },
|
||||
{ "label": "1", "matrix": [0, 1], "x": 0, "y": 1 },
|
||||
{ "label": "2", "matrix": [0, 2], "x": 1, "y": 1 },
|
||||
{ "label": "3", "matrix": [0, 3], "x": 2, "y": 1 },
|
||||
{ "label": "4", "matrix": [0, 4], "x": 3, "y": 1 },
|
||||
{ "label": "5", "matrix": [0, 5], "x": 0, "y": 2 },
|
||||
{ "label": "6", "matrix": [0, 6], "x": 1, "y": 2 },
|
||||
{ "label": "7", "matrix": [0, 7], "x": 2, "y": 2 },
|
||||
{ "label": "8", "matrix": [0, 8], "x": 3, "y": 2 }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
31
keyboards/1upkeyboards/1upslider8/keymaps/default/keymap.c
Normal file
31
keyboards/1upkeyboards/1upslider8/keymaps/default/keymap.c
Normal file
|
@ -0,0 +1,31 @@
|
|||
/* Copyright 2022 ziptyze
|
||||
*
|
||||
* 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
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = LAYOUT(
|
||||
RGB_TOG,
|
||||
KC_1, KC_2, KC_3, KC_4,
|
||||
KC_5, KC_6, KC_7, KC_8
|
||||
)
|
||||
};
|
||||
|
||||
#if defined(ENCODER_MAP_ENABLE)
|
||||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
||||
[0] = { ENCODER_CCW_CW(RGB_RMOD, RGB_MOD)}
|
||||
};
|
||||
#endif
|
|
@ -0,0 +1 @@
|
|||
ENCODER_MAP_ENABLE = yes
|
31
keyboards/1upkeyboards/1upslider8/keymaps/via/keymap.c
Normal file
31
keyboards/1upkeyboards/1upslider8/keymaps/via/keymap.c
Normal file
|
@ -0,0 +1,31 @@
|
|||
/* Copyright 2023 ziptyze
|
||||
*
|
||||
* 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
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = LAYOUT(
|
||||
RGB_TOG,
|
||||
KC_1, KC_2, KC_3, KC_4,
|
||||
KC_5, KC_6, KC_7, KC_8
|
||||
)
|
||||
};
|
||||
|
||||
#if defined(ENCODER_MAP_ENABLE)
|
||||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
||||
[0] = { ENCODER_CCW_CW(RGB_RMOD, RGB_MOD)}
|
||||
};
|
||||
#endif
|
3
keyboards/1upkeyboards/1upslider8/keymaps/via/rules.mk
Normal file
3
keyboards/1upkeyboards/1upslider8/keymaps/via/rules.mk
Normal file
|
@ -0,0 +1,3 @@
|
|||
VIA_ENABLE = yes
|
||||
|
||||
ENCODER_MAP_ENABLE = yes
|
11
keyboards/1upkeyboards/1upslider8/mcuconf.h
Normal file
11
keyboards/1upkeyboards/1upslider8/mcuconf.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
// Copyright 2023 ziptyze
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later#pragma once
|
||||
|
||||
#pragma once
|
||||
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
#undef RP_I2C_USE_I2C1
|
||||
#undef RP_ADC_USE_ADC1
|
||||
#define RP_I2C_USE_I2C1 TRUE
|
||||
#define RP_ADC_USE_ADC1 TRUE
|
27
keyboards/1upkeyboards/1upslider8/readme.md
Normal file
27
keyboards/1upkeyboards/1upslider8/readme.md
Normal file
|
@ -0,0 +1,27 @@
|
|||
# slider8
|
||||
|
||||
![slider8](https://i.imgur.com/AiVQySnh.jpg)
|
||||
|
||||
|
||||
This keyboard is the slider8 from 1upkeyboards.com, a small macropad with an oled, slide potentiometer, rotary encoder, and 8 switches in a 2x4 ortholinear arrangement with per-key in-switch rgb leds.
|
||||
|
||||
The slide potentiometer presents to the computer as a midi device and will need a seperate program to map to device control.
|
||||
|
||||
* Keyboard Maintainer: [ziptyze](https://github.com/ziptyze)
|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
make 1upkeyboards/1upslider8:default
|
||||
|
||||
Flashing example for this keyboard:
|
||||
|
||||
make 1upkeyboards/1upslider8:default:flash
|
||||
|
||||
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
|
||||
|
||||
## Bootloader
|
||||
|
||||
Enter the bootloader in 2 ways:
|
||||
|
||||
* **Bootmagic reset**: Hold down the top left key and plug in the keyboard
|
||||
* **Physical reset button**: Hold down the button on the pi pico and plug in the keyboard
|
1
keyboards/1upkeyboards/1upslider8/rules.mk
Normal file
1
keyboards/1upkeyboards/1upslider8/rules.mk
Normal file
|
@ -0,0 +1 @@
|
|||
SRC += analog.c
|
Loading…
Reference in a new issue