diff options
Diffstat (limited to 'keyboards/zinc')
43 files changed, 443 insertions, 2263 deletions
diff --git a/keyboards/zinc/config.h b/keyboards/zinc/config.h index 712db0ac6d..cfb6bf4ffc 100644 --- a/keyboards/zinc/config.h +++ b/keyboards/zinc/config.h @@ -17,30 +17,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once -//#ifndef CONFIG_H -//#define CONFIG_H #include "config_common.h" - -// GCC include 'config.h" sequence in qmk_firmware/keyboards/zinc/ -// -include keyboards/zinc/config.h -// -include keyboards/zinc/rev?/config.h -// -include keyboards/zinc/rev?/keymaps/MAPNAME/config.h -// XXXX.c - -#include <serial_config.h> - -// GCC include search path in qmk_firmare/keyboards/zinc/ -// #include "..." search starts here: -// #include <...> search starts here: -// keyboards/zinc/rev?/keymaps/MAPNAME -// keyboards/zinc -// keyboards/zinc/rev? -// . -// ./tmk_core -// ...... - -#define NO_ACTION_MACRO -#define NO_ACTION_FUNCTION - -//#endif /* CONFIG_H */ diff --git a/keyboards/zinc/i2c.c b/keyboards/zinc/i2c.c deleted file mode 100644 index 4bee5c6398..0000000000 --- a/keyboards/zinc/i2c.c +++ /dev/null @@ -1,162 +0,0 @@ -#include <util/twi.h> -#include <avr/io.h> -#include <stdlib.h> -#include <avr/interrupt.h> -#include <util/twi.h> -#include <stdbool.h> -#include "i2c.h" - -#ifdef USE_I2C - -// Limits the amount of we wait for any one i2c transaction. -// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is -// 9 bits, a single transaction will take around 90μs to complete. -// -// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit -// poll loop takes at least 8 clock cycles to execute -#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8 - -#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE) - -volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; - -static volatile uint8_t slave_buffer_pos; -static volatile bool slave_has_register_set = false; - -// Wait for an i2c operation to finish -inline static -void i2c_delay(void) { - uint16_t lim = 0; - while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT) - lim++; - - // easier way, but will wait slightly longer - // _delay_us(100); -} - -// Setup twi to run at 100kHz or 400kHz (see ./i2c.h SCL_CLOCK) -void i2c_master_init(void) { - // no prescaler - TWSR = 0; - // Set TWI clock frequency to SCL_CLOCK. Need TWBR>10. - // Check datasheets for more info. - TWBR = ((F_CPU/SCL_CLOCK)-16)/2; -} - -// Start a transaction with the given i2c slave address. The direction of the -// transfer is set with I2C_READ and I2C_WRITE. -// returns: 0 => success -// 1 => error -uint8_t i2c_master_start(uint8_t address) { - TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTA); - - i2c_delay(); - - // check that we started successfully - if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START)) - return 1; - - TWDR = address; - TWCR = (1<<TWINT) | (1<<TWEN); - - i2c_delay(); - - if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) ) - return 1; // slave did not acknowledge - else - return 0; // success -} - - -// Finish the i2c transaction. -void i2c_master_stop(void) { - TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO); - - uint16_t lim = 0; - while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT) - lim++; -} - -// Write one byte to the i2c slave. -// returns 0 => slave ACK -// 1 => slave NACK -uint8_t i2c_master_write(uint8_t data) { - TWDR = data; - TWCR = (1<<TWINT) | (1<<TWEN); - - i2c_delay(); - - // check if the slave acknowledged us - return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1; -} - -// Read one byte from the i2c slave. If ack=1 the slave is acknowledged, -// if ack=0 the acknowledge bit is not set. -// returns: byte read from i2c device -uint8_t i2c_master_read(int ack) { - TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA); - - i2c_delay(); - return TWDR; -} - -void i2c_reset_state(void) { - TWCR = 0; -} - -void i2c_slave_init(uint8_t address) { - TWAR = address << 0; // slave i2c address - // TWEN - twi enable - // TWEA - enable address acknowledgement - // TWINT - twi interrupt flag - // TWIE - enable the twi interrupt - TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN); -} - -ISR(TWI_vect); - -ISR(TWI_vect) { - uint8_t ack = 1; - switch(TW_STATUS) { - case TW_SR_SLA_ACK: - // this device has been addressed as a slave receiver - slave_has_register_set = false; - break; - - case TW_SR_DATA_ACK: - // this device has received data as a slave receiver - // The first byte that we receive in this transaction sets the location - // of the read/write location of the slaves memory that it exposes over - // i2c. After that, bytes will be written at slave_buffer_pos, incrementing - // slave_buffer_pos after each write. - if(!slave_has_register_set) { - slave_buffer_pos = TWDR; - // don't acknowledge the master if this memory loctaion is out of bounds - if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) { - ack = 0; - slave_buffer_pos = 0; - } - slave_has_register_set = true; - } else { - i2c_slave_buffer[slave_buffer_pos] = TWDR; - BUFFER_POS_INC(); - } - break; - - case TW_ST_SLA_ACK: - case TW_ST_DATA_ACK: - // master has addressed this device as a slave transmitter and is - // requesting data. - TWDR = i2c_slave_buffer[slave_buffer_pos]; - BUFFER_POS_INC(); - break; - - case TW_BUS_ERROR: // something went wrong, reset twi state - TWCR = 0; - default: - break; - } - // Reset everything, so we are ready for the next TWI interrupt - TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN); -} -#endif diff --git a/keyboards/zinc/i2c.h b/keyboards/zinc/i2c.h deleted file mode 100644 index 47cf6bd1b2..0000000000 --- a/keyboards/zinc/i2c.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef I2C_H -#define I2C_H - -#include <stdint.h> - -#ifndef F_CPU -#define F_CPU 16000000UL -#endif - -#define I2C_READ 1 -#define I2C_WRITE 0 - -#define I2C_ACK 1 -#define I2C_NACK 0 - -#define SLAVE_BUFFER_SIZE 0x10 - -// i2c SCL clock frequency 400kHz -#define SCL_CLOCK 400000L - -extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; - -void i2c_master_init(void); -uint8_t i2c_master_start(uint8_t address); -void i2c_master_stop(void); -uint8_t i2c_master_write(uint8_t data); -uint8_t i2c_master_read(int); -void i2c_reset_state(void); -void i2c_slave_init(uint8_t address); - - -static inline unsigned char i2c_start_read(unsigned char addr) { - return i2c_master_start((addr << 1) | I2C_READ); -} - -static inline unsigned char i2c_start_write(unsigned char addr) { - return i2c_master_start((addr << 1) | I2C_WRITE); -} - -// from SSD1306 scrips -extern unsigned char i2c_rep_start(unsigned char addr); -extern void i2c_start_wait(unsigned char addr); -extern unsigned char i2c_readAck(void); -extern unsigned char i2c_readNak(void); -extern unsigned char i2c_read(unsigned char ack); - -#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); - -#endif diff --git a/keyboards/zinc/keymaps/default/config.h b/keyboards/zinc/keymaps/default/config.h index 4dcb0724ff..2185dc9ebe 100644 --- a/keyboards/zinc/keymaps/default/config.h +++ b/keyboards/zinc/keymaps/default/config.h @@ -20,8 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once -// if you need more program area, try uncomment follow line -#include "serial_config_simpleapi.h" // place overrides here // Selection of RGBLIGHT MODE to use. diff --git a/keyboards/zinc/keymaps/default/keymap.c b/keyboards/zinc/keymaps/default/keymap.c index 0f08d21ee7..cd1bf0328b 100644 --- a/keyboards/zinc/keymaps/default/keymap.c +++ b/keyboards/zinc/keymaps/default/keymap.c @@ -139,7 +139,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { \ * |------+------+------+------+------+------| |------+------+------+------+------+------| * | |RGB ON| HUE+ | SAT+ | VAL+ | Mac | | Win | - | = |Print |ScLock|Pause | * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | | MODE | HUE- | SAT- | VAL- | | | | | | | | | + * |MODE R| MODE | HUE- | SAT- | VAL- | | | | | | |PageUp| | * |------+------+------+------+------+------| |------+------+------+------+------+------| * | | | | EISU | EISU | EISU | | KANA | KANA | Home |PageDn|PageUp| End | * `-----------------------------------------' `-----------------------------------------' @@ -147,13 +147,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { \ [_ADJUST] = LAYOUT_ortho_4x12( \ _______, RESET, RGBRST, _______, _______, _______, _______, QWERTY, COLEMAK, DVORAK, _______, KC_INS, \ _______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, AG_NORM, AG_SWAP, KC_MINS, KC_EQL, KC_PSCR, KC_SLCK, KC_PAUS,\ - _______, RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______, _______, _______, _______, _______, _______,\ - _______, _______, _______, EISU, EISU, EISU, KANA, KANA, KC_HOME, KC_PGDN, KC_PGUP, KC_END\ + RGB_RMOD,RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______, _______, _______, _______, KC_PGUP, _______,\ + _______, _______, _______, EISU, EISU, EISU, KANA, KANA, KANA, KC_HOME, KC_PGDN, KC_END\ ) }; // define variables for reactive RGB -bool TOG_STATUS = false; +bool TOG_STATUS = false; // Setting ADJUST layer RGB back to default void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { @@ -211,7 +211,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; - + case RAISE: if (record->event.pressed) { //not sure how to have keyboard check mode and set it to a variable, so my work around @@ -244,16 +244,28 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; + //led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released + case RGB_RMOD: + #if defined(RGBLIGHT_ENABLE) + if (record->event.pressed) { + rgblight_mode_noeeprom(RGB_current_config.mode); + rgblight_step_reverse(); + RGB_current_config.mode = rgblight_config.mode; + } + return false; + #endif + break; + case RGB_MOD: - #ifdef RGBLIGHT_ENABLE + #if defined(RGBLIGHT_ENABLE) if (record->event.pressed) { rgblight_mode_noeeprom(RGB_current_config.mode); rgblight_step(); RGB_current_config.mode = rgblight_config.mode; } - #endif return false; + #endif break; case EISU: diff --git a/keyboards/zinc/keymaps/default/readme_en.md b/keyboards/zinc/keymaps/default/readme_en.md new file mode 100644 index 0000000000..6447e96ed4 --- /dev/null +++ b/keyboards/zinc/keymaps/default/readme_en.md @@ -0,0 +1,131 @@ +# The Default Zinc Layout +## layout + +### Qwerty + +``` + ,-----------------------------------------. ,-----------------------------------------. + | Tab | Q | W | E | R | T | | Y | U | I | O | P | Bksp | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | Ctrl | A | S | D | F | G | | H | J | K | L | ; | ' | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | Shift| Z | X | C | V | B | | N | M | , | . | / |Enter | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | Esc | Fn | Alt | Win |Lower |Space | | Space| Raise| Left | Down | Up | Right| + `------------------------------------------ ------------------------------------------' +``` + +### Colemak + +``` + ,-----------------------------------------. ,-----------------------------------------. + | Tab | Q | W | F | P | G | | J | L | U | Y | ; | Bksp | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | Ctrl | A | R | S | T | D | | H | N | E | I | O | ' | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | Shift| Z | X | C | V | B | | K | M | , | . | / |Enter | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | Esc |ADJUST| Alt | Win |LOWER |Space | | Space| RAISE| Left | Down | Up | Right| + `------------------------------------------ ------------------------------------------' +``` + +### Dvorak + +``` + ,-----------------------------------------. ,-----------------------------------------. + | Tab | ' | , | . | P | Y | | F | G | C | R | L | Del | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | Ctrl | A | O | E | U | I | | D | H | T | N | S | / | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | Shift| ; | Q | J | K | X | | B | M | W | V | Z |Enter | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | Esc |ADJUST| Alt | Win |LOWER |Space | | Space| RAISE| Left | Down | Up | Right| + `-----------------------------------------' `-----------------------------------------' +``` + +### Lower +``` + ,-----------------------------------------. ,-----------------------------------------. + | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | | | | | | | - | _ | + | { | } | | | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | | | | | | | | | | Home | End | | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | | | | | | | | | Next | Vol- | Vol+ | Play | + `-----------------------------------------' `-----------------------------------------' +``` + +### RAISE +``` + ,-----------------------------------------. ,-----------------------------------------. + | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | \ | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | F7 | F8 | F9 | F10 | F11 | | F12 | | | | | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | | | | | | | | | Next | Vol- | Vol+ | Play | + `-----------------------------------------' `-----------------------------------------' +``` + +### Adjust (Lower + Raise) +``` + ,-----------------------------------------. ,-----------------------------------------. + | | Reset|RGBRST|Aud on|Audoff| | | |Qwerty|Colemk|Dvorak| | Ins | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | |RGB ON| HUE+ | SAT+ | VAL+ | Mac | | Win | - | = |Print |ScLock|Pause | + |------+------+------+------+------+------| |------+------+------+------+------+------| + |MODE R|RGBMOD| HUE- | SAT- | VAL- | | | | | | |PageUp| | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | | | EISU | EISU | EISU | | KANA | KANA | KANA | Home |PageDn| End | + `-----------------------------------------' `-----------------------------------------' +``` + +## Compile + +go to qmk top directory. + +``` +$ cd qmk_firmware +``` +make with `zinc:<keymap_name>` + +``` +$ make zinc:default +``` + +To make and flash with `:flash` + +``` +$ make zinc:default:flash +``` + + +## Customize + +You can customize from the command line. + +``` +# Zinc keyboard 'default' keymap: convenient command line option +make ZINC=<options> zinc:defualt +# option= back | under | both | cont | na | ios +# ex. +# make ZINC=under zinc:defualt +# make ZINC=under,ios zinc:defualt +# make ZINC=back zinc:default +# make ZINC=back,na zinc:default +# make ZINC=back,ios zinc:default +``` + +Or edit `qmk_firmware/keyboards/zinc/rev1/keymaps/~/rules.mk` directly. + +``` +# Zinc keyboard customize +LED_BACK_ENABLE = no # LED backlight (Enable SK6812mini backlight) +LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight) +LED_BOTH_ENABLE = no # LED backlight and underglow +LED_RGB_CONT = no # LED continuous backlight or/and underglow between left Zinc and right Zinc +LED_ANIMATIONS = yes # LED animations +IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) +``` diff --git a/keyboards/zinc/keymaps/default/readme_jp.md b/keyboards/zinc/keymaps/default/readme_jp.md index dfedb37c15..8132f5036e 100644 --- a/keyboards/zinc/keymaps/default/readme_jp.md +++ b/keyboards/zinc/keymaps/default/readme_jp.md @@ -43,6 +43,44 @@ `-----------------------------------------' `-----------------------------------------' ``` + ### Lower +``` + ,-----------------------------------------. ,-----------------------------------------. + | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | | | | | | | - | _ | + | { | } | | | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | | | | | | | | | | Home | End | | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | | | | | | | | | Next | Vol- | Vol+ | Play | + `-----------------------------------------' `-----------------------------------------' +``` + +### RAISE +``` + ,-----------------------------------------. ,-----------------------------------------. + | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | \ | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | F7 | F8 | F9 | F10 | F11 | | F12 | | | | | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | | | | | | | | | Next | Vol- | Vol+ | Play | + `-----------------------------------------' `-----------------------------------------' +``` + +### Adjust (Lower + Raise) +``` + ,-----------------------------------------. ,-----------------------------------------. + | | Reset|RGBRST|Aud on|Audoff| | | |Qwerty|Colemk|Dvorak| | Ins | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | |RGB ON| HUE+ | SAT+ | VAL+ | Mac | | Win | - | = |Print |ScLock|Pause | + |------+------+------+------+------+------| |------+------+------+------+------+------| + |MODE R|RGBMOD| HUE- | SAT- | VAL- | | | | | | |PageUp| | + |------+------+------+------+------+------| |------+------+------+------+------+------| + | | | | EISU | EISU | EISU | | KANA | KANA | KANA | Home |PageDn| End | + `-----------------------------------------' `-----------------------------------------' +``` ## コンパイルの仕方 @@ -76,7 +114,7 @@ $ make zinc:default:clean ``` # Zinc keyboard 'default' keymap: convenient command line option make ZINC=<options> zinc:defualt -# option= back | under | na | ios +# option= back | under | both | cont | na | ios # ex. # make ZINC=under zinc:defualt # make ZINC=under,ios zinc:defualt @@ -85,16 +123,16 @@ make ZINC=<options> zinc:defualt # make ZINC=back,ios zinc:default ``` -あるいは`qmk_firmware/keyboards/zinc/rev1/keymaps/default/rules.mk` の以下の部分を直接編集して機能を有効化してください。 +あるいは`qmk_firmware/keyboards/zinc/rev1/keymaps/~/rules.mk` の以下の部分を直接編集して機能を有効化してください。 ``` # Zinc keyboard customize LED_BACK_ENABLE = no # LED backlight (Enable SK6812mini backlight) LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight) +LED_BOTH_ENABLE = no # LED backlight and underglow +LED_RGB_CONT = no # LED continuous backlight or/and underglow between left Zinc and right Zinc LED_ANIMATIONS = yes # LED animations IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) - - ``` ## RGB backlight を有効にする @@ -120,4 +158,4 @@ RBG Underglow や RGBバックライトの輝度を抑えて、iPad, iPhone に ``` IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) -```
\ No newline at end of file +``` diff --git a/keyboards/zinc/keymaps/default/rules.mk b/keyboards/zinc/keymaps/default/rules.mk index c980f7d00b..32e0f21610 100644 --- a/keyboards/zinc/keymaps/default/rules.mk +++ b/keyboards/zinc/keymaps/default/rules.mk @@ -20,6 +20,9 @@ define ZINC_CUSTOMISE_MSG $(info Zinc customize) $(info - LED_BACK_ENABLE=$(LED_BACK_ENABLE)) $(info - LED_UNDERGLOW_ENABLE=$(LED_UNDERGLOW_ENABLE)) + $(info - LED_BOTH_ENABLE=$(LED_BOTH_ENABLE)) + $(info - LED_RGB_CONT=$(LED_RGB_CONT)) + $(info - RGB_MATRIX=$(RGB_MATRIX)) $(info - LED_ANIMATION=$(LED_ANIMATIONS)) $(info - IOS_DEVICE_ENABLE=$(IOS_DEVICE_ENABLE)) endef @@ -27,6 +30,10 @@ endef # Zinc keyboard customize LED_BACK_ENABLE = no # LED backlight (Enable SK6812mini backlight) LED_UNDERGLOW_ENABLE = no # LED underglow (Enable WS2812 RGB underlight) +LED_BOTH_ENABLE = no # LED backlight and underglow +LED_RGB_CONT = no # LED continuous backlight or/and underglow between left Zinc and right Zinc +RGB_MATRIX = no # RGB LED Matrix +RGB_MATRIX_SPLIT_RIGHT = no # RGB Matrix for RIGHT Hand LED_ANIMATIONS = yes # LED animations IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone) Link_Time_Optimization = no # if firmware size over limit, try this option @@ -36,7 +43,7 @@ Link_Time_Optimization = no # if firmware size over limit, try this option ### Zinc keyboard 'default' keymap: convenient command line option ## make ZINC=<options> zinc:defualt -## option= back | under | na | ios +## option= back | under | both | cont | matrix | na | ios ## ex. ## make ZINC=under zinc:defualt ## make ZINC=under,ios zinc:defualt @@ -47,9 +54,22 @@ Link_Time_Optimization = no # if firmware size over limit, try this |