1
0
Fork 0

[Keyboard] Rebuild treadstone48 rev1 firmware (#7856)

* Keyboard: add treeadstone48

* rename layout defines

* Use of pragma once

* move common include code

* fixed info.json

* change keymap layout from kc to normal

* fix alpha revision keymap

* fixed info.json

* remove USE_Link_Time_Optimization

* I re-created treastone48 keyboard firmware from ./util/new_keyboard.sh
After that I use common OLED_DRIVER, RGB_LIGHT and SPLIT_KEYBOARD options.
And then check all keymap.

* Modified by PR review
This commit is contained in:
marksard 2020-01-14 03:06:40 +09:00 committed by Drashna Jaelre
parent 1b8cb95f2e
commit 240e1ef6fd
33 changed files with 510 additions and 2568 deletions

View file

@ -1,8 +1,22 @@
/* Copyright 2020 marksard
*
* 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
#include "keymap_jp.h"
#include "../common/oled_helper.h"
#ifdef RGBLIGHT_ENABLE
//Following line allows macro to read current RGB settings
extern rgblight_config_t rgblight_config;
@ -115,7 +129,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#define L_ADJUST (1<<_ADJUST)
#define L_ADJUST_TRI (L_ADJUST|L_RAISE|L_LOWER)
#ifdef SSD1306OLED
#ifdef OLED_DRIVER_ENABLE
#include <stdio.h>
#include <string.h>
typedef struct {
uint8_t state;
char name[8];
@ -152,18 +169,42 @@ static inline void update_keymap_status(void) {
keymap_config.swap_lalt_lgui? "win" : "mac", get_leyer_status());
}
static inline void render_keymap_status(struct CharacterMatrix *matrix) {
static inline void render_keymap_status(void) {
matrix_write(matrix, layer_status_buf);
oled_write(layer_status_buf, false);
}
#define UPDATE_KEYMAP_STATUS() update_keymap_status()
#define RENDER_KEYMAP_STATUS(a) render_keymap_status(a)
static inline void render_status(void) {
UPDATE_LED_STATUS();
RENDER_LED_STATUS();
render_keymap_status();
UPDATE_LOCK_STATUS();
RENDER_LOCK_STATUS();
RENDER_KEY_STATUS();
}
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
// if (is_keyboard_master())
// return OLED_ROTATION_180; // flips the display 180 degrees if offhand
return rotation;
}
void oled_task_user(void) {
if (is_keyboard_master()) {
render_status();
} else {
render_logo();
}
}
#else
#define UPDATE_KEYMAP_STATUS()
#define RENDER_KEYMAP_STATUS(a)
#endif
@ -198,18 +239,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
break;
#ifdef RGBLIGHT_ENABLE
case RGB_MOD:
if (record->event.pressed) {
rgblight_mode(RGB_current_mode);
rgblight_step();
RGB_current_mode = rgblight_config.mode;
}
break;
case RGBRST:
if (record->event.pressed) {
eeconfig_update_rgblight_default();
rgblight_enable();
RGB_current_mode = rgblight_config.mode;
}
break;
#endif
@ -221,57 +254,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
UPDATE_KEYMAP_STATUS();
return result;
}
void matrix_init_user(void) {
#ifdef RGBLIGHT_ENABLE
RGB_current_mode = rgblight_config.mode;
#endif
//SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
#ifdef SSD1306OLED
iota_gfx_init(!has_usb()); // turns on the display
#endif
}
//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
#ifdef SSD1306OLED
void matrix_scan_user(void) {
iota_gfx_task(); // this is what updates the display continuously
}
static inline void matrix_update(struct CharacterMatrix *dest,
const struct CharacterMatrix *source) {
if (memcmp(dest->display, source->display, sizeof(dest->display))) {
memcpy(dest->display, source->display, sizeof(dest->display));
dest->dirty = true;
}
}
static inline void render_status(struct CharacterMatrix *matrix) {
UPDATE_LED_STATUS();
RENDER_LED_STATUS(matrix);
RENDER_KEYMAP_STATUS(matrix);
UPDATE_LOCK_STATUS();
RENDER_LOCK_STATUS(matrix);
RENDER_KEY_STATUS(matrix);
}
void iota_gfx_task_user(void) {
struct CharacterMatrix matrix;
#if DEBUG_TO_SCREEN
if (debug_enable) {
return;
}
#endif
matrix_clear(&matrix);
if (is_master) {
render_status(&matrix);
}
matrix_update(&display, &matrix);
}
#endif