summaryrefslogtreecommitdiffstats
path: root/keyboards/helix/rev2
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/helix/rev2')
-rw-r--r--keyboards/helix/rev2/config.h6
-rw-r--r--keyboards/helix/rev2/custom/matrix.c341
-rw-r--r--keyboards/helix/rev2/custom/split_scomm.c92
-rw-r--r--keyboards/helix/rev2/custom/split_scomm.h21
-rw-r--r--keyboards/helix/rev2/custom/split_util.c109
-rw-r--r--keyboards/helix/rev2/custom/split_util.h21
-rw-r--r--keyboards/helix/rev2/keymaps/default/oled_display.c196
-rw-r--r--keyboards/helix/rev2/local_features.mk53
-rw-r--r--keyboards/helix/rev2/override_helix_options.mk-maintenance (renamed from keyboards/helix/rev2/override_helix_options.mk)0
-rw-r--r--keyboards/helix/rev2/rev2.c16
-rw-r--r--keyboards/helix/rev2/rules.mk7
11 files changed, 133 insertions, 729 deletions
diff --git a/keyboards/helix/rev2/config.h b/keyboards/helix/rev2/config.h
index 577edba56b..8c6210bae4 100644
--- a/keyboards/helix/rev2/config.h
+++ b/keyboards/helix/rev2/config.h
@@ -45,12 +45,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define MASTER_RIGHT
// #define EE_HANDS
-// Helix keyboard OLED support
-// see ./local_features.mk: OLED_SELECT=local
-#ifdef OLED_LOCAL_ENABLE
- #define SSD1306OLED
-#endif
-
#define OLED_UPDATE_INTERVAL 50
/* Select rows configuration */
diff --git a/keyboards/helix/rev2/custom/matrix.c b/keyboards/helix/rev2/custom/matrix.c
deleted file mode 100644
index 5221d7fd4e..0000000000
--- a/keyboards/helix/rev2/custom/matrix.c
+++ /dev/null
@@ -1,341 +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;
-
-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)
-{
- split_keyboard_setup();
-
- // initialize row and col
- unselect_rows();
- init_cols();
-
- setPinOutput(B0);
- setPinOutput(D5);
- writePinHigh(B0);
- writePinHigh(D5);
-
- // initialize matrix state: all keys off
- for (uint8_t i=0; i < MATRIX_ROWS; i++) {
- matrix[i] = 0;
- matrix_debouncing[i] = 0;
- }
-
- 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();
- if (matrix_debouncing[i+offset] != cols) {
- matrix_debouncing[i+offset] = cols;
- debouncing = DEBOUNCE;
- }
- unselect_rows();
- }
-
- if (debouncing) {
- if (--debouncing) {
- _delay_ms(1);
- } else {
- for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
- matrix[i+offset] = matrix_debouncing[i+offset];
- }
- }
- }
-
- return 1;
-}
-
-#ifdef USE_MATRIX_I2C
-
-// Get rows from other half over i2c
-int i2c_transaction(void) {
- int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
-
- int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE);
- if (err) goto i2c_error;
-
- // start of matrix stored at 0x00
- err = i2c_master_write(0x00);
- if (err) goto i2c_error;
-
- // Start read
- err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ);
- if (err) goto i2c_error;
-
- if (!err) {
- int i;
- for (i = 0; i < ROWS_PER_HAND-1; ++i) {
- matrix[slaveOffset+i] = i2c_master_read(I2C_ACK);
- }
- matrix[slaveOffset+i] = i2c_master_read(I2C_NACK);
- i2c_master_stop();
- } else {
-i2c_error: // the cable is disconnceted, or something else went wrong
- i2c_reset_state();
- return err;
- }
-
- return 0;
-}
-
-#else // USE_SERIAL
-
-int serial_transaction(int master_changed) {
- int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
-#ifdef SERIAL_USE_MULTI_TRANSACTION
- int ret=serial_update_buffers(master_changed);
-#else
- int ret=serial_update_buffers();
-#endif
- if (ret ) {
- if(ret==2) writePinLow(B0);
- return 1;
- }
- writePinHigh(B0);
- memcpy(&matrix[slaveOffset],
- (void *)serial_slave_buffer, sizeof(serial_slave_buffer));
- return 0;
-}
-#endif
-
-uint8_t matrix_scan(void)
-{
- if (is_helix_master()) {
- matrix_master_scan();
- }else{
- matrix_slave_scan();
- int offset = (isLeftHand) ? ROWS_PER_HAND : 0;
- memcpy(&matrix[offset],
- (void *)serial_master_buffer, sizeof(serial_master_buffer));
- matrix_scan_quantum();
- }
- return 1;
-}
-
-
-uint8_t matrix_master_scan(void) {
-
- int ret = _matrix_scan();
- int mchanged = 1;
-
-#ifndef KEYBOARD_helix_rev1
- int offset = (isLeftHand) ? 0 : ROWS_PER_HAND;
-
-#ifdef USE_MATRIX_I2C
-// for (int i = 0; i < ROWS_PER_HAND; ++i) {
- /* i2c_slave_buffer[i] = matrix[offset+i]; */
-// i2c_slave_buffer[i] = matrix[offset+i];
-// }
-#else // USE_SERIAL
- #ifdef SERIAL_USE_MULTI_TRANSACTION
- mchanged = memcmp((void *)serial_master_buffer,
- &matrix[offset], sizeof(serial_master_buffer));
- #endif
- memcpy((void *)serial_master_buffer,
- &matrix[offset], sizeof(serial_master_buffer));
-#endif
-#endif
-
-#ifdef USE_MATRIX_I2C
- if( i2c_transaction() ) {
-#else // USE_SERIAL
- if( serial_transaction(mchanged) ) {
-#endif
- // turn on the indicator led when halves are disconnected
- writePinLow(D5);
-
- error_count++;
-
- if (error_count > ERROR_DISCONNECT_COUNT) {
- // reset other half if disconnected
- int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
- for (int i = 0; i < ROWS_PER_HAND; ++i) {
- matrix[slaveOffset+i] = 0;
- }
- }
- } else {
- // turn off the indicator led on no error
- writePinHigh(D5);
- error_count = 0;
- }
- matrix_scan_quantum();
- return ret;
-}
-
-void matrix_slave_scan(void) {
- _matrix_scan();
-
- int offset = (isLeftHand) ? 0 : ROWS_PER_HAND;
-
-#ifdef USE_MATRIX_I2C
- for (int i = 0; i < ROWS_PER_HAND; ++i) {
- /* i2c_slave_buffer[i] = matrix[offset+i]; */
- i2c_slave_buffer[i] = matrix[offset+i];
- }
-#else // USE_SERIAL
- #ifdef SERIAL_USE_MULTI_TRANSACTION
- int change = 0;
- #endif
- for (int i = 0; i < ROWS_PER_HAND; ++i) {
- #ifdef SERIAL_USE_MULTI_TRANSACTION
- if( serial_slave_buffer[i] != matrix[offset+i] )
- change = 1;
- #endif
- serial_slave_buffer[i] = matrix[offset+i];
- }
- #ifdef SERIAL_USE_MULTI_TRANSACTION
- slave_buffer_change_count += change;
- #endif
-#endif
-}
-
-inline
-bool matrix_is_on(uint8_t row, uint8_t col)
-{
- return (matrix[row] & ((matrix_row_t)1<<col));
-}
-
-inline
-matrix_row_t matrix_get_row(uint8_t row)
-{
- return matrix[row];
-}
-
-void matrix_print(void)
-{
- print("\nr/c 0123456789ABCDEF\n");
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- print_hex8(row); print(": ");
- print_bin_reverse16(matrix_get_row(row));
- print("\n");
- }
-}
-
-static void init_cols(void)
-{
- for(int x = 0; x < MATRIX_COLS; x++) {
- _SFR_IO8((col_pins[x] >> 4) + 1) &= ~_BV(col_pins[x] & 0xF);
- _SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF);
- }
-}
-
-static matrix_row_t read_cols(void)
-{
- matrix_row_t result = 0;
- for(int x = 0; x < MATRIX_COLS; x++) {
- result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x);
- }
- return result;
-}
-
-static void unselect_rows(void)
-{
- for(int x = 0; x < ROWS_PER_HAND; x++) {
- _SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF);
- _SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF);
- }
-}
-
-static void select_row(uint8_t row)
-{
- _SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF);
- _SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF);
-}
diff --git a/keyboards/helix/rev2/custom/split_scomm.c b/keyboards/helix/rev2/custom/split_scomm.c
deleted file mode 100644
index 378781b98c..0000000000
--- a/keyboards/helix/rev2/custom/split_scomm.c
+++ /dev/null
@@ -1,92 +0,0 @@
-#ifdef USE_SERIAL
-#ifdef SERIAL_USE_MULTI_TRANSACTION
-/* --- USE flexible API (using multi-type transaction function) --- */
-
-#include <stdbool.h>
-#include <stdint.h>
-#include <stddef.h>
-#include "split_scomm.h"
-#include "serial.h"
-#ifdef CONSOLE_ENABLE
- #include "print.h"
-#endif
-
-uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
-uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
-uint8_t volatile status_com = 0;
-uint8_t volatile status1 = 0;
-uint8_t slave_buffer_change_count = 0;
-uint8_t s_change_old = 0xff;
-uint8_t s_change_new = 0xff;
-
-SSTD_t transactions[] = {
-#define GET_SLAVE_STATUS 0
- /* master buffer not changed, only recive slave_buffer_change_count */
- { (uint8_t *)&status_com,
- 0, NULL,
- sizeof(slave_buffer_change_count), &slave_buffer_change_count,
- },
-#define PUT_MASTER_GET_SLAVE_STATUS 1
- /* master buffer changed need send, and recive slave_buffer_change_count */
- { (uint8_t *)&status_com,
- sizeof(serial_master_buffer), (uint8_t *)serial_master_buffer,
- sizeof(slave_buffer_change_count), &slave_buffer_change_count,
- },
-#define GET_SLAVE_BUFFER 2
- /* recive serial_slave_buffer */
- { (uint8_t *)&status1,
- 0, NULL,
- sizeof(serial_slave_buffer), (uint8_t *)serial_slave_buffer
- }
-};
-
-void serial_master_init(void)
-{
- soft_serial_initiator_init(transactions, TID_LIMIT(transactions));
-}
-
-void serial_slave_init(void)
-{
- soft_serial_target_init(transactions, TID_LIMIT(transactions));
-}
-
-// 0 => no error
-// 1 => slave did not respond
-// 2 => checksum error
-int serial_update_buffers(int master_update)
-{
- int status, smatstatus;
- static int need_retry = 0;
-
- if( s_change_old != s_change_new ) {
- smatstatus = soft_serial_transaction(GET_SLAVE_BUFFER);
- if( smatstatus == TRANSACTION_END ) {
- s_change_old = s_change_new;
-#ifdef CONSOLE_ENABLE
- uprintf("slave matrix = %b %b %b %b %b\n",
- serial_slave_buffer[0], serial_slave_buffer[1],
- serial_slave_buffer[2], serial_slave_buffer[3],
- serial_slave_buffer[4] );
-#endif
- }
- } else {
- // serial_slave_buffer dosen't change
- smatstatus = TRANSACTION_END; // dummy status
- }
-
- if( !master_update && !need_retry) {
- status = soft_serial_transaction(GET_SLAVE_STATUS);
- } else {
- status = soft_serial_transaction(PUT_MASTER_GET_SLAVE_STATUS);
- }
- if( status == TRANSACTION_END ) {
- s_change_new = slave_buffer_change_count;
- need_retry = 0;
- } else {
- need_retry = 1;
- }
- return smatstatus;
-}
-
-#endif // SERIAL_USE_MULTI_TRANSACTION
-#endif /* USE_SERIAL */
diff --git a/keyboards/helix/rev2/custom/split_scomm.h b/keyboards/helix/rev2/custom/split_scomm.h
deleted file mode 100644
index 16887eb74f..0000000000
--- a/keyboards/helix/rev2/custom/split_scomm.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#pragma once
-
-#ifndef SERIAL_USE_MULTI_TRANSACTION
-/* --- USE Simple API (OLD API, compatible with let's split serial.c) --- */
-#include "serial.h"
-
-#else
-/* --- USE flexible API (using multi-type transaction function) --- */
-// Buffers for master - slave communication
-#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
-#define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2
-
-extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
-extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
-extern uint8_t slave_buffer_change_count;
-
-void serial_master_init(void);
-void serial_slave_init(void);
-int serial_update_buffers(int master_changed);
-
-#endif
diff --git a/keyboards/helix/rev2/custom/split_util.c b/keyboards/helix/rev2/custom/split_util.c
deleted file mode 100644
index ab40315487..0000000000
--- a/keyboards/helix/rev2/custom/split_util.c
+++ /dev/null
@@ -1,109 +0,0 @@
-#include <avr/io.h>
-#include <avr/wdt.h>
-#include <avr/power.h>
-#include <avr/interrupt.h>
-#include <util/delay.h>
-#include <avr/eeprom.h>
-#include "split_util.h"
-#include "matrix.h"
-#include "keyboard.h"
-#include "wait.h"
-
-#ifdef USE_MATRIX_I2C
-# include "i2c.h"
-#else
-# include "split_scomm.h"
-#endif
-
-#ifdef EE_HANDS
-# include "eeconfig.h"
-#endif
-
-#ifndef SPLIT_USB_TIMEOUT
-# define SPLIT_USB_TIMEOUT 2000
-#endif
-
-#ifndef SPLIT_USB_TIMEOUT_POLL
-# define SPLIT_USB_TIMEOUT_POLL 10
-#endif
-
-volatile bool isLeftHand = true;
-
-bool waitForUsb(void) {
- for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / SPLIT_USB_TIMEOUT_POLL); i++) {
- // This will return true if a USB connection has been established
- if (UDADDR & _BV(ADDEN)) {
- return true;
- }
- wait_ms(SPLIT_USB_TIMEOUT_POLL);
- }
-
- // Avoid NO_USB_STARTUP_CHECK - Disable USB as the previous checks seem to enable it somehow
- (USBCON &= ~(_BV(USBE) | _BV(OTGPADE)));
-
- return false;
-}
-
-
-bool is_keyboard_left(void) {
-#if defined(SPLIT_HAND_PIN)
- // Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand
- setPinInput(SPLIT_HAND_PIN);
- return readPin(SPLIT_HAND_PIN);
-#elif defined(EE_HANDS)
- return eeconfig_read_handedness();
-#elif defined(MASTER_RIGHT)
- return !is_helix_master();
-#endif
-
- return is_helix_master();
-}
-
-bool is_helix_master(void) {
- static enum { UNKNOWN, MASTER, SLAVE } usbstate = UNKNOWN;
-
- // only check once, as this is called often
- if (usbstate == UNKNOWN) {
-#if defined(SPLIT_USB_DETECT)
- usbstate = waitForUsb() ? MASTER : SLAVE;
-#elif defined(__AVR__)
- USBCON |= (1 << OTGPADE); // enables VBUS pad
- wait_us(5);
-
- usbstate = (USBSTA & (1 << VBUS)) ? MASTER : SLAVE; // checks state of VBUS
-#else
- usbstate = MASTER;
-#endif
- }
-
- return (usbstate == MASTER);
-}
-
-static void keyboard_master_setup(void) {
-
-#ifdef USE_MATRIX_I2C
- i2c_master_init();
-#else
- serial_master_init();
-#endif
-}
-
-static void keyboard_slave_setup(void) {
-
-#ifdef USE_MATRIX_I2C
- i2c_slave_init(SLAVE_I2C_ADDRESS);
-#else
- serial_slave_init();
-#endif
-}
-
-void split_keyboard_setup(void) {
- isLeftHand = is_keyboard_left();
-
- if (is_helix_master()) {
- keyboard_master_setup();
- } else {
- keyboard_slave_setup();
- }
- sei();
-}
diff --git a/keyboards/helix/rev2/custom/split_util.h b/keyboards/helix/rev2/custom/split_util.h
deleted file mode 100644
index 3b1d4249f5..0000000000
--- a/keyboards/helix/rev2/custom/split_util.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#pragma once
-
-#ifdef SPLIT_KEYBOARD
-# error This is helix local split_util.h.
-# error This header file is used only when SPLIT_KEYBOARD=no.
-#endif
-
-#include <stdbool.h>
-#include "eeconfig.h"
-
-#define SLAVE_I2C_ADDRESS 0x32
-
-extern volatile bool isLeftHand;
-
-// slave version of matix scan, defined in matrix.c
-void matrix_slave_scan(void);
-
-void split_keyboard_setup(void);
-bool is_helix_master(void);
-
-void matrix_master_OLED_init (void);
diff --git a/keyboards/helix/rev2/keymaps/default/oled_display.c b/keyboards/helix/rev2/keymaps/default/oled_display.c
index 824d2e4d86..ad5558869f 100644
--- a/keyboards/helix/rev2/keymaps/default/oled_display.c
+++ b/keyboards/helix/rev2/keymaps/default/oled_display.c
@@ -18,10 +18,6 @@
#include <string.h>
#include QMK_KEYBOARD_H
-#ifdef SSD1306OLED
- #include "ssd1306.h"
-#endif
-
// 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
@@ -35,10 +31,15 @@ enum layer_number {
_ADJUST
};
-//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
-#if defined(SSD1306OLED) || defined(OLED_ENABLE)
+//assign the right code to your layers for OLED display
+#define L_BASE 0
+#define L_LOWER (1<<_LOWER)
+#define L_RAISE (1<<_RAISE)
+#define L_ADJUST (1<<_ADJUST)
+#define L_ADJUST_TRI (L_ADJUST|L_RAISE|L_LOWER)
-# if defined(OLED_ENABLE)
+//OLED update loop
+#ifdef OLED_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
if (is_keyboard_master()) {
return OLED_ROTATION_0;
@@ -46,12 +47,120 @@ oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_180;
}
}
-# else
-# define oled_write(data,flag) matrix_write(matrix, data)
-# define oled_write_P(data,flag) matrix_write_P(matrix, data)
+
+static void render_rgbled_status(bool full) {
+# ifdef RGBLIGHT_ENABLE
+ char buf[30];
+ if (RGBLIGHT_MODES > 1 && rgblight_is_enabled()) {
+ if (full) {
+ snprintf(buf, sizeof(buf), " LED %2d: %d,%d,%d ",
+ rgblight_get_mode(),
+ rgblight_get_hue()/RGBLIGHT_HUE_STEP,
+ rgblight_get_sat()/RGBLIGHT_SAT_STEP,
+ rgblight_get_val()/RGBLIGHT_VAL_STEP);
+ } else {
+ snprintf(buf, sizeof(buf), "[%2d] ", rgblight_get_mode());
+ }
+ oled_write(buf, false);
+ }
# endif
+}
+
+static void render_layer_status(void) {
+ // Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
+ char buf[10];
+ oled_write_P(PSTR("Layer: "), false);
+ switch (layer_state) {
+ case L_BASE:
+ oled_write_P(PSTR("Default"), false);
+ break;
+ case L_RAISE:
+ oled_write_P(PSTR("Raise"), false);
+ break;
+ case L_LOWER:
+ oled_write_P(PSTR("Lower"), false);
+ break;
+ case L_ADJUST:
+ case L_ADJUST_TRI:
+ oled_write_P(PSTR("Adjust"), false);
+ break;
+ default:
+ oled_write_P(PSTR("Undef-"), false);
+ snprintf(buf,sizeof(buf), "%ld", layer_state);
+ oled_write(buf, false);
+ }
+ oled_write_P(PSTR("\n"), false);
+}
+
+void render_status(void) {
+ // Render to mode icon
+ static const char os_logo[][2][3] PROGMEM = {{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}};
+ if (is_mac_mode()) {
+ oled_write_P(os_logo[0][0], false);
+ oled_write_P(PSTR("\n"), false);
+ oled_write_P(os_logo[0][1], false);
+ } else {
+ oled_write_P(os_logo[1][0], false);
+ oled_write_P(PSTR("\n"), false);
+ oled_write_P(os_logo[1][1], false);
+ }
+
+ oled_write_P(PSTR(" "), false);
+ render_layer_status();
+
+ // Host Keyboard LED Status
+ led_t led_state = host_keyboard_led_state();
+ oled_write_P(led_state.num_lock ? PSTR("NUMLOCK") : PSTR(" "), false);
+ oled_write_P(led_state.caps_lock ? PSTR("CAPS") : PSTR(" "), false);
+ oled_write_P(led_state.scroll_lock ? PSTR("SCLK") : PSTR(" "), false);
+ oled_advance_page(true);
+ render_rgbled_status(true);
+ oled_write_P(PSTR("\n"), false);
+}
+
+bool oled_task_user(void) {
+
+# if DEBUG_TO_SCREEN
+ if (debug_enable) {
+ return;
+ }
+# endif
+
+ if (is_keyboard_master()) {
+ render_status();
+ } else {
+ render_helix_logo();
+ render_rgbled_status(false);
+ render_layer_status();
+ }
+ return false;
+}
+#endif // end of OLED_ENABLE
+
+//SSD1306 OLED update loop
+/*
+ The following code is left as a sample to help you transition from SSD1306OLED to OLED_ENABLE.
+
+ * `matrix_write(matrix, data)` is replaced by `oled_write(data, false)`.
+ * `matrix_write_P(matrix, data)` is replaced by `oled_write_P(data, false)`.
+ * It is no longer necessary to call `iota_gfx_task()`.
+ * `matrix_update()` are no longer needed.
+ * `iota_gfx_task_user()` is no longer needed. Instead, `bool oled_task_user(void)` is provided.
+
+ 以下のコードは、SSD1306OLED から OLED_ENABLE に移行する助けになるようにサンプルとして残してあります。
+
+ * `matrix_write(matrix, data)` は、`oled_write(data, false)` に書き換えます。
+ * `matrix_write_P(matrix, data)` は、`oled_write_P(data, false)` に書き換えます。
+ * `iota_gfx_task()` を呼び出す必要はなくなります。
+ * `matrix_update()` は不要になります。
+ * `iota_gfx_task_user()` は不要になります。代りに `bool oled_task_user(void)` を用意します。
+ */
+
+#ifdef SSD1306OLED
+#include "ssd1306.h"
+#define oled_write(data,flag) matrix_write(matrix, data)
+#define oled_write_P(data,flag) matrix_write_P(matrix, data)
-# ifdef SSD1306OLED
void matrix_scan_user(void) {
iota_gfx_task(); // this is what updates the display continuously
}
@@ -63,16 +172,7 @@ void matrix_update(struct CharacterMatrix *dest,
dest->dirty = true;
}
}
-# endif
-
-//assign the right code to your layers for OLED display
-#define L_BASE 0
-#define L_LOWER (1<<_LOWER)
-#define L_RAISE (1<<_RAISE)
-#define L_ADJUST (1<<_ADJUST)
-#define L_ADJUST_TRI (L_ADJUST|L_RAISE|L_LOWER)
-# ifdef SSD1306OLED
static void render_logo(struct CharacterMatrix *matrix) {
static const char helix_logo[] PROGMEM ={
@@ -82,13 +182,8 @@ static void render_logo(struct CharacterMatrix *matrix) {
0};
oled_write_P(helix_logo, false);
}
-# endif
-# ifdef SSD1306OLED
static void render_rgbled_status(bool full, struct CharacterMatrix *matrix) {
-# else
-static void render_rgbled_status(bool full) {
-# endif
# ifdef RGBLIGHT_ENABLE
char buf[30];
if (RGBLIGHT_MODES > 1 && rgblight_is_enabled()) {
@@ -106,11 +201,7 @@ static void render_rgbled_status(bool full) {
# endif
}
-# ifdef SSD1306OLED
static void render_layer_status(struct CharacterMatrix *matrix) {
-# else
-static void render_layer_status(void) {
-# endif
// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
char buf[10];
oled_write_P(PSTR("Layer: "), false);
@@ -136,11 +227,7 @@ static void render_layer_status(void) {
oled_write_P(PSTR("\n"), false);
}
-# ifdef SSD1306OLED
void render_status(struct CharacterMatrix *matrix) {
-# else
-void render_status(void) {
-# endif
// Render to mode icon
static const char os_logo[][2][3] PROGMEM = {{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}};
if (is_mac_mode()) {
@@ -154,11 +241,7 @@ void render_status(void) {
}
oled_write_P(PSTR(" "), false);
-# ifdef SSD1306OLED
render_layer_status(matrix);
-# else
- render_layer_status();
-# endif
// Host Keyboard LED Status
led_t led_state = host_keyboard_led_state();
@@ -166,35 +249,28 @@ void render_status(void) {
oled_write_P(led_state.caps_lock ? PSTR("CAPS") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCLK") : PSTR(" "), false);
oled_write_P(PSTR("\n"), false);
-# ifdef SSD1306OLED
render_rgbled_status(true, matrix);
-# else
- render_rgbled_status(true);
- oled_write_P(PSTR("\n"), false);
-# endif
}
-
-# ifdef SSD1306OLED
-# if OLED_UPDATE_INTERVAL > 0
+# if OLED_UPDATE_INTERVAL > 0
uint16_t oled_update_timeout;
-# endif
+# endif
void iota_gfx_task_user(void) {
struct CharacterMatrix matrix;
-# if DEBUG_TO_SCREEN
+# if DEBUG_TO_SCREEN
if (debug_enable) {
return;
}
-# endif
+# endif
-#if OLED_UPDATE_INTERVAL > 0
+# if OLED_UPDATE_INTERVAL > 0
if (timer_elapsed(oled_update_timeout) < OLED_UPDATE_INTERVAL) {
return;
}
oled_update_timeout = timer_read();
-#endif
+# endif
matrix_clear(&matrix);
if (is_keyboard_master()) {
render_status(&matrix);
@@ -205,23 +281,5 @@ void iota_gfx_task_user(void) {
}
matrix_update(&display, &matrix);
}
-# else
-bool oled_task_user(void) {
-# if DEBUG_TO_SCREEN
- if (debug_enable) {
- return;
- }
-# endif
-
- if (is_keyboard_master()) {
- render_status();
- } else {
- render_helix_logo();
- render_rgbled_status(false);
- render_layer_status();
- }
- return false;
-}
-# endif
-#endif
+#endif // end of SSD1306OLED
diff --git a/keyboards/helix/rev2/local_features.mk b/keyboards/helix/rev2/local_features.mk
index c6f818bf39..34fd699a65 100644
--- a/keyboards/helix/rev2/local_features.mk
+++ b/keyboards/helix/rev2/local_features.mk
@@ -40,24 +40,6 @@ ifneq ($(strip $(HELIX)),)
SHOW_HELIX_OPTIONS = yes
endif
-ifneq ($(strip $(SPLIT_KEYBOARD)), yes)
- # In the very near future, all keymaps will be compatible with split_common and this block will be removed.
- SRC += local_drivers/serial.c
- KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers
-
- # A workaround until #7089 is merged.
- # serial.c must not be compiled with the -lto option.
- # The current LIB_SRC has a side effect with the -fno-lto option, so use it.
- LIB_SRC += local_drivers/serial.c
-
- CUSTOM_MATRIX = yes
-
- SRC += rev2/custom/matrix.c
- SRC += rev2/custom/split_util.c
- SRC += rev2/custom/split_scomm.c
- KEYBOARD_PATHS += $(HELIX_TOP_DIR)/rev2/custom
-endif
-
########
# convert Helix-specific options (that represent combinations of standard options)
# into QMK standard options.
@@ -88,44 +70,17 @@ ifeq ($(strip $(LED_ANIMATIONS)), yes)
endif
ifeq ($(strip $(OLED_ENABLE)), yes)
- ifeq ($(strip $(OLED_SELECT)),core)
- OLED_ENABLE = yes
- OLED_DRIVER = SSD1306
- ifeq ($(strip $(LOCAL_GLCDFONT)), yes)
- OPT_DEFS += -DOLED_FONT_H=\<helixfont.h\>
- else
- OPT_DEFS += -DOLED_FONT_H=\"common/glcdfont.c\"
- endif
+ OLED_DRIVER = SSD1306
+ ifeq ($(strip $(LOCAL_GLCDFONT)), yes)
+ OPT_DEFS += -DOLED_FONT_H=\<helixfont.h\>
else
-
- # In the very near future, all keymaps will be compatible with QMK standard oled_driver and this block will be removed.
- ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
- $(info Helix/rev2: The following combinations are not supported.)
- $(info - SPLIT_KEYBOARD = $(SPLIT_KEYBOARD)) # yes
- $(info - OLED_ENABLE = $(OLED_ENABLE)) # yes
- $(info - OLED_SELECT = $(OLED_SELECT)) # local
- $(info Force : OLED_ENABLE = no)
- $(info .)
- OLED_ENABLE = no
- endif
- ifeq ($(strip $(OLED_ENABLE)), yes)
- OLED_ENABLE = no # disable OLED in TOP/common_features.mk
- OLED_LOCAL_ENABLE = yes
- SRC += local_drivers/i2c.c
- SRC += local_drivers/ssd1306.c
- KEYBOARD_PATHS += $(HELIX_TOP_DIR)/local_drivers
- OPT_DEFS += -DOLED_LOCAL_ENABLE
- ifeq ($(strip $(LOCAL_GLCDFONT)), yes)
- OPT_DEFS += -DLOCAL_GLCDFONT
- endif
- endif
+ OPT_DEFS += -DOLED_FONT_H=\"common/glcdfont.c\"
endif
endif
ifneq ($(strip $(SHOW_HELIX_OPTIONS)),)
$(info Helix Spacific Build Options)
$(info - OLED_ENABLE = $(OLED_ENABLE))
- $(info - OLED_SELECT = $(OLED_SELECT))
$(info - LED_BACK_ENABLE = $(LED_BACK_ENABLE))
$(info - LED_UNDERGLOW_ENABLE = $(LED_UNDERGLOW_ENABLE))
$(info - LED_ANIMATIONS = $(LED_ANIMATIONS))
diff --git a/keyboards/helix/rev2/override_helix_options.mk b/keyboards/helix/rev2/override_helix_options.mk-maintenance
index 56dee8ce78..56dee8ce78 100644
--- a/keyboards/helix/rev2/override_helix_options.mk
+++ b/keyboards/helix/rev2/override_helix_options.mk-maintenance
diff --git a/keyboards/helix/rev2/rev2.c b/keyboards/helix/rev2/rev2.c
index ba29f3c7de..2bbe9a28e2 100644
--- a/keyboards/helix/rev2/rev2.c
+++ b/keyboards/helix/rev2/rev2.c
@@ -20,14 +20,6 @@
// for the old keymap.c.
uint8_t is_master = false;
-#ifdef SSD1306OLED
-#include "ssd1306.h"
-
-bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
- return process_record_gfx(keycode,record) && process_record_user(keycode, record);
-}
-#endif
-
bool is_mac_mode(void) {
// This is the opposite of the QMK standard, but we'll leave it for backwards compatibility.
return keymap_config.swap_lalt_lgui == false;
@@ -59,12 +51,6 @@ void keyboard_post_init_kb(void) {
keyboard_post_init_user();
}
-#if defined(SPLIT_KEYBOARD) && defined(SSD1306OLED)
-void matrix_slave_scan_user(void) {
<