1
0
Fork 0

[Keyboard] Add Terrazzo Keyboard (#10408)

* Ciao Terrazzo!

* Keymap updates

* Adding info json
Cleaning up keymap files
Readme updates with template

* Coding style updates

* Removing vscode files

* PR feedback updates

* biton32 -> get_highest_layer update
Adding license headers
This commit is contained in:
Anne Demey 2020-10-23 17:14:17 -05:00 committed by GitHub
parent 5d2deaca06
commit d689f76110
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 1560 additions and 0 deletions

View file

@ -0,0 +1,162 @@
/* Copyright 2020 ademey "MsMustard"
*
* 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/>.
*/
#ifndef DISABLE_TERRAZZO_EFFECT_DINO
TERRAZZO_EFFECT(DINO)
# ifdef TERRAZZO_EFFECT_IMPLS
static uint8_t dino_frames[2][56] = {
{
0, 0, 0, 9, 9, 9, 9,
0, 0, 0, 9, 0, 9, 9,
9, 0, 0, 9, 9, 9, 9,
9, 9, 9, 9, 9, 0, 0,
9, 9, 9, 9, 9, 0, 0,
0, 9, 9, 9, 0, 0, 0,
0, 9, 0, 9, 9, 0, 0,
0, 9, 9, 0, 0, 0, 0
},
{
0, 0, 0, 9, 9, 9, 9,
0, 0, 0, 9, 0, 9, 9,
9, 0, 0, 9, 9, 9, 9,
9, 9, 9, 9, 9, 0, 0,
9, 9, 9, 9, 9, 0, 0,
0, 9, 9, 9, 0, 0, 0,
0, 9, 0, 9, 0, 0, 0,
0, 0, 0, 9, 9, 0, 0
}
};
static uint8_t dino_reverse[2][56] = {
{
9, 9, 9, 9, 0, 0, 0,
9, 9, 0, 9, 0, 0, 0,
9, 9, 9, 9, 0,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0, 0, 0, 1,
1, 1, 4, 1, 1, 1, 0,
0, 0, 4, 0, 0, 0, 0
},
{
0, 4, 0, 0, 0, 0, 0,
0, 4, 0, 4, 0, 0, 0,
0, 4, 4, 4, 0, 0, 0,
4, 4, 0, 0, 0, 1, 1,
1, 4, 1, 1, 1, 0, 0,
0, 4, 0, 0, 0, 0, 0
},
{
4, 0, 0, 0, 0, 0, 0,
4, 0, 4, 0, 0, 0, 0,
4, 4, 4, 0, 0, 0, 0,
4, 0, 0, 0, 1, 1, 0,
4, 1, 1, 1, 0, 0, 1,
4, 0, 0, 0, 0, 0, 0
},
{
0, 0, 0, 0, 0, 0, 0,
0, 4, 0, 0, 0, 0, 0,
4, 4, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 0, 0,
1, 1, 1, 0, 0, 1, 1,
0, 0, 0, 0, 0, 0, 0
},
{
0, 0, 0, 0, 0, 0, 0,
4, 0, 0, 0, 0, 0, 4,
4, 0, 0, 0, 0, 0, 4,
0, 0, 1, 1, 0, 0, 0,
1, 1, 0, 0, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0
}
};
void DINO(uint8_t i, bool dir) {
led_matrix_set_index_value_all(0);
if (dir) {
terrazzo_draw_at(0, 7, 7, 8, dino_frames[i % 2]);
} else {
terrazzo_draw_at(0, 7, 7, 8, dino_reverse[i % 2]);
}
terrazzo_draw_at(0, 0, 7, 6, dino_bg[i % 10]);
}
# endif
#endif

View file

@ -0,0 +1,27 @@
/* Copyright 2020 ademey "MsMustard"
*
* 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/>.
*/
#ifndef DISABLE_TERRAZZO_EFFECT_DOT
TERRAZZO_EFFECT(DOT)
# ifdef TERRAZZO_EFFECT_IMPLS
// Animation for debugging. Lights one pixel according to animation index
void DOT(uint8_t i, bool dir) {
led_matrix_set_index_value_all(0);
led_matrix_set_index_value(i, 10);
}
# endif
#endif

View file

@ -0,0 +1,99 @@
/* Copyright 2020 ademey "MsMustard"
*
* 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/>.
*/
#ifndef DISABLE_TERRAZZO_EFFECT_HEART
TERRAZZO_EFFECT(HEART)
# ifdef TERRAZZO_EFFECT_IMPLS
static uint8_t heart_frames[4][105] = {
{
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 5, 5, 0, 5, 5, 0,
5, 0, 0, 5, 0, 0, 5,
5, 0, 0, 0, 0, 0, 5,
0, 5, 0, 0, 0, 5, 0,
0, 0, 5, 0, 5, 0, 0,
0, 0, 0, 5, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0
},
{
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 5, 5, 0, 5, 5, 0,
5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5,
0, 5, 5, 5, 5, 5, 0,
0, 0, 5, 5, 5, 0, 0,
0, 0, 0, 5, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0
},
{
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 0, 1, 1, 0,
1, 0, 0, 5, 0, 0, 1,
0, 5, 5, 0, 5, 5, 0,
5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5,
0, 5, 5, 5, 5, 5, 0,
0, 0, 5, 5, 5, 0, 0,
1, 0, 0, 5, 0, 0, 1,
0, 1, 0, 0, 0, 1, 0,
0, 0, 1, 0, 1, 0, 0,
0, 0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0
},
{
0, 1, 1, 0, 1, 1, 0,
1, 0, 0, 1, 0, 0, 1,
0, 5, 5, 0, 5, 5, 0,
5, 0, 0, 5, 0, 0, 5,
0, 5, 5, 0, 5, 5, 0,
5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5,
0, 5, 5, 5, 5, 5, 0,
0, 0, 5, 5, 5, 0, 0,
5, 0, 0, 5, 0, 0, 5,
0, 5, 0, 0, 0, 5, 0,
1, 0, 5, 0, 5, 0, 1,
0, 1, 0, 5, 0, 1, 0,
0, 0, 1, 0, 1, 0, 0,
0, 0, 0, 1, 0, 0, 0
}
};
void HEART(uint8_t i, bool dir) {
led_matrix_set_index_value_all(0);
terrazzo_draw_at(0, 0, 7, 15, heart_frames[i % 4]);
}
# endif
#endif

View file

@ -0,0 +1,127 @@
/* Copyright 2020 ademey "MsMustard"
*
* 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/>.
*/
#ifndef DISABLE_TERRAZZO_EFFECT_OUTRUN
TERRAZZO_EFFECT(OUTRUN)
# ifdef TERRAZZO_EFFECT_IMPLS
static uint8_t outrun_sun[25] = {
0, 9, 9, 9, 0,
7, 7, 7, 7, 7,
4, 4, 4, 4, 4,
2, 2, 2, 2, 2,
0, 1, 1, 1, 0
};
static uint8_t outrun_ground[63] = {
0, 0, 1, 1, 1, 0, 0,
0, 2, 0, 2, 0, 2, 0,
0, 2, 0, 2, 0, 2, 0,
0, 2, 0, 4, 0, 2, 0,
2, 0, 0, 5, 0, 0, 2,
2, 0, 0, 5, 0, 0, 2,
2, 0, 0, 6, 0, 0, 2,
0, 0, 0, 7, 0, 0, 0,
0, 0, 0, 8, 0, 0, 0
};
static uint8_t outrun_rows[4][63] = {
{
1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0,
2, 2, 2, 2, 2, 2, 2,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
4, 4, 4, 4, 4, 4, 4,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0
},
{
0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0,
2, 2, 2, 2, 2, 2, 2,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
4, 4, 4, 4, 4, 4, 4,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0
},
{
1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0,
2, 2, 2, 2, 2, 2, 2,
0, 0, 0, 0, 0, 0, 0,
4, 4, 4, 4, 4, 4, 4,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
9, 9, 9, 9, 9, 9, 9,
0, 0, 0, 0, 0, 0, 0
},
{
0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0,
2, 2, 2, 2, 2, 2, 2,
0, 0, 0, 0, 0, 0, 0,
4, 4, 4, 4, 4, 4, 4,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
9, 9, 9, 9, 9, 9, 9
}
};
bool last_dir;
uint8_t change_index = 0;
void OUTRUN(uint8_t i, bool dir) {
led_matrix_set_index_value_all(0);
if(dir != last_dir) {
change_index = i;
}
uint8_t change_diff = abs(i - change_index);
uint8_t horz_bright = 9;
if(change_diff < 4) {
if (dir) {
terrazzo_draw_at(1, 4 - change_diff, 5, 1 + change_diff, outrun_sun);
horz_bright = 3 + change_diff;
} else {
terrazzo_draw_at(1, 0 + change_diff, 5, 5 - change_diff, outrun_sun);
horz_bright = 5 - change_diff;
}
} else {
if (dir) {
terrazzo_draw_at(1, 0, 5, 5, outrun_sun);
} else {
horz_bright = 1;
}
}
for(int x = 0; x < 7; x++){
terrazzo_set_pixel(x, 5, horz_bright);
}
// Sun is larger but render the top 3 rows only
terrazzo_draw_at(0, 6, 7, 10, outrun_ground);
terrazzo_draw_at(0, 6, 7, 10, outrun_rows[i % 4]);
last_dir = dir;
}
# endif
#endif

View file

@ -0,0 +1,67 @@
/* Copyright 2020 ademey "MsMustard"
*
* 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/>.
*/
#ifndef DISABLE_TERRAZZO_EFFECT_PAC_DUDE
TERRAZZO_EFFECT(PAC_DUDE)
# ifdef TERRAZZO_EFFECT_IMPLS
static uint8_t pac_frames[3][25] = {
{ // up
0, 0, 0, 0, 0,
9, 0, 0, 0, 9,
9, 9, 0, 9, 9,
9, 9, 9, 9, 9,
0, 9, 9, 9, 0
},
{ // closed
0, 9, 9, 9, 0,
9, 9, 9, 9, 9,
9, 9, 9, 9, 9,
9, 9, 9, 9, 9,
0, 9, 9, 9, 0
},
{ // down
0, 9, 9, 9, 0,
9, 9, 9, 9, 9,
9, 9, 0, 9, 9,
9, 0, 0, 0, 9,
0, 0, 0, 0, 0
}
};
static uint8_t pac_ghost[20] = {
0, 4, 4, 4, 0,
4, 0, 4, 0, 4,
4, 4, 4, 4, 4,
4, 0, 4, 0, 4
};
void PAC_DUDE(uint8_t i, bool dir) {
led_matrix_set_index_value_all(0);
if (dir) {
terrazzo_draw_at(1, 4, 5, 5, pac_frames[i % 2]);
terrazzo_set_pixel(3, 0 + i % 3, 5);
terrazzo_set_pixel(3, 3 + i % 3, 5);
} else {
terrazzo_draw_at(1, 4, 5, 5, pac_frames[1 + i % 2]);
terrazzo_draw_at(1, 8 + i % 8, 5, 4, pac_ghost);
}
}
# endif
#endif

View file

@ -0,0 +1,35 @@
/* Copyright 2020 ademey "MsMustard"
*
* 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/>.
*/
#ifndef DISABLE_TERRAZZO_EFFECT_STRIPES
TERRAZZO_EFFECT(STRIPES)
# ifdef TERRAZZO_EFFECT_IMPLS
void STRIPES(uint8_t i, bool dir) {
uint8_t sweep[] = {1, 2, 3, 4, 6, 8, 10, 15, 20, 30, 40, 60};
uint8_t levels = 12;
float soften = 5;
for (int y = 0; y < LED_MATRIX_ROWS; y++) {
for (int x = 0; x < LED_MATRIX_COLS; x++) {
uint8_t target = (x+y+i)%levels;
terrazzo_set_pixel(x, y, floor(sweep[target] / soften));
}
}
}
# endif
#endif

View file

@ -0,0 +1,7 @@
#include "terrazzo_effects/stripes.h"
#include "terrazzo_effects/dino.h"
#include "terrazzo_effects/outrun.h"
#include "terrazzo_effects/pac_dude.h"
#include "terrazzo_effects/heart.h"
#include "terrazzo_effects/wpm_chart.h"
#include "terrazzo_effects/dot.h"

View file

@ -0,0 +1,111 @@
/* Copyright 2020 ademey "MsMustard"
*
* 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/>.
*/
#ifndef DISABLE_TERRAZZO_EFFECT_WPM_CHART
TERRAZZO_EFFECT(WPM_CHART)
# ifdef TERRAZZO_EFFECT_IMPLS
static uint8_t number_3_4[10][12] = {
{ // 0
9, 9, 9,
9, 0, 9,
9, 0, 9,
9, 9, 9
},
{ // 1
0, 9, 0,
9, 9, 0,
0, 9, 0,
9, 9, 9
},
{ // 2
9, 9, 0,
0, 0, 9,
0, 9, 0,
9, 9, 9
},
{ // 3
9, 9, 9,
0, 9, 0,
0, 0, 9,
9, 9, 0
},
{ // 4
9, 0, 9,
9, 0, 9,
9, 9, 9,
0, 0, 9
},
{ // 5
9, 9, 9,
9, 9, 0,
0, 0, 9,
9, 9, 9
},
{ // 6
0, 0, 9,
0, 9, 0,
9, 0, 9,
0, 9, 0
},
{ // 7
9, 9, 9,
0, 0, 9,
0, 9, 0,
9, 0, 0
},
{ // 8
9, 9, 9,
9, 0, 9,
9, 4, 9,
9, 9, 9
},
{ // 9
9, 9, 9,
9, 0, 9,
9, 9, 9,
0, 0, 9
}
};
/* Reference to create a gradient effect */
uint8_t wpm_levels[10] = {20, 9, 8, 7, 6, 5, 4, 3, 2, 1};
void WPM_CHART(uint8_t i, bool dir) {
led_matrix_set_index_value_all(0);
uint8_t c_wpm = get_current_wpm();
uint8_t half_wpm = floor(c_wpm / 2);
uint8_t max_rows = 10;
/* Turn on LED for current WPM. Each pixel is 2 wpm. */
for (int k = 0; k < half_wpm && k < 70; k++) {
uint8_t current_row = (int)floor(k / 7);
led_matrix_set_index_value(k, wpm_levels[max_rows - current_row]);
};
uint8_t d1 = (int)floor(c_wpm / 10);
/* There is only room to print 2 digits. If the WPM is greater than
99 then the last 2 digits will show, ie 120 = 20. */
if (c_wpm > 99) {
uint8_t tens_place = d1 % 10;
terrazzo_draw_at(0, 11, 3, 4, number_3_4[tens_place]);
} else {
terrazzo_draw_at(0, 11, 3, 4, number_3_4[d1]);
}
terrazzo_draw_at(4, 11, 3, 4, number_3_4[c_wpm % 10]);
}
# endif
#endif