diff options
author | Joel Challis <git@zvecr.com> | 2022-07-31 20:32:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-31 12:32:45 -0700 |
commit | 2f19579d3f2c8b4041f0128976c00136c5a6a32d (patch) | |
tree | 6e2040ef4c4574edffe09b0386c6574c890e0ba5 /keyboards | |
parent | b03a7cef7555119f1cdee95b0c08cafd9f1f18eb (diff) |
Convert yosino58 to use split common (#17861)
Diffstat (limited to 'keyboards')
27 files changed, 96 insertions, 2118 deletions
diff --git a/keyboards/yosino58/.noci b/keyboards/yosino58/.noci deleted file mode 100644 index e69de29bb2..0000000000 --- a/keyboards/yosino58/.noci +++ /dev/null diff --git a/keyboards/yosino58/config.h b/keyboards/yosino58/config.h deleted file mode 100644 index 24831ee5b2..0000000000 --- a/keyboards/yosino58/config.h +++ /dev/null @@ -1,25 +0,0 @@ -/* -Copyright 2012 Jun Wako <wakojun@gmail.com> -Copyright 2015 Jack Humbert - -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 - -#include "config_common.h" -#include "serial_config.h" - -#define USE_I2C -#define USE_SERIAL diff --git a/keyboards/yosino58/i2c.c b/keyboards/yosino58/i2c.c deleted file mode 100644 index 4bee5c6398..0000000000 --- a/keyboards/yosino58/i2c.c +++ /dev/null @@ -1,162 +0,0 @@ -#include <util/twi.h> -#include <avr/io.h> -#include <stdlib.h> -#include <avr/interrupt.h> -#include <util/twi.h> -#include <stdbool.h> -#include "i2c.h" - -#ifdef USE_I2C - -// Limits the amount of we wait for any one i2c transaction. -// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is -// 9 bits, a single transaction will take around 90μs to complete. -// -// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit -// poll loop takes at least 8 clock cycles to execute -#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8 - -#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE) - -volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; - -static volatile uint8_t slave_buffer_pos; -static volatile bool slave_has_register_set = false; - -// Wait for an i2c operation to finish -inline static -void i2c_delay(void) { - uint16_t lim = 0; - while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT) - lim++; - - // easier way, but will wait slightly longer - // _delay_us(100); -} - -// Setup twi to run at 100kHz or 400kHz (see ./i2c.h SCL_CLOCK) -void i2c_master_init(void) { - // no prescaler - TWSR = 0; - // Set TWI clock frequency to SCL_CLOCK. Need TWBR>10. - // Check datasheets for more info. - TWBR = ((F_CPU/SCL_CLOCK)-16)/2; -} - -// Start a transaction with the given i2c slave address. The direction of the -// transfer is set with I2C_READ and I2C_WRITE. -// returns: 0 => success -// 1 => error -uint8_t i2c_master_start(uint8_t address) { - TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTA); - - i2c_delay(); - - // check that we started successfully - if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START)) - return 1; - - TWDR = address; - TWCR = (1<<TWINT) | (1<<TWEN); - - i2c_delay(); - - if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) ) - return 1; // slave did not acknowledge - else - return 0; // success -} - - -// Finish the i2c transaction. -void i2c_master_stop(void) { - TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO); - - uint16_t lim = 0; - while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT) - lim++; -} - -// Write one byte to the i2c slave. -// returns 0 => slave ACK -// 1 => slave NACK -uint8_t i2c_master_write(uint8_t data) { - TWDR = data; - TWCR = (1<<TWINT) | (1<<TWEN); - - i2c_delay(); - - // check if the slave acknowledged us - return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1; -} - -// Read one byte from the i2c slave. If ack=1 the slave is acknowledged, -// if ack=0 the acknowledge bit is not set. -// returns: byte read from i2c device -uint8_t i2c_master_read(int ack) { - TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA); - - i2c_delay(); - return TWDR; -} - -void i2c_reset_state(void) { - TWCR = 0; -} - -void i2c_slave_init(uint8_t address) { - TWAR = address << 0; // slave i2c address - // TWEN - twi enable - // TWEA - enable address acknowledgement - // TWINT - twi interrupt flag - // TWIE - enable the twi interrupt - TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN); -} - -ISR(TWI_vect); - -ISR(TWI_vect) { - uint8_t ack = 1; - switch(TW_STATUS) { - case TW_SR_SLA_ACK: - // this device has been addressed as a slave receiver - slave_has_register_set = false; - break; - - case TW_SR_DATA_ACK: - // this device has received data as a slave receiver - // The first byte that we receive in this transaction sets the location - // of the read/write location of the slaves memory that it exposes over - // i2c. After that, bytes will be written at slave_buffer_pos, incrementing - // slave_buffer_pos after each write. - if(!slave_has_register_set) { - slave_buffer_pos = TWDR; - // don't acknowledge the master if this memory loctaion is out of bounds - if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) { - ack = 0; - slave_buffer_pos = 0; - } - slave_has_register_set = true; - } else { - i2c_slave_buffer[slave_buffer_pos] = TWDR; - BUFFER_POS_INC(); - } - break; - - case TW_ST_SLA_ACK: - case TW_ST_DATA_ACK: - // master has addressed this device as a slave transmitter and is - // requesting data. - TWDR = i2c_slave_buffer[slave_buffer_pos]; - BUFFER_POS_INC(); - break; - - case TW_BUS_ERROR: // something went wrong, reset twi state - TWCR = 0; - default: - break; - } - // Reset everything, so we are ready for the next TWI interrupt - TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN); -} -#endif diff --git a/keyboards/yosino58/i2c.h b/keyboards/yosino58/i2c.h deleted file mode 100644 index 710662c7ab..0000000000 --- a/keyboards/yosino58/i2c.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once - -#include <stdint.h> - -#ifndef F_CPU -#define F_CPU 16000000UL -#endif - -#define I2C_READ 1 -#define I2C_WRITE 0 - -#define I2C_ACK 1 -#define I2C_NACK 0 - -#define SLAVE_BUFFER_SIZE 0x10 - -// i2c SCL clock frequency 400kHz -#define SCL_CLOCK 400000L - -extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; - -void i2c_master_init(void); -uint8_t i2c_master_start(uint8_t address); -void i2c_master_stop(void); -uint8_t i2c_master_write(uint8_t data); -uint8_t i2c_master_read(int); -void i2c_reset_state(void); -void i2c_slave_init(uint8_t address); - - -static inline unsigned char i2c_start_read(unsigned char addr) { - return i2c_master_start((addr << 1) | I2C_READ); -} - -static inline unsigned char i2c_start_write(unsigned char addr) { - return i2c_master_start((addr << 1) | I2C_WRITE); -} - -// from SSD1306 scrips -extern unsigned char i2c_rep_start(unsigned char addr); -extern void i2c_start_wait(unsigned char addr); -extern unsigned char i2c_readAck(void); -extern unsigned char i2c_readNak(void); -extern unsigned char i2c_read(unsigned char ack); - -#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); diff --git a/keyboards/yosino58/keymaps/default/config.h b/keyboards/yosino58/keymaps/default/config.h index 21fc2d3b54..aa3caa3d06 100644 --- a/keyboards/yosino58/keymaps/default/config.h +++ b/keyboards/yosino58/keymaps/default/config.h @@ -20,17 +20,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #pragma once -//#define USE_MATRIX_I2C - /* Select hand configuration */ #define MASTER_LEFT // #define MASTER_RIGHT // #define EE_HANDS -#define SSD1306OLED -// #define SSD1306_128X64 - #define TAPPING_FORCE_HOLD #define TAPPING_TERM 100 @@ -40,4 +35,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define RGBLIGHT_LIMIT_VAL 120 #define RGBLIGHT_HUE_STEP 10 #define RGBLIGHT_SAT_STEP 17 -#define RGBLIGHT_VAL_STEP 17
\ No newline at end of file +#define RGBLIGHT_VAL_STEP 17 diff --git a/keyboards/yosino58/keymaps/default/keymap.c b/keyboards/yosino58/keymaps/default/keymap.c index 3200d14708..00a6c8e83f 100644 --- a/keyboards/yosino58/keymaps/default/keymap.c +++ b/keyboards/yosino58/keymaps/default/keymap.c @@ -1,20 +1,10 @@ #include QMK_KEYBOARD_H -#ifdef PROTOCOL_LUFA - #include "lufa.h" - #include "split_util.h" -#endif -#ifdef SSD1306OLED - #include "ssd1306.h" -#endif - #ifdef RGBLIGHT_ENABLE //Following line allows macro to read current RGB settings extern rgblight_config_t rgblight_config; #endif -extern uint8_t is_master; - // Each layer gets a name for readability, which is then used in the keymap matrix below. // The underscores don't mean anything - you can have a layer called STUFF or any other name. // Layer names don't all need to be of the same length, obviously, and you can also skip them @@ -25,8 +15,7 @@ extern uint8_t is_master; #define _ADJUST 3 enum custom_keycodes { - QWERTY = SAFE_RANGE, - LOWER, + LOWER = SAFE_RANGE, RAISE, ADJUST, RGBRST @@ -126,11 +115,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { int RGB_current_mode; -void persistent_default_layer_set(uint16_t default_layer) { - eeconfig_update_default_layer(default_layer); - default_layer_set(default_layer); -} - // Setting ADJUST layer RGB back to default void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { @@ -144,18 +128,9 @@ 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 - #ifdef SSD1306_128X64 - iota_gfx_init(false); // turns on the display - #else - iota_gfx_init(!has_usb()); // turns on the display - #endif - #endif } -//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h -#ifdef SSD1306OLED +#ifdef OLED_ENABLE //assign the right code to your layers for OLED display #define L_QWERTY 0 @@ -166,12 +141,8 @@ void matrix_init_user(void) { // When add source files to SRC in rules.mk, you can use functions. const char *read_logo(void); -void matrix_scan_user(void) { - iota_gfx_task(); -} - -void matrix_render_user(struct CharacterMatrix *matrix) { - if (is_master) { +bool oled_task_user(void) { + if (is_keyboard_master()) { static char indctr[2][20][5]= { // white icon @@ -235,58 +206,40 @@ void matrix_render_user(struct CharacterMatrix *matrix) { if (layer_state == L_RAISE) { rowr = 1; } if (layer_state == L_ADJUST) { rowa = 1; } - matrix_write(matrix, indctr[rowl] [0]); - matrix_write(matrix, indctr[rowr] [1]); - matrix_write(matrix, indctr[rowa] [2]); - matrix_write(matrix, indctr[rowc] [3]); - matrix_write(matrix, indctr[rown] [4]); - matrix_write_char(matrix, 0x13); - matrix_write(matrix, indctr[rowl] [5]); - matrix_write(matrix, indctr[rowr] [6]); - matrix_write(matrix, indctr[rowa] [7]); - matrix_write(matrix, indctr[rowc] [8]); - matrix_write(matrix, indctr[rown] [9]); - matrix_write_char(matrix, 0x13); - matrix_write(matrix, indctr[rowl] [10]); - matrix_write(matrix, indctr[rowr] [11]); - matrix_write(matrix, indctr[rowa] [12]); - matrix_write(matrix, indctr[rowc] [13]); - matrix_write(matrix, indctr[rown] [14]); - matrix_write_char(matrix, 0x13); - matrix_write(matrix, indctr[rowl] [15]); - matrix_write(matrix, indctr[rowr] [16]); - matrix_write(matrix, indctr[rowa] [17]); - matrix_write(matrix, indctr[rowc] [18]); - matrix_write(matrix, indctr[rown] [19]); + oled_write(indctr[rowl] [0], false); + oled_write(indctr[rowr] [1], false); + oled_write(indctr[rowa] [2], false); + oled_write(indctr[rowc] [3], false); + oled_write(indctr[rown] [4], false); + oled_write_char(0x13, false); + oled_write(indctr[rowl] [5], false); + oled_write(indctr[rowr] [6], false); + oled_write(indctr[rowa] [7], false); + oled_write(indctr[rowc] [8], false); + oled_write(indctr[rown] [9], false); + oled_write_char(0x13, false); + oled_write(indctr[rowl] [10], false); + oled_write(indctr[rowr] [11], false); + oled_write(indctr[rowa] [12], false); + oled_write(indctr[rowc] [13], false); + oled_write(indctr[rown] [14], false); + oled_write_char(0x13, false); + oled_write(indctr[rowl] [15], false); + oled_write(indctr[rowr] [16], false); + oled_write(indctr[rowa] [17], false); + oled_write(indctr[rowc] [18], false); + oled_write(indctr[rown] [19], false); }else{ - matrix_write(matrix, read_logo()); + oled_write(read_logo(), false); } + return false; } -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; - } -} - -void iota_gfx_task_user(void) { - struct CharacterMatrix matrix; - matrix_clear(&matrix); - matrix_render_user(&matrix); - matrix_update(&display, &matrix); -} -#endif//SSD1306OLED +#endif bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { - case QWERTY: - if (record->event.pressed) { - persistent_default_layer_set(1UL<<_QWERTY); - } - return false; - break; case LOWER: if (record->event.pressed) { layer_on(_LOWER); diff --git a/keyboards/yosino58/keymaps/default/rules.mk b/keyboards/yosino58/keymaps/default/rules.mk index 88c202edb0..191140d278 100644 --- a/keyboards/yosino58/keymaps/default/rules.mk +++ b/keyboards/yosino58/keymaps/default/rules.mk @@ -1,5 +1,6 @@ EXTRAKEY_ENABLE = yes RGBLIGHT_ENABLE = yes +OLED_ENABLE = yes # If you want to change the display of OLED, you need to change here SRC += ./lib/glcdfont.c \ diff --git a/keyboards/yosino58/keymaps/sakura/config.h b/keyboards/yosino58/keymaps/sakura/config.h index 64962b0d20..b80d37d457 100644 --- a/keyboards/yosino58/keymaps/sakura/config.h +++ b/keyboards/yosino58/keymaps/sakura/config.h @@ -20,16 +20,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #pragma once -//#define USE_MATRIX_I2C - /* Select hand configuration */ // #define MASTER_LEFT #define MASTER_RIGHT // #define EE_HANDS -#define SSD1306OLED -#define SSD1306_128X64 +#define OLED_DISPLAY_128X64 #define TAPPING_FORCE_HOLD #define TAPPING_TERM 100 diff --git a/keyboards/yosino58/keymaps/sakura/keymap.c b/keyboards/yosino58/keymaps/sakura/keymap.c index 0996f0e4e7..2ed734292a 100644 --- a/keyboards/yosino58/keymaps/sakura/keymap.c +++ b/keyboards/yosino58/keymaps/sakura/keymap.c @@ -1,21 +1,10 @@ #include QMK_KEYBOARD_H -#ifdef PROTOCOL_LUFA - #include "lufa.h" - #include "split_util.h" -#endif -#ifdef SSD1306OLED - #include "ssd1306.h" -#endif - -extern keymap_config_t keymap_config; #ifdef RGBLIGHT_ENABLE //Following line allows macro to read current RGB settings extern rgblight_config_t rgblight_config; #endif -extern uint8_t is_master; - // Each layer gets a name for readability, which is then used in the keymap matrix below. // The underscores don't mean anything - you can have a layer called STUFF or any other name. // Layer names don't all need to be of the same length, obviously, and you can also skip them @@ -26,8 +15,7 @@ extern uint8_t is_master; #define _ADJUST 3 enum custom_keycodes { - QWERTY = SAFE_RANGE, - LOWER, + LOWER = SAFE_RANGE, RAISE, ADJUST, RGBRST @@ -60,11 +48,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * ,-----------------------------------------. ,-----------------------------------------. * | ESC | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | | * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | Tab | / | - | 7 | 8 | 9 | | PSCR | SLCK | Pause| | | | + * | Tab | / | - | 7 | 8 | 9 | | PSCR | SLCK | Pause| | �� | | * |------+------+------+------+------+------| |------+------+------+------+------+------| - * |LShift| * | + | 4 | 5 | 6 | |Insert| Home |PageUP| | | | + * |LShift| * | + | 4 | 5 | 6 | |Insert| Home |PageUP| | �� | �� | * |------+------+------+------+------+------| |------+------+------+------+------+------| - * |LCTRL | . | 0 | 1 | 2 | 3 |-------.-------. ,---------------| Del | End |PageDN| | Num | Caps | + * |LCTRL | . | 0 | 1 | 2 | 3 |-------.-------. ,---------------| Del | End |PageDN| �� | Num | Caps | * `-----------------------------------------/ F11 / / \ \ F12 \----------------------------------------' * | LAlt | LGUI | /-------/ Space / \ Enter \-------\ | | | * | | |/ LOWER / / \ \ \ | | | @@ -127,11 +115,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { int RGB_current_mode; -void persistent_default_layer_set(uint16_t default_layer) { - eeconfig_update_default_layer(default_layer); - default_layer_set(default_layer); -} - // Setting ADJUST layer RGB back to default void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { @@ -145,18 +128,9 @@ 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 - #ifdef SSD1306_128X64 - iota_gfx_init(false); // turns on the display - #else - iota_gfx_init(!has_usb()); // turns on the display - #endif - #endif } -//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h -#ifdef SSD1306OLED +#ifdef OLED_ENABLE //assign the right code to your layers for OLED display #define L_QWERTY 0 @@ -167,12 +141,8 @@ void matrix_init_user(void) { // When add source files to SRC in rules.mk, you can use functions. const char *read_logo(void); -void matrix_scan_user(void) { - iota_gfx_task(); -} - -void matrix_render_user(struct CharacterMatrix *matrix) { - if (is_master) { +bool oled_task_user(void) { + if (is_keyboard_master()) { static char indctr[2][20][5]= { // white icon @@ -236,58 +206,40 @@ void matrix_render_user(struct CharacterMatrix *matrix) { if (layer_state == L_RAISE) { rowr = 1; } if (layer_state == L_ADJUST) { rowa = 1; } - matrix_write(matrix, indctr[rowl] [0]); - matrix_write(matrix, indctr[rowr] [1]); - matrix_write(matrix, indctr[rowa] [2]); - matrix_write(matrix, indctr[rowc] [3]); - matrix_write(matrix, indctr[rown] [4]); - matrix_write_char(matrix, 0x13); - matrix_write(matrix, indctr[rowl] [5]); - matrix_write(matrix, indctr[rowr] [6]); - matrix_write(matrix, indctr[rowa] [7]); - matrix_write(matrix, indctr[rowc] [8]); - matrix_write(matrix, indctr[rown] [9]); - matrix_write_char(matrix, 0x13); - matrix_write(matrix, indctr[rowl] [10]); - matrix_write(matrix, indctr[rowr] [11]); - matrix_write(matrix, indctr[rowa] [12]); - matrix_write(matrix, indctr[rowc] [13]); - matrix_write(matrix, indctr[rown] [14]); - matrix_write_char(matrix, 0x13); - matrix_write(matrix, indctr[rowl] [15]); - matrix_write(matrix, indctr[rowr] [16]); - matrix_write(matrix, indctr[rowa] [17]); - matrix_write(matrix, indctr[rowc] [18]); - matrix_write(matrix, indctr[rown] [19]); + oled_write(indctr[rowl] [0], false); + oled_write(indctr[rowr] [1], false); + oled_write(indctr[rowa] [2], false); + oled_write(indctr[rowc] [3], false); + oled_write(indctr[rown] [4], false); + oled_write_char(0x13, false); + oled_write(indctr[rowl] [5], false); + oled_write(indctr[rowr] [6], false); + oled_write(indctr[rowa] [7], false); + oled_write(indctr[rowc] [8], false); + oled_write(indctr[rown] [9], false); + oled_write_char(0x13, false); + oled_write(indctr[rowl] [10], false); + oled_write(indctr[rowr] [11], false); + oled_write(indctr[rowa] [12], false); + oled_write(indctr[rowc] [13], false); + oled_write(indctr[rown] [14], false); + oled_write_char(0x13, false); + oled_write(indctr[rowl] [15], false); + oled_write(indctr[rowr] [16], false); + oled_write(indctr[rowa] [17], false); + oled_write(indctr[rowc] [18], false); + oled_write(indctr[rown] [19], false); }else{ - matrix_write(matrix, read_logo()); + oled_write(read_logo(), false); } + return false; } -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; - } -} - -void iota_gfx_task_user(void) { - struct CharacterMatrix matrix; - matrix_clear(&matrix); - matrix_render_user(&matrix); - matrix_update(&display, &matrix); -} -#endif//SSD1306OLED +#endif bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { - case QWERTY: - if (record->event.pressed) { - persistent_default_layer_set(1UL<<_QWERTY); - } - return false; - break; case LOWER: if (record->event.pressed) { layer_on(_LOWER); diff --git a/keyboards/yosino58/keymaps/sakura/rules.mk b/keyboards/yosino58/keymaps/sakura/rules.mk index 0b2ca1ba59..679c8c155d 100644 --- a/keyboards/yosino58/keymaps/sakura/rules.mk +++ b/keyboards/yosino58/keymaps/sakura/rules.mk @@ -15,6 +15,7 @@ UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. SWAP_HANDS_ENABLE = no # Enable one-hand typing +OLED_ENABLE = yes # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend diff --git a/keyboards/yosino58/rev1/.noci b/keyboards/yosino58/rev1/.noci deleted file mode 100644 index e69de29bb2..0000000000 --- a/keyboards/yosino58/rev1/.noci +++ /dev/null diff --git a/keyboards/yosino58/rev1/config.h b/keyboards/yosino58/rev1/config.h index b7bbace5d9..6969aca480 100644 --- a/keyboards/yosino58/rev1/config.h +++ b/keyboards/yosino58/rev1/config.h @@ -18,6 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #pragma once +#include "config_common.h" + /* USB Device descriptor parameter */ #define VENDOR_ID 0x0F6A #define PRODUCT_ID 0x01B8 @@ -33,6 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. // wiring of each half #define MATRIX_ROW_PINS { D4, C6, D7, E6, B4 } #define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3 } +#define DIODE_DIRECTION COL2ROW /* define if matrix has ghost */ //#define MATRIX_HAS_GHOST @@ -43,6 +46,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* Set 0 if debouncing isn't needed */ #define DEBOUNCE 5 +/* + * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN. + */ +#define SOFT_SERIAL_PIN D2 // or D1, D2, D3, E6 + /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ //#define LOCKING_SUPPORT_ENABLE /* Locking resynchronize hack */ diff --git a/keyboards/yosino58/rev1/matrix.c b/keyboards/yosino58/rev1/matrix.c deleted file mode 100644 index 802ce00cc6..0000000000 --- a/keyboards/yosino58/rev1/matrix.c +++ /dev/null @@ -1,343 +0,0 @@ -/* -Copyright 2012 Jun Wako <wakojun@gmail.com> - -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/>. -*/ - -/* - * scan matrix - */ -#include <stdint.h> -#include <stdbool.h> -#include <string.h> -#include <avr/io.h> -#include <avr/wdt.h> -#include <avr/interrupt.h> -#include <util/delay.h> -#include "print.h" -#include "debug.h" -#include "util.h" -#include "matrix.h" -#include "split_util.h" -#include "quantum.h" - -#ifdef USE_MATRIX_I2C -# include "i2c.h" -#else // USE_SERIAL -# include "split_scomm.h" -#endif - -#ifndef DEBOUNCE -# define DEBOUNCE 5 -#endif - -#define ERROR_DISCONNECT_COUNT 5 - -static uint8_t debouncing = DEBOUNCE; -static const int ROWS_PER_HAND = MATRIX_ROWS/2; -static uint8_t error_count = 0; -uint8_t is_master = 0 ; - -static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; -static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; - -/* matrix state(1:on, 0:off) */ -static matrix_row_t matrix[MATRIX_ROWS]; -static matrix_row_t matrix_debouncing[MATRIX_ROWS]; - -static matrix_row_t read_cols(void); -static void init_cols(void); -static void unselect_rows(void); -static void select_row(uint8_t row); -static uint8_t matrix_master_scan(void); - - -__attribute__ ((weak)) -void matrix_init_kb(void) { - matrix_init_user(); -} - -__attribute__ ((weak)) -void matrix_scan_kb(void) { - matrix_scan_user(); -} - -__attribute__ ((weak)) -void matrix_init_user(void) { -} - -__attribute__ ((weak)) -void matrix_scan_user(void) { -} - -inline -uint8_t matrix_rows(void) -{ - return MATRIX_ROWS; -} - -inline -uint8_t matrix_cols(void) -{ - return MATRIX_COLS; -} - -void matrix_init(void) -{ - debug_enable = true; - debug_matrix = true; - debug_mouse = true; - // initialize row and col - unselect_rows(); - init_cols(); - - setPinOutput(B0); - setPinOutput(D5); - writePinHigh(D5); - writePinHigh(B0); - - // initialize matrix state: all keys off - for (uint8_t i=0; i < MATRIX_ROWS; i++) { - matrix[i] = 0; - matrix_debouncing[i] = 0; - } - - is_master = has_usb(); - - matrix_init_quantum(); -} - -uint8_t _matrix_scan(void) -{ - // Right hand is stored after the left in the matirx so, we need to offset it - int offset = isLeftHand ? 0 : (ROWS_PER_HAND); - - for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { - select_row(i); - _delay_us(30); // without this wait read unstable value. - matrix_row_t cols = read_cols(); |