diff options
| author | marksard <38324387+marksard@users.noreply.github.com> | 2020-01-14 03:06:40 +0900 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2020-01-13 10:06:40 -0800 |
| commit | 240e1ef6fd4b3356f3d21a50b0a0ad6c0673b1dd (patch) | |
| tree | 2bb6492f22a39e389a8e5fe2bdb56e2de6558d55 | |
| parent | 1b8cb95f2e56acf09bb66e779b800ae14aa074e5 (diff) | |
| download | qmk_firmware-240e1ef6fd4b3356f3d21a50b0a0ad6c0673b1dd.tar.gz qmk_firmware-240e1ef6fd4b3356f3d21a50b0a0ad6c0673b1dd.zip | |
[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
33 files changed, 513 insertions, 2571 deletions
diff --git a/keyboards/treadstone48/common/oled_helper.c b/keyboards/treadstone48/common/oled_helper.c index 500d3c0dc..18d8681a4 100644 --- a/keyboards/treadstone48/common/oled_helper.c +++ b/keyboards/treadstone48/common/oled_helper.c | |||
| @@ -1,8 +1,9 @@ | |||
| 1 | #ifdef SSD1306OLED | 1 | #ifdef OLED_DRIVER_ENABLE |
| 2 | #include QMK_KEYBOARD_H | 2 | #include QMK_KEYBOARD_H |
| 3 | #include "ssd1306.h" | 3 | #include <stdio.h> |
| 4 | #include <string.h> | ||
| 4 | 5 | ||
| 5 | void render_logo(struct CharacterMatrix *matrix) { | 6 | void render_logo(void) { |
| 6 | 7 | ||
| 7 | const char logo_buf[]={ | 8 | const char logo_buf[]={ |
| 8 | 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94, | 9 | 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94, |
| @@ -10,10 +11,10 @@ void render_logo(struct CharacterMatrix *matrix) { | |||
| 10 | 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4, | 11 | 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4, |
| 11 | 0}; | 12 | 0}; |
| 12 | 13 | ||
| 13 | matrix_write(matrix, logo_buf); | 14 | oled_write(logo_buf, false); |
| 14 | } | 15 | } |
| 15 | 16 | ||
| 16 | static char keylog_buf[24] = "Key state ready."; | 17 | static char keylog_buf[24] = "Key state ready.\n"; |
| 17 | const char code_to_name[60] = { | 18 | const char code_to_name[60] = { |
| 18 | ' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', | 19 | ' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', |
| 19 | 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', | 20 | 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', |
| @@ -27,14 +28,14 @@ void update_key_status(uint16_t keycode, keyrecord_t *record) { | |||
| 27 | if (!record->event.pressed) return; | 28 | if (!record->event.pressed) return; |
| 28 | 29 | ||
| 29 | char name = (keycode < 60) ? code_to_name[keycode] : ' '; | 30 | char name = (keycode < 60) ? code_to_name[keycode] : ' '; |
| 30 | snprintf(keylog_buf, sizeof(keylog_buf) - 1, "Key:%dx%d %2x %c", | 31 | snprintf(keylog_buf, sizeof(keylog_buf) - 1, "Key:%dx%d %2x %c\n", |
| 31 | record->event.key.row, record->event.key.col, | 32 | record->event.key.row, record->event.key.col, |
| 32 | (uint16_t)keycode, name); | 33 | (uint16_t)keycode, name); |
| 33 | } | 34 | } |
| 34 | 35 | ||
| 35 | void render_key_status(struct CharacterMatrix *matrix) { | 36 | void render_key_status(void) { |
| 36 | 37 | ||
| 37 | matrix_write(matrix, keylog_buf); | 38 | oled_write(keylog_buf, false); |
| 38 | } | 39 | } |
| 39 | 40 | ||
| 40 | static char lock_buf[24] = "Lock state ready.\n"; | 41 | static char lock_buf[24] = "Lock state ready.\n"; |
| @@ -48,9 +49,9 @@ void update_lock_status(void) { | |||
| 48 | num_lock, caps_lock, scrl_lock); | 49 | num_lock, caps_lock, scrl_lock); |
| 49 | } | 50 | } |
| 50 | 51 | ||
| 51 | void render_lock_status(struct CharacterMatrix *matrix) { | 52 | void render_lock_status(void) { |
| 52 | 53 | ||
| 53 | matrix_write(matrix, lock_buf); | 54 | oled_write(lock_buf, false); |
| 54 | } | 55 | } |
| 55 | 56 | ||
| 56 | #ifdef RGBLIGHT_ENABLE | 57 | #ifdef RGBLIGHT_ENABLE |
| @@ -75,9 +76,9 @@ void update_led_status(void) { | |||
| 75 | } | 76 | } |
| 76 | } | 77 | } |
| 77 | 78 | ||
| 78 | void render_led_status(struct CharacterMatrix *matrix) { | 79 | void render_led_status(void) { |
| 79 | 80 | ||
| 80 | matrix_write(matrix, led_buf); | 81 | oled_write(led_buf, false); |
| 81 | } | 82 | } |
| 82 | #endif | 83 | #endif |
| 83 | #endif | 84 | #endif |
diff --git a/keyboards/treadstone48/common/oled_helper.h b/keyboards/treadstone48/common/oled_helper.h index 44628a526..69ab70560 100644 --- a/keyboards/treadstone48/common/oled_helper.h +++ b/keyboards/treadstone48/common/oled_helper.h | |||
| @@ -1,35 +1,35 @@ | |||
| 1 | #ifdef SSD1306OLED | 1 | #ifdef OLED_DRIVER_ENABLE |
| 2 | 2 | ||
| 3 | void render_logo(struct CharacterMatrix *matrix); | 3 | void render_logo(void); |
| 4 | void update_key_status(uint16_t keycode, keyrecord_t *record); | 4 | void update_key_status(uint16_t keycode, keyrecord_t *record); |
| 5 | void render_key_status(struct CharacterMatrix *matrix); | 5 | void render_key_status(void); |
| 6 | void update_lock_status(void); | 6 | void update_lock_status(void); |
| 7 | void render_lock_status(struct CharacterMatrix *matrix); | 7 | void render_lock_status(void); |
| 8 | 8 | ||
| 9 | #define RENDER_LOGO(a) render_logo(a) | 9 | #define RENDER_LOGO() render_logo() |
| 10 | #define UPDATE_KEY_STATUS(a, b) update_key_status(a, b) | 10 | #define UPDATE_KEY_STATUS(a, b) update_key_status(a, b) |
| 11 | #define RENDER_KEY_STATUS(a) render_key_status(a) | 11 | #define RENDER_KEY_STATUS() render_key_status() |
| 12 | #define UPDATE_LOCK_STATUS() update_lock_status() | 12 | #define UPDATE_LOCK_STATUS() update_lock_status() |
| 13 | #define RENDER_LOCK_STATUS(a) render_lock_status(a) | 13 | #define RENDER_LOCK_STATUS() render_lock_status() |
| 14 | 14 | ||
| 15 | #ifdef RGBLIGHT_ENABLE | 15 | #ifdef RGBLIGHT_ENABLE |
| 16 | void update_led_status(void); | 16 | void update_led_status(void); |
| 17 | void render_led_status(struct CharacterMatrix *matrix); | 17 | void render_led_status(void); |
| 18 | #define UPDATE_LED_STATUS() update_led_status() | 18 | #define UPDATE_LED_STATUS() update_led_status() |
| 19 | #define RENDER_LED_STATUS(a) render_led_status(a) | 19 | #define RENDER_LED_STATUS() render_led_status() |
| 20 | #else | 20 | #else |
| 21 | #define UPDATE_LED_STATUS() | 21 | #define UPDATE_LED_STATUS() |
| 22 | #define RENDER_LED_STATUS(a) | 22 | #define RENDER_LED_STATUS() |
| 23 | #endif | 23 | #endif |
| 24 | 24 | ||
| 25 | #else | 25 | #else |
| 26 | 26 | ||
| 27 | #define RENDER_LOGO(a) | 27 | #define RENDER_LOGO() |
| 28 | #define UPDATE_KEY_STATUS(a, b) | 28 | #define UPDATE_KEY_STATUS(a, b) |
| 29 | #define RENDER_KEY_STATUS(a) | 29 | #define RENDER_KEY_STATUS() |
| 30 | #define UPDATE_LOCK_STATUS() | 30 | #define UPDATE_LOCK_STATUS() |
| 31 | #define RENDER_LOCK_STATUS(a) | 31 | #define RENDER_LOCK_STATUS() |
| 32 | #define UPDATE_LED_STATUS() | 32 | #define UPDATE_LED_STATUS() |
| 33 | #define RENDER_LED_STATUS(a) | 33 | #define RENDER_LED_STATUS() |
| 34 | 34 | ||
| 35 | #endif | 35 | #endif |
diff --git a/keyboards/treadstone48/config.h b/keyboards/treadstone48/config.h deleted file mode 100644 index 2e571e269..000000000 --- a/keyboards/treadstone48/config.h +++ /dev/null | |||
| @@ -1,43 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
| 3 | Copyright 2015 Jack Humbert | ||
| 4 | |||
| 5 | This program is free software: you can redistribute it and/or modify | ||
| 6 | it under the terms of the GNU General Public License as published by | ||
| 7 | the Free Software Foundation, either version 2 of the License, or | ||
| 8 | (at your option) any later version. | ||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, | ||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | GNU General Public License for more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU General Public License | ||
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #pragma once | ||
| 20 | |||
| 21 | #include "config_common.h" | ||
| 22 | |||
| 23 | // GCC include 'config.h" sequence in qmk_firmware/keyboards/treadstone48/ | ||
| 24 | // -include keyboards/treadstone48/config.h | ||
| 25 | // -include keyboards/treadstone48/rev?/config.h | ||
| 26 | // -include keyboards/treadstone48/rev?/keymaps/MAPNAME/config.h | ||
| 27 | // XXXX.c | ||
| 28 | |||
| 29 | #include <serial_config.h> | ||
| 30 | |||
| 31 | // GCC include search path in qmk_firmare/keyboards/treadstone48/ | ||
| 32 | // #include "..." search starts here: | ||
| 33 | // #include <...> search starts here: | ||
| 34 | // keyboards/treadstone48/rev?/keymaps/MAPNAME | ||
| 35 | // keyboards/treadstone48 | ||
| 36 | // keyboards/treadstone48/rev? | ||
| 37 | // . | ||
| 38 | // ./tmk_core | ||
| 39 | // ...... | ||
| 40 | |||
| 41 | // MACRO and FUNCTION are features that are depreciated. | ||
| 42 | #define NO_ACTION_MACRO | ||
| 43 | #define NO_ACTION_FUNCTION | ||
diff --git a/keyboards/treadstone48/i2c.c b/keyboards/treadstone48/i2c.c deleted file mode 100644 index 4bee5c639..000000000 --- a/keyboards/treadstone48/i2c.c +++ /dev/null | |||
| @@ -1,162 +0,0 @@ | |||
| 1 | #include <util/twi.h> | ||
| 2 | #include <avr/io.h> | ||
| 3 | #include <stdlib.h> | ||
| 4 | #include <avr/interrupt.h> | ||
| 5 | #include <util/twi.h> | ||
| 6 | #include <stdbool.h> | ||
| 7 | #include "i2c.h" | ||
| 8 | |||
| 9 | #ifdef USE_I2C | ||
| 10 | |||
| 11 | // Limits the amount of we wait for any one i2c transaction. | ||
| 12 | // Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is | ||
| 13 | // 9 bits, a single transaction will take around 90μs to complete. | ||
| 14 | // | ||
| 15 | // (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit | ||
| 16 | // poll loop takes at least 8 clock cycles to execute | ||
| 17 | #define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8 | ||
| 18 | |||
| 19 | #define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE) | ||
| 20 | |||
| 21 | volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; | ||
| 22 | |||
| 23 | static volatile uint8_t slave_buffer_pos; | ||
| 24 | static volatile bool slave_has_register_set = false; | ||
| 25 | |||
| 26 | // Wait for an i2c operation to finish | ||
| 27 | inline static | ||
| 28 | void i2c_delay(void) { | ||
| 29 | uint16_t lim = 0; | ||
| 30 | while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT) | ||
| 31 | lim++; | ||
| 32 | |||
| 33 | // easier way, but will wait slightly longer | ||
| 34 | // _delay_us(100); | ||
| 35 | } | ||
| 36 | |||
| 37 | // Setup twi to run at 100kHz or 400kHz (see ./i2c.h SCL_CLOCK) | ||
| 38 | void i2c_master_init(void) { | ||
| 39 | // no prescaler | ||
| 40 | TWSR = 0; | ||
| 41 | // Set TWI clock frequency to SCL_CLOCK. Need TWBR>10. | ||
| 42 | // Check datasheets for more info. | ||
| 43 | TWBR = ((F_CPU/SCL_CLOCK)-16)/2; | ||
| 44 | } | ||
| 45 | |||
| 46 | // Start a transaction with the given i2c slave address. The direction of the | ||
| 47 | // transfer is set with I2C_READ and I2C_WRITE. | ||
| 48 | // returns: 0 => success | ||
| 49 | // 1 => error | ||
| 50 | uint8_t i2c_master_start(uint8_t address) { | ||
| 51 | TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTA); | ||
| 52 | |||
| 53 | i2c_delay(); | ||
| 54 | |||
| 55 | // check that we started successfully | ||
| 56 | if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START)) | ||
| 57 | return 1; | ||
| 58 | |||
| 59 | TWDR = address; | ||
| 60 | TWCR = (1<<TWINT) | (1<<TWEN); | ||
| 61 | |||
| 62 | i2c_delay(); | ||
| 63 | |||
| 64 | if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) ) | ||
| 65 | return 1; // slave did not acknowledge | ||
| 66 | else | ||
| 67 | return 0; // success | ||
| 68 | } | ||
| 69 | |||
| 70 | |||
| 71 | // Finish the i2c transaction. | ||
| 72 | void i2c_master_stop(void) { | ||
| 73 | TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO); | ||
| 74 | |||
| 75 | uint16_t lim = 0; | ||
| 76 | while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT) | ||
| 77 | lim++; | ||
| 78 | } | ||
| 79 | |||
| 80 | // Write one byte to the i2c slave. | ||
| 81 | // returns 0 => slave ACK | ||
| 82 | // 1 => slave NACK | ||
| 83 | uint8_t i2c_master_write(uint8_t data) { | ||
| 84 | TWDR = data; | ||
| 85 | TWCR = (1<<TWINT) | (1<<TWEN); | ||
| 86 | |||
| 87 | i2c_delay(); | ||
| 88 | |||
| 89 | // check if the slave acknowledged us | ||
| 90 | return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1; | ||
| 91 | } | ||
| 92 | |||
| 93 | // Read one byte from the i2c slave. If ack=1 the slave is acknowledged, | ||
| 94 | // if ack=0 the acknowledge bit is not set. | ||
| 95 | // returns: byte read from i2c device | ||
| 96 | uint8_t i2c_master_read(int ack) { | ||
| 97 | TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA); | ||
| 98 | |||
| 99 | i2c_delay(); | ||
| 100 | return TWDR; | ||
| 101 | } | ||
| 102 | |||
| 103 | void i2c_reset_state(void) { | ||
| 104 | TWCR = 0; | ||
| 105 | } | ||
| 106 | |||
| 107 | void i2c_slave_init(uint8_t address) { | ||
| 108 | TWAR = address << 0; // slave i2c address | ||
| 109 | // TWEN - twi enable | ||
| 110 | // TWEA - enable address acknowledgement | ||
| 111 | // TWINT - twi interrupt flag | ||
| 112 | // TWIE - enable the twi interrupt | ||
| 113 | TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN); | ||
| 114 | } | ||
| 115 | |||
| 116 | ISR(TWI_vect); | ||
| 117 | |||
| 118 | ISR(TWI_vect) { | ||
| 119 | uint8_t ack = 1; | ||
| 120 | switch(TW_STATUS) { | ||
| 121 | case TW_SR_SLA_ACK: | ||
| 122 | // this device has been addressed as a slave receiver | ||
| 123 | slave_has_register_set = false; | ||
| 124 | break; | ||
| 125 | |||
| 126 | case TW_SR_DATA_ACK: | ||
| 127 | // this device has received data as a slave receiver | ||
| 128 | // The first byte that we receive in this transaction sets the location | ||
| 129 | // of the read/write location of the slaves memory that it exposes over | ||
| 130 | // i2c. After that, bytes will be written at slave_buffer_pos, incrementing | ||
| 131 | // slave_buffer_pos after each write. | ||
| 132 | if(!slave_has_register_set) { | ||
| 133 | slave_buffer_pos = TWDR; | ||
| 134 | // don't acknowledge the master if this memory loctaion is out of bounds | ||
| 135 | if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) { | ||
| 136 | ack = 0; | ||
| 137 | slave_buffer_pos = 0; | ||
| 138 | } | ||
| 139 | slave_has_register_set = true; | ||
| 140 | } else { | ||
| 141 | i2c_slave_buffer[slave_buffer_pos] = TWDR; | ||
| 142 | BUFFER_POS_INC(); | ||
| 143 | } | ||
| 144 | break; | ||
| 145 | |||
| 146 | case TW_ST_SLA_ACK: | ||
| 147 | case TW_ST_DATA_ACK: | ||
| 148 | // master has addressed this device as a slave transmitter and is | ||
| 149 | // requesting data. | ||
| 150 | TWDR = i2c_slave_buffer[slave_buffer_pos]; | ||
| 151 | BUFFER_POS_INC(); | ||
| 152 | break; | ||
| 153 | |||
| 154 | case TW_BUS_ERROR: // something went wrong, reset twi state | ||
| 155 | TWCR = 0; | ||
| 156 | default: | ||
| 157 | break; | ||
| 158 | } | ||
| 159 | // Reset everything, so we are ready for the next TWI interrupt | ||
| 160 | TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN); | ||
| 161 | } | ||
| 162 | #endif | ||
diff --git a/keyboards/treadstone48/i2c.h b/keyboards/treadstone48/i2c.h deleted file mode 100644 index 710662c7a..000000000 --- a/keyboards/treadstone48/i2c.h +++ /dev/null | |||
| @@ -1,46 +0,0 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <stdint.h> | ||
| 4 | |||
| 5 | #ifndef F_CPU | ||
| 6 | #define F_CPU 16000000UL | ||
| 7 | #endif | ||
| 8 | |||
| 9 | #define I2C_READ 1 | ||
| 10 | #define I2C_WRITE 0 | ||
| 11 | |||
| 12 | #define I2C_ACK 1 | ||
| 13 | #define I2C_NACK 0 | ||
| 14 | |||
| 15 | #define SLAVE_BUFFER_SIZE 0x10 | ||
| 16 | |||
| 17 | // i2c SCL clock frequency 400kHz | ||
| 18 | #define SCL_CLOCK 400000L | ||
| 19 | |||
| 20 | extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; | ||
| 21 | |||
| 22 | void i2c_master_init(void); | ||
| 23 | uint8_t i2c_master_start(uint8_t address); | ||
| 24 | void i2c_master_stop(void); | ||
| 25 | uint8_t i2c_master_write(uint8_t data); | ||
| 26 | uint8_t i2c_master_read(int); | ||
| 27 | void i2c_reset_state(void); | ||
| 28 | void i2c_slave_init(uint8_t address); | ||
| 29 | |||
| 30 | |||
| 31 | static inline unsigned char i2c_start_read(unsigned char addr) { | ||
| 32 | return i2c_master_start((addr << 1) | I2C_READ); | ||
| 33 | } | ||
| 34 | |||
| 35 | static inline unsigned char i2c_start_write(unsigned char addr) { | ||
| 36 | return i2c_master_start((addr << 1) | I2C_WRITE); | ||
| 37 | } | ||
| 38 | |||
| 39 | // from SSD1306 scrips | ||
| 40 | extern unsigned char i2c_rep_start(unsigned char addr); | ||
| 41 | extern void i2c_start_wait(unsigned char addr); | ||
| 42 | extern unsigned char i2c_readAck(void); | ||
| 43 | extern unsigned char i2c_readNak(void); | ||
| 44 | extern unsigned char i2c_read(unsigned char ack); | ||
| 45 | |||
| 46 | #define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); | ||
diff --git a/keyboards/treadstone48/keymaps/default/config.h b/keyboards/treadstone48/keymaps/default/config.h index e22040cdd..baa4ec846 100644 --- a/keyboards/treadstone48/keymaps/default/config.h +++ b/keyboards/treadstone48/keymaps/default/config.h | |||
| @@ -1,22 +1,18 @@ | |||
| 1 | /* | 1 | /* Copyright 2020 marksard |
| 2 | This is the c configuration file for the keymap | 2 | * |
| 3 | 3 | * This program is free software: you can redistribute it and/or modify | |
| 4 | Copyright 2012 Jun Wako <wakojun@gmail.com> | 4 | * it under the terms of the GNU General Public License as published by |
| 5 | Copyright 2015 Jack Humbert | 5 | * the Free Software Foundation, either version 2 of the License, or |
| 6 | 6 | * (at your option) any later version. | |
| 7 | This program is free software: you can redistribute it and/or modify | 7 | * |
| 8 | it under the terms of the GNU General Public License as published by | 8 | * This program is distributed in the hope that it will be useful, |
| 9 | the Free Software Foundation, either version 2 of the License, or | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | (at your option) any later version. | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | 11 | * GNU General Public License for more details. | |
| 12 | This program is distributed in the hope that it will be useful, | 12 | * |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | * You should have received a copy of the GNU General Public License |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | GNU General Public License for more details. | 15 | */ |
| 16 | |||
| 17 | You should have received a copy of the GNU General Public License | ||
| 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | */ | ||
| 20 | 16 | ||
| 21 | #pragma once | 17 | #pragma once |
| 22 | 18 | ||
| @@ -26,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 26 | #undef TAPPING_TERM | 22 | #undef TAPPING_TERM |
| 27 | #endif | 23 | #endif |
| 28 | #define TAPPING_TERM 225 | 24 | #define TAPPING_TERM 225 |
| 29 | // #define IGNORE_MOD_TAP_INTERRUPT | ||
| 30 | 25 | ||
| 31 | #ifdef MOUSEKEY_ENABLE | 26 | #ifdef MOUSEKEY_ENABLE |
| 32 | #undef MOUSEKEY_INTERVAL | 27 | #undef MOUSEKEY_INTERVAL |
| @@ -45,15 +40,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 45 | #define MOUSEKEY_DELAY 0 | 40 | #define MOUSEKEY_DELAY 0 |
| 46 | #endif | 41 | #endif |
| 47 | 42 | ||
| 48 | // Selection of RGBLIGHT MODE to use. | 43 | // If you use the HashTwenty(alpha), please enable USE_HASHTWENTY |
| 49 | #if defined(LED_ANIMATIONS) | 44 | // #define ANGELINA_KEYMAP |
| 50 | //#define RGBLIGHT_EFFECT_BREATHING | 45 | |
| 51 | #define RGBLIGHT_EFFECT_RAINBOW_MOOD | 46 | // If you plug in the USB on the right side, please enable MASTER_RIGHT |
| 52 | #define RGBLIGHT_EFFECT_RAINBOW_SWIRL | 47 | // #define RHYMESTONE_RIGHTHAND |
| 53 | //#define RGBLIGHT_EFFECT_SNAKE | 48 | |
| 54 | #define RGBLIGHT_EFFECT_KNIGHT | 49 | #define OLED_FONT_H "keyboards/treadstone48/common/glcdfont.c" |
| 55 | //#define RGBLIGHT_EFFECT_CHRISTMAS | ||
| 56 | #define RGBLIGHT_EFFECT_STATIC_GRADIENT | ||
| 57 | //#define RGBLIGHT_EFFECT_RGB_TEST | ||
| 58 | //#define RGBLIGHT_EFFECT_ALTERNATING | ||
| 59 | #endif | ||
diff --git a/keyboards/treadstone48/keymaps/default/keymap.c b/keyboards/treadstone48/keymaps/default/keymap.c index 614330752..100434246 100644 --- a/keyboards/treadstone48/keymaps/default/keymap.c +++ b/keyboards/treadstone48/keymaps/default/keymap.c | |||
| @@ -1,8 +1,22 @@ | |||
| 1 | /* Copyright 2020 marksard | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 1 | #include QMK_KEYBOARD_H | 16 | #include QMK_KEYBOARD_H |
| 2 | #include "keymap_jp.h" | 17 | #include "keymap_jp.h" |
| 3 | #include "../common/oled_helper.h" | 18 | #include "../common/oled_helper.h" |
| 4 | 19 | ||
| 5 | |||
| 6 | #ifdef RGBLIGHT_ENABLE | 20 | #ifdef RGBLIGHT_ENABLE |
| 7 | //Following line allows macro to read current RGB settings | 21 | //Following line allows macro to read current RGB settings |
| 8 | extern rgblight_config_t rgblight_config; | 22 | extern rgblight_config_t rgblight_config; |
| @@ -115,7 +129,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 115 | #define L_ADJUST (1<<_ADJUST) | 129 | #define L_ADJUST (1<<_ADJUST) |
| 116 | #define L_ADJUST_TRI (L_ADJUST|L_RAISE|L_LOWER) | 130 | #define L_ADJUST_TRI (L_ADJUST|L_RAISE|L_LOWER) |
| 117 | 131 | ||
| 118 | #ifdef SSD1306OLED | 132 | #ifdef OLED_DRIVER_ENABLE |
| 133 | #include <stdio.h> | ||
| 134 | #include <string.h> | ||
| 135 | |||
| 119 | typedef struct { | 136 | typedef struct { |
| 120 | uint8_t state; | 137 | uint8_t state; |
| 121 | char name[8]; | 138 | char name[8]; |
| @@ -152,18 +169,42 @@ static inline void update_keymap_status(void) { | |||
| 152 | keymap_config.swap_lalt_lgui? "win" : "mac", get_leyer_status()); | 169 | keymap_config.swap_lalt_lgui? "win" : "mac", get_leyer_status()); |
| 153 | } | 170 | } |
| 154 | 171 | ||
| 155 | static inline void render_keymap_status(struct CharacterMatrix *matrix) { | 172 | static inline void render_keymap_status(void) { |
| 156 | 173 | ||
| 157 | matrix_write(matrix, layer_status_buf); | 174 | oled_write(layer_status_buf, false); |
| 158 | } | 175 | } |
| 159 | 176 | ||
| 160 | #define UPDATE_KEYMAP_STATUS() update_keymap_status() | 177 | #define UPDATE_KEYMAP_STATUS() update_keymap_status() |
| 161 | #define RENDER_KEYMAP_STATUS(a) render_keymap_status(a) | 178 | |
| 179 | static inline void render_status(void) { | ||
| 180 | |||
| 181 | UPDATE_LED_STATUS(); | ||
| 182 | RENDER_LED_STATUS(); | ||
| 183 | render_keymap_status(); | ||
| 184 | UPDATE_LOCK_STATUS(); | ||
| 185 | RENDER_LOCK_STATUS(); | ||
| 186 | RENDER_KEY_STATUS(); | ||
| 187 | } | ||
| 188 | |||
| 189 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { | ||
| 190 | |||
| 191 | // if (is_keyboard_master()) | ||
| 192 | // return OLED_ROTATION_180; // flips the display 180 degrees if offhand | ||
| 193 | return rotation; | ||
| 194 | } | ||
| 195 | |||
| 196 | void oled_task_user(void) { | ||
| 197 | |||
| 198 | if (is_keyboard_master()) { | ||
| 199 | render_status(); | ||
| 200 | } else { | ||
| 201 | render_logo(); | ||
| 202 | } | ||
| 203 | } | ||
| 162 | 204 | ||
| 163 | #else | 205 | #else |
| 164 | 206 | ||
| 165 | #define UPDATE_KEYMAP_STATUS() | 207 | #define UPDATE_KEYMAP_STATUS() |
| 166 | #define RENDER_KEYMAP_STATUS(a) | ||
| 167 | 208 | ||
| 168 | #endif | 209 | #endif |
| 169 | 210 | ||
| @@ -198,18 +239,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 198 | } | 239 | } |
| 199 | break; | 240 | break; |
| 200 | #ifdef RGBLIGHT_ENABLE | 241 | #ifdef RGBLIGHT_ENABLE |
| 201 | case RGB_MOD: | ||
| 202 | if (record->event.pressed) { | ||
| 203 | rgblight_mode(RGB_current_mode); | ||
| 204 | rgblight_step(); | ||
| 205 | RGB_current_mode = rgblight_config.mode; | ||
| 206 | } | ||
| 207 | break; | ||
| 208 | case RGBRST: | 242 | case RGBRST: |
| 209 | if (record->event.pressed) { | 243 | if (record->event.pressed) { |
| 210 | eeconfig_update_rgblight_default(); | 244 | eeconfig_update_rgblight_default(); |
| 211 | rgblight_enable(); | 245 | rgblight_enable(); |
| 212 | RGB_current_mode = rgblight_config.mode; | ||
| 213 | } | 246 | } |
| 214 | break; | 247 | break; |
| 215 | #endif | 248 | #endif |
| @@ -221,57 +254,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 221 | UPDATE_KEYMAP_STATUS(); | 254 | UPDATE_KEYMAP_STATUS(); |
| 222 | return result; | 255 | return result; |
| 223 | } | 256 | } |
| 224 | |||
| 225 | void matrix_init_user(void) { | ||
| 226 | #ifdef RGBLIGHT_ENABLE | ||
| 227 | RGB_current_mode = rgblight_config.mode; | ||
| 228 | #endif | ||
| 229 | //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h | ||
| 230 | #ifdef SSD1306OLED | ||
| 231 | iota_gfx_init(!has_usb()); // turns on the display | ||
| 232 | #endif | ||
| 233 | } | ||
| 234 | |||
| 235 | //SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h | ||
| 236 | #ifdef SSD1306OLED | ||
| 237 | |||
| 238 | void matrix_scan_user(void) { | ||
| 239 | iota_gfx_task(); // this is what updates the display continuously | ||
| 240 | } | ||
| 241 | |||
| 242 | static inline void matrix_update(struct CharacterMatrix *dest, | ||
| 243 | const struct CharacterMatrix *source) { | ||
| 244 | if (memcmp(dest->display, source->display, sizeof(dest->display))) { | ||
| 245 | memcpy(dest->display, source->display, sizeof(dest->display)); | ||
| 246 | dest->dirty = true; | ||
| 247 | } | ||
| 248 | } | ||
| 249 | |||
| 250 | static inline void render_status(struct CharacterMatrix *matrix) { | ||
| 251 | |||
| 252 | UPDATE_LED_STATUS(); | ||
| 253 | RENDER_LED_STATUS(matrix); | ||
| 254 | RENDER_KEYMAP_STATUS(matrix); | ||
| 255 | UPDATE_LOCK_STATUS(); | ||
| 256 | RENDER_LOCK_STATUS(matrix); | ||
| 257 | RENDER_KEY_STATUS(matrix); | ||
| 258 | } | ||
| 259 | |||
| 260 | void iota_gfx_task_user(void) { | ||
| 261 | struct CharacterMatrix matrix; | ||
| 262 | |||
| 263 | #if DEBUG_TO_SCREEN | ||
| 264 | if (debug_enable) { | ||
| 265 | return; | ||
| 266 | } | ||
| 267 | #endif | ||
| 268 | |||
| 269 | matrix_clear(&matrix); | ||
| 270 | if (is_master) { | ||
| 271 | render_status(&matrix); | ||
| 272 | } | ||
| 273 | |||
| 274 | matrix_update(&display, &matrix); | ||
| 275 | } | ||
| 276 | |||
| 277 | #endif | ||
diff --git a/keyboards/treadstone48/keymaps/default/rules.mk b/keyboards/treadstone48/keymaps/default/rules.mk index 38ef4cc9f..474e71ab1 100644 --- a/keyboards/treadstone48/keymaps/default/rules.mk +++ b/keyboards/treadstone48/keymaps/default/rules.mk | |||
| @@ -1,49 +1,9 @@ | |||
| 1 | MOUSEKEY_ENABLE = yes # Mouse keys | ||
| 1 | TAP_DANCE_ENABLE = yes | 2 | TAP_DANCE_ENABLE = yes |
| 2 | 3 | ||
| 3 | # If your custom treadstone48 pcb, you can rewrite to yes. | 4 | RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow |
| 4 | OLED_ENABLE = no # OLED_ENABLE | 5 | OLED_DRIVER_ENABLE = no |
| 5 | LED_UNDERGLOW_ENABLE = yes # LED underglow (Enable WS2812 RGB underlight.) | 6 | LTO_ENABLE = yes |
| 6 | LED_ANIMATIONS = yes # LED animations | ||
| 7 | |||
| 8 | # Other selectable option | ||
| 9 | IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) | ||
| 10 | LOCAL_GLCDFONT = no # use each keymaps "font.h" insted of "common/glcdfont.c" | ||
| 11 | # RHYMESTONE_RIGHTHAND = no # If connect right hand side of the Rhymestone, set to yes. | ||
| 12 | ANGELINA_KEYMAP = no # If Alfa verstion use set to yes. | ||
| 13 | |||
| 14 | ifeq ($(strip $(OLED_ENABLE)), yes) | ||
| 15 | OPT_DEFS += -DOLED_ENABLE | ||
| 16 | endif | ||
| 17 | |||
| 18 | ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) | ||
| 19 | RGBLIGHT_ENABLE = yes | ||
| 20 | else | ||
| 21 | RGBLIGHT_ENABLE = no | ||
| 22 | endif | ||
| 23 | |||
| 24 | ifeq ($(strip $(LED_ANIMATIONS)), yes) | ||
| 25 | # OPT_DEFS += -DRGBLIGHT_ANIMATIONS | ||
| 26 | OPT_DEFS += -DLED_ANIMATIONS | ||
| 27 | endif | ||
| 28 | |||
| 29 | ifeq ($(strip $(IOS_DEVICE_ENABLE)), yes) | ||
| 30 | OPT_DEFS += -DIOS_DEVICE_ENABLE | ||
| 31 | endif | ||
| 32 | |||
| 33 | ifeq ($(strip $(LOCAL_GLCDFONT)), yes) | ||
| 34 | OPT_DEFS += -DLOCAL_GLCDFONT | ||
| 35 | endif | ||
| 36 | |||
| 37 | # ifeq ($(strip $(RHYMESTONE_RIGHTHAND)), yes) | ||
| 38 | # OPT_DEFS += -DRHYMESTONE_RIGHTHAND | ||
| 39 | # endif | ||
| 40 | |||
| 41 | ifeq ($(strip $(ANGELINA_KEYMAP)), yes) | ||
| 42 | OPT_DEFS += -DANGELINA_KEYMAP | ||
| 43 | endif | ||
| 44 | |||
| 45 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 46 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
| 47 | 7 | ||
| 48 | # If you want to change the display of OLED, you need to change here | 8 | # If you want to change the display of OLED, you need to change here |
| 49 | SRC += ./common/oled_helper.c \ | 9 | SRC += ./common/oled_helper.c \ |
diff --git a/keyboards/treadstone48/keymaps/like_jis/config.h b/keyboards/treadstone48/keymaps/like_jis/config.h index 3f63a0cfb..baa4ec846 100644 --- a/keyboards/treadstone48/keymaps/like_jis/config.h +++ b/keyboards/treadstone48/keymaps/like_jis/config.h | |||
| @@ -1,22 +1,18 @@ | |||
| 1 | /* | 1 | /* Copyright 2020 marksard |
| 2 | This is the c configuration file for the keymap | 2 | * |
| 3 | 3 | * This program is free software: you can redistribute it and/or modify | |
| 4 | Copyright 2012 Jun Wako <wakojun@gmail.com> | 4 | * it under the terms of the GNU General Public License as published by |
| 5 | Copyright 2015 Jack Humbert | 5 | * the Free Software Foundation, either version 2 of the License, or |
| 6 | 6 | * (at your option) any later version. | |
| 7 | This program is free software: you can redistribute it and/or modify | 7 | * |
| 8 | it under the terms of the GNU General Public License as published by | 8 | * This program is distributed in the hope that it will be useful, |
| 9 | the Free Software Foundation, either version 2 of the License, or | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | (at your option) any later version. | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | 11 | * GNU General Public License for more details. | |
| 12 | This program is distributed in the hope that it will be useful, | 12 | * |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | * You should have received a copy of the GNU General Public License |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | GNU General Public License for more details. | 15 | */ |
| 16 | |||
| 17 | You should have received a copy of the GNU General Public License | ||
| 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | */ | ||
| 20 | 16 | ||
| 21 | #pragma once | 17 | #pragma once |
| 22 | 18 | ||
| @@ -26,8 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 26 | #undef TAPPING_TERM | 22 | #undef TAPPING_TERM |
| 27 | #endif | 23 | #endif |
| 28 | #define TAPPING_TERM 225 | 24 | #define TAPPING_TERM 225 |
| 29 | // #define PREVENT_STUCK_MODIFIERS | ||
| 30 | // #define IGNORE_MOD_TAP_INTERRUPT | ||
| 31 | 25 | ||
| 32 | #ifdef MOUSEKEY_ENABLE | 26 | #ifdef MOUSEKEY_ENABLE |
| 33 | #undef MOUSEKEY_INTERVAL | 27 | #undef MOUSEKEY_INTERVAL |
| @@ -46,15 +40,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 46 | #define MOUSEKEY_DELAY 0 | 40 | #define MOUSEKEY_DELAY 0 |
| 47 | #endif | 41 | #endif |
| 48 | 42 | ||
| 49 | // Selection of RGBLIGHT MODE to use. | 43 | // If you use the HashTwenty(alpha), please enable USE_HASHTWENTY |
| 50 | #if defined(LED_ANIMATIONS) | 44 | // #define ANGELINA_KEYMAP |
| 51 | //#define RGBLIGHT_EFFECT_BREATHING | 45 | |
| 52 | #define RGBLIGHT_EFFECT_RAINBOW_MOOD | 46 | // If you plug in the USB on the right side, please enable MASTER_RIGHT |
| 53 | #define RGBLIGHT_EFFECT_RAINBOW_SWIRL | 47 | // #define RHYMESTONE_RIGHTHAND |
| 54 | //#define RGBLIGHT_EFFECT_SNAKE | 48 | |
| 55 | #define RGBLIGHT_EFFECT_KNIGHT | 49 | #define OLED_FONT_H "keyboards/treadstone48/common/glcdfont.c" |
| 56 | //#define RGBLIGHT_EFFECT_CHRISTMAS | ||
| 57 | #define RGBLIGHT_EFFECT_STATIC_GRADIENT | ||
| 58 | //#define RGBLIGHT_EFFECT_RGB_TEST | ||
| 59 | //#define RGBLIGHT_EFFECT_ALTERNATING | ||
| 60 | #endif | ||
diff --git a/keyboards/treadstone48/keymaps/like_jis/keymap.c b/keyboards/treadstone48/keymaps/like_jis/keymap.c index b63b0c9f4..6cde28d24 100644 --- a/keyboards/treadstone48/keymaps/like_jis/keymap.c +++ b/keyboards/treadstone48/keymaps/like_jis/keymap.c | |||
| @@ -1,9 +1,22 @@ | |||
| 1 | /* Copyright 2020 marksard | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 1 | #include QMK_KEYBOARD_H | 16 | #include QMK_KEYBOARD_H |
| 2 | #include "keymap_jp.h" | 17 | #include "keymap_jp.h" |
| 3 | #include "../common/oled_helper.h" | 18 | #include "../common/oled_helper.h" |
| 4 | 19 | ||
| 5 | extern keymap_config_t keymap_config; | ||
| 6 | |||
| 7 | #ifdef RGBLIGHT_ENABLE | 20 | #ifdef RGBLIGHT_ENABLE |
| 8 | //Following line allows macro to read current RGB settings | 21 | //Following line allows macro to read current RGB settings |
| 9 | extern rgblight_config_t rgblight_config; | 22 | extern rgblight_config_t rgblight_config; |
| @@ -116,7 +129,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 116 | #define L_ADJUST (1<<_ADJUST) | 129 | #define L_ADJUST (1<<_ADJUST) |
| 117 | #define L_ADJUST_TRI (L_ADJUST|L_RAISE|L_LOWER) | 130 | #define L_ADJUST_TRI (L_ADJUST|L_RAISE|L_LOWER) |
| 118 | 131 | ||
| 119 | #ifdef SSD1306OLED | 132 | #ifdef OLED_DRIVER_ENABLE |
| 133 | #include <stdio.h> | ||
| 134 | #include <string.h> | ||
| 135 | |||
| 120 | typedef struct { | 136 | typedef struct { |
| 121 | uint8_t state; | 137 | uint8_t state; |
| 122 | char name[8]; | 138 | char name[8]; |
| @@ -153,18 +169,42 @@ static inline void update_keymap_status(void) { | |||
| 153 | keymap_config.swap_lalt_lgui? "win" : "mac", get_leyer_status()); | 169 | keymap_config.swap_lalt_lgui? "win" : "mac", get_leyer_status()); |
| 154 | } | 170 | } |
| 155 | 171 | ||
| 156 | static inline void render_keymap_status(struct CharacterMatrix *matrix) { | 172 | static inline void render_keymap_status(void) { |
| 157 | 173 | ||
| 158 | matrix_write(matrix, layer_status_buf); | 174 | oled_write(layer_status_buf, false); |
| 159 | } | 175 | } |
| 160 | 176 | ||
| 161 | #define UPDATE_KEYMAP_STATUS() update_keymap_status() | 177 | #define UPDATE_KEYMAP_STATUS() update_keymap_status() |
| 162 | #define RENDER_KEYMAP_STATUS(a) render_keymap_status(a) | 178 | |
| 179 | static inline void render_status(void) { | ||
| 180 | |||
| 181 | UPDATE_LED_STATUS(); | ||
| 182 | RENDER_LED_STATUS(); | ||
| 183 | render_keymap_status(); | ||
| 184 | UPDATE_LOCK_STATUS(); | ||
| 185 | RENDER_LOCK_STATUS(); | ||
| 186 | RENDER_KEY_STATUS(); | ||
| 187 | } | ||
| 188 | |||
| 189 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { | ||
| 190 | |||
| 191 | // if (is_keyboard_master()) | ||
| 192 | // return OLED_ROTATION_180; // flips the display 180 degrees if offhand | ||
| 193 | return rotation; | ||
| 194 | } | ||
| 195 | |||
| 196 | void oled_task_user(void) { | ||
| 197 | |||
| 198 | if (is_keyboard_master()) { | ||
| 199 | render_status(); | ||
| 200 | } else { | ||
| 201 | render_logo(); | ||
| 202 | } | ||
| 203 | } | ||
| 163 | 204 | ||
| 164 | #else | 205 | #else |
| 165 | 206 | ||
| 166 | #define UPDATE_KEYMAP_STATUS() | 207 | #define UPDATE_KEYMAP_STATUS() |
| 167 | #define RENDER_KEYMAP_STATUS(a) | ||
| 168 | 208 | ||
| 169 | #endif | 209 | #endif |
| 170 | 210 | ||
| @@ -199,18 +239,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 199 | } | 239 | } |
| 200 | break; | 240 | break; |
| 201 | #ifdef RGBLIGHT_ENABLE | 241 | #ifdef RGBLIGHT_ENABLE |
| 202 | case RGB_MOD: | ||
| 203 | if (record->event.pressed) { | ||
| 204 | rgblight_mode(RGB_current_mode); | ||
| 205 | rgblight_step(); | ||
| 206 | RGB_current_mode = rgblight_config.mode; | ||
| 207 | } | ||
| 208 | break; | ||
| 209 | case RGBRST: | 242 | case RGBRST: |
| 210 | if (record->event.pressed) { | 243 | if (record->event.pressed) { |
| 211 | eeconfig_update_rgblight_default(); | 244 | eeconfig_update_rgblight_default(); |
| 212 | rgblight_enable(); | 245 | rgblight_enable(); |
| 213 | RGB_current_mode = rgblight_config.mode; | ||
| 214 | } | 246 | } |
| 215 | break; | 247 | break; |
| 216 | #endif | 248 | #endif |
| @@ -222,57 +254,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 222 | UPDATE_KEYMAP_STATUS(); | 254 | UPDATE_KEYMAP_STATUS(); |
| 223 | return result; | 255 | return result; |
| 224 | } | 256 | } |
| 225 | |||
| 226 | void matrix_init_user(void) { | ||
| 227 | #ifdef RGBLIGHT_ENABLE | ||
| 228 | RGB_current_mode = rgblight_config.mode; | ||
| 229 | #endif | ||
| 230 | //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h | ||
| 231 | #ifdef SSD1306OLED | ||
| 232 | iota_gfx_init(!has_usb()); // turns on the display | ||
| 233 | #endif | ||
| 234 | } | ||
| 235 | |||
| 236 | //SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h | ||
| 237 | #ifdef SSD1306OLED | ||
| 238 | |||
| 239 | void matrix_scan_user(void) { | ||
| 240 | iota_gfx_task(); // this is what updates the display continuously | ||
| 241 | } | ||
| 242 | |||
| 243 | static inline void matrix_update(struct CharacterMatrix *dest, | ||
| 244 | const struct CharacterMatrix *source) { | ||
| 245 | if (memcmp(dest->display, source->display, sizeof(dest->display))) { | ||
| 246 | memcpy(dest->display, source->display, sizeof(dest->display)); | ||
| 247 | dest->dirty = true; | ||
| 248 | } | ||
| 249 | } | ||
| 250 | |||
| 251 | static inline void render_status(struct CharacterMatrix *matrix) { | ||
| 252 | |||
| 253 | UPDATE_LED_STATUS(); | ||
| 254 | RENDER_LED_STATUS(matrix); | ||
| 255 | RENDER_KEYMAP_STATUS(matrix); | ||
| 256 | UPDATE_LOCK_STATUS(); | ||
| 257 | RENDER_LOCK_STATUS(matrix); | ||
| 258 | RENDER_KEY_STATUS(matrix); | ||
| 259 | } | ||
| 260 | |||
| 261 | void iota_gfx_task_user(void) { | ||
| 262 | struct CharacterMatrix matrix; | ||
| 263 | |||
| 264 | #if DEBUG_TO_SCREEN | ||
| 265 | if (debug_enable) { | ||
| 266 | return; | ||
| 267 | } | ||
| 268 | #endif | ||
| 269 | |||
| 270 | matrix_clear(&matrix); | ||
| 271 | if (is_master) { | ||
| 272 | render_status(&matrix); | ||
| 273 | } | ||
| 274 | |||
| 275 | matrix_update(&display, &matrix); | ||
| 276 | } | ||
| 277 | |||
| 278 | #endif | ||
diff --git a/keyboards/treadstone48/keymaps/like_jis/rules.mk b/keyboards/treadstone48/keymaps/like_jis/rules.mk index c53226431..474e71ab1 100644 --- a/keyboards/treadstone48/keymaps/like_jis/rules.mk +++ b/keyboards/treadstone48/keymaps/like_jis/rules.mk | |||
| @@ -1,67 +1,9 @@ | |||
| 1 | 1 | MOUSEKEY_ENABLE = yes # Mouse keys | |
| 2 | # Build Options | ||
| 3 | # change to "no" to disable the options, or define them in the Makefile in | ||
| 4 | # the appropriate keymap folder that will get included automatically | ||
| 5 | # | ||
| 6 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | ||
| 7 | MOUSEKEY_ENABLE = no # Mouse keys(+4700) | ||
| 8 | EXTRAKEY_ENABLE = no # Audio control and System control(+450) | ||
| 9 | CONSOLE_ENABLE = no # Console for debug(+400) | ||
| 10 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
| 11 | NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 12 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
| 13 | MIDI_ENABLE = no # MIDI controls | ||
| 14 | AUDIO_ENABLE = no # Audio output on port C6 | ||
| 15 | UNICODE_ENABLE = no # Unicode | ||
| 16 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 17 | RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | ||
| 18 | SWAP_HANDS_ENABLE = no # Enable one-hand typing | ||
| 19 | TAP_DANCE_ENABLE = yes | 2 | TAP_DANCE_ENABLE = yes |
| 20 | 3 | ||
| 21 | # If your custom treadstone48 pcb, you can rewrite to yes. | 4 | RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow |
| 22 | OLED_ENABLE = no # OLED_ENABLE | 5 | OLED_DRIVER_ENABLE = no |
| 23 | LED_UNDERGLOW_ENABLE = yes # LED underglow (Enable WS2812 RGB underlight.) | 6 | LTO_ENABLE = yes |
| 24 | LED_ANIMATIONS = yes # LED animations | ||
| 25 | |||
| 26 | # Other selectable option | ||
| 27 | IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) | ||
| 28 | LOCAL_GLCDFONT = no # use each keymaps "font.h" insted of "common/glcdfont.c" | ||
| 29 | # RHYMESTONE_RIGHTHAND = no # If connect right hand side of the Rhymestone, set to yes. | ||
| 30 | ANGELINA_KEYMAP = no # If Alfa verstion use set to yes. | ||
| 31 | |||
| 32 | ifeq ($(strip $(OLED_ENABLE)), yes) | ||
| 33 | OPT_DEFS += -DOLED_ENABLE | ||
| 34 | endif | ||
| 35 | |||
| 36 | ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) | ||
| 37 | RGBLIGHT_ENABLE = yes | ||
| 38 | else | ||
| 39 | RGBLIGHT_ENABLE = no | ||
| 40 | endif | ||
| 41 | |||
| 42 | ifeq ($(strip $(LED_ANIMATIONS)), yes) | ||
| 43 | # OPT_DEFS += -DRGBLIGHT_ANIMATIONS | ||
| 44 | OPT_DEFS += -DLED_ANIMATIONS | ||
| 45 | endif | ||
| 46 | |||
| 47 | ifeq ($(strip $(IOS_DEVICE_ENABLE)), yes) | ||
| 48 | OPT_DEFS += -DIOS_DEVICE_ENABLE | ||
| 49 | endif | ||
| 50 | |||
| 51 | ifeq ($(strip $(LOCAL_GLCDFONT)), yes) | ||
| 52 | OPT_DEFS += -DLOCAL_GLCDFONT | ||
| 53 | endif | ||
| 54 | |||
| 55 | # ifeq ($(strip $(RHYMESTONE_RIGHTHAND)), yes) | ||
| 56 | # OPT_DEFS += -DRHYMESTONE_RIGHTHAND | ||
| 57 | # endif | ||
| 58 | |||
| 59 | ifeq ($(strip $(ANGELINA_KEYMAP)), yes) | ||
| 60 | OPT_DEFS += -DANGELINA_KEYMAP | ||
| 61 | endif | ||
| 62 | |||
| 63 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 64 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
| 65 | 7 | ||
| 66 | # If you want to change the display of OLED, you need to change here | 8 | # If you want to change the display of OLED, you need to change here |
| 67 | SRC += ./common/oled_helper.c \ | 9 | SRC += ./common/oled_helper.c \ |
diff --git a/keyboards/treadstone48/keymaps/like_jis_rs/config.h b/keyboards/treadstone48/keymaps/like_jis_rs/config.h index e8acd5c76..95b58c23d 100644 --- a/keyboards/treadstone48/keymaps/like_jis_rs/config.h +++ b/keyboards/treadstone48/keymaps/like_jis_rs/config.h | |||
| @@ -1,22 +1,18 @@ | |||
| 1 | /* | 1 | /* Copyright 2020 marksard |
| 2 | This is the c configuration file for the keymap | 2 | * |
| 3 | 3 | * This program is free software: you can redistribute it and/or modify | |
| 4 | Copyright 2012 Jun Wako <wakojun@gmail.com> | 4 | * it under the terms of the GNU General Public License as published by |
| 5 | Copyright 2015 Jack Humbert | 5 | * the Free Software Foundation, either version 2 of the License, or |
| 6 | 6 | * (at your option) any later version. | |
| 7 | This program is free software: you can redistribute it and/or modify | 7 | * |
| 8 | it under the terms of the GNU General Public License as published by | 8 | * This program is distributed in the hope that it will be useful, |
| 9 | the Free Software Foundation, either version 2 of the License, or | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | (at your option) any later version. | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | 11 | * GNU General Public License for more details. | |
| 12 | This program is distributed in the hope that it will be useful, | 12 | * |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | * You should have received a copy of the GNU General Public License |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | GNU General Public License for more details. | 15 | */ |
| 16 | |||
| 17 | You should have received a copy of the GNU General Public License | ||
| 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | */ | ||
| 20 | 16 | ||
| 21 | #pragma once | 17 | #pragma once |
| 22 | 18 | ||
| @@ -46,15 +42,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 46 | #define MOUSEKEY_DELAY 0 | 42 | #define MOUSEKEY_DELAY 0 |
| 47 | #endif | 43 | #endif |
| 48 | 44 | ||
| 49 | // Selection of RGBLIGHT MODE to use. | 45 | // If you use the HashTwenty(alpha), please enable USE_HASHTWENTY |
| 50 | #if defined(LED_ANIMATIONS) | 46 | // #define ANGELINA_KEYMAP |
| 51 | //#define RGBLIGHT_EFFECT_BREATHING | 47 | |
| 52 | #define RGBLIGHT_EFFECT_RAINBOW_MOOD | 48 | // If you plug in the USB on the right side, please enable MASTER_RIGHT |
| 53 | #define RGBLIGHT_EFFECT_RAINBOW_SWIRL | 49 | // #define RHYMESTONE_RIGHTHAND |
| 54 | //#define RGBLIGHT_EFFECT_SNAKE | 50 | |
| 55 | #define RGBLIGHT_EFFECT_KNIGHT | 51 | #define OLED_FONT_H "keyboards/treadstone48/common/glcdfont.c" |
| 56 | //#define RGBLIGHT_EFFECT_CHRISTMAS | ||
| 57 | #define RGBLIGHT_EFFECT_STATIC_GRADIENT | ||
| 58 | //#define RGBLIGHT_EFFECT_RGB_TEST | ||
| 59 | //#define RGBLIGHT_EFFECT_ALTERNATING | ||
| 60 | #endif | ||
diff --git a/keyboards/treadstone48/keymaps/like_jis_rs/keymap.c b/keyboards/treadstone48/keymaps/like_jis_rs/keymap.c index 0e4ec063c..354e40146 100644 --- a/keyboards/treadstone48/keymaps/like_jis_rs/keymap.c +++ b/keyboards/treadstone48/keymaps/like_jis_rs/keymap.c | |||
| @@ -1,9 +1,22 @@ | |||
| 1 | /* Copyright 2020 marksard | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 1 | #include QMK_KEYBOARD_H | 16 | #include QMK_KEYBOARD_H |
| 2 | #include "keymap_jp.h" | 17 | #include "keymap_jp.h" |
| 3 | #include "../common/oled_helper.h" | 18 | #include "../common/oled_helper.h" |
| 4 | 19 | ||
| 5 | extern keymap_config_t keymap_config; | ||
| 6 | |||
| 7 | #ifdef RGBLIGHT_ENABLE | 20 | #ifdef RGBLIGHT_ENABLE |
| 8 | //Following line allows macro to read current RGB settings | 21 | //Following line allows macro to read current RGB settings |
| 9 | extern rgblight_config_t rgblight_config; | 22 | extern rgblight_config_t rgblight_config; |
| @@ -165,7 +178,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 165 | #define L_ADJUST (1<<_ADJUST) | 178 | #define L_ADJUST (1<<_ADJUST) |
| 166 | #define L_ADJUST_TRI (L_ADJUST|L_RAISE|L_LOWER) | 179 | #define L_ADJUST_TRI (L_ADJUST|L_RAISE|L_LOWER) |
| 167 | 180 | ||
| 168 | #ifdef SSD1306OLED | 181 | #ifdef OLED_DRIVER_ENABLE |
| 182 | #include <stdio.h> | ||
| 183 | #include <string.h> | ||
| 184 | |||
| 169 | typedef struct { | 185 | typedef struct { |
| 170 | uint8_t state; | 186 | uint8_t state; |
| 171 | char name[8]; | 187 | char name[8]; |
| @@ -204,18 +220,42 @@ static inline void update_keymap_status(void) { | |||
| 204 | keymap_config.swap_lalt_lgui? "win" : "mac", get_leyer_status()); | 220 | keymap_config.swap_lalt_lgui? "win" : "mac", get_leyer_status()); |
| 205 | } | 221 | } |
| 206 | 222 | ||
| 207 | static inline void render_keymap_status(struct CharacterMatrix *matrix) { | 223 | static inline void render_keymap_status(void) { |
| 208 | 224 | ||
| 209 | matrix_write(matrix, layer_status_buf); | 225 | oled_write(layer_status_buf, false); |
| 210 | } | 226 | } |
| 211 | 227 | ||
| 212 | #define UPDATE_KEYMAP_STATUS() update_keymap_status() | 228 | #define UPDATE_KEYMAP_STATUS() update_keymap_status() |
| 213 | #define RENDER_KEYMAP_STATUS(a) render_keymap_status(a) | 229 | |
| 230 | static inline void render_status(void) { | ||
| 231 | |||
| 232 | UPDATE_LED_STATUS(); | ||
| 233 | RENDER_LED_STATUS(); | ||
| 234 | render_keymap_status(); | ||
| 235 | UPDATE_LOCK_STATUS(); | ||
| 236 | RENDER_LOCK_STATUS(); | ||
| 237 | RENDER_KEY_STATUS(); | ||
| 238 | } | ||
| 239 | |||
| 240 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { | ||
| 241 | |||
| 242 | // if (is_keyboard_master()) | ||
| 243 | // return OLED_ROTATION_180; // flips the display 180 degrees if offhand | ||
| 244 | return rotation; | ||
| 245 | } | ||
| 246 | |||
| 247 | void oled_task_user(void) { | ||
| 248 | |||
| 249 | if (is_keyboard_master()) { | ||
| 250 | render_status(); | ||
| 251 | } else { | ||
| 252 | render_logo(); | ||
| 253 | } | ||
| 254 | } | ||
| 214 | 255 | ||
| 215 | #else | 256 | #else |
| 216 | 257 | ||
| 217 | #define UPDATE_KEYMAP_STATUS() | 258 | #define UPDATE_KEYMAP_STATUS() |
| 218 | #define RENDER_KEYMAP_STATUS(a) | ||
| 219 | 259 | ||
| 220 | #endif | 260 | #endif |
| 221 | 261 | ||
| @@ -263,18 +303,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 263 | } | 303 | } |
| 264 | break; | 304 | break; |
| 265 | #ifdef RGBLIGHT_ENABLE | 305 | #ifdef RGBLIGHT_ENABLE |
| 266 | case RGB_MOD: | ||
| 267 | if (record->event.pressed) { | ||
| 268 | rgblight_mode(RGB_current_mode); | ||
| 269 | rgblight_step(); | ||
| 270 | RGB_current_mode = rgblight_config.mode; | ||
| 271 | } | ||
| 272 | break; | ||
| 273 | case RGBRST: | 306 | case RGBRST: |
| 274 | if (record->event.pressed) { | 307 | if (record->event.pressed) { |
| 275 | eeconfig_update_rgblight_default(); | 308 | eeconfig_update_rgblight_default(); |
| 276 | rgblight_enable(); | 309 | rgblight_enable(); |
| 277 | RGB_current_mode = rgblight_config.mode; | ||
| 278 | } | 310 | } |
| 279 | break; | 311 | break; |
| 280 | #endif | 312 | #endif |
| @@ -286,57 +318,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 286 | UPDATE_KEYMAP_STATUS(); | 318 | UPDATE_KEYMAP_STATUS(); |
| 287 | return result; | 319 | return result; |
| 288 | } | 320 | } |
| 289 | |||
| 290 | void matrix_init_user(void) { | ||
| 291 | #ifdef RGBLIGHT_ENABLE | ||
| 292 | RGB_current_mode = rgblight_config.mode; | ||
| 293 | #endif | ||
| 294 | //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h | ||
| 295 | #ifdef SSD1306OLED | ||
| 296 | iota_gfx_init(!has_usb()); // turns on the display | ||
| 297 | #endif | ||
| 298 | } | ||
| 299 | |||
| 300 | //SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h | ||
| 301 | #ifdef SSD1306OLED | ||
| 302 | |||
| 303 | void matrix_scan_user(void) { | ||
| 304 | iota_gfx_task(); // this is what updates the display continuously | ||
| 305 | } | ||
| 306 | |||
| 307 | static inline void matrix_update(struct CharacterMatrix *dest, | ||
| 308 | const struct CharacterMatrix *source) { | ||
| 309 | if (memcmp(dest->display, source->display, sizeof(dest->display))) { | ||
| 310 | memcpy(dest->display, source->display, sizeof(dest->display)); | ||
| 311 | dest->dirty = true; | ||
| 312 | } | ||
| 313 | } | ||
| 314 | |||
| 315 | static inline void render_status(struct CharacterMatrix *matrix) { | ||
| 316 | |||
| 317 | UPDATE_LED_STATUS(); | ||
| 318 | RENDER_LED_STATUS(matrix); | ||
| 319 | RENDER_KEYMAP_STATUS(matrix); | ||
| 320 | UPDATE_LOCK_STATUS(); | ||
| 321 | RENDER_LOCK_STATUS(matrix); | ||
| 322 | RENDER_KEY_STATUS(matrix); | ||
| 323 | } | ||
| 324 | |||
| 325 | void iota_gfx_task_user(void) { | ||
| 326 | struct CharacterMatrix matrix; | ||
| 327 | |||
| 328 | #if DEBUG_TO_SCREEN | ||
| 329 | if (debug_enable) { | ||
| 330 | return; | ||
| 331 | } | ||
| 332 | #endif | ||
| 333 | |||
| 334 | matrix_clear(&matrix); | ||
| 335 | if (is_master) { | ||
| 336 | render_status(&matrix); | ||
| 337 | } | ||
| 338 | |||
| 339 | matrix_update(&display, &matrix); | ||
| 340 | } | ||
| 341 | |||
| 342 | #endif | ||
diff --git a/keyboards/treadstone48/keymaps/like_jis_rs/readme_jp.md b/keyboards/treadstone48/keymaps/like_jis_rs/readme_jp.md index 5a6fc1d73..d3ce8eb3f 100644 --- a/keyboards/treadstone48/keymaps/like_jis_rs/readme_jp.md +++ b/keyboards/treadstone48/keymaps/like_jis_rs/readme_jp.md | |||
| @@ -4,9 +4,9 @@ | |||
| 4 | 4 | ||
| 5 | デフォルトキーマップの記号類をJISライクな配置に揃えなおしたものです。 | 5 | デフォルトキーマップの記号類をJISライクな配置に揃えなおしたものです。 |
| 6 | オプションのRhymestone用のマップを使用するために拡張しています。RhymestoneのpromicroにもTreadstone48のキーマップを入れてください。 | 6 | オプションのRhymestone用のマップを使用するために拡張しています。RhymestoneのpromicroにもTreadstone48のキーマップを入れてください。 |
| 7 | Rhymestoneは基本的には左手側を使うことを想定していますが、右手側を使用する場合はrules.mkにあるRHYMESTONE_RIGHTHAND設定をyesにすれば使えるようになります。 | 7 | Rhymestoneは基本的には左手側を使うことを想定していますが、右手側を使用する場合はconfig.hの以下の行を有効にしてください。 |
| 8 | 8 | ||
| 9 | ```RHYMESTONE_RIGHTHAND=yes``` | 9 | ```#define RHYMESTONE_RIGHTHAND``` |
| 10 | 10 | ||
| 11 | ## キーマップの見かた | 11 | ## キーマップの見かた |
| 12 | 12 | ||
diff --git a/keyboards/treadstone48/keymaps/like_jis_rs/rules.mk b/keyboards/treadstone48/keymaps/like_jis_rs/rules.mk index c34bb2e34..3f116d190 100644 --- a/keyboards/treadstone48/keymaps/like_jis_rs/rules.mk +++ b/keyboards/treadstone48/keymaps/like_jis_rs/rules.mk | |||
| @@ -1,67 +1,12 @@ | |||
| 1 | 1 | MOUSEKEY_ENABLE = yes # Mouse keys | |
| 2 | # Build Options | ||
| 3 | # change to "no" to disable the options, or define them in the Makefile in | ||
| 4 | # the appropriate keymap folder that will get included automatically | ||
| 5 | # | ||
| 6 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | ||
| 7 | MOUSEKEY_ENABLE = no # Mouse keys(+4700) | ||
| 8 | EXTRAKEY_ENABLE = no # Audio control and System control(+450) | ||
| 9 | CONSOLE_ENABLE = no # Console for debug(+400) | ||
| 10 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
| 11 | NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 12 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
| 13 | MIDI_ENABLE = no # MIDI controls | ||
| 14 | AUDIO_ENABLE = no # Audio output on port C6 | ||
| 15 | UNICODE_ENABLE = no # Unicode | ||
| 16 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 17 | RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | ||
| 18 | SWAP_HANDS_ENABLE = no # Enable one-hand typing | ||
| 19 | TAP_DANCE_ENABLE = yes | 2 | TAP_DANCE_ENABLE = yes |
| 20 | 3 | ||
| 21 | # If your custom treadstone48 pcb, you can rewrite to yes. | 4 | RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow |
| 22 | OLED_ENABLE = no # OLED_ENABLE | 5 | OLED_DRIVER_ENABLE = no |
| 23 | LED_UNDERGLOW_ENABLE = yes # LED underglow (Enable WS2812 RGB underlight.) | 6 | LTO_ENABLE = yes |
| 24 | LED_ANIMATIONS = yes # LED animations | ||
| 25 | |||
| 26 | # Other selectable option | ||
| 27 | IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) | ||
| 28 | LOCAL_GLCDFONT = no # use each keymaps "font.h" insted of "common/glcdfont.c" | ||
| 29 | RHYMESTONE_RIGHTHAND = no # If connect right hand side of the Rhymestone, set to yes. | ||
| 30 | ANGELINA_KEYMAP = no # If Alfa verstion use set to yes. | ||
| 31 | |||
| 32 | ifeq ($(strip $(OLED_ENABLE)), yes) | ||
| 33 | OPT_DEFS += -DOLED_ENABLE | ||
| 34 | endif | ||
| 35 | |||
| 36 | ifeq ($(strip $(LED_UNDERGLOW_ENABLE)), yes) | ||
| 37 | RGBLIGHT_ENABLE = yes | ||
| 38 | else | ||
| 39 | RGBLIGHT_ENABLE = no | ||
| 40 | endif | ||
| 41 | |||
| 42 | ifeq ($(strip $(LED_ANIMATIONS)), yes) | ||
| 43 | # OPT_DEFS += -DRGBLIGHT_ANIMATIONS | ||
| 44 | OPT_DEFS += -DLED_ANIMATIONS | ||
| 45 | endif | ||
| 46 | |||
| 47 | ifeq ($(strip $(IOS_DEVICE_ENABLE)), yes) | ||
| 48 | OPT_DEFS += -DIOS_DEVICE_ENABLE | ||
| 49 | endif | ||
| 50 | |||
| 51 | ifeq ($(strip $(LOCAL_GLCDFONT)), yes) | ||
| 52 | OPT_DEFS += -DLOCAL_GLCDFONT | ||
| 53 | endif | ||
| 54 | |||
| 55 | ifeq ($(strip $(RHYMESTONE_RIGHTHAND)), yes) | ||
| 56 | OPT_DEFS += -DRHYMESTONE_RIGHTHAND | ||
| 57 | endif | ||
| 58 | |||
| 59 | ifeq ($(strip $(ANGELINA_KEYMAP)), yes) | ||
| 60 | OPT_DEFS += -DANGELINA_KEYMAP | ||
| 61 | endif | ||
| 62 | 7 | ||
| 63 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | 8 | # If you use connection the Rhymestone, please enable RS_EXTRA_LED |
| 64 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | 9 | OPT_DEFS += -DRS_EXTRA_LED |
| 65 | 10 | ||
| 66 | # If you want to change the display of OLED, you need to change here | 11 | # If you want to change the display of OLED, you need to change here |
| 67 | SRC += ./common/oled_helper.c \ | 12 | SRC += ./common/oled_helper.c \ |
diff --git a/keyboards/treadstone48/rev1/config.h b/keyboards/treadstone48/rev1/config.h index a46951c71..56ffbaef0 100644 --- a/keyboards/treadstone48/rev1/config.h +++ b/keyboards/treadstone48/rev1/config.h | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | 2 | Copyright 2020 marksard |
| 3 | Copyright 2015 Jack Humbert | ||
| 4 | 3 | ||
| 5 | This program is free software: you can redistribute it and/or modify | 4 | This program is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
| @@ -16,8 +15,9 @@ You should have received a copy of the GNU General Public License | |||
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ | 16 | */ |
| 18 | 17 | ||
| 19 | #ifndef REV1_CONFIG_H | 18 | #pragma once |
| 20 | #define REV1_CONFIG_H | 19 | |
| 20 | #include "config_common.h" | ||
| 21 | 21 | ||
| 22 | /* USB Device descriptor parameter */ | 22 | /* USB Device descriptor parameter */ |
| 23 | #define VENDOR_ID 0xFEED | 23 | #define VENDOR_ID 0xFEED |
| @@ -27,83 +27,159 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 27 | #define PRODUCT treadstone48 | 27 | #define PRODUCT treadstone48 |
| 28 | #define DESCRIPTION Symmetrical staggered 47+1 Keys Keyboard | 28 | #define DESCRIPTION Symmetrical staggered 47+1 Keys Keyboard |
| 29 | 29 | ||
| 30 | #define TAPPING_FORCE_HOLD | ||
| 31 | #define TAPPING_TERM 150 | ||
| 32 | |||
| 33 | /* Use I2C or Serial */ | ||
| 34 | #define USE_I2C | ||
| 35 | #define USE_SERIAL | ||
| 36 | //#define USE_MATRIX_I2C | ||
| 37 | |||
| 38 | /* Select hand configuration */ | ||
| 39 | #define MASTER_LEFT | ||
| 40 | // #define MASTER_RIGHT | ||
| 41 | // #define EE_HANDS | ||
| 42 | |||
| 43 | // OLED support | ||
| 44 | // see ./rules.mk: OLED_ENABLE=yes or no | ||
| 45 | #ifdef OLED_ENABLE | ||
| 46 | #define SSD1306OLED | ||
| 47 | #endif | ||
| 48 | |||
| 49 | /* key matrix size */ | 30 | /* key matrix size */ |
| 50 | // Rows are doubled-up | ||
| 51 | #define MATRIX_ROWS 16 | 31 | #define MATRIX_ROWS 16 |
| 52 | #define MATRIX_ROW_PINS { F4, F5, F6, F7, B1, B3, B2, B6 } | ||
| 53 | |||
| 54 | // wiring of each half | ||
| 55 | #define MATRIX_COLS 6 | 32 | #define MATRIX_COLS 6 |
| 33 | |||
| 34 | /* | ||
| 35 | * Keyboard Matrix Assignments | ||
| 36 | * | ||
| 37 | * Change this to how you wired your keyboard | ||
| 38 | * COLS: AVR pins used for columns, left to right | ||
| 39 | * ROWS: AVR pins used for rows, top to bottom | ||
| 40 | * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) | ||
| 41 | * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) | ||
| 42 | * | ||
| 43 | */ | ||
| 44 | #define MATRIX_ROW_PINS { F4, F5, F6, F7, B1, B3, B2, B6 } | ||
| 56 | #define MATRIX_COL_PINS { D4, C6, D7, E6, B4, B5 } | 45 | #define MATRIX_COL_PINS { D4, C6, D7, E6, B4, B5 } |
| 46 | #define UNUSED_PINS | ||
| 57 | 47 | ||
| 58 | /* define if matrix has ghost */ | 48 | /* COL2ROW, ROW2COL*/ |
| 59 | //#define MATRIX_HAS_GHOST | 49 | #define DIODE_DIRECTION COL2ROW |
| 60 | 50 | ||
| 61 | /* number of backlight levels */ | 51 | /* |
| 52 | * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN. | ||
| 53 | */ | ||
| 54 | #define SOFT_SERIAL_PIN D2 // or D1, D2, D3, E6 | ||
| 55 | |||
| 56 | // #define BACKLIGHT_PIN B7 | ||
| 57 | // #define BACKLIGHT_BREATHING | ||
| 62 | // #define BACKLIGHT_LEVELS 3 | 58 | // #define BACKLIGHT_LEVELS 3 |
| 63 | 59 | ||
| 64 | /* Set 0 if debouncing isn't needed */ | 60 | #define RGB_DI_PIN D3 |
| 61 | #ifdef RGB_DI_PIN | ||
| 62 | #ifndef RS_EXTRA_LED | ||
| 63 | #define RGBLED_NUM 12 | ||
| 64 | #define RGBLED_SPLIT {12, 0} | ||
| 65 | #else | ||
| 66 | #define RGBLED_NUM 32 | ||
| 67 | #define RGBLED_SPLIT {12, 20} | ||
| 68 | #endif | ||
| 69 | #define RGBLIGHT_HUE_STEP 8 | ||
| 70 | #define RGBLIGHT_SAT_STEP 8 | ||
| 71 | #define RGBLIGHT_VAL_STEP 8 | ||
| 72 | #define RGBLIGHT_LIMIT_VAL 180 /* The maximum brightness level */ | ||
| 73 | #define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ | ||
| 74 | /*== all animations enable ==*/ | ||
| 75 | // #define RGBLIGHT_ANIMATIONS | ||
| 76 | /*== or choose animations ==*/ | ||
| 77 | // #define RGBLIGHT_EFFECT_BREATHING | ||
| 78 | #define RGBLIGHT_EFFECT_RAINBOW_MOOD | ||
| 79 | #define RGBLIGHT_EFFECT_RAINBOW_SWIRL | ||
| 80 | // #define RGBLIGHT_EFFECT_SNAKE | ||
| 81 | #define RGBLIGHT_EFFECT_KNIGHT | ||
| 82 | // #define RGBLIGHT_EFFECT_CHRISTMAS | ||
| 83 | #define RGBLIGHT_EFFECT_STATIC_GRADIENT | ||
| 84 | // #define RGBLIGHT_EFFECT_RGB_TEST | ||
| 85 | // #define RGBLIGHT_EFFECT_ALTERNATING | ||
| 86 | /*== customize breathing effect ==*/ | ||
| 87 | /*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/ | ||
| 88 | #define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64 | ||
| 89 | /*==== use exp() and sin() ====*/ | ||
| 90 | #define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7 | ||
| 91 | #define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255 | ||
| 92 | #endif | ||
| 93 | |||
| 94 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | ||
| 65 | #define DEBOUNCE 5 | 95 | #define DEBOUNCE 5 |
| 66 | 96 | ||
| 97 | /* define if matrix has ghost (lacks anti-ghosting diodes) */ | ||
| 98 | //#define MATRIX_HAS_GHOST | ||
| 99 | |||
| 67 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | 100 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ |
| 68 | //#define LOCKING_SUPPORT_ENABLE | 101 | #define LOCKING_SUPPORT_ENABLE |
| 69 | /* Locking resynchronize hack */ | 102 | /* Locking resynchronize hack */ |
| 70 | //#define LOCKING_RESYNC_ENABLE | 103 | #define LOCKING_RESYNC_ENABLE |
| 71 | 104 | ||
| 72 | /* ws2812 RGB LED */ | 105 | /* If defined, GRAVE_ESC will always act as ESC when CTRL is held. |
| 73 | #define RGB_DI_PIN D3 | 106 | * This is userful for the Windows task manager shortcut (ctrl+shift+esc). |
| 74 | #define RGBLIGHT_TIMER | 107 | */ |
| 75 | //#define RGBLED_NUM 12 // Number of LEDs. see ./keymaps/default/config.h | 108 | // #define GRAVE_ESC_CTRL_OVERRIDE |
| 76 | #define ws2812_PORTREG PORTD | 109 | |
| 77 | #define ws2812_DDRREG DDRD | 110 | /* |
| 78 | 111 | * Force NKRO | |
| 79 | // treadstone48 keyboard RGB LED support | 112 | * |
| 80 | //#define RGBLIGHT_ANIMATIONS : see ./rules.mk: LED_ANIMATIONS = yes or no | 113 | * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved |
| 81 | // see ./rules.mk: LED_BACK_ENABLE or LED_UNDERGLOW_ENABLE set yes | 114 | * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the |
| 82 | #define RGBLED_NUM 12 | 115 | * makefile for this to work.) |
| 83 | 116 | * | |
| 84 | #ifndef IOS_DEVICE_ENABLE | 117 | * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) |
| 85 | #define RGBLIGHT_LIMIT_VAL 180 | 118 | * until the next keyboard reset. |
| 86 | #define RGBLIGHT_VAL_STEP 17 | 119 | * |
| 87 | #else | 120 | * NKRO may prevent your keystrokes from being detected in the BIOS, but it is |
| 88 | #define RGBLIGHT_LIMIT_VAL 50 | 121 | * fully operational during normal computer usage. |
| 89 | #define RGBLIGHT_VAL_STEP 4 | 122 | * |
| 90 | #endif | 123 | * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) |
| 91 | #define RGBLIGHT_HUE_STEP 10 | 124 | * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by |
| 92 | #define RGBLIGHT_SAT_STEP 17 | 125 | * bootmagic, NKRO mode will always be enabled until it is toggled again during a |
| 93 | 126 | * power-up. | |
| 94 | #if defined(RGBLIGHT_ENABLE) && !defined(IOS_DEVICE_ENABLE) | 127 | * |
| 95 | // USB_MAX_POWER_CONSUMPTION value for treadstone48 keyboard | 128 | */ |
| 96 | // 120 RGBoff, OLEDoff | 129 | //#define FORCE_NKRO |
| 97 | // 120 OLED | 130 | |
| 98 | // 330 RGB 6 | 131 | /* |
| 99 | // 300 RGB 32 | 132 | * Magic Key Options |
| 100 | // 310 OLED & RGB 32 | 133 | * |
| 101 | #define USB_MAX_POWER_CONSUMPTION 400 | 134 | * Magic keys are hotkey commands that allow control over firmware functions of |
| 102 | #else | 135 | * the keyboard. They are best used in combination with the HID Listen program, |
| 103 | // fix iPhone and iPad power adapter issue | 136 | * found here: https://www.pjrc.com/teensy/hid_listen.html |
| 104 | // iOS device need lessthan 100 | 137 | * |
| 105 | #define USB_MAX_POWER_CONSUMPTION 100 | 138 | * The options below allow the magic key functionality to be changed. This is |
| 106 | #endif | 139 | * useful if your keyboard/keypad is missing keys and you want magic key support. |
| 140 | * | ||
| 141 | */ | ||
| 142 | |||
| 143 | /* key combination for magic key command */ | ||
| 144 | /* defined by default; to change, uncomment and set to the combination you want */ | ||
| 145 | // #define IS_COMMAND() (get_mods() == MOD_MASK_SHIFT) | ||
| 146 | |||
| 147 | /* control how magic key switches layers */ | ||
| 148 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true | ||
| 149 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true | ||
| 150 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false | ||
| 151 | |||
| 152 | /* override magic key keymap */ | ||
| 153 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS | ||
| 154 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS | ||
| 155 | //#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM | ||
| 156 | //#define MAGIC_KEY_HELP H | ||
| 157 | //#define MAGIC_KEY_HELP_ALT SLASH | ||
| 158 | //#define MAGIC_KEY_DEBUG D | ||
| 159 | //#define MAGIC_KEY_DEBUG_MATRIX X | ||
| 160 | //#define MAGIC_KEY_DEBUG_KBD K | ||
| 161 | //#define MAGIC_KEY_DEBUG_MOUSE M | ||
| 162 | //#define MAGIC_KEY_VERSION V | ||
| 163 | //#define MAGIC_KEY_STATUS S | ||
| 164 | //#define MAGIC_KEY_CONSOLE C | ||
| 165 | //#define MAGIC_KEY_LAYER0 0 | ||
| 166 | //#define MAGIC_KEY_LAYER0_ALT GRAVE | ||
| 167 | //#define MAGIC_KEY_LAYER1 1 | ||
| 168 | //#define MAGIC_KEY_LAYER2 2 | ||
| 169 | //#define MAGIC_KEY_LAYER3 3 | ||
| 170 | //#define MAGIC_KEY_LAYER4 4 | ||
| 171 | //#define MAGIC_KEY_LAYER5 5 | ||
| 172 | //#define MAGIC_KEY_LAYER6 6 | ||
| 173 | //#define MAGIC_KEY_LAYER7 7 | ||
| 174 | //#define MAGIC_KEY_LAYER8 8 | ||
| 175 | //#define MAGIC_KEY_LAYER9 9 | ||
| 176 | //#define MAGIC_KEY_BOOTLOADER B | ||
| 177 | //#define MAGIC_KEY_BOOTLOADER_ALT ESC | ||
| 178 | //#define MAGIC_KEY_LOCK CAPS | ||
| 179 | //#define MAGIC_KEY_EEPROM E | ||
| 180 | //#define MAGIC_KEY_EEPROM_CLEAR BSPACE | ||
| 181 | //#define MAGIC_KEY_NKRO N | ||
| 182 | //#define MAGIC_KEY_SLEEP_LED Z | ||
| 107 | 183 | ||
| 108 | /* | 184 | /* |
| 109 | * Feature disable options | 185 | * Feature disable options |
| @@ -111,17 +187,72 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 111 | */ | 187 | */ |
| 112 | 188 | ||
| 113 | /* disable debug print */ | 189 | /* disable debug print */ |
| 114 | // #define NO_DEBUG | 190 | //#define NO_DEBUG |
| 115 | 191 | ||
| 116 | /* disable print */ | 192 | /* disable print */ |
| 117 | // #define NO_PRINT | 193 | //#define NO_PRINT |
| 118 | 194 | ||
| 119 | /* disable action features */ | 195 | /* disable action features */ |
| 120 | //#define NO_ACTION_LAYER | 196 | //#define NO_ACTION_LAYER |
| 121 | //#define NO_ACTION_TAPPING | 197 | //#define NO_ACTION_TAPPING |
| 122 | //#define NO_ACTION_ONESHOT | 198 | //#define NO_ACTION_ONESHOT |
| 123 | //#define NO_ACTION_MACRO | ||
| 124 | //#define NO_ACTION_FUNCTION | ||
| 125 | 199 | ||
| 200 | /* disable these deprecated features by default */ | ||
| 201 | #ifndef LINK_TIME_OPTIMIZATION_ENABLE | ||
| 202 | #define NO_ACTION_MACRO | ||
| 203 | #define NO_ACTION_FUNCTION | ||
| 204 | #endif | ||
| 205 | /* | ||
| 206 | * MIDI options | ||
| 207 | */ | ||
| 208 | |||
| 209 | /* Prevent use of disabled MIDI features in the keymap */ | ||
| 210 | //#define MIDI_ENABLE_STRICT 1 | ||
| 126 | 211 | ||
| 212 | /* enable basic MIDI features: | ||
| 213 | - MIDI notes can be sent when in Music mode is on | ||
| 214 | */ | ||
| 215 | //#define MIDI_BASIC | ||
| 216 | |||
| 217 | /* enable advanced MIDI features: | ||
| 218 | - MIDI notes can be added to the keymap | ||
| 219 | - Octave shift and transpose | ||
| 220 | - Virtual sustain, portamento, and modulation wheel | ||
| 221 | - etc. | ||
| 222 | */ | ||
| 223 | //#define MIDI_ADVANCED | ||
| 224 | |||
| 225 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
| 226 | //#define MIDI_TONE_KEYCODE_OCTAVES 1 | ||
| 227 | |||
| 228 | /* | ||
| 229 | * HD44780 LCD Display Configuration | ||
| 230 | */ | ||
| 231 | /* | ||
| 232 | #define LCD_LINES 2 //< number of visible lines of the display | ||
| 233 | #define LCD_DISP_LENGTH 16 //< visibles characters per line of the display | ||
| 234 | |||
| 235 | #define LCD_IO_MODE 1 //< 0: memory mapped mode, 1: IO port mode | ||
| 236 | |||
| 237 | #if LCD_IO_MODE | ||
| 238 | #define LCD_PORT PORTB //< port for the LCD lines | ||
| 239 | #define LCD_DATA0_PORT LCD_PORT //< port for 4bit data bit 0 | ||
| 240 | #define LCD_DATA1_PORT LCD_PORT //< port for 4bit data bit 1 | ||
| 241 | #define LCD_DATA2_PORT LCD_PORT //< port for 4bit data bit 2 | ||
| 242 | #define LCD_DATA3_PORT LCD_PORT //< port for 4bit data bit 3 | ||
| 243 | #define LCD_DATA0_PIN 4 //< pin for 4bit data bit 0 | ||
| 244 | #define LCD_DATA1_PIN 5 //< pin for 4bit data bit 1 | ||
| 245 | #define LCD_DATA2_PIN 6 //< pin for 4bit data bit 2 | ||
| 246 | #define LCD_DATA3_PIN 7 //< pin for 4bit data bit 3 | ||
| 247 | #define LCD_RS_PORT LCD_PORT //< port for RS line | ||
| 248 | #define LCD_RS_PIN 3 //< pin for RS line | ||
| 249 | #define LCD_RW_PORT LCD_PORT //< port for RW line | ||
| 250 | #define LCD_RW_PIN 2 //< pin for RW line | ||
| 251 | #define LCD_E_PORT LCD_PORT //< port for Enable line | ||
| 252 | #define LCD_E_PIN 1 //< pin for Enable line | ||
| 127 | #endif | 253 | #endif |
| 254 | */ | ||
| 255 | |||
| 256 | /* Bootmagic Lite key configuration */ | ||
| 257 | // #define BOOTMAGIC_LITE_ROW 0 | ||
| 258 | // #define BOOTMAGIC_LITE_COLUMN 0 | ||
diff --git a/keyboards/treadstone48/rev1/matrix.c b/keyboards/treadstone48/rev1/matrix.c deleted file mode 100644 index 8685a8125..000000000 --- a/keyboards/treadstone48/rev1/matrix.c +++ /dev/null | |||
| @@ -1,357 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | /* | ||
| 19 | * scan matrix | ||
| 20 | */ | ||
| 21 | #include <stdint.h> | ||
| 22 | #include <stdbool.h> | ||
| 23 | #include <string.h> | ||
| 24 | #include <avr/io.h> | ||
| 25 | #include <avr/wdt.h> | ||
| 26 | #include <avr/interrupt.h> | ||
| 27 | #include <util/delay.h> | ||
| 28 | #include "print.h" | ||
| 29 | #include "debug.h" | ||
| 30 | #include "util.h" | ||
| 31 | #include "matrix.h" | ||
| 32 | #include "split_util.h" | ||
| 33 | #include "pro_micro.h" | ||
| 34 | |||
| 35 | #ifdef USE_MATRIX_I2C | ||
| 36 | # include "i2c.h" | ||
| 37 | #else // USE_SERIAL | ||
| 38 | # include "split_scomm.h" | ||
| 39 | #endif | ||
| 40 | |||
| 41 | #ifndef DEBOUNCE | ||
| 42 | # define DEBOUNCE 5 | ||
| 43 | #endif | ||
| 44 | |||
| 45 | #define ERROR_DISCONNECT_COUNT 5 | ||
| 46 | |||
| 47 | static uint8_t debouncing = DEBOUNCE; | ||
| 48 | static const int ROWS_PER_HAND = MATRIX_ROWS/2; | ||
| 49 | static uint8_t error_count = 0; | ||
| 50 | uint8_t is_master = 0 ; | ||
| 51 | |||
| 52 | static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; | ||
| 53 | static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; | ||
| 54 | |||
| 55 | /* matrix state(1:on, 0:off) */ | ||
| 56 | static matrix_row_t matrix[MATRIX_ROWS]; | ||
| 57 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | ||
| 58 | |||
| 59 | static matrix_row_t read_cols(void); | ||
| 60 | static void init_cols(void); | ||
| 61 | static void unselect_rows(void); | ||
| 62 | static void select_row(uint8_t row); | ||
| 63 | static uint8_t matrix_master_scan(void); | ||
| 64 | |||
| 65 | |||
| 66 | __attribute__ ((weak)) | ||
| 67 | void matrix_init_kb(void) { | ||
| 68 | matrix_init_user(); | ||
| 69 | } | ||
| 70 | |||
| 71 | __attribute__ ((weak)) | ||
| 72 | void matrix_scan_kb(void) { | ||
| 73 | matrix_scan_user(); | ||
| 74 | } | ||
| 75 | |||
| 76 | __attribute__ ((weak)) | ||
| 77 | void matrix_init_user(void) { | ||
| 78 | } | ||
| 79 | |||
| 80 | __attribute__ ((weak)) | ||
| 81 | void matrix_scan_user(void) { | ||
| 82 | } | ||
| 83 | |||
| 84 | inline | ||
| 85 | uint8_t matrix_rows(void) | ||
| 86 | { | ||
| 87 | return MATRIX_ROWS; | ||
| 88 | } | ||
| 89 | |||
| 90 | inline | ||
| 91 | uint8_t matrix_cols(void) | ||
| 92 | { | ||
| 93 | return MATRIX_COLS; | ||
| 94 | } | ||
| 95 | |||
| 96 | void matrix_init(void) | ||
| 97 | { | ||
| 98 | debug_enable = true; | ||
| 99 | debug_matrix = true; | ||
| 100 | debug_mouse = true; | ||
| 101 | // initialize row and col | ||
| 102 | unselect_rows(); | ||
| 103 | init_cols(); | ||
| 104 | |||
| 105 | TX_RX_LED_INIT; | ||
| 106 | TXLED0; | ||
| 107 | RXLED0; | ||
| 108 | |||
| 109 | // initialize matrix state: all keys off | ||
| 110 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { | ||
| 111 | matrix[i] = 0; | ||
| 112 | matrix_debouncing[i] = 0; | ||
| 113 | } | ||
| 114 | |||
| 115 | is_master = has_usb(); | ||
| 116 | |||
| 117 | matrix_init_quantum(); | ||
| 118 | } | ||
| 119 | |||
| 120 | uint8_t _matrix_scan(void) | ||
| 121 | { | ||
| 122 | // Right hand is stored after the left in the matirx so, we need to offset it | ||
| 123 | int offset = isLeftHand ? 0 : (ROWS_PER_HAND); | ||
| 124 | |||
| 125 | for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { | ||
| 126 | select_row(i); | ||
| 127 | _delay_us(30); // without this wait read unstable value. | ||
| 128 | matrix_row_t cols = read_cols(); | ||
| 129 | if (matrix_debouncing[i+offset] != cols) { | ||
| 130 | matrix_debouncing[i+offset] = cols; | ||
| 131 | debouncing = DEBOUNCE; | ||
| 132 | } | ||
| 133 | unselect_rows(); | ||
| 134 | } | ||
| 135 | |||
| 136 | if (debouncing) { | ||
| 137 | if (--debouncing) { | ||
| 138 | _delay_ms(1); | ||
| 139 | } else { | ||
| 140 | for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { | ||
| 141 | matrix[i+offset] = matrix_debouncing[i+offset]; | ||
| 142 | } | ||
| 143 | } | ||
| 144 | } | ||
| 145 | |||
| 146 | return 1; | ||
| 147 | } | ||
| 148 | |||
| 149 | #ifdef USE_MATRIX_I2C | ||
| 150 | |||
| 151 | // Get rows from other half over i2c | ||
| 152 | int i2c_transaction(void) { | ||
| 153 | int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; | ||
| 154 | |||
| 155 | int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE); | ||
| 156 | if (err) goto i2c_error; | ||
| 157 | |||
| 158 | // start of matrix stored at 0x00 | ||
| 159 | err = i2c_master_write(0x00); | ||
| 160 | if (err) goto i2c_error; | ||
| 161 | |||
| 162 | // Start read | ||
| 163 | err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ); | ||
| 164 | if (err) goto i2c_error; | ||
| 165 | |||
| 166 | if (!err) { | ||
| 167 | int i; | ||
| 168 | for (i = 0; i < ROWS_PER_HAND-1; ++i) { | ||
| 169 | matrix[slaveOffset+i] = i2c_master_read(I2C_ACK); | ||
| 170 | } | ||
| 171 | matrix[slaveOffset+i] = i2c_master_read(I2C_NACK); | ||
| 172 | i2c_master_stop(); | ||
| 173 | } else { | ||
| 174 | i2c_error: // the cable is disconnceted, or something else went wrong | ||
| 175 | i2c_reset_state(); | ||
| 176 | return err; | ||
| 177 | } | ||
| 178 | |||
| 179 | return 0; | ||
| 180 | } | ||
| 181 | |||
| 182 | #else // USE_SERIAL | ||
| 183 | |||
| 184 | int serial_transaction(int master_changed) { | ||
| 185 | int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; | ||
| 186 | #ifdef SERIAL_USE_MULTI_TRANSACTION | ||
| 187 | int ret=serial_update_buffers(master_changed); | ||
| 188 | #else | ||
| 189 | int ret=serial_update_buffers(); | ||
| 190 | #endif | ||
| 191 | if (ret ) { | ||
| 192 | if(ret==2) RXLED1; | ||
| 193 | return 1; | ||
| 194 | } | ||
| 195 | RXLED0; | ||
| 196 | memcpy(&matrix[slaveOffset], | ||
| 197 | (void *)serial_slave_buffer, sizeof(serial_slave_buffer)); | ||
| 198 | return 0; | ||
| 199 | } | ||
| 200 | #endif | ||
| 201 | |||
| 202 | uint8_t matrix_scan(void) | ||
| 203 | { | ||
| 204 | if (is_master) { | ||
| 205 | matrix_master_scan(); | ||
| 206 | }else{ | ||
| 207 | matrix_slave_scan(); | ||
| 208 | int offset = (isLeftHand) ? ROWS_PER_HAND : 0; | ||
| 209 | memcpy(&matrix[offset], | ||
| 210 | (void *)serial_master_buffer, sizeof(serial_master_buffer)); | ||
| 211 | matrix_scan_quantum(); | ||
| 212 | } | ||
| 213 | return 1; | ||
| 214 | } | ||
| 215 | |||
| 216 | |||
| 217 | uint8_t matrix_master_scan(void) { | ||
| 218 | |||
| 219 | int ret = _matrix_scan(); | ||
| 220 | int mchanged = 1; | ||
| 221 | |||
| 222 | int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; | ||
| 223 | |||
| 224 | #ifdef USE_MATRIX_I2C | ||
| 225 | // for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 226 | /* i2c_slave_buffer[i] = matrix[offset+i]; */ | ||
| 227 | // i2c_slave_buffer[i] = matrix[offset+i]; | ||
| 228 | // } | ||
| 229 | #else // USE_SERIAL | ||
| 230 | #ifdef SERIAL_USE_MULTI_TRANSACTION | ||
| 231 | mchanged = memcmp((void *)serial_master_buffer, | ||
| 232 | &matrix[offset], sizeof(serial_master_buffer)); | ||
| 233 | #endif | ||
| 234 | memcpy((void *)serial_master_buffer, | ||
| 235 | &matrix[offset], sizeof(serial_master_buffer)); | ||
| 236 | #endif | ||
| 237 | |||
| 238 | #ifdef USE_MATRIX_I2C | ||
| 239 | if( i2c_transaction() ) { | ||
| 240 | #else // USE_SERIAL | ||
| 241 | if( serial_transaction(mchanged) ) { | ||
| 242 | #endif | ||
| 243 | // turn on the indicator led when halves are disconnected | ||
| 244 | TXLED1; | ||
| 245 | |||
| 246 | error_count++; | ||
| 247 | |||
| 248 | if (error_count > ERROR_DISCONNECT_COUNT) { | ||
| 249 | // reset other half if disconnected | ||
| 250 | int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; | ||
| 251 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 252 | matrix[slaveOffset+i] = 0; | ||
| 253 | } | ||
| 254 | } | ||
| 255 | } else { | ||
| 256 | // turn off the indicator led on no error | ||
| 257 | TXLED0; | ||
| 258 | error_count = 0; | ||
| 259 | } | ||
| 260 | matrix_scan_quantum(); | ||
| 261 | return ret; | ||
| 262 | } | ||
| 263 | |||
| 264 | void matrix_slave_scan(void) { | ||
| 265 | _matrix_scan(); | ||
| 266 | |||
| 267 | int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; | ||
| 268 | |||
| 269 | #ifdef USE_MATRIX_I2C | ||
| 270 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 271 | /* i2c_slave_buffer[i] = matrix[offset+i]; */ | ||
| 272 | i2c_slave_buffer[i] = matrix[offset+i]; | ||
| 273 | } | ||
| 274 | #else // USE_SERIAL | ||
| 275 | #ifdef SERIAL_USE_MULTI_TRANSACTION | ||
| 276 | int change = 0; | ||
| 277 | #endif | ||
| 278 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 279 | #ifdef SERIAL_USE_MULTI_TRANSACTION | ||
| 280 | if( serial_slave_buffer[i] != matrix[offset+i] ) | ||
| 281 | change = 1; | ||
| 282 | #endif | ||
| 283 | serial_slave_buffer[i] = matrix[offset+i]; | ||
| 284 | } | ||
| 285 | #ifdef SERIAL_USE_MULTI_TRANSACTION | ||
| 286 | slave_buffer_change_count += change; | ||
| 287 | #endif | ||
| 288 | #endif | ||
| 289 | } | ||
| 290 | |||
| 291 | bool matrix_is_modified(void) | ||
| 292 | { | ||
| 293 | if (debouncing) return false; | ||
| 294 | return true; | ||
| 295 | } | ||
| 296 | |||
| 297 | inline | ||
| 298 | bool matrix_is_on(uint8_t row, uint8_t col) | ||
| 299 | { | ||
| 300 | return (matrix[row] & ((matrix_row_t)1<<col)); | ||
| 301 | } | ||
| 302 | |||
| 303 | inline | ||
| 304 | matrix_row_t matrix_get_row(uint8_t row) | ||
| 305 | { | ||
| 306 | return matrix[row]; | ||
| 307 | } | ||
| 308 | |||
| 309 | void matrix_print(void) | ||
| 310 | { | ||
| 311 | print("\nr/c 0123456789ABCDEF\n"); | ||
| 312 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
| 313 | phex(row); print(": "); | ||
| 314 | pbin_reverse16(matrix_get_row(row)); | ||
| 315 | print("\n"); | ||
| 316 | } | ||
| 317 | } | ||
| 318 | |||
| 319 | uint8_t matrix_key_count(void) | ||
| 320 | { | ||
| 321 | uint8_t count = 0; | ||
| 322 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
| 323 | count += bitpop16(matrix[i]); | ||
| 324 | } | ||
| 325 | return count; | ||
| 326 | } | ||
| 327 | |||
| 328 | static void init_cols(void) | ||
| 329 | { | ||
| 330 | for(int x = 0; x < MATRIX_COLS; x++) { | ||
| 331 | _SFR_IO8((col_pins[x] >> 4) + 1) &= ~_BV(col_pins[x] & 0xF); | ||
| 332 | _SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF); | ||
| 333 | } | ||
| 334 | } | ||
| 335 | |||
| 336 | static matrix_row_t read_cols(void) | ||
| 337 | { | ||
| 338 | matrix_row_t result = 0; | ||
| 339 | for(int x = 0; x < MATRIX_COLS; x++) { | ||
| 340 | result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x); | ||
| 341 | } | ||
| 342 | return result; | ||
| 343 | } | ||
| 344 | |||
| 345 | static void unselect_rows(void) | ||
| 346 | { | ||
| 347 | for(int x = 0; x < ROWS_PER_HAND; x++) { | ||
| 348 | _SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF); | ||
| 349 | _SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF); | ||
| 350 | } | ||
| 351 | } | ||
| 352 | |||
| 353 | static void select_row(uint8_t row) | ||
| 354 | { | ||
| 355 | _SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF); | ||
| 356 | _SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF); | ||
| 357 | } | ||
diff --git a/keyboards/treadstone48/rev1/rev1.c b/keyboards/treadstone48/rev1/rev1.c index 263786427..3daa3e8e8 100644 --- a/keyboards/treadstone48/rev1/rev1.c +++ b/keyboards/treadstone48/rev1/rev1.c | |||
| @@ -1,15 +1,17 @@ | |||
| 1 | #include "treadstone48.h" | 1 | /* Copyright 2020 marksard |
| 2 | 2 | * | |
| 3 | 3 | * This program is free software: you can redistribute it and/or modify | |
| 4 | #ifdef SSD1306OLED | 4 | * it under the terms of the GNU General Public License as published by |
| 5 | void led_set_kb(uint8_t usb_led) { | 5 | * the Free Software Foundation, either version 2 of the License, or |
| 6 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here | 6 | * (at your option) any later version. |
| 7 | //led_set_user(usb_led); | 7 | * |
| 8 | } | 8 | * This program is distributed in the hope that it will be useful, |
| 9 | #endif | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 11 | void matrix_init_kb(void) { | 11 | * GNU General Public License for more details. |
| 12 | 12 | * | |
| 13 | matrix_init_user(); | 13 | * You should have received a copy of the GNU General Public License |
| 14 | }; | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | ||
| 15 | 16 | ||
| 17 | #include "rev1.h" | ||
diff --git a/keyboards/treadstone48/rev1/rev1.h b/keyboards/treadstone48/rev1/rev1.h index 16ab2d716..9a66d855d 100644 --- a/keyboards/treadstone48/rev1/rev1.h +++ b/keyboards/treadstone48/rev1/rev1.h | |||
| @@ -1,22 +1,31 @@ | |||
| 1 | #ifndef REV1_H | 1 | /* Copyright 2020 marksard |
| 2 | #define REV1_CONFIG_H | 2 | * |
| 3 | 3 | * This program is free software: you can redistribute it and/or modify | |
| 4 | #include "../treadstone48.h" | 4 | * it under the terms of the GNU General Public License as published by |
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 5 | 18 | ||
| 6 | #include "quantum.h" | 19 | #include "quantum.h" |
| 7 | 20 | ||
| 8 | #ifdef RGBLIGHT_ENABLE | 21 | /* This is a shortcut to help you visually see your layout. |
| 9 | //rgb led driver | 22 | * |
| 10 | #include "ws2812.h" | 23 | * The first section contains all of the arguments representing the physical |
| 11 | #endif | 24 | * layout of the board and position of the keys. |
| 12 | 25 | * | |
| 13 | #ifdef USE_I2C | 26 | * The second converts the arguments into a two-dimensional array which |
| 14 | #include <stddef.h> | 27 | * represents the switch matrix. |
| 15 | #ifdef __AVR__ | 28 | */ |
| 16 | #include <avr/io.h> | ||
| 17 | #include <avr/interrupt.h> | ||
| 18 | #endif | ||
| 19 | #endif | ||
| 20 | 29 | ||
| 21 | // full Keymap | 30 | // full Keymap |
| 22 | // (TRRS jack on the left half is to the right, TRRS jack on the right half is to the left) | 31 | // (TRRS jack on the left half is to the right, TRRS jack on the right half is to the left) |
| @@ -197,5 +206,3 @@ | |||
| 197 | 206 | ||
| 198 | #endif | 207 | #endif |
| 199 | ////////////////////////////////////////////////////////////////////////////// | 208 | ////////////////////////////////////////////////////////////////////////////// |
| 200 | |||
| 201 | #endif | ||
diff --git a/keyboards/treadstone48/rev1/rules.mk b/keyboards/treadstone48/rev1/rules.mk deleted file mode 100644 index 6028b5a5b..000000000 --- a/keyboards/treadstone48/rev1/rules.mk +++ /dev/null | |||
| @@ -1,3 +0,0 @@ | |||
| 1 | SRC += rev1/matrix.c | ||
| 2 | SRC += rev1/split_util.c | ||
| 3 | SRC += rev1/split_scomm.c | ||
diff --git a/keyboards/treadstone48/rev1/serial_config.h b/keyboards/treadstone48/rev1/serial_config.h deleted file mode 100644 index 37135213d..000000000 --- a/keyboards/treadstone48/rev1/serial_config.h +++ /dev/null | |||
| @@ -1,8 +0,0 @@ | |||
| 1 | //// #error rev2 serial config | ||
| 2 | |||
| 3 | #ifndef SOFT_SERIAL_PIN | ||
| 4 | /* Soft Serial defines */ | ||
| 5 | #define SOFT_SERIAL_PIN D2 | ||
| 6 | |||
| 7 | #define SERIAL_USE_MULTI_TRANSACTION | ||
| 8 | #endif | ||
diff --git a/keyboards/treadstone48/rev1/serial_config_simpleapi.h b/keyboards/treadstone48/rev1/serial_config_simpleapi.h deleted file mode 100644 index e2d22a41e..000000000 --- a/keyboards/treadstone48/rev1/serial_config_simpleapi.h +++ /dev/null | |||
| @@ -1,8 +0,0 @@ | |||
| 1 | #ifndef SERIAL_CONFIG_SIMPLEAPI_H | ||
| 2 | #define SERIAL_CONFIG_SIMPLEAPI_H | ||
| 3 | |||
| 4 | #undef SERIAL_USE_MULTI_TRANSACTION | ||
| 5 | #define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 | ||
| 6 | #define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2 | ||
| 7 | |||
| 8 | #endif // SERIAL_CONFIG_SIMPLEAPI_H | ||
diff --git a/keyboards/treadstone48/rev1/split_scomm.c b/keyboards/treadstone48/rev1/split_scomm.c deleted file mode 100644 index ada786796..000000000 --- a/keyboards/treadstone48/rev1/split_scomm.c +++ /dev/null | |||
| @@ -1,92 +0,0 @@ | |||
| 1 | #ifdef USE_SERIAL | ||
| 2 | #ifdef SERIAL_USE_MULTI_TRANSACTION | ||
| 3 | /* --- USE flexible API (using multi-type transaction function) --- */ | ||
| 4 | |||
| 5 | #include <stdbool.h> | ||
| 6 | #include <stdint.h> | ||
| 7 | #include <stddef.h> | ||
| 8 | #include <split_scomm.h> | ||
| 9 | #include "serial.h" | ||
| 10 | #ifdef CONSOLE_ENABLE | ||
| 11 | #include <print.h> | ||
| 12 | #endif | ||
| 13 | |||
| 14 | uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0}; | ||
| 15 | uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0}; | ||
| 16 | uint8_t volatile status_com = 0; | ||
| 17 | uint8_t volatile status1 = 0; | ||
| 18 | uint8_t slave_buffer_change_count = 0; | ||
| 19 | uint8_t s_change_old = 0xff; | ||
| 20 | uint8_t s_change_new = 0xff; | ||
| 21 | |||
| 22 | SSTD_t transactions[] = { | ||
| 23 | #define GET_SLAVE_STATUS 0 | ||
| 24 | /* master buffer not changed, only recive slave_buffer_change_count */ | ||
| 25 | { (uint8_t *)&status_com, | ||
| 26 | 0, NULL, | ||
| 27 | sizeof(slave_buffer_change_count), &slave_buffer_change_count, | ||
| 28 | }, | ||
| 29 | #define PUT_MASTER_GET_SLAVE_STATUS 1 | ||
| 30 | /* master buffer changed need send, and recive slave_buffer_change_count */ | ||
| 31 | { (uint8_t *)&status_com, | ||
| 32 | sizeof(serial_master_buffer), (uint8_t *)serial_master_buffer, | ||
| 33 | sizeof(slave_buffer_change_count), &slave_buffer_change_count, | ||
| 34 | }, | ||
| 35 | #define GET_SLAVE_BUFFER 2 | ||
| 36 | /* recive serial_slave_buffer */ | ||
| 37 | { (uint8_t *)&status1, | ||
| 38 | 0, NULL, | ||
| 39 | sizeof(serial_slave_buffer), (uint8_t *)serial_slave_buffer | ||
| 40 | } | ||
| 41 | }; | ||
| 42 | |||
| 43 | void serial_master_init(void) | ||
| 44 | { | ||
| 45 | soft_serial_initiator_init(transactions, TID_LIMIT(transactions)); | ||
| 46 | } | ||
| 47 | |||
| 48 | void serial_slave_init(void) | ||
| 49 | { | ||
| 50 | soft_serial_target_init(transactions, TID_LIMIT(transactions)); | ||
| 51 | } | ||
| 52 | |||
| 53 | // 0 => no error | ||
| 54 | // 1 => slave did not respond | ||
| 55 | // 2 => checksum error | ||
| 56 | int serial_update_buffers(int master_update) | ||
| 57 | { | ||
| 58 | int status, smatstatus; | ||
| 59 | static int need_retry = 0; | ||
| 60 | |||
| 61 | if( s_change_old != s_change_new ) { | ||
| 62 | smatstatus = soft_serial_transaction(GET_SLAVE_BUFFER); | ||
| 63 | if( smatstatus == TRANSACTION_END ) { | ||
| 64 | s_change_old = s_change_new; | ||
| 65 | #ifdef CONSOLE_ENABLE | ||
| 66 | uprintf("slave matrix = %b %b %b %b %b\n", | ||
| 67 | serial_slave_buffer[0], serial_slave_buffer[1], | ||
| 68 | serial_slave_buffer[2], serial_slave_buffer[3], | ||
| 69 | serial_slave_buffer[4] ); | ||
| 70 | #endif | ||
| 71 | } | ||
| 72 | } else { | ||
| 73 | // serial_slave_buffer dosen't change | ||
| 74 | smatstatus = TRANSACTION_END; // dummy status | ||
| 75 | } | ||
| 76 | |||
| 77 | if( !master_update && !need_retry) { | ||
| 78 | status = soft_serial_transaction(GET_SLAVE_STATUS); | ||
| 79 | } else { | ||
| 80 | status = soft_serial_transaction(PUT_MASTER_GET_SLAVE_STATUS); | ||
| 81 | } | ||
| 82 | if( status == TRANSACTION_END ) { | ||
| 83 | s_change_new = slave_buffer_change_count; | ||
| 84 | need_retry = 0; | ||
| 85 | } else { | ||
| 86 | need_retry = 1; | ||
| 87 | } | ||
| 88 | return smatstatus; | ||
| 89 | } | ||
| 90 | |||
| 91 | #endif // SERIAL_USE_MULTI_TRANSACTION | ||
| 92 | #endif /* USE_SERIAL */ | ||
diff --git a/keyboards/treadstone48/rev1/split_scomm.h b/keyboards/treadstone48/rev1/split_scomm.h deleted file mode 100644 index 16887eb74..000000000 --- a/keyboards/treadstone48/rev1/split_scomm.h +++ /dev/null | |||
| @@ -1,21 +0,0 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #ifndef SERIAL_USE_MULTI_TRANSACTION | ||
| 4 | /* --- USE Simple API (OLD API, compatible with let's split serial.c) --- */ | ||
| 5 | #include "serial.h" | ||
| 6 | |||
| 7 | #else | ||
| 8 | /* --- USE flexible API (using multi-type transaction function) --- */ | ||
| 9 | // Buffers for master - slave communication | ||
| 10 | #define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 | ||
| 11 | #define SERIAL_MASTER_BUFFER_LENGTH MATRIX_ROWS/2 | ||
| 12 | |||
| 13 | extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH]; | ||
| 14 | extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH]; | ||
| 15 | extern uint8_t slave_buffer_change_count; | ||
| 16 | |||
| 17 | void serial_master_init(void); | ||
| 18 | void serial_slave_init(void); | ||
| 19 | int serial_update_buffers(int master_changed); | ||
| 20 | |||
| 21 | #endif | ||
diff --git a/keyboards/treadstone48/rev1/split_util.c b/keyboards/treadstone48/rev1/split_util.c deleted file mode 100644 index e1ff8b437..000000000 --- a/keyboards/treadstone48/rev1/split_util.c +++ /dev/null | |||
| @@ -1,70 +0,0 @@ | |||
| 1 | #include <avr/io.h> | ||
| 2 | #include <avr/wdt.h> | ||
| 3 | #include <avr/power.h> | ||
| 4 | #include <avr/interrupt.h> | ||
| 5 | #include <util/delay.h> | ||
| 6 | #include <avr/eeprom.h> | ||
| 7 | #include "split_util.h" | ||
| 8 | #include "matrix.h" | ||
| 9 | #include "keyboard.h" | ||
| 10 | |||
| 11 | #ifdef USE_MATRIX_I2C | ||
| 12 | # include "i2c.h" | ||
| 13 | #else | ||
| 14 | # include "split_scomm.h" | ||
| 15 | #endif | ||
| 16 | |||
| 17 | volatile bool isLeftHand = true; | ||
| 18 | |||
| 19 | static void setup_handedness(void) { | ||
| 20 | #ifdef EE_HANDS | ||
| 21 | isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS); | ||
| 22 | #else | ||
| 23 | // I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c | ||
| 24 | #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT) | ||
| 25 | isLeftHand = !has_usb(); | ||
| 26 | #else | ||
| 27 | isLeftHand = has_usb(); | ||
| 28 | #endif | ||
| 29 | #endif | ||
| 30 | } | ||
| 31 | |||
| 32 | static void keyboard_master_setup(void) { | ||
| 33 | |||
| 34 | #ifdef USE_MATRIX_I2C | ||
| 35 | i2c_master_init(); | ||
| 36 | #else | ||
| 37 | serial_master_init(); | ||
| 38 | #endif | ||
| 39 | } | ||
| 40 | |||
| 41 | static void keyboard_slave_setup(void) { | ||
| 42 | |||
| 43 | #ifdef USE_MATRIX_I2C | ||
| 44 | i2c_slave_init(SLAVE_I2C_ADDRESS); | ||
| 45 | #else | ||
| 46 | serial_slave_init(); | ||
| 47 | #endif | ||
| 48 | } | ||
| 49 | |||
| 50 | bool has_usb(void) { | ||
| 51 | USBCON |= (1 << OTGPADE); //enables VBUS pad | ||
| 52 | _delay_us(5); | ||
| 53 | return (USBSTA & (1<<VBUS)); //checks state of VBUS | ||
| 54 | } | ||
| 55 | |||
| 56 | void split_keyboard_setup(void) { | ||
| 57 | setup_handedness(); | ||
| 58 | |||
| 59 | if (has_usb()) { | ||
| 60 | keyboard_master_setup(); | ||
| 61 | } else { | ||
| 62 | keyboard_slave_setup(); | ||
| 63 | } | ||
| 64 | sei(); | ||
| 65 | } | ||
| 66 | |||
| 67 | // this code runs before the usb and keyboard is initialized | ||
| 68 | void matrix_setup(void) { | ||
| 69 | split_keyboard_setup(); | ||
| 70 | } | ||
diff --git a/keyboards/treadstone48/rev1/split_util.h b/keyboards/treadstone48/rev1/split_util.h deleted file mode 100644 index f59304756..000000000 --- a/keyboards/treadstone48/rev1/split_util.h +++ /dev/null | |||
| @@ -1,16 +0,0 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <stdbool.h> | ||
| 4 | #include "eeconfig.h" | ||
| 5 | |||
| 6 | #define SLAVE_I2C_ADDRESS 0x32 | ||
| 7 | |||
| 8 | extern volatile bool isLeftHand; | ||
| 9 | |||
| 10 | // slave version of matix scan, defined in matrix.c | ||
| 11 | void matrix_slave_scan(void); | ||
| 12 | |||
| 13 | void split_keyboard_setup(void); | ||
| 14 | bool has_usb(void); | ||
| 15 | |||
| 16 | void matrix_master_OLED_init (void); | ||
diff --git a/keyboards/treadstone48/rules.mk b/keyboards/treadstone48/rules.mk index fd3c6df57..df284153c 100644 --- a/keyboards/treadstone48/rules.mk +++ b/keyboards/treadstone48/rules.mk | |||
| @@ -12,30 +12,28 @@ MCU = atmega32u4 | |||
| 12 | BOOTLOADER = caterina | 12 | BOOTLOADER = caterina |
| 13 | 13 | ||
| 14 | # Build Options | 14 | # Build Options |
| 15 | # change to "no" to disable the options, or define them in the Makefile in | 15 | # change yes to no to disable |
| 16 | # the appropriate keymap folder that will get included automatically | ||
| 17 | # | 16 | # |
| 18 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | 17 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration |
| 19 | MOUSEKEY_ENABLE = no # Mouse keys(+4700) | 18 | EXTRAKEY_ENABLE = no # Audio control and System control |
| 20 | EXTRAKEY_ENABLE = no # Audio control and System control(+450) | 19 | CONSOLE_ENABLE = no # Console for debug |
| 21 | CONSOLE_ENABLE = no # Console for debug(+400) | ||
| 22 | COMMAND_ENABLE = no # Commands for debug and configuration | 20 | COMMAND_ENABLE = no # Commands for debug and configuration |
| 23 | NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 24 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
| 25 | MIDI_ENABLE = no # MIDI controls | ||
| 26 | AUDIO_ENABLE = no # Audio output on port C6 | ||
| 27 | UNICODE_ENABLE = no # Unicode | ||
| 28 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 29 | RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. | ||
| 30 | SUBPROJECT_rev1 = no | ||
| 31 | USE_I2C = yes | ||
| 32 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | 21 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE |
| 33 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | 22 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend |
| 23 | # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 24 | NKRO_ENABLE = no # USB Nkey Rollover | ||
| 25 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
| 26 | MIDI_ENABLE = no # MIDI support | ||
| 27 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 28 | AUDIO_ENABLE = no # Audio output on port C6 | ||
| 29 | FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches | ||
| 30 | HD44780_ENABLE = no # Enable support for HD44780 based LCDs | ||
| 31 | SPLIT_KEYBOARD = yes | ||
| 34 | 32 | ||
| 35 | CUSTOM_MATRIX = yes | 33 | MOUSEKEY_ENABLE = yes # Mouse keys |
| 34 | TAP_DANCE_ENABLE = no | ||
| 36 | 35 | ||
| 37 | DEFAULT_FOLDER = treadstone48/rev1 | 36 | RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow |
| 37 | OLED_DRIVER_ENABLE = yes | ||
| 38 | 38 | ||
| 39 | SRC += i2c.c | 39 | DEFAULT_FOLDER = treadstone48/rev1 |
| 40 | SRC += serial.c | ||
| 41 | SRC += ssd1306.c | ||
diff --git a/keyboards/treadstone48/serial.c b/keyboards/treadstone48/serial.c deleted file mode 100644 index 674c42d59..000000000 --- a/keyboards/treadstone48/serial.c +++ /dev/null | |||
| @@ -1,589 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * WARNING: be careful changing this code, it is very timing dependent | ||
| 3 | * | ||
| 4 | * 2018-10-28 checked | ||
| 5 | * avr-gcc 4.9.2 | ||
| 6 | * avr-gcc 5.4.0 | ||
| 7 | * avr-gcc 7.3.0 | ||
| 8 | */ | ||
| 9 | |||
| 10 | #ifndef F_CPU | ||
| 11 | #define F_CPU 16000000 | ||
| 12 | #endif | ||
| 13 | |||
| 14 | #include <avr/io.h> | ||
| 15 | #include <avr/interrupt.h> | ||
| 16 | #include <util/delay.h> | ||
| 17 | #include <stddef.h> | ||
| 18 | #include <stdbool.h> | ||
| 19 | #include "serial.h" | ||
| 20 | |||
| 21 | #ifdef SOFT_SERIAL_PIN | ||
| 22 | |||
| 23 | #ifdef __AVR_ATmega32U4__ | ||
| 24 | // if using ATmega32U4 I2C, can not use PD0 and PD1 in soft serial. | ||
| 25 | #ifdef USE_I2C | ||
| 26 | #if SOFT_SERIAL_PIN == D0 || SOFT_SERIAL_PIN == D1 | ||
| 27 | #error Using ATmega32U4 I2C, so can not use PD0, PD1 | ||
| 28 | #endif | ||
| 29 | #endif | ||
| 30 | |||
| 31 | #if SOFT_SERIAL_PIN >= D0 && SOFT_SERIAL_PIN <= D3 | ||
| 32 | #define SERIAL_PIN_DDR DDRD | ||
| 33 | #define SERIAL_PIN_PORT PORTD | ||
| 34 | #define SERIAL_PIN_INPUT PIND | ||
| 35 | #if SOFT_SERIAL_PIN == D0 | ||
| 36 | #define SERIAL_PIN_MASK _BV(PD0) | ||
| 37 | #define EIMSK_BIT _BV(INT0) | ||
| 38 | #define EICRx_BIT (~(_BV(ISC00) | _BV(ISC01))) | ||
| 39 | #define SERIAL_PIN_INTERRUPT INT0_vect | ||
| 40 | #elif SOFT_SERIAL_PIN == D1 | ||
| 41 | #define SERIAL_PIN_MASK _BV(PD1) | ||
| 42 | #define EIMSK_BIT _BV(INT1) | ||
| 43 | #define EICRx_BIT (~(_BV(ISC10) | _BV(ISC11))) | ||
| 44 | #define SERIAL_PIN_INTERRUPT INT1_vect | ||
| 45 | #elif SOFT_SERIAL_PIN == D2 | ||
| 46 | #define SERIAL_PIN_MASK _BV(PD2) | ||
| 47 | #define EIMSK_BIT _BV(INT2) | ||
| 48 | #define EICRx_BIT (~(_BV(ISC20) | _BV(ISC21))) | ||
| 49 | #define SERIAL_PIN_INTERRUPT INT2_vect | ||
| 50 | #elif SOFT_SERIAL_PIN == D3 | ||
| 51 | #define SERIAL_PIN_MASK _BV(PD3) | ||
| 52 | #define EIMSK_BIT _BV(INT3) | ||
| 53 | #define EICRx_BIT (~(_BV(ISC30) | _BV(ISC31))) | ||
| 54 | #define SERIAL_PIN_INTERRUPT INT3_vect | ||
| 55 | #endif | ||
| 56 | #elif SOFT_SERIAL_PIN == E6 | ||
| 57 | #define SERIAL_PIN_DDR DDRE | ||
| 58 | #define SERIAL_PIN_PORT PORTE | ||
| 59 | #define SERIAL_PIN_INPUT PINE | ||
| 60 | #define SERIAL_PIN_MASK _BV(PE6) | ||
| 61 | #define EIMSK_BIT _BV(INT6) | ||
| 62 | #define EICRx_BIT (~(_BV(ISC60) | _BV(ISC61))) | ||
| 63 | #define SERIAL_PIN_INTERRUPT INT6_vect | ||
| 64 | #else | ||
| 65 | #error invalid SOFT_SERIAL_PIN value | ||
| 66 | #endif | ||
| 67 | |||
| 68 | #else | ||
| 69 | #error serial.c now support ATmega32U4 only | ||
| 70 | #endif | ||
| 71 | |||
| 72 | //////////////// for backward compatibility //////////////////////////////// | ||
| 73 | #if !defined(SERIAL_USE_SINGLE_TRANSACTION) && !defined(SERIAL_USE_MULTI_TRANSACTION) | ||
| 74 | /* --- USE OLD API (compatible with let's split serial.c) */ | ||
| 75 | #if SERIAL_SLAVE_BUFFER_LENGTH > 0 | ||
| 76 | uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0}; | ||
| 77 | #endif | ||
| 78 | #if SERIAL_MASTER_BUFFER_LENGTH > 0 | ||
| 79 | uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0}; | ||
| 80 | #endif | ||
| 81 | uint8_t volatile status0 = 0; | ||
| 82 | |||
| 83 | SSTD_t transactions[] = { | ||
| 84 | { (uint8_t *)&status0, | ||
| 85 | #if SERIAL_MASTER_BUFFER_LENGTH > 0 | ||
| 86 | sizeof(serial_master_buffer), (uint8_t *)serial_master_buffer, | ||
| 87 | #else | ||
| 88 | 0, (uint8_t *)NULL, | ||
| 89 | #endif | ||
| 90 | #if SERIAL_SLAVE_BUFFER_LENGTH > 0 | ||
| 91 | sizeof(serial_slave_buffer), (uint8_t *)serial_slave_buffer | ||
| 92 | #else | ||
| 93 | 0, (uint8_t *)NULL, | ||
| 94 | #endif | ||
| 95 | } | ||
| 96 | }; | ||
| 97 | |||
| 98 | void serial_master_init(void) | ||
| 99 | { soft_serial_initiator_init(transactions, TID_LIMIT(transactions)); } | ||
| 100 | |||
| 101 | void serial_slave_init(void) | ||
| 102 | { soft_serial_target_init(transactions, TID_LIMIT(transactions)); } | ||
| 103 | |||
| 104 | // 0 => no error | ||
| 105 | // 1 => slave did not respond | ||
| 106 | // 2 => checksum error | ||
| 107 | int serial_update_buffers() | ||
| 108 | { | ||
| 109 | int result; | ||
| 110 | result = soft_serial_transaction(); | ||
| 111 | return result; | ||
| 112 | } | ||
| 113 | |||
| 114 | #endif // end of OLD API (compatible with let's split serial.c) | ||
| 115 | //////////////////////////////////////////////////////////////////////////// | ||
| 116 | |||
| 117 | #define ALWAYS_INLINE __attribute__((always_inline)) | ||
| 118 | #define NO_INLINE __attribute__((noinline)) | ||
| 119 | #define _delay_sub_us(x) __builtin_avr_delay_cycles(x) | ||
| 120 | |||
| 121 | // parity check | ||
| 122 | #define ODD_PARITY 1 | ||
| 123 | #define EVEN_PARITY 0 | ||
| 124 | #define PARITY EVEN_PARITY | ||
| 125 | |||
| 126 | #ifdef SERIAL_DELAY | ||
| 127 | // custom setup in config.h | ||
| 128 | // #define TID_SEND_ADJUST 2 | ||
| 129 | // #define SERIAL_DELAY 6 // micro sec | ||
| 130 | // #define READ_WRITE_START_ADJUST 30 // cycles | ||
| 131 | // #define READ_WRITE_WIDTH_ADJUST 8 // cycles | ||
| 132 | #else | ||
| 133 | // ============ Standard setups ============ | ||
| 134 | |||
| 135 | #ifndef SELECT_SOFT_SERIAL_SPEED | ||
| 136 | #define SELECT_SOFT_SERIAL_SPEED 1 | ||
| 137 | // 0: about 189kbps | ||
| 138 | // 1: about 137kbps (default) | ||
| 139 | // 2: about 75kbps | ||
| 140 | // 3: about 39kbps | ||
| 141 | // 4: about 26kbps | ||
| 142 | // 5: about 20kbps | ||
| 143 | #endif | ||
| 144 | |||
| 145 | #if __GNUC__ < 6 | ||
| 146 | #define TID_SEND_ADJUST 14 | ||
| 147 | #else | ||
| 148 | #define TID_SEND_ADJUST 2 | ||
| 149 | #endif | ||
| 150 | |||
| 151 | #if SELECT_SOFT_SERIAL_SPEED == 0 | ||
| 152 | // Very High speed | ||
| 153 | #define SERIAL_DELAY 4 // micro sec | ||
| 154 | #if __GNUC__ < 6 | ||
| 155 | #define READ_WRITE_START_ADJUST 33 // cycles | ||
| 156 | #define READ_WRITE_WIDTH_ADJUST 3 // cycles | ||
| 157 | #else | ||
| 158 | #define READ_WRITE_START_ADJUST 34 // cycles | ||
| 159 | #define READ_WRITE_WIDTH_ADJUST 7 // cycles | ||
| 160 | #endif | ||
| 161 | #elif SELECT_SOFT_SERIAL_SPEED == 1 | ||
| 162 | // High speed | ||
| 163 | #define SERIAL_DELAY 6 // micro sec | ||
| 164 | #if __GNUC__ < 6 | ||
| 165 | #define READ_WRITE_START_ADJUST 30 // cycles | ||
| 166 | #define READ_WRITE_WIDTH_ADJUST 3 // cycles | ||
| 167 | #else | ||
| 168 | #define READ_WRITE_START_ADJUST 33 // cycles | ||
| 169 | #define READ_WRITE_WIDTH_ADJUST 7 // cycles | ||
| 170 | #endif | ||
| 171 | #elif SELECT_SOFT_SERIAL_SPEED == 2 | ||
| 172 | // Middle speed | ||
| 173 | #define SERIAL_DELAY 12 // micro sec | ||
| 174 | #define READ_WRITE_START_ADJUST 30 // cycles | ||
| 175 | #if __GNUC__ < 6 | ||
| 176 | #define READ_WRITE_WIDTH_ADJUST 3 // cycles | ||
| 177 | #else | ||
| 178 | #define READ_WRITE_WIDTH_ADJUST 7 // cycles | ||
| 179 | #endif | ||
| 180 | #elif SELECT_SOFT_SERIAL_SPEED == 3 | ||
| 181 | // Low speed | ||
| 182 | #define SERIAL_DELAY 24 // micro sec | ||
| 183 | #define READ_WRITE_START_ADJUST 30 // cycles | ||
| 184 | #if __GNUC__ < 6 | ||
| 185 | #define READ_WRITE_WIDTH_ADJUST 3 // cycles | ||
| 186 | #else | ||
| 187 | #define READ_WRITE_WIDTH_ADJUST 7 // cycles | ||
| 188 | #endif | ||
| 189 | #elif SELECT_SOFT_SERIAL_SPEED == 4 | ||
| 190 | // Very Low speed | ||
| 191 | #define SERIAL_DELAY 36 // micro sec | ||
| 192 | #define READ_WRITE_START_ADJUST 30 // cycles | ||
| 193 | #if __GNUC__ < 6 | ||
| 194 | #define READ_WRITE_WIDTH_ADJUST 3 // cycles | ||
| 195 | #else | ||
| 196 | #define READ_WRITE_WIDTH_ADJUST 7 // cycles | ||
| 197 | #endif | ||
| 198 | #elif SELECT_SOFT_SERIAL_SPEED == 5 | ||
| 199 | // Ultra Low speed | ||
| 200 | #define SERIAL_DELAY 48 // micro sec | ||
| 201 | #define READ_WRITE_START_ADJUST 30 // cycles | ||
| 202 | #if __GNUC__ < 6 | ||
| 203 | #define READ_WRITE_WIDTH_ADJUST 3 // cycles | ||
| 204 | #else | ||
| 205 | #define READ_WRITE_WIDTH_ADJUST 7 // cycles | ||
| 206 | #endif | ||
| 207 | #else | ||
| 208 | #error invalid SELECT_SOFT_SERIAL_SPEED value | ||
| 209 | #endif /* SELECT_SOFT_SERIAL_SPEED */ | ||
| 210 | #endif /* SERIAL_DELAY */ | ||
| 211 | |||
| 212 | #define SERIAL_DELAY_HALF1 (SERIAL_DELAY/2) | ||
| 213 | #define SERIAL_DELAY_HALF2 (SERIAL_DELAY - SERIAL_DELAY/2) | ||
| 214 | |||
| 215 | #define SLAVE_INT_WIDTH_US 1 | ||
| 216 | #ifndef SERIAL_USE_MULTI_TRANSACTION | ||
| 217 | #define SLAVE_INT_RESPONSE_TIME SERIAL_DELAY | ||
| 218 | #else | ||
| 219 | #define SLAVE_INT_ACK_WIDTH_UNIT 2 | ||
| 220 | #define SLAVE_INT_ACK_WIDTH 4 | ||
| 221 | #endif | ||
| 222 | |||
| 223 | static SSTD_t *Transaction_table = NULL; | ||
| 224 | static uint8_t Transaction_table_size = 0; | ||
| 225 | |||
| 226 | inline static void serial_delay(void) ALWAYS_INLINE; | ||
| 227 | inline static | ||
| 228 | void serial_delay(void) { | ||
| 229 | _delay_us(SERIAL_DELAY); | ||
| 230 | } | ||
| 231 | |||
| 232 | inline static void serial_delay_half1(void) ALWAYS_INLINE; | ||
| 233 | inline static | ||
| 234 | void serial_delay_half1(void) { | ||
| 235 | _delay_us(SERIAL_DELAY_HALF1); | ||
| 236 | } | ||
| 237 | |||
| 238 | inline static void serial_delay_half2(void) ALWAYS_INLINE; | ||
| 239 | inline static | ||
| 240 | void serial_delay_half2(void) { | ||
| 241 | _delay_us(SERIAL_DELAY_HALF2); | ||
| 242 | } | ||
| 243 | |||
| 244 | inline static void serial_output(void) ALWAYS_INLINE; | ||
| 245 | inline static | ||
| 246 | void serial_output(void) { | ||
| 247 | SERIAL_PIN_DDR |= SERIAL_PIN_MASK; | ||
| 248 | } | ||
| 249 | |||
| 250 | // make the serial pin an input with pull-up resistor | ||
| 251 | inline static void serial_input_with_pullup(void) ALWAYS_INLINE; | ||
| 252 | inline static | ||
| 253 | void serial_input_with_pullup(void) { | ||
| 254 | SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK; | ||
| 255 | SERIAL_PIN_PORT |= SERIAL_PIN_MASK; | ||
| 256 | } | ||
| 257 | |||
| 258 | inline static uint8_t serial_read_pin(void) ALWAYS_INLINE; | ||
| 259 | inline static | ||
| 260 | uint8_t serial_read_pin(void) { | ||
| 261 | return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK); | ||
| 262 | } | ||
| 263 | |||
| 264 | inline static void serial_low(void) ALWAYS_INLINE; | ||
| 265 | inline static | ||
| 266 | void serial_low(void) { | ||
| 267 | SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK; | ||
| 268 | } | ||
| 269 | |||
| 270 | inline static void serial_high(void) ALWAYS_INLINE; | ||
| 271 | inline static | ||
| 272 | void serial_high(void) { | ||
| 273 | SERIAL_PIN_PORT |= SERIAL_PIN_MASK; | ||
| 274 | } | ||
| 275 | |||
| 276 | void soft_serial_initiator_init(SSTD_t *sstd_table, int sstd_table_size) | ||
| 277 | { | ||
| 278 | Transaction_table = sstd_table; | ||
| 279 | Transaction_table_size = (uint8_t)sstd_table_size; | ||
| 280 | serial_output(); | ||
| 281 | serial_high(); | ||
| 282 | } | ||
| 283 | |||
| 284 | void soft_serial_target_init(SSTD_t *sstd_table, int sstd_table_size) | ||
| 285 | { | ||
| 286 | Transaction_table = sstd_table; | ||
| 287 | Transaction_table_size = (uint8_t)sstd_table_size; | ||
| 288 | serial_input_with_pullup(); | ||
| 289 | |||
| 290 | // Enable INT0-INT3,INT6 | ||
| 291 | EIMSK |= EIMSK_BIT; | ||
| 292 | #if SERIAL_PIN_MASK == _BV(PE6) | ||
| 293 | // Trigger on falling edge of INT6 | ||
| 294 | EICRB &= EICRx_BIT; | ||
| 295 | #else | ||
| 296 | // Trigger on falling edge of INT0-INT3 | ||
| 297 | EICRA &= EICRx_BIT; | ||
| 298 | #endif | ||
| 299 | } | ||
| 300 | |||
| 301 | // Used by the sender to synchronize timing with the reciver. | ||
| 302 | static void sync_recv(void) NO_INLINE; | ||
| 303 | static | ||
| 304 | void sync_recv(void) { | ||
| 305 | for (uint8_t i = 0; i < SERIAL_DELAY*5 && serial_read_pin(); i++ ) { | ||
| 306 | } | ||
| 307 | // This shouldn't hang if the target disconnects because the | ||
| 308 | // serial line will float to high if the target does disconnect. | ||
| 309 | while (!serial_read_pin()); | ||
| 310 | } | ||
| 311 | |||
| 312 | // Used by the reciver to send a synchronization signal to the sender. | ||
| 313 | static void sync_send(void) NO_INLINE; | ||
| 314 | static | ||
| 315 | void sync_send(void) { | ||
| 316 | serial_low(); | ||
| 317 | serial_delay(); | ||
| 318 | serial_high(); | ||
| 319 | } | ||
| 320 | |||
| 321 | // Reads a byte from the serial line | ||
| 322 | static uint8_t serial_read_chunk(uint8_t *pterrcount, uint8_t bit) NO_INLINE; | ||
| 323 | static uint8_t serial_read_chunk(uint8_t *pterrcount, uint8_t bit) { | ||
| 324 | uint8_t byte, i, p, pb; | ||
| 325 | |||
| 326 | _delay_sub_us(READ_WRITE_START_ADJUST); | ||
| 327 | for( i = 0, byte = 0, p = PARITY; i < bit; i++ ) { | ||
| 328 | serial_delay_half1(); // read the middle of pulses | ||
| 329 | if( serial_read_pin() ) { | ||
| 330 | byte = (byte << 1) | 1; p ^= 1; | ||
| 331 | } else { | ||
| 332 | byte = (byte << 1) | 0; p ^= 0; | ||
| 333 | } | ||
| 334 | _delay_sub_us(READ_WRITE_WIDTH_ADJUST); | ||
| 335 | serial_delay_half2(); | ||
| 336 | } | ||
| 337 | /* recive parity bit */ | ||
| 338 | serial_delay_half1(); // read the middle of pulses | ||
| 339 | pb = serial_read_pin(); | ||
| 340 | _delay_sub_us(READ_WRITE_WIDTH_ADJUST); | ||
| 341 | serial_delay_half2(); | ||
| 342 | |||
| 343 | *pterrcount += (p != pb)? 1 : 0; | ||
| 344 | |||
| 345 | return byte; | ||
| 346 | } | ||
| 347 | |||
| 348 | // Sends a byte with MSB ordering | ||
| 349 | void serial_write_chunk(uint8_t data, uint8_t bit) NO_INLINE; | ||
| 350 | void serial_write_chunk(uint8_t data, uint8_t bit) { | ||
| 351 | uint8_t b, p; | ||
| 352 | for( p = PARITY, b = 1<<(bit-1); b ; b >>= 1) { | ||
| 353 | if(data & b) { | ||
| 354 | serial_high(); p ^= 1; | ||
| 355 | } else { | ||
| 356 | serial_low(); p ^= 0; | ||
| 357 | } | ||
| 358 | serial_delay(); | ||
| 359 | } | ||
| 360 | /* send parity bit */ | ||
| 361 | if(p & 1) { serial_high(); } | ||
| 362 | else { serial_low(); } | ||
| 363 | serial_delay(); | ||
| 364 | |||
| 365 | serial_low(); // sync_send() / senc_recv() need raise edge | ||
| 366 | } | ||
| 367 | |||
| 368 | static void serial_send_packet(uint8_t *buffer, uint8_t size) NO_INLINE; | ||
| 369 | static | ||
| 370 | void serial_send_packet(uint8_t *buffer, uint8_t size) { | ||
| 371 | for (uint8_t i = 0; i < size; ++i) { | ||
| 372 | uint8_t data; | ||
| 373 | data = buffer[i]; | ||
| 374 | sync_send(); | ||
| 375 | serial_write_chunk(data,8); | ||
| 376 | } | ||
| 377 | } | ||
| 378 | |||
| 379 | static uint8_t serial_recive_packet(uint8_t *buffer, uint8_t size) NO_INLINE; | ||
| 380 | static | ||
| 381 | uint8_t serial_recive_packet(uint8_t *buffer, uint8_t size) { | ||
| 382 | uint8_t pecount = 0; | ||
| 383 | for (uint8_t i = 0; i < size; ++i) { | ||
| 384 | uint8_t data; | ||
| 385 | sync_recv(); | ||
| 386 | data = serial_read_chunk(&pecount, 8); | ||
| 387 | buffer[i] = data; | ||
| 388 | } | ||
| 389 | return pecount == 0; | ||
| 390 | } | ||
| 391 | |||
| 392 | inline static | ||
| 393 | void change_sender2reciver(void) { | ||
| 394 | sync_send(); //0 | ||
| 395 | serial_delay_half1(); //1 | ||
| 396 | serial_low(); //2 | ||
| 397 | serial_input_with_pullup(); //2 | ||
| 398 | serial_delay_half1(); //3 | ||
| 399 | } | ||
| 400 | |||
| 401 | inline static | ||
| 402 | void change_reciver2sender(void) { | ||
| 403 | sync_recv(); //0 | ||
| 404 | serial_delay(); //1 | ||
| 405 | serial_low(); //3 | ||
| 406 | serial_output(); //3 | ||
| 407 | serial_delay_half1(); //4 | ||
| 408 | } | ||
| 409 | |||
| 410 | static inline uint8_t nibble_bits_count(uint8_t bits) | ||
| 411 | { | ||
| 412 | bits = (bits & 0x5) + (bits >> 1 & 0x5); | ||
| 413 | bits = (bits & 0x3) + (bits >> 2 & 0x3); | ||
| 414 | return bits; | ||
| 415 | } | ||
| 416 | |||
| 417 | // interrupt handle to be used by the target device | ||
| 418 | ISR(SERIAL_PIN_INTERRUPT) { | ||
| 419 | |||
| 420 | #ifndef SERIAL_USE_MULTI_TRANSACTION | ||
| 421 | serial_low(); | ||
| 422 | serial_output(); | ||
| 423 | SSTD_t *trans = Transaction_table; | ||
| 424 | #else | ||
| 425 | // recive transaction table index | ||
| 426 | uint8_t tid, bits; | ||
| 427 | uint8_t pecount = 0; | ||
| 428 | sync_recv(); | ||
| 429 | bits = serial_read_chunk(&pecount,7); | ||
| 430 | tid = bits>>3; | ||
| 431 | bits = (bits&7) != nibble_bits_count(tid); | ||
| 432 | if( bits || pecount> 0 || tid > Transaction_table_size ) { | ||
| 433 | return; | ||
| 434 | } | ||
| 435 | serial_delay_half1(); | ||
| 436 | |||
| 437 | serial_high(); // response step1 low->high | ||
| 438 | serial_output(); | ||
| 439 | _delay_sub_us(SLAVE_INT_ACK_WIDTH_UNIT*SLAVE_INT_ACK_WIDTH); | ||
| 440 | SSTD_t *trans = &Transaction_table[tid]; | ||
| 441 | serial_low(); // response step2 ack high->low | ||
| 442 | #endif | ||
| 443 | |||
| 444 | // target send phase | ||
| 445 | if( trans->target2initiator_buffer_size > 0 ) | ||
| 446 | serial_send_packet((uint8_t *)trans->target2initiator_buffer, | ||
| 447 | trans->target2initiator_buffer_size); | ||
| 448 | // target switch to input | ||
| 449 | change_sender2reciver(); | ||
| 450 | |||
| 451 | // target recive phase | ||
| 452 | if( trans->initiator2target_buffer_size > 0 ) { | ||
| 453 | if (serial_recive_packet((uint8_t *)trans->initiator2target_buffer, | ||
| 454 | trans->initiator2target_buffer_size) ) { | ||
| 455 | *trans->status = TRANSACTION_ACCEPTED; | ||
| 456 | } else { | ||
| 457 | *trans->status = TRANSACTION_DATA_ERROR; | ||
| 458 | } | ||
| 459 | } else { | ||
| 460 | *trans->status = TRANSACTION_ACCEPTED; | ||
| 461 | } | ||
| 462 | |||
| 463 | sync_recv(); //weit initiator output to high | ||
| 464 | } | ||
| 465 | |||
| 466 | ///////// | ||
| 467 | // start transaction by initiator | ||
| 468 | // | ||
| 469 | // int soft_serial_transaction(int sstd_index) | ||
| 470 | // | ||
| 471 | // Returns: | ||
| 472 | // TRANSACTION_END | ||
| 473 | // TRANSACTION_NO_RESPONSE | ||
| 474 | // TRANSACTION_DATA_ERROR | ||
| 475 | // this code is very time dependent, so we need to disable interrupts | ||
| 476 | #ifndef SERIAL_USE_MULTI_TRANSACTION | ||
| 477 | int soft_serial_transaction(void) { | ||
| 478 | SSTD_t *trans = Transaction_table; | ||
| 479 | #else | ||
| 480 | int soft_serial_transaction(int sstd_index) { | ||
| 481 | if( sstd_index > Transaction_table_size ) | ||
| 482 | return TRANSACTION_TYPE_ERROR; | ||
| 483 | SSTD_t *trans = &Transaction_table[sstd_index]; | ||
| 484 | #endif | ||
| 485 | cli(); | ||
| 486 | |||
| 487 | // signal to the target that we want to start a transaction | ||
| 488 | serial_output(); | ||
| 489 | serial_low(); | ||
| 490 | _delay_us(SLAVE_INT_WIDTH_US); | ||
| 491 | |||
| 492 | #ifndef SERIAL_USE_MULTI_TRANSACTION | ||
| 493 | // wait for the target response | ||
| 494 | serial_input_with_pullup(); | ||
| 495 | _delay_us(SLAVE_INT_RESPONSE_TIME); | ||
| 496 | |||
| 497 | // check if the target is present | ||
| 498 | if (serial_read_pin()) { | ||
| 499 | // target failed to pull the line low, assume not present | ||
| 500 | serial_output(); | ||
| 501 | serial_high(); | ||
| 502 | *trans->status = TRANSACTION_NO_RESPONSE; | ||
| 503 | sei(); | ||
| 504 | return TRANSACTION_NO_RESPONSE; | ||
| 505 | } | ||
| 506 | |||
| 507 | #else | ||
| 508 | // send transaction table index | ||
| 509 | int tid = (sstd_index<<3) | (7 & nibble_bits_count(sstd_index)); | ||
| 510 | sync_send(); | ||
| 511 | _delay_sub_us(TID_SEND_ADJUST); | ||
| 512 | serial_write_chunk(tid, 7); | ||
| 513 | serial_delay_half1(); | ||
| 514 | |||
| 515 | // wait for the target response (step1 low->high) | ||
| 516 | serial_input_with_pullup(); | ||
| 517 | while( !serial_read_pin() ) { | ||
| 518 | _delay_sub_us(2); | ||
| 519 | } | ||
| 520 | |||
| 521 | // check if the target is present (step2 high->low) | ||
| 522 | for( int i = 0; serial_read_pin(); i++ ) { | ||
| 523 | if (i > SLAVE_INT_ACK_WIDTH + 1) { | ||
| 524 | // slave failed to pull the line low, assume not present | ||
| 525 | serial_output(); | ||
| 526 | serial_high(); | ||
| 527 | *trans->status = TRANSACTION_NO_RESPONSE; | ||
| 528 | sei(); | ||
| 529 | return TRANSACTION_NO_RESPONSE; | ||
| 530 | } | ||
| 531 | _delay_sub_us(SLAVE_INT_ACK_WIDTH_UNIT); | ||
| 532 | } | ||
| 533 | #endif | ||
| 534 | |||
| 535 | // initiator recive phase | ||
| 536 | // if the target is present syncronize with it | ||
| 537 | if( trans->target2initiator_buffer_size > 0 ) { | ||
| 538 | if (!serial_recive_packet((uint8_t *)trans->target2initiator_buffer, | ||
| 539 | trans->target2initiator_buffer_size) ) { | ||
| 540 | serial_output(); | ||
| 541 | serial_high(); | ||
| 542 | *trans->status = TRANSACTION_DATA_ERROR; | ||
| 543 | sei(); | ||
| 544 | return TRANSACTION_DATA_ERROR; | ||
| 545 | } | ||
| 546 | } | ||
| 547 | |||
| 548 | // initiator switch to output | ||
| 549 | change_reciver2sender(); | ||
| 550 | |||
| 551 | // initiator send phase | ||
| 552 | if( trans->initiator2target_buffer_size > 0 ) { | ||
| 553 | serial_send_packet((uint8_t *)trans->initiator2target_buffer, | ||
| 554 | trans->initiator2target_buffer_size); | ||
| 555 | } | ||
| 556 | |||
| 557 | // always, release the line when not in use | ||
| 558 | sync_send(); | ||
| 559 | |||
| 560 | *trans->status = TRANSACTION_END; | ||
| 561 | sei(); | ||
| 562 | return TRANSACTION_END; | ||
| 563 | } | ||
| 564 | |||
| 565 | #ifdef SERIAL_USE_MULTI_TRANSACTION | ||
| 566 | int soft_serial_get_and_clean_status(int sstd_index) { | ||
| 567 | SSTD_t *trans = &Transaction_table[sstd_index]; | ||
| 568 | cli(); | ||
| 569 | int retval = *trans->status; | ||
| 570 | *trans->status = 0;; | ||
| 571 | sei(); | ||
| 572 | return retval; | ||
| 573 | } | ||
| 574 | #endif | ||
| 575 | |||
| 576 | #endif | ||
| 577 | |||
| 578 | // Helix serial.c history | ||
| 579 | // 2018-1-29 fork from let's split and add PD2, modify sync_recv() (#2308, bceffdefc) | ||
| 580 | // 2018-6-28 bug fix master to slave comm and speed up (#3255, 1038bbef4) | ||
| 581 | // (adjusted with avr-gcc 4.9.2) | ||
| 582 | // 2018-7-13 remove USE_SERIAL_PD2 macro (#3374, f30d6dd78) | ||
| 583 | // (adjusted with avr-gcc 4.9.2) | ||
| 584 | // 2018-8-11 add support multi-type transaction (#3608, feb5e4aae) | ||
| 585 | // (adjusted with avr-gcc 4.9.2) | ||
| 586 | // 2018-10-21 fix serial and RGB animation conflict (#4191, 4665e4fff) | ||
| 587 | // (adjusted with avr-gcc 7.3.0) | ||
| 588 | // 2018-10-28 re-adjust compiler depend value of delay (#4269, 8517f8a66) | ||
| 589 | // (adjusted with avr-gcc 5.4.0, 7.3.0) | ||
diff --git a/keyboards/treadstone48/serial.h b/keyboards/treadstone48/serial.h deleted file mode 100644 index 5deaf789e..000000000 --- a/keyboards/treadstone48/serial.h +++ /dev/null | |||
| @@ -1,86 +0,0 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <stdbool.h> | ||
| 4 | |||
| 5 | // ///////////////////////////////////////////////////////////////// | ||
| 6 | // Need Soft Serial defines in config.h | ||
| 7 | // ///////////////////////////////////////////////////////////////// | ||
| 8 | // ex. | ||
| 9 | // #define SOFT_SERIAL_PIN ?? // ?? = D0,D1,D2,D3,E6 | ||
| 10 | // OPTIONAL: #define SELECT_SOFT_SERIAL_SPEED ? // ? = 1,2,3,4,5 | ||
| 11 | // // 1: about 137kbps (default) | ||
| 12 | // // 2: about 75kbps | ||
| 13 | // // 3: about 39kbps | ||
| 14 | // // 4: about 26kbps | ||
| 15 | // // 5: about 20kbps | ||
| 16 | // | ||
| 17 | // //// USE OLD API (compatible with let's split serial.c) | ||
| 18 | // ex. | ||
| 19 | // #define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 | ||
| 20 | // #define SERIAL_MASTER_BUFFER_LENGTH 1 | ||
| 21 | // | ||
| 22 | // //// USE NEW API | ||
| 23 | // //// USE simple API (using signle-type transaction function) | ||
| 24 | // #define SERIAL_USE_SINGLE_TRANSACTION | ||
| 25 | // //// USE flexible API (using multi-type transaction function) | ||
| 26 | // #define SERIAL_USE_MULTI_TRANSACTION | ||
| 27 | // | ||
| 28 | // ///////////////////////////////////////////////////////////////// | ||
| 29 | |||
| 30 | |||
| 31 | //////////////// for backward compatibility //////////////////////////////// | ||
| 32 | #if !defined(SERIAL_USE_SINGLE_TRANSACTION) && !defined(SERIAL_USE_MULTI_TRANSACTION) | ||
| 33 | /* --- USE OLD API (compatible with let's split serial.c) */ | ||
| 34 | #if SERIAL_SLAVE_BUFFER_LENGTH > 0 | ||
| 35 | extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH]; | ||
| 36 | #endif | ||
| 37 | #if SERIAL_MASTER_BUFFER_LENGTH > 0 | ||
| 38 | extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH]; | ||
| 39 | #endif | ||
| 40 | |||
| 41 | void serial_master_init(void); | ||
| 42 | void serial_slave_init(void); | ||
| 43 | int serial_update_buffers(void); | ||
| 44 | |||
| 45 | #endif // end of USE OLD API | ||
| 46 | //////////////////////////////////////////////////////////////////////////// | ||
| 47 | |||
| 48 | // Soft Serial Transaction Descriptor | ||
| 49 | typedef struct _SSTD_t { | ||
| 50 | uint8_t *status; | ||
| 51 | uint8_t initiator2target_buffer_size; | ||
| 52 | uint8_t *initiator2target_buffer; | ||
| 53 | uint8_t target2initiator_buffer_size; | ||
| 54 | uint8_t *target2initiator_buffer; | ||
| 55 | } SSTD_t; | ||
| 56 | #define TID_LIMIT( table ) (sizeof(table) / sizeof(SSTD_t)) | ||
| 57 | |||
| 58 | // initiator is transaction start side | ||
| 59 | void soft_serial_initiator_init(SSTD_t *sstd_table, int sstd_table_size); | ||
| 60 | // target is interrupt accept side | ||
| 61 | void soft_serial_target_init(SSTD_t *sstd_table, int sstd_table_size); | ||
| 62 | |||
| 63 | // initiator resullt | ||
| 64 | #define TRANSACTION_END 0 | ||
| 65 | #define TRANSACTION_NO_RESPONSE 0x1 | ||
| 66 | #define TRANSACTION_DATA_ERROR 0x2 | ||
| 67 | #define TRANSACTION_TYPE_ERROR 0x4 | ||
| 68 | #ifndef SERIAL_USE_MULTI_TRANSACTION | ||
| 69 | int soft_serial_transaction(void); | ||
| 70 | #else | ||
| 71 | int soft_serial_transaction(int sstd_index); | ||
| 72 | #endif | ||
| 73 | |||
| 74 | // target status | ||
| 75 | // *SSTD_t.status has | ||
| 76 | // initiator: | ||
| 77 | // TRANSACTION_END | ||
| 78 | // or TRANSACTION_NO_RESPONSE | ||
| 79 | // or TRANSACTION_DATA_ERROR | ||
| 80 | // target: | ||
| 81 | // TRANSACTION_DATA_ERROR | ||
| 82 | // or TRANSACTION_ACCEPTED | ||
| 83 | #define TRANSACTION_ACCEPTED 0x8 | ||
| 84 | #ifdef SERIAL_USE_MULTI_TRANSACTION | ||
| 85 | int soft_serial_get_and_clean_status(int sstd_index); | ||
| 86 | #endif | ||
diff --git a/keyboards/treadstone48/ssd1306.c b/keyboards/treadstone48/ssd1306.c deleted file mode 100644 index dd3290ba0..000000000 --- a/keyboards/treadstone48/ssd1306.c +++ /dev/null | |||
| @@ -1,342 +0,0 @@ | |||
| 1 | |||
| 2 | #ifdef SSD1306OLED | ||
| 3 | |||
| 4 | #include "ssd1306.h" | ||
| 5 | #include "i2c.h" | ||
| 6 | #include <string.h> | ||
| 7 | #include "print.h" | ||
| 8 | #ifndef LOCAL_GLCDFONT | ||
| 9 | #include "common/glcdfont.c" | ||
| 10 | #else | ||
| 11 | #include <helixfont.h> | ||
| 12 | #endif | ||
| 13 | #ifdef ADAFRUIT_BLE_ENABLE | ||
| 14 | #include "adafruit_ble.h" | ||
| 15 | #endif | ||
| 16 | #ifdef PROTOCOL_LUFA | ||
| 17 | #include "lufa.h" | ||
| 18 | #endif | ||
| 19 | #include "sendchar.h" | ||
| 20 | #include "timer.h" | ||
| 21 | |||
| 22 | // Set this to 1 to help diagnose early startup problems | ||
| 23 | // when testing power-on with ble. Turn it off otherwise, | ||
| 24 | // as the latency of printing most of the debug info messes | ||
| 25 | // with the matrix scan, causing keys to drop. | ||
| 26 | #define DEBUG_TO_SCREEN 0 | ||
| 27 | |||
| 28 | //static uint16_t last_battery_update; | ||
| 29 | //static uint32_t vbat; | ||
| 30 | //#define BatteryUpdateInterval 10000 /* milliseconds */ | ||
| 31 | |||
| 32 | // 'last_flush' is declared as uint16_t, | ||
| 33 | // so this must be less than 65535 | ||
| 34 | #define ScreenOffInterval 60000 /* milliseconds */ | ||
| 35 | #if DEBUG_TO_SCREEN | ||
| 36 | static uint8_t displaying; | ||
| 37 | #endif | ||
| 38 | static uint16_t last_flush; | ||
| 39 | |||
| 40 | static bool force_dirty = true; | ||
| 41 | |||
| 42 | // Write command sequence. | ||
| 43 | // Returns true on success. | ||
| 44 | static inline bool _send_cmd1(uint8_t cmd) { | ||
| 45 | bool res = false; | ||
| 46 | |||
| 47 | if (i2c_start_write(SSD1306_ADDRESS)) { | ||
| 48 | xprintf("failed to start write to %d\n", SSD1306_ADDRESS); | ||
| 49 | goto done; | ||
| 50 | } | ||
| 51 | |||
| 52 | if (i2c_master_write(0x0 /* command byte follows */)) { | ||
| 53 | print("failed to write control byte\n"); | ||
| 54 | |||
| 55 | goto done; | ||
| 56 | } | ||
| 57 | |||
| 58 | if (i2c_master_write(cmd)) { | ||
| 59 | xprintf("failed to write command %d\n", cmd); | ||
| 60 | goto done; | ||
| 61 | } | ||
| 62 | res = true; | ||
| 63 | done: | ||
| 64 | i2c_master_stop(); | ||
| 65 | return res; | ||
| 66 | } | ||
| 67 | |||
| 68 | // Write 2-byte command sequence. | ||
| 69 | // Returns true on success | ||
| 70 | static inline bool _send_cmd2(uint8_t cmd, uint8_t opr) { | ||
| 71 | if (!_send_cmd1(cmd)) { | ||
| 72 | return false; | ||
| 73 | } | ||
| 74 | return _send_cmd1(opr); | ||
| 75 | } | ||
| 76 | |||
| 77 | // Write 3-byte command sequence. | ||
| 78 | // Returns true on success | ||
| 79 | static inline bool _send_cmd3(uint8_t cmd, uint8_t opr1, uint8_t opr2) { | ||
| 80 | if (!_send_cmd1(cmd)) { | ||
| 81 | return false; | ||
| 82 | } | ||
| 83 | if (!_send_cmd1(opr1)) { | ||
| 84 | return false; | ||
| 85 | } | ||
| 86 | return _send_cmd1(opr2); | ||
| 87 | } | ||
| 88 | |||
| 89 | #define send_cmd1(c) if (!_send_cmd1(c)) {goto done;} | ||
| 90 | #define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;} | ||
| 91 | #define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;} | ||
| 92 | |||
| 93 | static void clear_display(void) { | ||
| 94 | matrix_clear(&display); | ||
| 95 | |||
| 96 | // Clear all of the display bits (there can be random noise | ||
| 97 | // in the RAM on startup) | ||
| 98 | send_cmd3(PageAddr, 0, (DisplayHeight / 8) - 1); | ||
| 99 | send_cmd3(ColumnAddr, 0, DisplayWidth - 1); | ||
| 100 | |||
| 101 | if (i2c_start_write(SSD1306_ADDRESS)) { | ||
| 102 | goto done; | ||
| 103 | } | ||
| 104 | if (i2c_master_write(0x40)) { | ||
| 105 | // Data mode | ||
| 106 | goto done; | ||
| 107 | } | ||
| 108 | for (uint8_t row = 0; row < MatrixRows; ++row) { | ||
| 109 | for (uint8_t col = 0; col < DisplayWidth; ++col) { | ||
| 110 | i2c_master_write(0); | ||
| 111 | } | ||
| 112 | } | ||
| 113 | |||
| 114 | display.dirty = false; | ||
| 115 | |||
| 116 | done: | ||
| 117 | i2c_master_stop(); | ||
| 118 | } | ||
| 119 | |||
| 120 | #if DEBUG_TO_SCREEN | ||
| 121 | #undef sendchar | ||
| 122 | static int8_t capture_sendchar(uint8_t c) { | ||
| 123 | sendchar(c); | ||
| 124 | iota_gfx_write_char(c); | ||
| 125 | |||
| 126 | if (!displaying) { | ||
| 127 | iota_gfx_flush(); | ||
| 128 | } | ||
| 129 | return 0; | ||
| 130 | } | ||
| 131 | #endif | ||
| 132 | |||
| 133 | bool iota_gfx_init(bool rotate) { | ||
| 134 | bool success = false; | ||
| 135 | |||
| 136 | i2c_master_init(); | ||
| 137 | send_cmd1(DisplayOff); | ||
| 138 | send_cmd2(SetDisplayClockDiv, 0x80); | ||
| 139 | send_cmd2(SetMultiPlex, DisplayHeight - 1); | ||
| 140 | |||
| 141 | send_cmd2(SetDisplayOffset, 0); | ||
| 142 | |||
| 143 | |||
| 144 | send_cmd1(SetStartLine | 0x0); | ||
| 145 | send_cmd2(SetChargePump, 0x14 /* Enable */); | ||
| 146 | send_cmd2(SetMemoryMode, 0 /* horizontal addressing */); | ||
| 147 | |||
| 148 | if(rotate){ | ||
| 149 | // the following Flip the display orientation 180 degrees | ||
| 150 | send_cmd1(SegRemap); | ||
| 151 | send_cmd1(ComScanInc); | ||
| 152 | }else{ | ||
| 153 | // Flips the display orientation 0 degrees | ||
| 154 | send_cmd1(SegRemap | 0x1); | ||
| 155 | send_cmd1(ComScanDec); | ||
| 156 | } | ||
| 157 | |||
| 158 | send_cmd2(SetComPins, 0x2); | ||
| 159 | send_cmd2(SetContrast, 0x8f); | ||
| 160 | send_cmd2(SetPreCharge, 0xf1); | ||
| 161 | send_cmd2(SetVComDetect, 0x40); | ||
| 162 | send_cmd1(DisplayAllOnResume); | ||
| 163 | send_cmd1(NormalDisplay); | ||
| 164 | send_cmd1(DeActivateScroll); | ||
| 165 | send_cmd1(DisplayOn); | ||
| 166 | |||
| 167 | send_cmd2(SetContrast, 0); // Dim | ||
| 168 | |||
| 169 | clear_display(); | ||
| 170 | |||
| 171 | success = true; | ||
| 172 | |||
| 173 | iota_gfx_flush(); | ||
| 174 | |||
| 175 | #if DEBUG_TO_SCREEN | ||
| 176 | print_set_sendchar(capture_sendchar); | ||
| 177 | #endif | ||
| 178 | |||
| 179 | done: | ||
| 180 | return success; | ||
| 181 | } | ||
| 182 | |||
| 183 | bool iota_gfx_off(void) { | ||
| 184 | bool success = false; | ||
| 185 | |||
| 186 | send_cmd1(DisplayOff); | ||
| 187 | success = true; | ||
| 188 | |||
| 189 | done: | ||
| 190 | return success; | ||
| 191 | } | ||
| 192 | |||
| 193 | bool iota_gfx_on(void) { | ||
| 194 | bool success = false; | ||
| 195 | |||
| 196 | send_cmd1(DisplayOn); | ||
| 197 | success = true; | ||
| 198 | |||
| 199 | done: | ||
| 200 | return success; | ||
| 201 | } | ||
| 202 | |||
| 203 | void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) { | ||
| 204 | *matrix->cursor = c; | ||
| 205 | ++matrix->cursor; | ||
| 206 | |||
| 207 | if (matrix->cursor - &matrix->display[0][0] == sizeof(matrix->display)) { | ||
| 208 | // We went off the end; scroll the display upwards by one line | ||
| 209 | memmove(&matrix->display[0], &matrix->display[1], | ||
| 210 | MatrixCols * (MatrixRows - 1)); | ||
| 211 | matrix->cursor = &matrix->display[MatrixRows - 1][0]; | ||
| 212 | memset(matrix->cursor, ' ', MatrixCols); | ||
| 213 | } | ||
| 214 | } | ||
| 215 | |||
| 216 | void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) { | ||
| 217 | matrix->dirty = true; | ||
| 218 | |||
| 219 | if (c == '\n') { | ||
| 220 | // Clear to end of line from the cursor and then move to the | ||
| 221 | // start of the next line | ||
| 222 | uint8_t cursor_col = (matrix->cursor - &matrix->display[0][0]) % MatrixCols; | ||
| 223 | |||
| 224 | while (cursor_col++ < MatrixCols) { | ||
| 225 | matrix_write_char_inner(matrix, ' '); | ||
| 226 | } | ||
| 227 | return; | ||
| 228 | } | ||
| 229 | |||
| 230 | matrix_write_char_inner(matrix, c); | ||
| 231 | } | ||
| 232 | |||
| 233 | void iota_gfx_write_char(uint8_t c) { | ||
| 234 | matrix_write_char(&display, c); | ||
| 235 | } | ||
| 236 | |||
| 237 | void matrix_write(struct CharacterMatrix *matrix, const char *data) { | ||
| 238 | const char *end = data + strlen(data); | ||
| 239 | while (data < end) { | ||
| 240 | matrix_write_char(matrix, *data); | ||
| 241 | ++data; | ||
| 242 | } | ||
| 243 | } | ||
| 244 | |||
| 245 | void iota_gfx_write(const char *data) { | ||
| 246 | matrix_write(&display, data); | ||
| 247 | } | ||
| 248 | |||
| 249 | void matrix_write_P(struct CharacterMatrix *matrix, const char *data) { | ||
| 250 | while (true) { | ||
| 251 | uint8_t c = pgm_read_byte(data); | ||
| 252 | if (c == 0) { | ||
| 253 | return; | ||
| 254 | } | ||
| 255 | matrix_write_char(matrix, c); | ||
| 256 | ++data; | ||
| 257 | } | ||
| 258 | } | ||
| 259 | |||
| 260 | void iota_gfx_write_P(const char *data) { | ||
| 261 | matrix_write_P(&display, data); | ||
| 262 | } | ||
| 263 | |||
| 264 | void matrix_clear(struct CharacterMatrix *matrix) { | ||
| 265 | memset(matrix->display, ' ', sizeof(matrix->display)); | ||
| 266 | matrix->cursor = &matrix->display[0][0]; | ||
| 267 | matrix->dirty = true; | ||
| 268 | } | ||
| 269 | |||
| 270 | void iota_gfx_clear_screen(void) { | ||
| 271 | matrix_clear(&display); | ||
| 272 | } | ||
| 273 | |||
| 274 | void matrix_render(struct CharacterMatrix *matrix) { | ||
| 275 | last_flush = timer_read(); | ||
| 276 | iota_gfx_on(); | ||
| 277 | #if DEBUG_TO_SCREEN | ||
| 278 | ++displaying; | ||
| 279 | #endif | ||
| 280 | |||
| 281 | // Move to the home position | ||
| 282 | send_cmd3(PageAddr, 0, MatrixRows - 1); | ||
| 283 | send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1); | ||
| 284 | |||
| 285 | if (i2c_start_write(SSD1306_ADDRESS)) { | ||
| 286 | goto done; | ||
| 287 | } | ||
| 288 | if (i2c_master_write(0x40)) { | ||
| 289 | // Data mode | ||
| 290 | goto done; | ||
| 291 | } | ||
| 292 | |||
| 293 | for (uint8_t row = 0; row < MatrixRows; ++row) { | ||
| 294 | for (uint8_t col = 0; col < MatrixCols; ++col) { | ||
| 295 | const uint8_t *glyph = font + (matrix->display[row][col] * FontWidth); | ||
| 296 | |||
| 297 | for (uint8_t glyphCol = 0; glyphCol < FontWidth; ++glyphCol) { | ||
| 298 | uint8_t colBits = pgm_read_byte(glyph + glyphCol); | ||
| 299 | i2c_master_write(colBits); | ||
| 300 | } | ||
| 301 | |||
| 302 | // 1 column of space between chars (it's not included in the glyph) | ||
| 303 | //i2c_master_write(0); | ||
| 304 | } | ||
| 305 | } | ||
| 306 | |||
| 307 | matrix->dirty = false; | ||
| 308 | |||
| 309 | done: | ||
| 310 | i2c_master_stop(); | ||
| 311 | #if DEBUG_TO_SCREEN | ||
| 312 | --displaying; | ||
| 313 | #endif | ||
| 314 | } | ||
| 315 | |||
| 316 | void iota_gfx_flush(void) { | ||
| 317 | matrix_render(&display); | ||
| 318 | } | ||
| 319 | |||
| 320 | __attribute__ ((weak)) | ||
| 321 | void iota_gfx_task_user(void) { | ||
| 322 | } | ||
| 323 | |||
| 324 | void iota_gfx_task(void) { | ||
| 325 | iota_gfx_task_user(); | ||
| 326 | |||
| 327 | if (display.dirty|| force_dirty) { | ||
| 328 | iota_gfx_flush(); | ||
| 329 | force_dirty = false; | ||
| 330 | } | ||
| 331 | |||
| 332 | if (timer_elapsed(last_flush) > ScreenOffInterval) { | ||
| 333 | iota_gfx_off(); | ||
| 334 | } | ||
| 335 | } | ||
| 336 | |||
| 337 | bool process_record_gfx(uint16_t keycode, keyrecord_t *record) { | ||
| 338 | force_dirty = true; | ||
| 339 | return true; | ||
| 340 | } | ||
| 341 | |||
| 342 | #endif | ||
diff --git a/keyboards/treadstone48/ssd1306.h b/keyboards/treadstone48/ssd1306.h deleted file mode 100644 index 49f258efa..000000000 --- a/keyboards/treadstone48/ssd1306.h +++ /dev/null | |||
| @@ -1,90 +0,0 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <stdbool.h> | ||
| 4 | #include <stdio.h> | ||
| 5 | #include "pincontrol.h" | ||
| 6 | #include "action.h" | ||
| 7 | |||
| 8 | enum ssd1306_cmds { | ||
| 9 | DisplayOff = 0xAE, | ||
| 10 | DisplayOn = 0xAF, | ||
| 11 | |||
| 12 | SetContrast = 0x81, | ||
| 13 | DisplayAllOnResume = 0xA4, | ||
| 14 | |||
| 15 | DisplayAllOn = 0xA5, | ||
| 16 | NormalDisplay = 0xA6, | ||
| 17 | InvertDisplay = 0xA7, | ||
| 18 | SetDisplayOffset = 0xD3, | ||
| 19 | SetComPins = 0xda, | ||
| 20 | SetVComDetect = 0xdb, | ||
| 21 | SetDisplayClockDiv = 0xD5, | ||
| 22 | SetPreCharge = 0xd9, | ||
| 23 | SetMultiPlex = 0xa8, | ||
| 24 | SetLowColumn = 0x00, | ||
| 25 | SetHighColumn = 0x10, | ||
| 26 | SetStartLine = 0x40, | ||
| 27 | |||
| 28 | SetMemoryMode = 0x20, | ||
| 29 | ColumnAddr = 0x21, | ||
| 30 | PageAddr = 0x22, | ||
| 31 | |||
| 32 | ComScanInc = 0xc0, | ||
| 33 | ComScanDec = 0xc8, | ||
| 34 | SegRemap = 0xa0, | ||
| 35 | SetChargePump = 0x8d, | ||
| 36 | ExternalVcc = 0x01, | ||
| 37 | SwitchCapVcc = 0x02, | ||
| 38 | |||
| 39 | ActivateScroll = 0x2f, | ||
| 40 | DeActivateScroll = 0x2e, | ||
| 41 | SetVerticalScrollArea = 0xa3, | ||
| 42 | RightHorizontalScroll = 0x26, | ||
| 43 | LeftHorizontalScroll = 0x27, | ||
| 44 | VerticalAndRightHorizontalScroll = 0x29, | ||
| 45 | VerticalAndLeftHorizontalScroll = 0x2a, | ||
| 46 | }; | ||
| 47 | |||
| 48 | // Controls the SSD1306 128x32 OLED display via i2c | ||
| 49 | |||
| 50 | #ifndef SSD1306_ADDRESS | ||
| 51 | #define SSD1306_ADDRESS 0x3C | ||
| 52 | #endif | ||
| 53 | |||
| 54 | #define DisplayHeight 32 | ||
| 55 | #define DisplayWidth 128 | ||
| 56 | |||
| 57 | #define FontHeight 8 | ||
| 58 | #define FontWidth 6 | ||
| 59 | |||
| 60 | #define MatrixRows (DisplayHeight / FontHeight) | ||
| 61 | #define MatrixCols (DisplayWidth / FontWidth) | ||
| 62 | |||
| 63 | struct CharacterMatrix { | ||
| 64 | uint8_t display[MatrixRows][MatrixCols]; | ||
| 65 | uint8_t *cursor; | ||
| 66 | bool dirty; | ||
| 67 | }; | ||
| 68 | |||
| 69 | struct CharacterMatrix display; | ||
| 70 | |||
| 71 | bool iota_gfx_init(bool rotate); | ||
| 72 | void iota_gfx_task(void); | ||
| 73 | bool iota_gfx_off(void); | ||
| 74 | bool iota_gfx_on(void); | ||
| 75 | void iota_gfx_flush(void); | ||
| 76 | void iota_gfx_write_char(uint8_t c); | ||
| 77 | void iota_gfx_write(const char *data); | ||
| 78 | void iota_gfx_write_P(const char *data); | ||
| 79 | void iota_gfx_clear_screen(void); | ||
| 80 | |||
| 81 | void iota_gfx_task_user(void); | ||
| 82 | |||
| 83 | void matrix_clear(struct CharacterMatrix *matrix); | ||
| 84 | void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c); | ||
| 85 | void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c); | ||
| 86 | void matrix_write(struct CharacterMatrix *matrix, const char *data); | ||
| 87 | void matrix_write_P(struct CharacterMatrix *matrix, const char *data); | ||
| 88 | void matrix_render(struct CharacterMatrix *matrix); | ||
| 89 | |||
| 90 | bool process_record_gfx(uint16_t keycode, keyrecord_t *record); | ||
diff --git a/keyboards/treadstone48/treadstone48.c b/keyboards/treadstone48/treadstone48.c deleted file mode 100644 index faadb2690..000000000 --- a/keyboards/treadstone48/treadstone48.c +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | #include "treadstone48.h" | ||
diff --git a/keyboards/treadstone48/treadstone48.h b/keyboards/treadstone48/treadstone48.h deleted file mode 100644 index 3123d1de5..000000000 --- a/keyboards/treadstone48/treadstone48.h +++ /dev/null | |||
| @@ -1,15 +0,0 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #ifdef KEYBOARD_treadstone48_rev1 | ||
| 4 | #include "rev1.h" | ||
| 5 | #endif | ||
| 6 | |||
| 7 | #include "quantum.h" | ||
| 8 | |||
| 9 | #ifdef PROTOCOL_LUFA | ||
| 10 | #include "lufa.h" | ||
| 11 | #include "split_util.h" | ||
| 12 | #endif | ||
| 13 | #ifdef SSD1306OLED | ||
| 14 | #include "ssd1306.h" | ||
| 15 | #endif | ||
