From bf71342b89798ef71e276d89556ee14bd512ecd3 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Thu, 24 Nov 2016 00:43:36 +1100 Subject: [PATCH 01/69] Initial version of zeal60 --- keyboards/zeal60/IS31FL3731_driver.c | 184 +++++ keyboards/zeal60/IS31FL3731_driver.h | 20 + keyboards/zeal60/Makefile | 3 + keyboards/zeal60/TWIlib.c | 232 ++++++ keyboards/zeal60/TWIlib.h | 82 +++ keyboards/zeal60/config.h | 94 +++ keyboards/zeal60/keymaps/default/config.h | 24 + keyboards/zeal60/keymaps/default/keymap.c | 51 ++ keyboards/zeal60/keymaps/hhkb_ansi/config.h | 24 + keyboards/zeal60/keymaps/hhkb_ansi/keymap.c | 57 ++ keyboards/zeal60/keymaps/poker2_ansi/config.h | 25 + keyboards/zeal60/keymaps/poker2_ansi/keymap.c | 51 ++ keyboards/zeal60/keymaps/poker2_iso/config.h | 25 + keyboards/zeal60/keymaps/poker2_iso/keymap.c | 51 ++ keyboards/zeal60/keymaps/test/config.h | 27 + keyboards/zeal60/keymaps/test/keymap.c | 51 ++ keyboards/zeal60/rules.mk | 83 +++ keyboards/zeal60/zeal60.c | 307 ++++++++ keyboards/zeal60/zeal60.h | 8 + keyboards/zeal60/zeal_backlight.c | 680 ++++++++++++++++++ keyboards/zeal60/zeal_backlight.h | 62 ++ keyboards/zeal60/zeal_color.c | 105 +++ keyboards/zeal60/zeal_color.h | 23 + keyboards/zeal60/zeal_eeprom.c | 14 + keyboards/zeal60/zeal_eeprom.h | 41 ++ keyboards/zeal60/zeal_keycode.h | 38 + keyboards/zeal60/zeal_keymap.c | 68 ++ keyboards/zeal60/zeal_keymap.h | 17 + keyboards/zeal60/zeal_rpc.h | 15 + quantum/keymap.h | 314 +------- quantum/keymap_common.c | 16 +- quantum/quantum_keycodes.h | 312 ++++++++ tmk_core/common/keycode.h | 2 +- 33 files changed, 2792 insertions(+), 314 deletions(-) create mode 100644 keyboards/zeal60/IS31FL3731_driver.c create mode 100644 keyboards/zeal60/IS31FL3731_driver.h create mode 100644 keyboards/zeal60/Makefile create mode 100644 keyboards/zeal60/TWIlib.c create mode 100644 keyboards/zeal60/TWIlib.h create mode 100644 keyboards/zeal60/config.h create mode 100644 keyboards/zeal60/keymaps/default/config.h create mode 100644 keyboards/zeal60/keymaps/default/keymap.c create mode 100644 keyboards/zeal60/keymaps/hhkb_ansi/config.h create mode 100644 keyboards/zeal60/keymaps/hhkb_ansi/keymap.c create mode 100644 keyboards/zeal60/keymaps/poker2_ansi/config.h create mode 100644 keyboards/zeal60/keymaps/poker2_ansi/keymap.c create mode 100644 keyboards/zeal60/keymaps/poker2_iso/config.h create mode 100644 keyboards/zeal60/keymaps/poker2_iso/keymap.c create mode 100644 keyboards/zeal60/keymaps/test/config.h create mode 100644 keyboards/zeal60/keymaps/test/keymap.c create mode 100644 keyboards/zeal60/rules.mk create mode 100644 keyboards/zeal60/zeal60.c create mode 100644 keyboards/zeal60/zeal60.h create mode 100644 keyboards/zeal60/zeal_backlight.c create mode 100644 keyboards/zeal60/zeal_backlight.h create mode 100644 keyboards/zeal60/zeal_color.c create mode 100644 keyboards/zeal60/zeal_color.h create mode 100644 keyboards/zeal60/zeal_eeprom.c create mode 100644 keyboards/zeal60/zeal_eeprom.h create mode 100644 keyboards/zeal60/zeal_keycode.h create mode 100644 keyboards/zeal60/zeal_keymap.c create mode 100644 keyboards/zeal60/zeal_keymap.h create mode 100644 keyboards/zeal60/zeal_rpc.h create mode 100644 quantum/quantum_keycodes.h diff --git a/keyboards/zeal60/IS31FL3731_driver.c b/keyboards/zeal60/IS31FL3731_driver.c new file mode 100644 index 000000000000..d89b791ab54e --- /dev/null +++ b/keyboards/zeal60/IS31FL3731_driver.c @@ -0,0 +1,184 @@ + +#include "IS31FL3731_driver.h" +#include +#include +#include +#include "TWIlib.h" +#include "progmem.h" + +// This is a 7-bit address, that gets left-shifted and bit 0 +// set to 0 for write, 1 for read (as per I2C protocol) +#define ISSI_ADDR_DEFAULT 0x74 + +#define ISSI_REG_CONFIG 0x00 +#define ISSI_REG_CONFIG_PICTUREMODE 0x00 +#define ISSI_REG_CONFIG_AUTOPLAYMODE 0x08 +#define ISSI_REG_CONFIG_AUDIOPLAYMODE 0x18 + +#define ISSI_CONF_PICTUREMODE 0x00 +#define ISSI_CONF_AUTOFRAMEMODE 0x04 +#define ISSI_CONF_AUDIOMODE 0x08 + +#define ISSI_REG_PICTUREFRAME 0x01 + +#define ISSI_REG_SHUTDOWN 0x0A +#define ISSI_REG_AUDIOSYNC 0x06 + +#define ISSI_COMMANDREGISTER 0xFD +#define ISSI_BANK_FUNCTIONREG 0x0B // helpfully called 'page nine' + +// Transfer buffer for TWITransmitData() +uint8_t g_twi_transfer_buffer[TXMAXBUFLEN]; + +// These buffers match the IS31FL3731 PWM registers 0x24-0xB3. +// Storing them like this is optimal for I2C transfers to the registers. +// We could optimize this and take out the unused registers from these +// buffers and the transfers in IS31FL3731_write_pwm_buffer() but it's +// probably not worth the extra complexity. +uint8_t g_pwm_buffer[2][144]; +bool g_pwm_buffer_update_required = false; + +// map of LED index to register (matrix A and matrix B) +// i.e. this is LA0..LA17,LB0..LB17 and also LC0..LC17,LD0..LD17 +// Index of LED (0..36) will map to a register. +// Subtract 0x24 to get the second index of g_pwm_buffer +const uint8_t g_red_registers[36] PROGMEM = { + 0x34, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, + 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0x9B, + 0x3C, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, + 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xA3 }; + +const uint8_t g_green_registers[36] PROGMEM = { + 0x44, 0x45, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, + 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x8A, 0x8B, + 0x4C, 0x4D, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, + 0x9C, 0x9D, 0x9E, 0x9F, 0xA0, 0xA1, 0xA2, 0x92, 0x93 }; + +const uint8_t g_blue_registers[36] PROGMEM = { + 0x54, 0x55, 0x56, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, + 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x79, 0x7A, 0x7B, + 0x5C, 0x5D, 0x5E, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, + 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x81, 0x82, 0x83 }; + +void IS31FL3731_write_register( uint8_t addr, uint8_t reg, uint8_t data ) +{ + g_twi_transfer_buffer[0] = (addr<<1) | 0x00; + g_twi_transfer_buffer[1] = reg; + g_twi_transfer_buffer[2] = data; + + // Set the error code to have no relevant information + TWIInfo.errorCode = TWI_NO_RELEVANT_INFO; + // Continuously attempt to transmit data until a successful transmission occurs + while (TWIInfo.errorCode != 0xFF) + { + TWITransmitData(g_twi_transfer_buffer, 3, 0); + } +} + +void IS31FL3731_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer ) +{ + // transmit PWM registers in 9 transfers of 16 bytes + // g_twi_transfer_buffer[] is 20 bytes + + // set the I2C address + g_twi_transfer_buffer[0] = (addr<<1) | 0x00; + + // iterate over the pwm_buffer contents at 16 byte intervals + for ( int i=0; i<144; i+=16 ) + { + // set the first register, e.g. 0x24, 0x34, 0x44, etc. + g_twi_transfer_buffer[1] = 0x24+i; + // copy the data from i to i+15 + // device will auto-increment register for data after the first byte + // thus this sets registers 0x24-0x33, 0x34-0x43, etc. in one transfer + for ( int j=0; j<16; j++ ) + { + g_twi_transfer_buffer[2+j] = pwm_buffer[i+j]; + } + + // Set the error code to have no relevant information + TWIInfo.errorCode = TWI_NO_RELEVANT_INFO; + // Continuously attempt to transmit data until a successful transmission occurs + while (TWIInfo.errorCode != 0xFF) + { + TWITransmitData(g_twi_transfer_buffer, 16+2, 0); + } + } +} + +void IS31FL3731_init( uint8_t addr ) +{ + // select "function register" bank + IS31FL3731_write_register( addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG ); + + // shutdown + IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00); + _delay_ms(10); + // out of shutdown + IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x01); + + // picture mode + IS31FL3731_write_register(addr, ISSI_REG_CONFIG, ISSI_REG_CONFIG_PICTUREMODE); + // display frame 0 + IS31FL3731_write_register(addr, ISSI_REG_PICTUREFRAME, 0x00); + // audio sync off + IS31FL3731_write_register(addr, ISSI_REG_AUDIOSYNC, 0x00); + + // select bank 0 + IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, 0 ); + + // turn off all LEDs in the LED control register + for ( int i=0x00; i<=0x11; i++ ) + { + IS31FL3731_write_register(addr, i, 0x00 ); + } + + // turn off all LEDs in the blink control register (not really needed) + for ( int i=0x12; i<=0x23; i++ ) + { + IS31FL3731_write_register(addr, i, 0x00 ); + } + + // set PWM on all LEDs to 0 + for ( int i=0x24; i<=0xB3; i++ ) + { + IS31FL3731_write_register(addr, i, 0x00 ); + } +} + +void IS31FL3731_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) +{ + if ( index >=0 && index <72 ) + { + int driver = 0; + if ( index >= 36 ) + { + driver = 1; + index -= 36; + } + // Index of LED (0..36) will map to a register. + // Subtract 0x24 to get the second index of g_pwm_buffer + g_pwm_buffer[driver][ pgm_read_byte(&g_red_registers[index])-0x24 ] = red; + g_pwm_buffer[driver][ pgm_read_byte(&g_green_registers[index])-0x24 ] = green; + g_pwm_buffer[driver][ pgm_read_byte(&g_blue_registers[index])-0x24 ] = blue; + g_pwm_buffer_update_required = true; + } +} + +void IS31FL3731_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) +{ + for ( int i=0; i<72; i++ ) + { + IS31FL3731_set_color( i, red, green, blue ); + } +} + +void IS31FL3731_update_pwm_buffers( uint8_t addr1, uint8_t addr2 ) +{ + if ( g_pwm_buffer_update_required ) + { + IS31FL3731_write_pwm_buffer( addr1, g_pwm_buffer[0] ); + IS31FL3731_write_pwm_buffer( addr2, g_pwm_buffer[1] ); + } + g_pwm_buffer_update_required = false; +} diff --git a/keyboards/zeal60/IS31FL3731_driver.h b/keyboards/zeal60/IS31FL3731_driver.h new file mode 100644 index 000000000000..ed31d5a3df82 --- /dev/null +++ b/keyboards/zeal60/IS31FL3731_driver.h @@ -0,0 +1,20 @@ +#ifndef IS31FL3731_DRIVER_H +#define IS31FL3731_DRIVER_H + +#include +#include + +void IS31FL3731_init( uint8_t addr ); +void IS31FL3731_write_register( uint8_t addr, uint8_t reg, uint8_t data ); +void IS31FL3731_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer ); + +void IS31FL3731_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ); +void IS31FL3731_set_color_all( uint8_t red, uint8_t green, uint8_t blue ); + +// This should not be called from an interrupt +// (eg. from a timer interrupt). +// Call this while idle (in between matrix scans). +// If the buffer is dirty, it will update the driver with the buffer. +void IS31FL3731_update_pwm_buffers( uint8_t addr1, uint8_t addr2 ); + +#endif // IS31FL3731_DRIVER_H diff --git a/keyboards/zeal60/Makefile b/keyboards/zeal60/Makefile new file mode 100644 index 000000000000..4e2a6f00fd8e --- /dev/null +++ b/keyboards/zeal60/Makefile @@ -0,0 +1,3 @@ +ifndef MAKEFILE_INCLUDED + include ../../Makefile +endif \ No newline at end of file diff --git a/keyboards/zeal60/TWIlib.c b/keyboards/zeal60/TWIlib.c new file mode 100644 index 000000000000..b39e3054a5c7 --- /dev/null +++ b/keyboards/zeal60/TWIlib.c @@ -0,0 +1,232 @@ +/* + * TWIlib.c + * + * Created: 6/01/2014 10:41:33 PM + * Author: Chris Herring + * http://www.chrisherring.net/all/tutorial-interrupt-driven-twi-interface-for-avr-part1/ + */ + +#include +#include +#include "TWIlib.h" +#include "util/delay.h" + +void TWIInit() +{ + TWIInfo.mode = Ready; + TWIInfo.errorCode = 0xFF; + TWIInfo.repStart = 0; + // Set pre-scalers (no pre-scaling) + TWSR = 0; + // Set bit rate + TWBR = ((F_CPU / TWI_FREQ) - 16) / 2; + // Enable TWI and interrupt + TWCR = (1 << TWIE) | (1 << TWEN); +} + +uint8_t isTWIReady() +{ + if ( (TWIInfo.mode == Ready) | (TWIInfo.mode == RepeatedStartSent) ) + { + return 1; + } + else + { + return 0; + } +} + +uint8_t TWITransmitData(void *const TXdata, uint8_t dataLen, uint8_t repStart) +{ + if (dataLen <= TXMAXBUFLEN) + { + // Wait until ready + while (!isTWIReady()) {_delay_us(1);} + // Set repeated start mode + TWIInfo.repStart = repStart; + // Copy data into the transmit buffer + uint8_t *data = (uint8_t *)TXdata; + for (int i = 0; i < dataLen; i++) + { + TWITransmitBuffer[i] = data[i]; + } + // Copy transmit info to global variables + TXBuffLen = dataLen; + TXBuffIndex = 0; + + // If a repeated start has been sent, then devices are already listening for an address + // and another start does not need to be sent. + if (TWIInfo.mode == RepeatedStartSent) + { + TWIInfo.mode = Initializing; + TWDR = TWITransmitBuffer[TXBuffIndex++]; // Load data to transmit buffer + TWISendTransmit(); // Send the data + } + else // Otherwise, just send the normal start signal to begin transmission. + { + TWIInfo.mode = Initializing; + TWISendStart(); + } + + } + else + { + return 1; // return an error if data length is longer than buffer + } + return 0; +} + +uint8_t TWIReadData(uint8_t TWIaddr, uint8_t bytesToRead, uint8_t repStart) +{ + // Check if number of bytes to read can fit in the RXbuffer + if (bytesToRead < RXMAXBUFLEN) + { + // Reset buffer index and set RXBuffLen to the number of bytes to read + RXBuffIndex = 0; + RXBuffLen = bytesToRead; + // Create the one value array for the address to be transmitted + uint8_t TXdata[1]; + // Shift the address and AND a 1 into the read write bit (set to write mode) + TXdata[0] = (TWIaddr << 1) | 0x01; + // Use the TWITransmitData function to initialize the transfer and address the slave + TWITransmitData(TXdata, 1, repStart); + } + else + { + return 0; + } + return 1; +} + +ISR (TWI_vect) +{ + switch (TWI_STATUS) + { + // ----\/ ---- MASTER TRANSMITTER OR WRITING ADDRESS ----\/ ---- // + case TWI_MT_SLAW_ACK: // SLA+W transmitted and ACK received + // Set mode to Master Transmitter + TWIInfo.mode = MasterTransmitter; + case TWI_START_SENT: // Start condition has been transmitted + case TWI_MT_DATA_ACK: // Data byte has been transmitted, ACK received + if (TXBuffIndex < TXBuffLen) // If there is more data to send + { + TWDR = TWITransmitBuffer[TXBuffIndex++]; // Load data to transmit buffer + TWIInfo.errorCode = TWI_NO_RELEVANT_INFO; + TWISendTransmit(); // Send the data + } + // This transmission is complete however do not release bus yet + else if (TWIInfo.repStart) + { + TWIInfo.errorCode = 0xFF; + TWISendStart(); + } + // All transmissions are complete, exit + else + { + TWIInfo.mode = Ready; + TWIInfo.errorCode = 0xFF; + TWISendStop(); + } + break; + + // ----\/ ---- MASTER RECEIVER ----\/ ---- // + + case TWI_MR_SLAR_ACK: // SLA+R has been transmitted, ACK has been received + // Switch to Master Receiver mode + TWIInfo.mode = MasterReceiver; + // If there is more than one byte to be read, receive data byte and return an ACK + if (RXBuffIndex < RXBuffLen-1) + { + TWIInfo.errorCode = TWI_NO_RELEVANT_INFO; + TWISendACK(); + } + // Otherwise when a data byte (the only data byte) is received, return NACK + else + { + TWIInfo.errorCode = TWI_NO_RELEVANT_INFO; + TWISendNACK(); + } + break; + + case TWI_MR_DATA_ACK: // Data has been received, ACK has been transmitted. + + /// -- HANDLE DATA BYTE --- /// + TWIReceiveBuffer[RXBuffIndex++] = TWDR; + // If there is more than one byte to be read, receive data byte and return an ACK + if (RXBuffIndex < RXBuffLen-1) + { + TWIInfo.errorCode = TWI_NO_RELEVANT_INFO; + TWISendACK(); + } + // Otherwise when a data byte (the only data byte) is received, return NACK + else + { + TWIInfo.errorCode = TWI_NO_RELEVANT_INFO; + TWISendNACK(); + } + break; + + case TWI_MR_DATA_NACK: // Data byte has been received, NACK has been transmitted. End of transmission. + + /// -- HANDLE DATA BYTE --- /// + TWIReceiveBuffer[RXBuffIndex++] = TWDR; + // This transmission is complete however do not release bus yet + if (TWIInfo.repStart) + { + TWIInfo.errorCode = 0xFF; + TWISendStart(); + } + // All transmissions are complete, exit + else + { + TWIInfo.mode = Ready; + TWIInfo.errorCode = 0xFF; + TWISendStop(); + } + break; + + // ----\/ ---- MT and MR common ----\/ ---- // + + case TWI_MR_SLAR_NACK: // SLA+R transmitted, NACK received + case TWI_MT_SLAW_NACK: // SLA+W transmitted, NACK received + case TWI_MT_DATA_NACK: // Data byte has been transmitted, NACK received + case TWI_LOST_ARBIT: // Arbitration has been lost + // Return error and send stop and set mode to ready + if (TWIInfo.repStart) + { + TWIInfo.errorCode = TWI_STATUS; + TWISendStart(); + } + // All transmissions are complete, exit + else + { + TWIInfo.mode = Ready; + TWIInfo.errorCode = TWI_STATUS; + TWISendStop(); + } + break; + case TWI_REP_START_SENT: // Repeated start has been transmitted + // Set the mode but DO NOT clear TWINT as the next data is not yet ready + TWIInfo.mode = RepeatedStartSent; + break; + + // ----\/ ---- SLAVE RECEIVER ----\/ ---- // + + // TODO IMPLEMENT SLAVE RECEIVER FUNCTIONALITY + + // ----\/ ---- SLAVE TRANSMITTER ----\/ ---- // + + // TODO IMPLEMENT SLAVE TRANSMITTER FUNCTIONALITY + + // ----\/ ---- MISCELLANEOUS STATES ----\/ ---- // + case TWI_NO_RELEVANT_INFO: // It is not really possible to get into this ISR on this condition + // Rather, it is there to be manually set between operations + break; + case TWI_ILLEGAL_START_STOP: // Illegal START/STOP, abort and return error + TWIInfo.errorCode = TWI_ILLEGAL_START_STOP; + TWIInfo.mode = Ready; + TWISendStop(); + break; + } + +} diff --git a/keyboards/zeal60/TWIlib.h b/keyboards/zeal60/TWIlib.h new file mode 100644 index 000000000000..23fd1f09aa9f --- /dev/null +++ b/keyboards/zeal60/TWIlib.h @@ -0,0 +1,82 @@ +/* + * TWIlib.h + * + * Created: 6/01/2014 10:38:42 PM + * Author: Chris Herring + * http://www.chrisherring.net/all/tutorial-interrupt-driven-twi-interface-for-avr-part1/ + */ + + +#ifndef TWILIB_H_ +#define TWILIB_H_ +// TWI bit rate (was 100000) +#define TWI_FREQ 400000 +// Get TWI status +#define TWI_STATUS (TWSR & 0xF8) +// Transmit buffer length +#define TXMAXBUFLEN 20 +// Receive buffer length +#define RXMAXBUFLEN 20 +// Global transmit buffer +uint8_t TWITransmitBuffer[TXMAXBUFLEN]; +// Global receive buffer +volatile uint8_t TWIReceiveBuffer[RXMAXBUFLEN]; +// Buffer indexes +volatile int TXBuffIndex; // Index of the transmit buffer. Is volatile, can change at any time. +int RXBuffIndex; // Current index in the receive buffer +// Buffer lengths +int TXBuffLen; // The total length of the transmit buffer +int RXBuffLen; // The total number of bytes to read (should be less than RXMAXBUFFLEN) + +typedef enum { + Ready, + Initializing, + RepeatedStartSent, + MasterTransmitter, + MasterReceiver, + SlaceTransmitter, + SlaveReciever + } TWIMode; + + typedef struct TWIInfoStruct{ + TWIMode mode; + uint8_t errorCode; + uint8_t repStart; + }TWIInfoStruct; +TWIInfoStruct TWIInfo; + + +// TWI Status Codes +#define TWI_START_SENT 0x08 // Start sent +#define TWI_REP_START_SENT 0x10 // Repeated Start sent +// Master Transmitter Mode +#define TWI_MT_SLAW_ACK 0x18 // SLA+W sent and ACK received +#define TWI_MT_SLAW_NACK 0x20 // SLA+W sent and NACK received +#define TWI_MT_DATA_ACK 0x28 // DATA sent and ACK received +#define TWI_MT_DATA_NACK 0x30 // DATA sent and NACK received +// Master Receiver Mode +#define TWI_MR_SLAR_ACK 0x40 // SLA+R sent, ACK received +#define TWI_MR_SLAR_NACK 0x48 // SLA+R sent, NACK received +#define TWI_MR_DATA_ACK 0x50 // Data received, ACK returned +#define TWI_MR_DATA_NACK 0x58 // Data received, NACK returned + +// Miscellaneous States +#define TWI_LOST_ARBIT 0x38 // Arbitration has been lost +#define TWI_NO_RELEVANT_INFO 0xF8 // No relevant information available +#define TWI_ILLEGAL_START_STOP 0x00 // Illegal START or STOP condition has been detected +#define TWI_SUCCESS 0xFF // Successful transfer, this state is impossible from TWSR as bit2 is 0 and read only + + +#define TWISendStart() (TWCR = (1< + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +// USB Device descriptor parameter +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6060 +#define DEVICE_VER 0x0001 +#define MANUFACTURER ZealPC +#define PRODUCT Zeal60 +#define DESCRIPTION Zeal60 (QMK Firmware) + +// key matrix size +#define MATRIX_ROWS 5 +#define MATRIX_COLS 14 + +// Zeal60 PCB default pin-out +#define MATRIX_ROW_PINS { F0, F1, F4, F6, F7 } +#define MATRIX_COL_PINS { F5, D5, B1, B2, B3, D3, D2, C7, C6, B6, B5, B4, D7, D6 } +#define UNUSED_PINS + +// COL2ROW or ROW2COL +#define DIODE_DIRECTION COL2ROW + +// Set 0 if debouncing isn't needed +#define DEBOUNCING_DELAY 5 + +// Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap +#define LOCKING_SUPPORT_ENABLE +// Locking resynchronize hack +#define LOCKING_RESYNC_ENABLE + +// key combination for command +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +// disable debug print +//#define NO_DEBUG + +// disable print +//#define NO_PRINT + +// disable action features +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +// enable/disable LEDs based on layout +#define USE_SPLIT_BACKSPACE 0 +#define USE_SPLIT_LEFT_SHIFT 0 +#define USE_SPLIT_RIGHT_SHIFT 0 +#define USE_7U_SPACEBAR 0 +#define USE_ISO_ENTER 0 + +// These define which keys in the matrix are alphas/mods +// Used for backlight effects so colors are different for +// alphas vs. mods +// Each value is for a row, bit 0 is column 13 +// Alpha=0 Mod=1 +#define ALPHAS_MODS_ROW_0 0b0010000000000001 +#define ALPHAS_MODS_ROW_1 0b0010000000000000 +#define ALPHAS_MODS_ROW_2 0b0010000000000010 +#define ALPHAS_MODS_ROW_3 0b0010000000000011 +#define ALPHAS_MODS_ROW_4 0b0011100000001111 + + + +#endif diff --git a/keyboards/zeal60/keymaps/default/config.h b/keyboards/zeal60/keymaps/default/config.h new file mode 100644 index 000000000000..8b76f1bddf93 --- /dev/null +++ b/keyboards/zeal60/keymaps/default/config.h @@ -0,0 +1,24 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +/* enable/disable LEDs based on layout */ +#undef USE_SPLIT_BACKSPACE +#define USE_SPLIT_BACKSPACE 0 + +#undef USE_SPLIT_LEFT_SHIFT +#define USE_SPLIT_LEFT_SHIFT 0 + +#undef USE_SPLIT_RIGHT_SHIFT +#define USE_SPLIT_RIGHT_SHIFT 0 + +#undef USE_7U_SPACEBAR +#define USE_7U_SPACEBAR 0 + +#undef USE_ISO_ENTER +#define USE_ISO_ENTER 0 + + + +#endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/default/keymap.c b/keyboards/zeal60/keymaps/default/keymap.c new file mode 100644 index 000000000000..6134783b048f --- /dev/null +++ b/keyboards/zeal60/keymaps/default/keymap.c @@ -0,0 +1,51 @@ +// Default layout for Zeal60 + +#include "zeal60.h" +#include "action_layer.h" + +// [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace +// [1,13] is either backslash or ISO Enter +// [2,12] is either ANSI Enter or key left of ISO Enter +// [2,13] is right key of split backspace (e.g. HHKB `~ key) +// [3,1] is right key of split left-shift (e.g ISO key) +// [3,13] is right key of split right-shift (e.g. HHKB Fn key) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +// Default layer +[0] = { + {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS}, + {KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_NO }, + {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO }, + {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RALT, FN_TT13, FN_TT23, KC_RCTL} +}, + +// Fn1 LayerS +[1] = { + {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, + {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS}, + {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, + +// Fn2 Layer +[2] = { + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, + +// Fn3 Layer (zeal60 Configuration) +[3] = { + {RESET, EF_DEC, EF_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +} + +}; diff --git a/keyboards/zeal60/keymaps/hhkb_ansi/config.h b/keyboards/zeal60/keymaps/hhkb_ansi/config.h new file mode 100644 index 000000000000..be7910b63a39 --- /dev/null +++ b/keyboards/zeal60/keymaps/hhkb_ansi/config.h @@ -0,0 +1,24 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +/* enable/disable LEDs based on layout */ +#undef USE_SPLIT_BACKSPACE +#define USE_SPLIT_BACKSPACE 1 + +#undef USE_SPLIT_LEFT_SHIFT +#define USE_SPLIT_LEFT_SHIFT 0 + +#undef USE_SPLIT_RIGHT_SHIFT +#define USE_SPLIT_RIGHT_SHIFT 1 + +#undef USE_7U_SPACEBAR +#define USE_7U_SPACEBAR 1 + +#undef USE_ISO_ENTER +#define USE_ISO_ENTER 0 + + + +#endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/hhkb_ansi/keymap.c b/keyboards/zeal60/keymaps/hhkb_ansi/keymap.c new file mode 100644 index 000000000000..f6d56fb9e0fc --- /dev/null +++ b/keyboards/zeal60/keymaps/hhkb_ansi/keymap.c @@ -0,0 +1,57 @@ +// HHKB layout for Zeal60 + +#include "zeal60.h" +#include "action_layer.h" + +// [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace +// [1,13] is either backslash or ISO Enter +// [2,12] is either ANSI Enter or key left of ISO Enter +// [2,13] is right key of split backspace (e.g. HHKB `~ key) +// [3,1] is right key of split left-shift (e.g ISO key) +// [3,13] is right key of split right-shift (e.g. HHKB Fn key) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +// Default layer +[0] = { + {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS}, + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC}, + {KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_GRV }, + {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, FN_TT13}, + {KC_NO, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_NO, KC_RALT, FN_TT23, KC_NO } +}, + +// Fn1 Layer +[1] = { + {KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS }, + {KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_EJCT, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_TRNS, KC_DEL }, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, + +// Fn2 Layer +[2] = { + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, + +// Fn3 Layer (zeal60 Configuration) +[3] = { + {RESET, EF_DEC, EF_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +} + +}; + +const uint16_t PROGMEM fn_actions[] = { +}; + + + diff --git a/keyboards/zeal60/keymaps/poker2_ansi/config.h b/keyboards/zeal60/keymaps/poker2_ansi/config.h new file mode 100644 index 000000000000..e3b070ce6557 --- /dev/null +++ b/keyboards/zeal60/keymaps/poker2_ansi/config.h @@ -0,0 +1,25 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + + +/* enable/disable LEDs based on layout */ +#undef USE_SPLIT_BACKSPACE +#define USE_SPLIT_BACKSPACE 0 + +#undef USE_SPLIT_LEFT_SHIFT +#define USE_SPLIT_LEFT_SHIFT 0 + +#undef USE_SPLIT_RIGHT_SHIFT +#define USE_SPLIT_RIGHT_SHIFT 0 + +#undef USE_7U_SPACEBAR +#define USE_7U_SPACEBAR 0 + +#undef USE_ISO_ENTER +#define USE_ISO_ENTER 0 + + + +#endif //CONFIG_USER_H \ No newline at end of file diff --git a/keyboards/zeal60/keymaps/poker2_ansi/keymap.c b/keyboards/zeal60/keymaps/poker2_ansi/keymap.c new file mode 100644 index 000000000000..dce36252a0be --- /dev/null +++ b/keyboards/zeal60/keymaps/poker2_ansi/keymap.c @@ -0,0 +1,51 @@ +// Poker2 ANSI layout for Zeal60 + +#include "zeal60.h" +#include "action_layer.h" + +// [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace +// [1,13] is either backslash or ISO Enter +// [2,12] is either ANSI Enter or key left of ISO Enter +// [2,13] is right key of split backspace (e.g. HHKB `~ key) +// [3,1] is right key of split left-shift (e.g ISO key) +// [3,13] is right key of split right-shift (e.g. HHKB Fn key) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +// Default layer +[0] = { + {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS}, + {KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_NO }, + {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO }, + {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RALT, FN_TT13, FN_TT23, KC_RCTL} +}, + +// Fn1 Layer +[1] = { + {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, + {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS}, + {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, + +// Fn2 Layer +[2] = { + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, + +// Fn3 Layer (zeal60 Configuration) +[3] = { + {RESET, EF_DEC, EF_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +} + +}; diff --git a/keyboards/zeal60/keymaps/poker2_iso/config.h b/keyboards/zeal60/keymaps/poker2_iso/config.h new file mode 100644 index 000000000000..3b04288cc0c2 --- /dev/null +++ b/keyboards/zeal60/keymaps/poker2_iso/config.h @@ -0,0 +1,25 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + + +/* enable/disable LEDs based on layout */ +#undef USE_SPLIT_BACKSPACE +#define USE_SPLIT_BACKSPACE 0 + +#undef USE_SPLIT_LEFT_SHIFT +#define USE_SPLIT_LEFT_SHIFT 0 + +#undef USE_SPLIT_RIGHT_SHIFT +#define USE_SPLIT_RIGHT_SHIFT 0 + +#undef USE_7U_SPACEBAR +#define USE_7U_SPACEBAR 0 + +#undef USE_ISO_ENTER +#define USE_ISO_ENTER 1 + + + +#endif //CONFIG_USER_H \ No newline at end of file diff --git a/keyboards/zeal60/keymaps/poker2_iso/keymap.c b/keyboards/zeal60/keymaps/poker2_iso/keymap.c new file mode 100644 index 000000000000..46acebfa11f9 --- /dev/null +++ b/keyboards/zeal60/keymaps/poker2_iso/keymap.c @@ -0,0 +1,51 @@ +// Poker2 ANSI layout for Zeal60 + +#include "zeal60.h" +#include "action_layer.h" + +// [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace +// [1,13] is either backslash or ISO Enter +// [2,12] is either ANSI Enter or key left of ISO Enter +// [2,13] is right key of split backspace (e.g. HHKB `~ key) +// [3,1] is right key of split left-shift (e.g ISO key) +// [3,13] is right key of split right-shift (e.g. HHKB Fn key) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +// Default layer +[0] = { + {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_ENT }, + {KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_NO }, + {KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO }, + {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RALT, FN_TT13, FN_TT23, KC_RCTL} +}, + +// Fn1 Layer +[1] = { + {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, + {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS}, + {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, + +// Fn2 Layer +[2] = { + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, + +// Fn3 Layer (zeal60 Configuration) +[3] = { + {RESET, EF_DEC, EF_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +} + +}; diff --git a/keyboards/zeal60/keymaps/test/config.h b/keyboards/zeal60/keymaps/test/config.h new file mode 100644 index 000000000000..6150f938718d --- /dev/null +++ b/keyboards/zeal60/keymaps/test/config.h @@ -0,0 +1,27 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#define ZEAL60_TEST +#undef RAW_ENABLE + +/* enable/disable LEDs based on layout */ +#undef USE_SPLIT_BACKSPACE +#define USE_SPLIT_BACKSPACE 0 + +#undef USE_SPLIT_LEFT_SHIFT +#define USE_SPLIT_LEFT_SHIFT 0 + +#undef USE_SPLIT_RIGHT_SHIFT +#define USE_SPLIT_RIGHT_SHIFT 0 + +#undef USE_7U_SPACEBAR +#define USE_7U_SPACEBAR 0 + +#undef USE_ISO_ENTER +#define USE_ISO_ENTER 0 + + + +#endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/test/keymap.c b/keyboards/zeal60/keymaps/test/keymap.c new file mode 100644 index 000000000000..de2d02b3dfd5 --- /dev/null +++ b/keyboards/zeal60/keymaps/test/keymap.c @@ -0,0 +1,51 @@ +// Poker2 ANSI layout for Zeal60 + +#include "zeal60.h" +#include "action_layer.h" + +// [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace +// [1,13] is either backslash or ISO Enter +// [2,12] is either ANSI Enter or key left of ISO Enter +// [2,13] is right key of split backspace (e.g. HHKB `~ key) +// [3,1] is right key of split left-shift (e.g ISO key) +// [3,13] is right key of split right-shift (e.g. HHKB Fn key) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +// Default layer +[0] = { + {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS}, + {KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_NO }, + {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO }, + {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RALT, FN_TT13, FN_TT23, KC_RCTL} +}, + +// Fn1 Layer +[1] = { + {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, + {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS}, + {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_NO }, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, + +// Fn2 Layer +[2] = { + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, + +// Fn3 Layer (zeal60 Configuration) +[3] = { + {RESET, EF_DEC, EF_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +} + +}; diff --git a/keyboards/zeal60/rules.mk b/keyboards/zeal60/rules.mk new file mode 100644 index 000000000000..296f13f48000 --- /dev/null +++ b/keyboards/zeal60/rules.mk @@ -0,0 +1,83 @@ + + +# project specific files +SRC = zeal_backlight.c \ + zeal_color.c \ + zeal_eeprom.c \ + zeal_keymap.c \ + IS31FL3731_driver.c \ + TWIlib.c + +# MCU name +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + +# Do not put the microcontroller into power saving mode +# when we get USB suspend event. We want it to keep updating +# backlight effects. +OPT_DEFS += -DNO_SUSPEND_POWER_DOWN + +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE ?= yes # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE ?= no # Mouse keys(+4700) +EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) +CONSOLE_ENABLE ?= yes # Console for debug(+400) +COMMAND_ENABLE ?= yes # Commands for debug and configuration +NKRO_ENABLE ?= yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE ?= no # MIDI controls +AUDIO_ENABLE ?= no # Audio output on port C6 +UNICODE_ENABLE ?= no # Unicode +BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend + +RAW_ENABLE = yes diff --git a/keyboards/zeal60/zeal60.c b/keyboards/zeal60/zeal60.c new file mode 100644 index 000000000000..5037ef4c2cc6 --- /dev/null +++ b/keyboards/zeal60/zeal60.c @@ -0,0 +1,307 @@ +#include "zeal60.h" +#include "zeal_backlight.h" +#include "zeal_keymap.h" +#include "zeal_eeprom.h" +#include "zeal_rpc.h" + +#include "raw_hid.h" +#include "config.h" + +#ifdef RAW_ENABLE + +void raw_hid_receive( uint8_t *data, uint8_t length ) +{ + uint8_t command = data[0]; + switch ( command ) + { + case id_keymap_keycode_load: + { + uint16_t keycode = keymap_keycode_load(data[1], data[2], data[3]); + data[4] = (uint8_t)(keycode >> 8); + data[5] = (uint8_t)(keycode & 0xFF); + break; + } + case id_keymap_keycode_save: + { + uint16_t keycode = data[4] << 8; + keycode |= data[5]; + keymap_keycode_save(data[1], data[2], data[3], keycode); + break; + } + case id_keymap_default_save: + { + keymap_default_save(); + break; + } + case id_backlight_config_set_flags: + { + backlight_config_set_flags(data[1]); + backlight_config_save(); + backlight_init_drivers(); + break; + } + case id_backlight_config_set_alphas_mods: + { + uint16_t alpha_mods[5]; + alpha_mods[0] = data[1] << 8 | data[2]; + alpha_mods[1] = data[3] << 8 | data[4]; + alpha_mods[2] = data[5] << 8 | data[6]; + alpha_mods[3] = data[7] << 8 | data[8]; + alpha_mods[4] = data[9] << 8 | data[10]; + backlight_config_set_alphas_mods( alpha_mods ); + backlight_config_save(); + break; + } + case id_backlight_set_key_color: + { + HSV hsv = { data[3], data[4], data[5] }; + backlight_set_key_color(data[1], data[2], hsv); + break; + } + } + + // Return same buffer with values changed + raw_hid_send( data, length ); + +} + +#endif + + +void matrix_init_kb(void) +{ + +#ifndef ZEAL60_TEST + // If the EEPROM has the magic, the data is good. + // OK to load from EEPROM. + if (eeprom_is_valid()) + { + backlight_config_load(); + + // TODO: do something to "turn on" keymaps in EEPROM? + } + else + { + // If the EEPROM has not been saved before, or is out of date, + // save the default values to the EEPROM. Default values + // come from construction of the zeal_backlight_config instance. + backlight_config_save(); + + // This saves "empty" keymaps so it falls back to the keymaps + // in the firmware (aka. progmem/flash) + keymap_default_save(); + + // Save the magic number last, in case saving was interrupted + eeprom_set_valid(true); + } +#endif + + // Initialize LED drivers for backlight. + backlight_init_drivers(); + + backlight_timer_init(); + backlight_timer_enable(); + + matrix_init_user(); +} + +void matrix_scan_kb(void) +{ + // This only updates the LED driver buffers if something has changed. + backlight_update_pwm_buffers(); + + matrix_scan_user(); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + // put your per-action keyboard code here + // runs for every action, just before processing by the firmware + + switch(keycode) + { + case BR_INC: + if (record->event.pressed) + { + backlight_brightness_increase(); + } + return false; + break; + case BR_DEC: + if (record->event.pressed) + { + backlight_brightness_decrease(); + } + return false; + break; + case EF_INC: + if (record->event.pressed) + { + backlight_effect_increase(); + } + return false; + break; + case EF_DEC: + if (record->event.pressed) + { + backlight_effect_decrease(); + } + return false; + break; + case H1_INC: + if (record->event.pressed) + { + backlight_color_1_hue_increase(); + } + return false; + break; + case H1_DEC: + if (record->event.pressed) + { + backlight_color_1_hue_decrease(); + } + return false; + break; + case S1_INC: + if (record->event.pressed) + { + backlight_color_1_sat_increase(); + } + return false; + break; + case S1_DEC: + if (record->event.pressed) + { + backlight_color_1_sat_decrease(); + break; + } + return false; + break; + case H2_INC: + if (record->event.pressed) + { + backlight_color_2_hue_increase(); + } + return false; + break; + case H2_DEC: + if (record->event.pressed) + { + backlight_color_2_hue_decrease(); + } + return false; + break; + case S2_INC: + if (record->event.pressed) + { + backlight_color_2_sat_increase(); + } + return false; + break; + case S2_DEC: + if (record->event.pressed) + { + backlight_color_2_sat_decrease(); + break; + } + return false; + break; + } + + return process_record_user(keycode, record); +} + +// This overrides the one in quantum/keymap_common.c +uint16_t keymap_function_id_to_action( uint16_t function_id ) +{ + // Zeal60 specific "action functions" are 0xF00 to 0xFFF + // i.e. F(0xF00) to F(0xFFF) are mapped to + // enum zeal60_action_functions by masking last 8 bits. + if ( function_id >= 0x0F00 && function_id <= 0x0FFF ) + { + uint8_t id = function_id & 0xFF; + switch ( id ) + { + case TRIPLE_TAP_1_3: + case TRIPLE_TAP_2_3: + { + return ACTION_FUNCTION_TAP(id); + break; + } + default: + break; + } + } + +#if 0 + // This is how to implement actions stored in EEPROM. + // Not yet implemented. Not sure if it's worth the trouble + // before we have a nice GUI for keymap editing. + if ( eeprom_is_valid() && + function_id < 32 ) // TODO: replace magic number + { + uint16_t action = keymap_action_load(function_id); + + // If action is not "empty", return it, otherwise + // drop down to return the one in flash + if ( action != 0x0000 ) // TODO: replace magic number + { + return action; + } + } +#endif + + return pgm_read_word(&fn_actions[function_id]); +} + + +// Zeal60 specific "action functions" +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + switch (id) + { + case TRIPLE_TAP_1_3: + case TRIPLE_TAP_2_3: + if (record->event.pressed) + { + layer_on( id == TRIPLE_TAP_1_3 ? 1 : 2 ); + + if (record->tap.count && !record->tap.interrupted) + { + if (record->tap.count >= 3) + { + layer_invert(3); + } + } + else + { + record->tap.count = 0; + } + } + else + { + layer_off( id == TRIPLE_TAP_1_3 ? 1 : 2 ); + } + break; + } +} + +void led_set_kb(uint8_t usb_led) +{ + if (usb_led & (1< +#include "TWIlib.h" +#include +#include +#include "progmem.h" +#include "config.h" +#include "zeal_eeprom.h" +#include "zeal_color.h" +#include "IS31FL3731_driver.h" + +#define BACKLIGHT_EFFECT_MAX 7 + +zeal_backlight_config g_config = { + .use_split_backspace = USE_SPLIT_BACKSPACE, + .use_split_left_shift = USE_SPLIT_LEFT_SHIFT, + .use_split_right_shift = USE_SPLIT_RIGHT_SHIFT, + .use_7u_spacebar = USE_7U_SPACEBAR, + .use_iso_enter = USE_ISO_ENTER, + .alphas_mods = { ALPHAS_MODS_ROW_0, + ALPHAS_MODS_ROW_1, + ALPHAS_MODS_ROW_2, + ALPHAS_MODS_ROW_3, + ALPHAS_MODS_ROW_4 }, + .brightness = 127, + .effect = 0, + .color_1 = { .h = 0, .s = 255, .v = 0 }, + .color_2 = { .h = 127, .s = 255, .v = 0 } +}; + +// Global tick at 20 Hz +uint32_t g_tick = 0; + +// This is a 7-bit address, that gets left-shifted and bit 0 +// set to 0 for write, 1 for read (as per I2C protocol) +#define ISSI_ADDR_1 0x74 +#define ISSI_ADDR_2 0x76 + +typedef struct Point { + uint8_t x; + uint8_t y; +} Point; + +// index in range 0..71 (LA0..LA17, LB0..LB17, LC0..LC17, LD0..LD17) +// point values in range x=0..224 y=0..64 +// origin is center of top-left key (i.e Esc) +const Point g_map_led_to_point[72] PROGMEM = { + // LA0..LA17 + {120,16}, {104,16}, {88,16}, {72,16}, {56,16}, {40,16}, {24,16}, {4,16}, {4,32}, + {128,0}, {112,0}, {96,0}, {80,0}, {64,0}, {48,0}, {32,0}, {16,0}, {0,0}, + // LB0..LB17 + {144,0}, {160,0}, {176,0}, {192,0}, {216,0}, {224,0}, {255,255}, {255,255}, {255,255}, + {136,16}, {152,16}, {168,16}, {184,16}, {200,16}, {220,16}, {255,255}, {255,255}, {255,255}, + // LC0..LC17 + {102,64}, {100,48}, {84,48}, {68,48}, {52,48}, {36,48}, {60,48}, {43,64}, {23,64}, + {108,32}, {92,32}, {76,32}, {60,32}, {44,32}, {28,32}, {20,48}, {2,48}, {3,64}, + // LD0..LD17 + {124,32}, {140,32}, {156,32}, {172,32}, {188,32}, {214,32}, {180,48}, {210,48}, {224,48}, + {116,48}, {132,48}, {148,48}, {164,48}, {144,64}, {161,64}, {181,64}, {201,64}, {221,64} +}; + +// This may seem counter-intuitive, but it's quite flexible. +// For each LED, get it's position to decide what color to make it. +// This solves the issue of LEDs (and switches) not aligning to a grid, +// or having a large "bitmap" and sampling them. +void map_led_to_point( uint8_t index, Point *point ) +{ + // Slightly messy way to get Point structs out of progmem. + uint8_t *addr = (uint8_t*)&g_map_led_to_point[index]; + point->x = pgm_read_byte(addr); + point->y = pgm_read_byte(addr+1); + + switch (index) + { + case 18+4: // LB4A + if ( g_config.use_split_backspace ) + point->x -= 8; + break; + case 18+14: // LB14A + if ( g_config.use_iso_enter ) + point->y += 8; // extremely pedantic + break; + case 36+0: // LC0A + if ( g_config.use_7u_spacebar ) + point->x += 10; + break; + case 36+6: // LC6A + if ( g_config.use_7u_spacebar ) + point->x += 4; + break; + case 36+16: // LC16A + if ( !g_config.use_split_left_shift ) + point->x += 8; + break; + case 54+5: // LD5A + if ( !g_config.use_iso_enter ) + point->x -= 10; + break; + case 54+7: // LD7A + if ( !g_config.use_split_right_shift ) + point->x -= 8; + break; + } +} + +// +// Maps switch matrix coordinate (row,col) to LED index +// +// Note: Left spacebar stab is at 4,3 (LC6) +// Right spacebar stab is at 4,9 (LD13) or 4,10 (LD14) +// +// A17, A16, A15, A14, A13, A12, A11, A10, A9, B0, B1, B2, B3, B4, +// A7, A6, A5, A4, A3, A2, A1, A0, B9, B10, B11, B12, B13, B14, +// A8, C14, C13, C12, C11, C10, C9, D0, D1, D2, D3, D4, D5, B5, +// C16, C15, C5, C4, C3, C2, C1, D9, D10, D11, D12, D6, D7, D8, +// C17, C8, C7, C6, ---, ---, ---, C0, ---, D13, D14, D15, D16, D17, +// +const uint8_t g_map_row_col_to_led[5][14] PROGMEM = { + { 0+17, 0+16, 0+15, 0+14, 0+13, 0+12, 0+11, 0+10, 0+9, 18+0, 18+1, 18+2, 18+3, 18+4 }, + { 0+7, 0+6, 0+5, 0+4, 0+3, 0+2, 0+1, 0+0, 18+9, 18+10, 18+11, 18+12, 18+13, 18+14 }, + { 0+8, 36+14, 36+13, 36+12, 36+11, 36+10, 36+9, 54+0, 54+1, 54+2, 54+3, 54+4, 54+5, 18+5 }, + { 36+16, 36+15, 36+5, 36+4, 36+3, 36+2, 36+1, 54+9, 54+10, 54+11, 54+12, 54+6, 54+7, 54+8 }, + { 36+17, 36+8, 36+7, 36+6, 255, 255, 255, 36+0, 255, 54+13, 54+14, 54+15, 54+16, 54+17 } +}; + + +void map_row_col_to_led( uint8_t row, uint8_t col, uint8_t *index ) +{ + *index = 255; + if ( row < MATRIX_ROWS && col < MATRIX_COLS ) + { + *index = pgm_read_byte(&g_map_row_col_to_led[row][col]); + } +} + +void backlight_update_pwm_buffers(void) +{ + IS31FL3731_update_pwm_buffers( ISSI_ADDR_1, ISSI_ADDR_2 ); +} + +void backlight_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) +{ + IS31FL3731_set_color( index, red, green, blue ); +} + +void backlight_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) +{ + IS31FL3731_set_color_all( red, green, blue ); +} + +// This is (F_CPU/1024) / 20 Hz +// = 15625 Hz / 20 Hz +// = 781 +#define TIMER3_TOP 781 + +void backlight_timer_init(void) +{ + static uint8_t backlight_timer_is_init = 0; + if ( backlight_timer_is_init ) + { + return; + } + backlight_timer_is_init = 1; + + // Timer 3 setup + TCCR3B = _BV(WGM32) | // CTC mode OCR3A as TOP + _BV(CS32) | _BV(CS30); // prescale by /1024 + // Set TOP value + uint8_t sreg = SREG; + cli(); + + OCR3AH = (TIMER3_TOP >> 8) & 0xff; + OCR3AL = TIMER3_TOP & 0xff; + SREG = sreg; +} + +void backlight_timer_enable(void) +{ + TIMSK3 |= _BV(OCIE3A); +} + +void backlight_timer_disable(void) +{ + TIMSK3 &= ~_BV(OCIE3A); +} + +void backlight_effect_test(void) +{ + uint8_t offset = (g_tick<<3) & 0xFF; + // Relies on hue being 8-bit and wrapping + HSV hsv = { offset, 255, 127 }; + RGB rgb = hsv_to_rgb( hsv ); + + backlight_set_color_all( rgb.r, rgb.g, rgb.b ); + } + +// All LEDs off +void backlight_effect_all_off(void) +{ + backlight_set_color_all( 0, 0, 0 ); +} + +// Solid color +void backlight_effect_solid_color(void) +{ + HSV hsv = { g_config.color_1.h, g_config.color_1.s, g_config.brightness }; + RGB rgb = hsv_to_rgb( hsv ); + backlight_set_color_all( rgb.r, rgb.g, rgb.b ); +} + +// alphas = color1, mods = color2 +void backlight_effect_alphas_mods(void) +{ + RGB rgb1 = hsv_to_rgb( (HSV){ .h = g_config.color_1.h, .s = g_config.color_1.s, .v = g_config.brightness } ); + RGB rgb2 = hsv_to_rgb( (HSV){ .h = g_config.color_2.h, .s = g_config.color_2.s, .v = g_config.brightness } ); + + for ( int row = 0; row < MATRIX_ROWS; row++ ) + { + for ( int col = 0; col < MATRIX_COLS; col++ ) + { + uint8_t index; + map_row_col_to_led( row, col, &index ); + if ( index < 72 ) + { + if ( ( g_config.alphas_mods[row] & (0b0010000000000000>>col) ) == 0 ) + { + backlight_set_color( index, rgb1.r, rgb1.g, rgb1.b ); + } + else + { + backlight_set_color( index, rgb2.r, rgb2.g, rgb2.b ); + } + } + } + } +} + +void backlight_effect_gradient_up_down(void) +{ + int16_t h1 = g_config.color_1.h; + int16_t h2 = g_config.color_2.h; + int16_t delta = h2 - h1; + + // Take the shortest path between hues + if ( delta > 127 ) + { + delta -= 256; + } + else if ( delta < -127 ) + { + delta += 256; + } + // Divide delta by 4, this gives the delta per row + delta /= 4; + + HSV hsv = { 0, 255, g_config.brightness }; + RGB rgb; + Point point; + for ( int i=0; i<72; i++ ) + { + map_led_to_point( i, &point ); + // The y range will be 0..64, map this to 0..4 + int16_t offset = delta * (point.y>>4); + // Relies on hue being 8-bit and wrapping + hsv.h = g_config.color_1.h + offset; + rgb = hsv_to_rgb( hsv ); + backlight_set_color( i, rgb.r, rgb.g, rgb.b ); + } +} + +void backlight_effect_cycle_all(void) +{ + uint8_t offset = g_tick & 0xFF; + // Relies on hue being 8-bit and wrapping + HSV hsv = { offset, 255, g_config.brightness }; + RGB rgb = hsv_to_rgb( hsv ); + backlight_set_color_all( rgb.r, rgb.g, rgb.b ); +} + + void backlight_effect_cycle_left_right(void) + { + uint8_t offset = g_tick & 0xFF; + HSV hsv = { 0, 255, g_config.brightness }; + RGB rgb; + Point point; + for ( int i=0; i<72; i++ ) + { + map_led_to_point( i, &point ); + // Relies on hue being 8-bit and wrapping + hsv.h = point.x + offset; + rgb = hsv_to_rgb( hsv ); + backlight_set_color( i, rgb.r, rgb.g, rgb.b ); + } +} + +void backlight_effect_cycle_up_down(void) +{ + uint8_t offset = g_tick & 0xFF; + HSV hsv = { 0, 255, g_config.brightness }; + RGB rgb; + Point point; + for ( int i=0; i<72; i++ ) + { + map_led_to_point( i, &point ); + // Relies on hue being 8-bit and wrapping + hsv.h = point.y + offset; + rgb = hsv_to_rgb( hsv ); + backlight_set_color( i, rgb.r, rgb.g, rgb.b ); + } +} + +void backlight_effect_custom(void) +{ + HSV hsv; + RGB rgb; + for ( int i=0; i<72; i++ ) + { + backlight_get_key_color(i, &hsv); + // Override brightness with global brightness control + hsv.v = g_config.brightness; + rgb = hsv_to_rgb( hsv ); + backlight_set_color( i, rgb.r, rgb.g, rgb.b ); + } +} + +ISR(TIMER3_COMPA_vect) +{ + g_tick++; + + // delay 1 second before driving LEDs + if ( g_tick < 20 ) + { + return; + } + + // Store backlight config to EEPROM every 6.4 seconds + // A slightly hacky way of reducing the number of EEPROM writes + // should the user be hammering away on backlight changes + // Paranoid? Probably... + // Note this will only write if it's different, so it's safe to + // call often. + if ( ( g_tick & 0x7F ) == 0 ) + { + backlight_config_save(); + } + +#ifdef ZEAL60_TEST + backlight_effect_test(); + return; +#endif + + // this gets ticked at 20 Hz. + // each effect can opt to do calculations + // and/or request PWM buffer updates. + if ( g_config.effect == 0 ) + { + backlight_effect_all_off(); + } + else if ( g_config.effect == 1 ) + { + backlight_effect_solid_color(); + } + else if ( g_config.effect == 2 ) + { + backlight_effect_alphas_mods(); + } + else if ( g_config.effect == 3 ) + { + backlight_effect_gradient_up_down(); + } + else if ( g_config.effect == 4 ) + { + backlight_effect_cycle_all(); + } + else if ( g_config.effect == 5 ) + { + backlight_effect_cycle_left_right(); + } + else if ( g_config.effect == 6 ) + { + backlight_effect_cycle_up_down(); + } + else if ( g_config.effect >= 7 ) + { + backlight_effect_custom(); + } +} + +void backlight_config_set_flags(uint8_t flags) +{ + // TODO: replace with #define bitmasks + g_config.use_split_backspace = ( flags&(1<<0) ? true : false ); + g_config.use_split_left_shift = ( flags&(1<<1) ? true : false ); + g_config.use_split_right_shift = ( flags&(1<<2) ? true : false ); + g_config.use_7u_spacebar = ( flags&(1<<3) ? true : false ); + g_config.use_iso_enter = ( flags&(1<<4) ? true : false ); +} + +void backlight_config_set_alphas_mods( uint16_t *alphas_mods ) +{ + g_config.alphas_mods[0] = alphas_mods[0]; + g_config.alphas_mods[1] = alphas_mods[1]; + g_config.alphas_mods[2] = alphas_mods[2]; + g_config.alphas_mods[3] = alphas_mods[3]; + g_config.alphas_mods[4] = alphas_mods[4]; +} + +void backlight_config_load(void) +{ + void *addr = EEPROM_BACKLIGHT_CONFIG_ADDR; + uint8_t flags = eeprom_read_byte(addr++); + backlight_config_set_flags(flags); + + g_config.alphas_mods[0] = eeprom_read_byte( addr++ ) << 8; + g_config.alphas_mods[0] |= eeprom_read_byte( addr++ ); + g_config.alphas_mods[1] = eeprom_read_byte( addr++ ) << 8; + g_config.alphas_mods[1] |= eeprom_read_byte( addr++ ); + g_config.alphas_mods[2] = eeprom_read_byte( addr++ ) << 8; + g_config.alphas_mods[2] |= eeprom_read_byte( addr++ ); + g_config.alphas_mods[3] = eeprom_read_byte( addr++ ) << 8; + g_config.alphas_mods[3] |= eeprom_read_byte( addr++ ); + g_config.alphas_mods[4] = eeprom_read_byte( addr++ ) << 8; + g_config.alphas_mods[4] |= eeprom_read_byte( addr++ ); + + g_config.brightness = eeprom_read_byte( EEPROM_BACKLIGHT_CONFIG_ADDR+11 ); + g_config.effect = eeprom_read_byte( EEPROM_BACKLIGHT_CONFIG_ADDR+12 ); + g_config.color_1.h = eeprom_read_byte( EEPROM_BACKLIGHT_CONFIG_ADDR+13 ); + g_config.color_1.s = eeprom_read_byte( EEPROM_BACKLIGHT_CONFIG_ADDR+14 ); + g_config.color_1.v = eeprom_read_byte( EEPROM_BACKLIGHT_CONFIG_ADDR+15 ); + g_config.color_2.h = eeprom_read_byte( EEPROM_BACKLIGHT_CONFIG_ADDR+16 ); + g_config.color_2.s = eeprom_read_byte( EEPROM_BACKLIGHT_CONFIG_ADDR+17 ); + g_config.color_2.v = eeprom_read_byte( EEPROM_BACKLIGHT_CONFIG_ADDR+18 ); +} + +void backlight_config_save(void) +{ + // TODO: replace with #define bitmasks + uint8_t flags = ( g_config.use_split_backspace ? (1<<0) : 0 ) | + ( g_config.use_split_left_shift ? (1<<1) : 0 ) | + ( g_config.use_split_right_shift ? (1<<2) : 0 ) | + ( g_config.use_7u_spacebar ? (1<<3) : 0 ) | + ( g_config.use_iso_enter ? (1<<4) : 0 ); + + void *addr = EEPROM_BACKLIGHT_CONFIG_ADDR; + eeprom_update_byte( addr++, flags ); + + eeprom_update_byte( addr++, (uint8_t)(g_config.alphas_mods[0] >> 8) ); + eeprom_update_byte( addr++, (uint8_t)(g_config.alphas_mods[0] & 0xFF) ); + eeprom_update_byte( addr++, (uint8_t)(g_config.alphas_mods[1] >> 8) ); + eeprom_update_byte( addr++, (uint8_t)(g_config.alphas_mods[1] & 0xFF) ); + eeprom_update_byte( addr++, (uint8_t)(g_config.alphas_mods[2] >> 8) ); + eeprom_update_byte( addr++, (uint8_t)(g_config.alphas_mods[2] & 0xFF) ); + eeprom_update_byte( addr++, (uint8_t)(g_config.alphas_mods[3] >> 8) ); + eeprom_update_byte( addr++, (uint8_t)(g_config.alphas_mods[3] & 0xFF) ); + eeprom_update_byte( addr++, (uint8_t)(g_config.alphas_mods[4] >> 8) ); + eeprom_update_byte( addr++, (uint8_t)(g_config.alphas_mods[4] & 0xFF) ); + + eeprom_update_byte( addr++, g_config.brightness ); + eeprom_update_byte( addr++, g_config.effect ); + eeprom_update_byte( addr++, g_config.color_1.h ); + eeprom_update_byte( addr++, g_config.color_1.s ); + eeprom_update_byte( addr++, g_config.color_1.v ); + eeprom_update_byte( addr++, g_config.color_2.h ); + eeprom_update_byte( addr++, g_config.color_2.s ); + eeprom_update_byte( addr++, g_config.color_2.v ); + + +} + +void backlight_init_drivers(void) +{ + uint8_t enable_led_LB5 = g_config.use_split_backspace; + uint8_t enable_led_LC15 = g_config.use_split_left_shift; + uint8_t enable_led_LD8 = g_config.use_split_right_shift; + uint8_t enable_led_LD13 = g_config.use_7u_spacebar ? 0 : 1; + + sei(); + + // Initialize TWI + TWIInit(); + + _delay_ms(100); + + IS31FL3731_init( ISSI_ADDR_1 ); + + _delay_ms(100); + + IS31FL3731_init( ISSI_ADDR_2 ); + + _delay_ms(100); + + // This is how you define which LEDs are present in the matrix. + // If you don't turn off missing LEDs, the LED driver doesn't work properly. + + // This is the bit pattern in the LED control registers + // (per matrix) + // + // R08,R07,R06,R05,R04,R03,R02,R01 + // G08,G07,G06,G05,G04,G03,G02,R00 + // B08,B07,B06,B05,B04,B03,G01,G00 + // - , - , - , - , - ,B02,B01,B00 + // - , - , - , - , - , - , - , - + // B17,B16,B15, - , - , - , - , - + // G17,G16,B14,B13,B12,B11,B19,B09 + // R17,G15,G14,G13,G12,G11,G10,G09 + // R16,R15,R14,R13,R12,R11,R10,R09 + // + // I could probably write some fancy wrapper for this to allow easy + // reconfiguration, but it's really too much work and will probably use + // up program/data. Easier to just work out which LEDs are not being used + // by referencing the Nth LED per matrix and replacing some 1s with 0s below. + // + // Since this never needs to change at runtime, and only happens once, + // it doesn't matter that it's 36 discrete calls ;-) + // + + // Driver 1, Matrix A (LA0-LA17) + IS31FL3731_write_register(ISSI_ADDR_1, 0x00, 0b11111111 ); + IS31FL3731_write_register(ISSI_ADDR_1, 0x02, 0b11111111 ); + IS31FL3731_write_register(ISSI_ADDR_1, 0x04, 0b11111111 ); + IS31FL3731_write_register(ISSI_ADDR_1, 0x06, 0b00000111 ); + IS31FL3731_write_register(ISSI_ADDR_1, 0x08, 0b00000000 ); + IS31FL3731_write_register(ISSI_ADDR_1, 0x0A, 0b11100000 ); + IS31FL3731_write_register(ISSI_ADDR_1, 0x0C, 0b11111111 ); + IS31FL3731_write_register(ISSI_ADDR_1, 0x0E, 0b11111111 ); + IS31FL3731_write_register(ISSI_ADDR_1, 0x10, 0b11111111 ); + + // Driver 1, Matrix B (LB0-LB17) + // Disabled LB6 LB7 LB8 LB15 LB16 LB17 + // Not present on Zeal60. Present on Zeal65 + + IS31FL3731_write_register(ISSI_ADDR_1, 0x01, 0b00001111 | (enable_led_LB5<<4)); + IS31FL3731_write_register(ISSI_ADDR_1, 0x03, 0b00001111 | (enable_led_LB5<<4)); + IS31FL3731_write_register(ISSI_ADDR_1, 0x05, 0b00001111 | (enable_led_LB5<<4)); + IS31FL3731_write_register(ISSI_ADDR_1, 0x07, 0b00000111 ); + IS31FL3731_write_register(ISSI_ADDR_1, 0x09, 0b00000000 ); + IS31FL3731_write_register(ISSI_ADDR_1, 0x0B, 0b00000000 ); + IS31FL3731_write_register(ISSI_ADDR_1, 0x0D, 0b00111111 ); + IS31FL3731_write_register(ISSI_ADDR_1, 0x0F, 0b00111111 ); + IS31FL3731_write_register(ISSI_ADDR_1, 0x11, 0b00111111 ); + + // Driver 2, Matrix A (LC0-LC17) + IS31FL3731_write_register(ISSI_ADDR_2, 0x00, 0b11111111 ); + IS31FL3731_write_register(ISSI_ADDR_2, 0x02, 0b11111111 ); + IS31FL3731_write_register(ISSI_ADDR_2, 0x04, 0b11111111 ); + IS31FL3731_write_register(ISSI_ADDR_2, 0x06, 0b00000111 ); + IS31FL3731_write_register(ISSI_ADDR_2, 0x08, 0b00000000 ); + IS31FL3731_write_register(ISSI_ADDR_2, 0x0A, 0b11000000 | (enable_led_LC15<<5)); + IS31FL3731_write_register(ISSI_ADDR_2, 0x0C, 0b11111111 ); + IS31FL3731_write_register(ISSI_ADDR_2, 0x0E, 0b10111111 | (enable_led_LC15<<6)); + IS31FL3731_write_register(ISSI_ADDR_2, 0x10, 0b10111111 | (enable_led_LC15<<6)); + + // Driver 2, Matrix B (LD0-LD17) + IS31FL3731_write_register(ISSI_ADDR_2, 0x01, 0b01111111 | (enable_led_LD8<<7)); + IS31FL3731_write_register(ISSI_ADDR_2, 0x03, 0b01111111 | (enable_led_LD8<<7)); + IS31FL3731_write_register(ISSI_ADDR_2, 0x05, 0b01111111 | (enable_led_LD8<<7)); + IS31FL3731_write_register(ISSI_ADDR_2, 0x07, 0b00000111 ); + IS31FL3731_write_register(ISSI_ADDR_2, 0x09, 0b00000000 ); + IS31FL3731_write_register(ISSI_ADDR_2, 0x0B, 0b11100000 ); + IS31FL3731_write_register(ISSI_ADDR_2, 0x0D, 0b11101111 | (enable_led_LD13<<4)); + IS31FL3731_write_register(ISSI_ADDR_2, 0x0F, 0b11101111 | (enable_led_LD13<<4)); + IS31FL3731_write_register(ISSI_ADDR_2, 0x11, 0b11101111 | (enable_led_LD13<<4)); + + // TODO: put the 1 second startup delay here? +} + + +// Deals with the messy details of incrementing an integer +uint8_t increment( uint8_t value, uint8_t step, uint8_t max ) +{ + int16_t new_value = value; + new_value += step; + return ( new_value <= max ) ? new_value : max; +} + +uint8_t decrement( uint8_t value, uint8_t step, uint8_t min ) +{ + int16_t new_value = value; + new_value -= step; + return ( new_value >= min ) ? new_value : min; +} + +void backlight_set_effect(uint8_t effect) +{ + g_config.effect = effect; +} + +void backlight_effect_increase(void) +{ + g_config.effect = increment( g_config.effect, 1, BACKLIGHT_EFFECT_MAX ); +} + +void backlight_effect_decrease(void) +{ + g_config.effect = decrement( g_config.effect, 1, 0 ); +} + +void backlight_set_brightness(uint8_t brightness) +{ + g_config.brightness = brightness; +} + +void backlight_brightness_increase(void) +{ + g_config.brightness = increment( g_config.brightness, 8, 255 ); +} + +void backlight_brightness_decrease(void) +{ + g_config.brightness = decrement( g_config.brightness, 8, 0 ); +} + +void backlight_color_1_hue_increase(void) +{ + g_config.color_1.h = increment( g_config.color_1.h, 8, 255 ); +} + +void backlight_color_1_hue_decrease(void) +{ + g_config.color_1.h = decrement( g_config.color_1.h, 8, 0 ); +} + +void backlight_color_1_sat_increase(void) +{ + g_config.color_1.s = increment( g_config.color_1.s, 8, 255 ); +} + +void backlight_color_1_sat_decrease(void) +{ + g_config.color_1.s = decrement( g_config.color_1.s, 8, 0 ); +} + +void backlight_color_2_hue_increase(void) +{ + g_config.color_2.h = increment( g_config.color_2.h, 8, 255 ); +} + +void backlight_color_2_hue_decrease(void) +{ + g_config.color_2.h = decrement( g_config.color_2.h, 8, 0 ); +} + +void backlight_color_2_sat_increase(void) +{ + g_config.color_2.s = increment( g_config.color_2.s, 8, 255 ); +} + +void backlight_color_2_sat_decrease(void) +{ + g_config.color_2.s = decrement( g_config.color_2.s, 8, 0 ); +} + +void *backlight_get_custom_key_color_eeprom_address(uint8_t led) +{ + // 3 bytes per color + return EEPROM_BACKLIGHT_KEY_COLOR_ADDR + ( led * 3 ); +} + +void backlight_get_key_color( uint8_t led, HSV *hsv ) +{ + // Pretend 2D array is 1D ;-) + void *address = backlight_get_custom_key_color_eeprom_address( led ); + hsv->h = eeprom_read_byte(address); + hsv->s = eeprom_read_byte(address+1); + hsv->v = eeprom_read_byte(address+2); +} + +void backlight_set_key_color( uint8_t row, uint8_t col, HSV hsv ) +{ + uint8_t led; + map_row_col_to_led( row, col, &led ); + if ( led < 72 ) + { + void *address = backlight_get_custom_key_color_eeprom_address(led); + eeprom_update_byte(address, hsv.h); + eeprom_update_byte(address+1, hsv.s); + eeprom_update_byte(address+2, hsv.v); + } +} diff --git a/keyboards/zeal60/zeal_backlight.h b/keyboards/zeal60/zeal_backlight.h new file mode 100644 index 000000000000..c8ae52a0e2ef --- /dev/null +++ b/keyboards/zeal60/zeal_backlight.h @@ -0,0 +1,62 @@ +#ifndef ZEAL_BACKLIGHT_H +#define ZEAL_BACKLIGHT_H + +#include +#include + +#include "zeal_color.h" + +typedef struct zeal_backlight_config +{ + bool use_split_backspace:1; + bool use_split_left_shift:1; + bool use_split_right_shift:1; + bool use_7u_spacebar:1; + bool use_iso_enter:1; + uint16_t alphas_mods[5]; + uint8_t brightness; + uint8_t effect; + + HSV color_1; + HSV color_2; +} zeal_backlight_config; + +void backlight_config_set_flags(uint8_t value); +void backlight_config_set_alphas_mods( uint16_t *value ); +void backlight_config_load(void); +void backlight_config_save(void); + +void backlight_init_drivers(void); + +void backlight_timer_init(void); +void backlight_timer_enable(void); +void backlight_timer_disable(void); + +// This should not be called from an interrupt +// (eg. from a timer interrupt). +// Call this while idle (in between matrix scans). +// If the buffer is dirty, it will update the driver with the buffer. +void backlight_update_pwm_buffers(void); + +void backlight_set_effect(uint8_t effect); +void backlight_effect_increase(void); +void backlight_effect_decrease(void); + +void backlight_set_brightness(uint8_t brightness); +void backlight_brightness_increase(void); +void backlight_brightness_decrease(void); + +void backlight_color_1_hue_increase(void); +void backlight_color_1_hue_decrease(void); +void backlight_color_1_sat_increase(void); +void backlight_color_1_sat_decrease(void); +void backlight_color_2_hue_increase(void); +void backlight_color_2_hue_decrease(void); +void backlight_color_2_sat_increase(void); +void backlight_color_2_sat_decrease(void); + +void *backlight_get_key_color_eeprom_address(uint8_t led); +void backlight_get_key_color( uint8_t led, HSV *hsv ); +void backlight_set_key_color( uint8_t row, uint8_t col, HSV hsv ); + +#endif //ZEAL_BACKLIGHT_H diff --git a/keyboards/zeal60/zeal_color.c b/keyboards/zeal60/zeal_color.c new file mode 100644 index 000000000000..0b0212c2f331 --- /dev/null +++ b/keyboards/zeal60/zeal_color.c @@ -0,0 +1,105 @@ + +#include "zeal_color.h" + +#include "progmem.h" + + +// Lightness curve using the CIE 1931 lightness formula +//Generated by the python script provided in http://jared.geek.nz/2013/feb/linear-led-pwm +const uint8_t DIM_CURVE[] PROGMEM = { + 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, + 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, + 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, + 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, + 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, + 13, 14, 14, 15, 15, 15, 16, 16, 17, 17, + 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, + 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, + 28, 28, 29, 29, 30, 31, 31, 32, 32, 33, + 34, 34, 35, 36, 37, 37, 38, 39, 39, 40, + 41, 42, 43, 43, 44, 45, 46, 47, 47, 48, + 49, 50, 51, 52, 53, 54, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 70, 71, 72, 73, 74, 75, 76, 77, 79, + 80, 81, 82, 83, 85, 86, 87, 88, 90, 91, + 92, 94, 95, 96, 98, 99, 100, 102, 103, 105, + 106, 108, 109, 110, 112, 113, 115, 116, 118, 120, + 121, 123, 124, 126, 128, 129, 131, 132, 134, 136, + 138, 139, 141, 143, 145, 146, 148, 150, 152, 154, + 155, 157, 159, 161, 163, 165, 167, 169, 171, 173, + 175, 177, 179, 181, 183, 185, 187, 189, 191, 193, + 196, 198, 200, 202, 204, 207, 209, 211, 214, 216, + 218, 220, 223, 225, 228, 230, 232, 235, 237, 240, + 242, 245, 247, 250, 252, 255, +}; + + +RGB hsv_to_rgb( HSV hsv ) +{ + RGB rgb; + uint8_t region, p, q, t; + uint16_t h, s, v, remainder; + + if (hsv.s == 0) + { + rgb.r = hsv.v; + rgb.g = hsv.v; + rgb.b = hsv.v; + return rgb; + } + + h = hsv.h; + s = hsv.s; + v = hsv.v; + + region = h / 43; + remainder = (h - (region * 43)) * 6; + + p = (v * (255 - s)) >> 8; + q = (v * (255 - ((s * remainder) >> 8))) >> 8; + t = (v * (255 - ((s * (255 - remainder)) >> 8))) >> 8; + + switch (region) + { + case 0: + rgb.r = v; + rgb.g = t; + rgb.b = p; + break; + case 1: + rgb.r = q; + rgb.g = v; + rgb.b = p; + break; + case 2: + rgb.r = p; + rgb.g = v; + rgb.b = t; + break; + case 3: + rgb.r = p; + rgb.g = q; + rgb.b = v; + break; + case 4: + rgb.r = t; + rgb.g = p; + rgb.b = v; + break; + default: + rgb.r = v; + rgb.g = p; + rgb.b = q; + break; + } + + rgb.r = pgm_read_byte(&DIM_CURVE[rgb.r]); + rgb.g = pgm_read_byte(&DIM_CURVE[rgb.g]); + rgb.b = pgm_read_byte(&DIM_CURVE[rgb.b]); + + return rgb; +} + + diff --git a/keyboards/zeal60/zeal_color.h b/keyboards/zeal60/zeal_color.h new file mode 100644 index 000000000000..7452f86976bb --- /dev/null +++ b/keyboards/zeal60/zeal_color.h @@ -0,0 +1,23 @@ +#ifndef ZEAL_COLOR_H +#define ZEAL_COLOR_H + +#include +#include + +typedef struct RGB +{ + uint8_t r; + uint8_t g; + uint8_t b; +} RGB; + +typedef struct HSV +{ + uint8_t h; + uint8_t s; + uint8_t v; +} HSV; + +RGB hsv_to_rgb( HSV hsv ); + +#endif // ZEAL_COLOR_H diff --git a/keyboards/zeal60/zeal_eeprom.c b/keyboards/zeal60/zeal_eeprom.c new file mode 100644 index 000000000000..aac0979d42e0 --- /dev/null +++ b/keyboards/zeal60/zeal_eeprom.c @@ -0,0 +1,14 @@ +#include "zeal_eeprom.h" +#include "tmk_core/common/eeprom.h" + +bool eeprom_is_valid(void) +{ + return (eeprom_read_word(EEPROM_MAGIC_ADDR) == EEPROM_MAGIC && + eeprom_read_byte(EEPROM_VERSION_ADDR) == EEPROM_VERSION); +} + +void eeprom_set_valid(bool valid) +{ + eeprom_update_word(EEPROM_MAGIC_ADDR, valid ? EEPROM_MAGIC : 0x0000); + eeprom_update_byte(EEPROM_VERSION_ADDR, valid ? EEPROM_VERSION : 0x00); +} diff --git a/keyboards/zeal60/zeal_eeprom.h b/keyboards/zeal60/zeal_eeprom.h new file mode 100644 index 000000000000..629495413d8d --- /dev/null +++ b/keyboards/zeal60/zeal_eeprom.h @@ -0,0 +1,41 @@ +#ifndef ZEAL_EEPROM_H +#define ZEAL_EEPROM_H + +#include +#include +#include "tmk_core/common/eeprom.h" + +#define EEPROM_MAGIC 0x451F +#define EEPROM_MAGIC_ADDR ((void*)16) + +// Bump this every time we change what we store +// This will automatically reset the EEPROM with defaults +// and avoid loading invalid data from the EEPROM +#define EEPROM_VERSION 0x00 +#define EEPROM_VERSION_ADDR ((void*)18) + +#define EEPROM_BACKLIGHT_CONFIG_ADDR ((void*)19) + +// zeal_backlight_config uses 19 bytes +#define EEPROM_BACKLIGHT_KEY_COLOR_ADDR ((void*)38) + +// key colors use 72*3=216 +// 38+216=254 + +#define EEPROM_KEYMAP_ADDR ((void*)254) +#define EEPROM_KEYMAP_MAX 4 + +// Each keymap is MATRIX_ROWS*MATRIX_COLS*2 bytes +// For Zeal60 this is 5*14*2=140 bytes +// 4 keymaps = 560 bytes +// 254 + 560 = 814 +// 814 < 1024 :-) + +bool eeprom_is_valid(void); +void eeprom_set_valid(bool valid); + + + + + +#endif // ZEAL_EEPROM_H diff --git a/keyboards/zeal60/zeal_keycode.h b/keyboards/zeal60/zeal_keycode.h new file mode 100644 index 000000000000..33406188a083 --- /dev/null +++ b/keyboards/zeal60/zeal_keycode.h @@ -0,0 +1,38 @@ +#ifndef ZEAL_KEYCODE_H +#define ZEAL_KEYCODE_H + +#define KC_EENULL 0xFFFF // TODO: move to enum quantum_keycodes + +// Can't use SAFE_RANGE here, it might change if someone adds +// new values to enum quantum_keycodes. +enum zeal60_keycodes { + BR_INC = 0x7080, // backlight brightness increase + BR_DEC, // backlight brightness decrease + EF_INC, // backlight effect increase + EF_DEC, // backlight effect decrease + H1_INC, + H1_DEC, + S1_INC, + S1_DEC, + H2_INC, + H2_DEC, + S2_INC, + S2_DEC +}; + +// Zeal60 specific "action functions" +// These are only valid IDs in action_function() +// Use FN_TT13, FN_TT23, etc. in keymaps +enum zeal60_action_functions { + TRIPLE_TAP_1_3 = 0x31, + TRIPLE_TAP_2_3 = 0x32 +}; + +// Bitwise OR the above with 0x0F00 to use in F(x) macro +// This reserves the top 256 of the 4096 range of F(x) keycodes, +// leaving the rest for use in fn_actions[] or actions in EEPROM. +#define FN_TT13 F((0x0F00|TRIPLE_TAP_1_3)) +#define FN_TT23 F((0x0F00|TRIPLE_TAP_2_3)) + + +#endif // ZEAL_KEYCODE_H diff --git a/keyboards/zeal60/zeal_keymap.c b/keyboards/zeal60/zeal_keymap.c new file mode 100644 index 000000000000..27ae4865bfe6 --- /dev/null +++ b/keyboards/zeal60/zeal_keymap.c @@ -0,0 +1,68 @@ +#include "zeal_keymap.h" +#include "zeal_eeprom.h" +#include "config.h" +#include "keymap.h" // to get keymaps[][][] + + + +void *keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t col) +{ + // TODO: optimize this with some left shifts + return EEPROM_KEYMAP_ADDR + ( layer * MATRIX_ROWS * MATRIX_COLS * 2 ) + + ( row * MATRIX_COLS * 2 ) + ( col * 2 ); +} + +uint16_t keymap_keycode_load(uint8_t layer, uint8_t row, uint8_t col) +{ + void *address = keymap_key_to_eeprom_address(layer, row, col); + // Big endian, so we can read/write EEPROM directly from host if we want + uint16_t keycode = eeprom_read_byte(address) << 8; + keycode |= eeprom_read_byte(address + 1); + return keycode; +} + +void keymap_keycode_save(uint8_t layer, uint8_t row, uint8_t col, uint16_t keycode) +{ + void *address = keymap_key_to_eeprom_address(layer, row, col); + // Big endian, so we can read/write EEPROM directly from host if we want + eeprom_update_byte(address, (uint8_t)(keycode >> 8)); + eeprom_update_byte(address+1, (uint8_t)(keycode & 0xFF)); +} + +void keymap_default_save(void) +{ + // Save "empty" keymaps. + for ( int layer = 0; layer < EEPROM_KEYMAP_MAX; layer++ ) + { + for ( int row = 0; row < MATRIX_ROWS; row++ ) + { + for ( int col = 0; col < MATRIX_COLS; col++ ) + { + keymap_keycode_save(layer, row, col, KC_EENULL); + } + } + } +} + +// This overrides the one in quantum/keymap_common.c +uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) +{ + if ( eeprom_is_valid() && + layer < EEPROM_KEYMAP_MAX && + key.row < MATRIX_ROWS && // possibly redundant + key.col < MATRIX_COLS ) // possibly redundant + { + uint16_t keycode = keymap_keycode_load(layer, key.row, key.col); + + // If keycode is not "empty", return it, otherwise + // drop down to return the one in flash + if ( keycode != KC_EENULL) + { + return keycode; + } + } + + return pgm_read_word(&keymaps[layer][key.row][key.col]); +} + + diff --git a/keyboards/zeal60/zeal_keymap.h b/keyboards/zeal60/zeal_keymap.h new file mode 100644 index 000000000000..5631400ae1f8 --- /dev/null +++ b/keyboards/zeal60/zeal_keymap.h @@ -0,0 +1,17 @@ +#ifndef ZEAL_KEYMAP_H +#define ZEAL_KEYMAP_H + +#include +#include + +#include "zeal_keycode.h" + +void *keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t col); +uint16_t keymap_keycode_load(uint8_t layer, uint8_t row, uint8_t col); +void keymap_keycode_save(uint8_t layer, uint8_t row, uint8_t col, uint16_t keycode); +void keymap_default_save(void); + +// This overrides the one in quantum/keymap_common.c +// uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key); + +#endif //ZEAL_EEPROM_H diff --git a/keyboards/zeal60/zeal_rpc.h b/keyboards/zeal60/zeal_rpc.h new file mode 100644 index 000000000000..a71b16d7a900 --- /dev/null +++ b/keyboards/zeal60/zeal_rpc.h @@ -0,0 +1,15 @@ +#ifndef ZEAL_RPC_H +#define ZEAL_RPC_H + +enum +{ + id_keymap_keycode_load = 0x42, + id_keymap_keycode_save, + id_keymap_default_save, + id_backlight_config_set_flags, + id_backlight_config_set_alphas_mods, + id_backlight_set_key_color + +}; + +#endif // ZEAL_RPC_H diff --git a/quantum/keymap.h b/quantum/keymap.h index ae56d16c75eb..302991644505 100644 --- a/quantum/keymap.h +++ b/quantum/keymap.h @@ -38,317 +38,15 @@ along with this program. If not, see . #define RESET QK_RESET #endif -/* translates key to keycode */ +#include "quantum_keycodes.h" + +// translates key to keycode uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key); +// translates function id to action +uint16_t keymap_function_id_to_action( uint16_t function_id ); + extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; extern const uint16_t fn_actions[]; -enum quantum_keycodes { - // Ranges used in shortucuts - not to be used directly - QK_TMK = 0x0000, - QK_TMK_MAX = 0x00FF, - QK_MODS = 0x0100, - QK_LCTL = 0x0100, - QK_LSFT = 0x0200, - QK_LALT = 0x0400, - QK_LGUI = 0x0800, - QK_RCTL = 0x1100, - QK_RSFT = 0x1200, - QK_RALT = 0x1400, - QK_RGUI = 0x1800, - QK_MODS_MAX = 0x1FFF, - QK_FUNCTION = 0x2000, - QK_FUNCTION_MAX = 0x2FFF, - QK_MACRO = 0x3000, - QK_MACRO_MAX = 0x3FFF, - QK_LAYER_TAP = 0x4000, - QK_LAYER_TAP_MAX = 0x4FFF, - QK_TO = 0x5000, - QK_TO_MAX = 0x50FF, - QK_MOMENTARY = 0x5100, - QK_MOMENTARY_MAX = 0x51FF, - QK_DEF_LAYER = 0x5200, - QK_DEF_LAYER_MAX = 0x52FF, - QK_TOGGLE_LAYER = 0x5300, - QK_TOGGLE_LAYER_MAX = 0x53FF, - QK_ONE_SHOT_LAYER = 0x5400, - QK_ONE_SHOT_LAYER_MAX = 0x54FF, - QK_ONE_SHOT_MOD = 0x5500, - QK_ONE_SHOT_MOD_MAX = 0x55FF, -#ifndef DISABLE_CHORDING - QK_CHORDING = 0x5600, - QK_CHORDING_MAX = 0x56FF, -#endif - QK_MOD_TAP = 0x6000, - QK_MOD_TAP_MAX = 0x6FFF, - QK_TAP_DANCE = 0x7100, - QK_TAP_DANCE_MAX = 0x71FF, -#ifdef UNICODEMAP_ENABLE - QK_UNICODE_MAP = 0x7800, - QK_UNICODE_MAP_MAX = 0x7FFF, -#endif -#ifdef UNICODE_ENABLE - QK_UNICODE = 0x8000, - QK_UNICODE_MAX = 0xFFFF, -#endif - - // Loose keycodes - to be used directly - - RESET = 0x7000, - DEBUG, - MAGIC_SWAP_CONTROL_CAPSLOCK, - MAGIC_CAPSLOCK_TO_CONTROL, - MAGIC_SWAP_LALT_LGUI, - MAGIC_SWAP_RALT_RGUI, - MAGIC_NO_GUI, - MAGIC_SWAP_GRAVE_ESC, - MAGIC_SWAP_BACKSLASH_BACKSPACE, - MAGIC_HOST_NKRO, - MAGIC_SWAP_ALT_GUI, - MAGIC_UNSWAP_CONTROL_CAPSLOCK, - MAGIC_UNCAPSLOCK_TO_CONTROL, - MAGIC_UNSWAP_LALT_LGUI, - MAGIC_UNSWAP_RALT_RGUI, - MAGIC_UNNO_GUI, - MAGIC_UNSWAP_GRAVE_ESC, - MAGIC_UNSWAP_BACKSLASH_BACKSPACE, - MAGIC_UNHOST_NKRO, - MAGIC_UNSWAP_ALT_GUI, - MAGIC_TOGGLE_NKRO, - - // Leader key -#ifndef DISABLE_LEADER - KC_LEAD, -#endif - - // Audio on/off/toggle - AU_ON, - AU_OFF, - AU_TOG, - - // Music mode on/off/toggle - MU_ON, - MU_OFF, - MU_TOG, - - // Music voice iterate - MUV_IN, - MUV_DE, - - // Midi mode on/off - MIDI_ON, - MIDI_OFF, - - // Backlight functionality - BL_0, - BL_1, - BL_2, - BL_3, - BL_4, - BL_5, - BL_6, - BL_7, - BL_8, - BL_9, - BL_10, - BL_11, - BL_12, - BL_13, - BL_14, - BL_15, - BL_DEC, - BL_INC, - BL_TOGG, - BL_STEP, - - // RGB functionality - RGB_TOG, - RGB_MOD, - RGB_HUI, - RGB_HUD, - RGB_SAI, - RGB_SAD, - RGB_VAI, - RGB_VAD, - - // Left shift, open paren - KC_LSPO, - - // Right shift, close paren - KC_RSPC, - - // Printing - PRINT_ON, - PRINT_OFF, - - // always leave at the end - SAFE_RANGE -}; - -// Ability to use mods in layouts -#define LCTL(kc) (kc | QK_LCTL) -#define LSFT(kc) (kc | QK_LSFT) -#define LALT(kc) (kc | QK_LALT) -#define LGUI(kc) (kc | QK_LGUI) -#define RCTL(kc) (kc | QK_RCTL) -#define RSFT(kc) (kc | QK_RSFT) -#define RALT(kc) (kc | QK_RALT) -#define RGUI(kc) (kc | QK_RGUI) - -#define HYPR(kc) (kc | QK_LCTL | QK_LSFT | QK_LALT | QK_LGUI) -#define MEH(kc) (kc | QK_LCTL | QK_LSFT | QK_LALT) -#define LCAG(kc) (kc | QK_LCTL | QK_LALT | QK_LGUI) -#define ALTG(kc) (kc | QK_RCTL | QK_RALT) - -#define MOD_HYPR 0xf -#define MOD_MEH 0x7 - - -// Aliases for shifted symbols -// Each key has a 4-letter code, and some have longer aliases too. -// While the long aliases are descriptive, the 4-letter codes -// make for nicer grid layouts (everything lines up), and are -// the preferred style for Quantum. -#define KC_TILD LSFT(KC_GRV) // ~ -#define KC_TILDE KC_TILD - -#define KC_EXLM LSFT(KC_1) // ! -#define KC_EXCLAIM KC_EXLM - -#define KC_AT LSFT(KC_2) // @ - -#define KC_HASH LSFT(KC_3) // # - -#define KC_DLR LSFT(KC_4) // $ -#define KC_DOLLAR KC_DLR - -#define KC_PERC LSFT(KC_5) // % -#define KC_PERCENT KC_PERC - -#define KC_CIRC LSFT(KC_6) // ^ -#define KC_CIRCUMFLEX KC_CIRC - -#define KC_AMPR LSFT(KC_7) // & -#define KC_AMPERSAND KC_AMPR - -#define KC_ASTR LSFT(KC_8) // * -#define KC_ASTERISK KC_ASTR - -#define KC_LPRN LSFT(KC_9) // ( -#define KC_LEFT_PAREN KC_LPRN - -#define KC_RPRN LSFT(KC_0) // ) -#define KC_RIGHT_PAREN KC_RPRN - -#define KC_UNDS LSFT(KC_MINS) // _ -#define KC_UNDERSCORE KC_UNDS - -#define KC_PLUS LSFT(KC_EQL) // + - -#define KC_LCBR LSFT(KC_LBRC) // { -#define KC_LEFT_CURLY_BRACE KC_LCBR - -#define KC_RCBR LSFT(KC_RBRC) // } -#define KC_RIGHT_CURLY_BRACE KC_RCBR - -#define KC_LABK LSFT(KC_COMM) // < -#define KC_LEFT_ANGLE_BRACKET KC_LABK - -#define KC_RABK LSFT(KC_DOT) // > -#define KC_RIGHT_ANGLE_BRACKET KC_RABK - -#define KC_COLN LSFT(KC_SCLN) // : -#define KC_COLON KC_COLN - -#define KC_PIPE LSFT(KC_BSLS) // | - -#define KC_LT LSFT(KC_COMM) // < - -#define KC_GT LSFT(KC_DOT) // > - -#define KC_QUES LSFT(KC_SLSH) // ? -#define KC_QUESTION KC_QUES - -#define KC_DQT LSFT(KC_QUOT) // " -#define KC_DOUBLE_QUOTE KC_DQT -#define KC_DQUO KC_DQT - -#define KC_DELT KC_DELETE // Del key (four letter code) - -// Alias for function layers than expand past FN31 -#define FUNC(kc) (kc | QK_FUNCTION) - -// Aliases -#define S(kc) LSFT(kc) -#define F(kc) FUNC(kc) - -#define M(kc) (kc | QK_MACRO) - -#define MACRODOWN(...) (record->event.pressed ? MACRO(__VA_ARGS__) : MACRO_NONE) - -// L-ayer, T-ap - 256 keycode max, 16 layer max -#define LT(layer, kc) (kc | QK_LAYER_TAP | ((layer & 0xF) << 8)) - -#define AG_SWAP MAGIC_SWAP_ALT_GUI -#define AG_NORM MAGIC_UNSWAP_ALT_GUI - -#define BL_ON BL_9 -#define BL_OFF BL_0 - -#define MI_ON MIDI_ON -#define MI_OFF MIDI_OFF - -// GOTO layer - 16 layers max -// when: -// ON_PRESS = 1 -// ON_RELEASE = 2 -// Unless you have a good reason not to do so, prefer ON_PRESS (1) as your default. -// In fact, we changed it to assume ON_PRESS for sanity/simplicity. If needed, you can add your own -// keycode modeled after the old version, kept below for this. -/* #define TO(layer, when) (layer | QK_TO | (when << 0x4)) */ -#define TO(layer) (layer | QK_TO | (ON_PRESS << 0x4)) - -// Momentary switch layer - 256 layer max -#define MO(layer) (layer | QK_MOMENTARY) - -// Set default layer - 256 layer max -#define DF(layer) (layer | QK_DEF_LAYER) - -// Toggle to layer - 256 layer max -#define TG(layer) (layer | QK_TOGGLE_LAYER) - -// One-shot layer - 256 layer max -#define OSL(layer) (layer | QK_ONE_SHOT_LAYER) - -// One-shot mod -#define OSM(mod) (mod | QK_ONE_SHOT_MOD) - -// M-od, T-ap - 256 keycode max -#define MT(mod, kc) (kc | QK_MOD_TAP | ((mod & 0xF) << 8)) -#define CTL_T(kc) MT(MOD_LCTL, kc) -#define SFT_T(kc) MT(MOD_LSFT, kc) -#define ALT_T(kc) MT(MOD_LALT, kc) -#define GUI_T(kc) MT(MOD_LGUI, kc) -#define C_S_T(kc) MT((MOD_LCTL | MOD_LSFT), kc) // Control + Shift e.g. for gnome-terminal -#define MEH_T(kc) MT((MOD_LCTL | MOD_LSFT | MOD_LALT), kc) // Meh is a less hyper version of the Hyper key -- doesn't include Win or Cmd, so just alt+shift+ctrl -#define LCAG_T(kc) MT((MOD_LCTL | MOD_LALT | MOD_LGUI), kc) // Left control alt and gui -#define ALL_T(kc) MT((MOD_LCTL | MOD_LSFT | MOD_LALT | MOD_LGUI), kc) // see http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/ - -// Dedicated keycode versions for Hyper and Meh, if you want to use them as standalone keys rather than mod-tap -#define KC_HYPR HYPR(KC_NO) -#define KC_MEH MEH(KC_NO) - -#ifdef UNICODE_ENABLE - // For sending unicode codes. - // You may not send codes over 7FFF -- this supports most of UTF8. - // To have a key that sends out Å’, go UC(0x0152) - #define UNICODE(n) (n | QK_UNICODE) - #define UC(n) UNICODE(n) -#endif - -#ifdef UNICODEMAP_ENABLE - #define X(n) (n | QK_UNICODE_MAP) -#endif - #endif diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c index 833e5a8f8d9f..eced3d2bba29 100644 --- a/quantum/keymap_common.c +++ b/quantum/keymap_common.c @@ -48,12 +48,10 @@ action_t action_for_key(uint8_t layer, keypos_t key) action_t action; uint8_t action_layer, when, mod; - // The arm-none-eabi compiler generates out of bounds warnings when using the fn_actions directly for some reason - const uint16_t* actions = fn_actions; switch (keycode) { case KC_FN0 ... KC_FN31: - action.code = pgm_read_word(&actions[FN_INDEX(keycode)]); + action.code = keymap_function_id_to_action(FN_INDEX(keycode)); break; case KC_A ... KC_EXSEL: case KC_LCTRL ... KC_RGUI: @@ -79,7 +77,7 @@ action_t action_for_key(uint8_t layer, keypos_t key) case QK_FUNCTION ... QK_FUNCTION_MAX: ; // Is a shortcut for function action_layer, pull last 12bits // This means we have 4,096 FN macros at our disposal - action.code = pgm_read_word(&actions[(int)keycode & 0xFFF]); + action.code = keymap_function_id_to_action( (int)keycode & 0xFFF ); break; case QK_MACRO ... QK_MACRO_MAX: action.code = ACTION_MACRO(keycode & 0xFF); @@ -163,9 +161,17 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { } -/* translates key to keycode */ +// translates key to keycode +__attribute__ ((weak)) uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) { // Read entire word (16bits) return pgm_read_word(&keymaps[(layer)][(key.row)][(key.col)]); } + +// translates function id to action +__attribute__ ((weak)) +uint16_t keymap_function_id_to_action( uint16_t function_id ) +{ + return pgm_read_word(&fn_actions[function_id]); +} diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h new file mode 100644 index 000000000000..1205771acb22 --- /dev/null +++ b/quantum/quantum_keycodes.h @@ -0,0 +1,312 @@ + +#ifndef QUANTUM_KEYCODES_H +#define QUANTUM_KEYCODES_H + +enum quantum_keycodes { + // Ranges used in shortucuts - not to be used directly + QK_TMK = 0x0000, + QK_TMK_MAX = 0x00FF, + QK_MODS = 0x0100, + QK_LCTL = 0x0100, + QK_LSFT = 0x0200, + QK_LALT = 0x0400, + QK_LGUI = 0x0800, + QK_RCTL = 0x1100, + QK_RSFT = 0x1200, + QK_RALT = 0x1400, + QK_RGUI = 0x1800, + QK_MODS_MAX = 0x1FFF, + QK_FUNCTION = 0x2000, + QK_FUNCTION_MAX = 0x2FFF, + QK_MACRO = 0x3000, + QK_MACRO_MAX = 0x3FFF, + QK_LAYER_TAP = 0x4000, + QK_LAYER_TAP_MAX = 0x4FFF, + QK_TO = 0x5000, + QK_TO_MAX = 0x50FF, + QK_MOMENTARY = 0x5100, + QK_MOMENTARY_MAX = 0x51FF, + QK_DEF_LAYER = 0x5200, + QK_DEF_LAYER_MAX = 0x52FF, + QK_TOGGLE_LAYER = 0x5300, + QK_TOGGLE_LAYER_MAX = 0x53FF, + QK_ONE_SHOT_LAYER = 0x5400, + QK_ONE_SHOT_LAYER_MAX = 0x54FF, + QK_ONE_SHOT_MOD = 0x5500, + QK_ONE_SHOT_MOD_MAX = 0x55FF, +#ifndef DISABLE_CHORDING + QK_CHORDING = 0x5600, + QK_CHORDING_MAX = 0x56FF, +#endif + QK_MOD_TAP = 0x6000, + QK_MOD_TAP_MAX = 0x6FFF, + QK_TAP_DANCE = 0x7100, + QK_TAP_DANCE_MAX = 0x71FF, +#ifdef UNICODEMAP_ENABLE + QK_UNICODE_MAP = 0x7800, + QK_UNICODE_MAP_MAX = 0x7FFF, +#endif +#ifdef UNICODE_ENABLE + QK_UNICODE = 0x8000, + QK_UNICODE_MAX = 0xFFFF, +#endif + + // Loose keycodes - to be used directly + + RESET = 0x7000, + DEBUG, + MAGIC_SWAP_CONTROL_CAPSLOCK, + MAGIC_CAPSLOCK_TO_CONTROL, + MAGIC_SWAP_LALT_LGUI, + MAGIC_SWAP_RALT_RGUI, + MAGIC_NO_GUI, + MAGIC_SWAP_GRAVE_ESC, + MAGIC_SWAP_BACKSLASH_BACKSPACE, + MAGIC_HOST_NKRO, + MAGIC_SWAP_ALT_GUI, + MAGIC_UNSWAP_CONTROL_CAPSLOCK, + MAGIC_UNCAPSLOCK_TO_CONTROL, + MAGIC_UNSWAP_LALT_LGUI, + MAGIC_UNSWAP_RALT_RGUI, + MAGIC_UNNO_GUI, + MAGIC_UNSWAP_GRAVE_ESC, + MAGIC_UNSWAP_BACKSLASH_BACKSPACE, + MAGIC_UNHOST_NKRO, + MAGIC_UNSWAP_ALT_GUI, + MAGIC_TOGGLE_NKRO, + + // Leader key +#ifndef DISABLE_LEADER + KC_LEAD, +#endif + + // Audio on/off/toggle + AU_ON, + AU_OFF, + AU_TOG, + + // Music mode on/off/toggle + MU_ON, + MU_OFF, + MU_TOG, + + // Music voice iterate + MUV_IN, + MUV_DE, + + // Midi mode on/off + MIDI_ON, + MIDI_OFF, + + // Backlight functionality + BL_0, + BL_1, + BL_2, + BL_3, + BL_4, + BL_5, + BL_6, + BL_7, + BL_8, + BL_9, + BL_10, + BL_11, + BL_12, + BL_13, + BL_14, + BL_15, + BL_DEC, + BL_INC, + BL_TOGG, + BL_STEP, + + // RGB functionality + RGB_TOG, + RGB_MOD, + RGB_HUI, + RGB_HUD, + RGB_SAI, + RGB_SAD, + RGB_VAI, + RGB_VAD, + + // Left shift, open paren + KC_LSPO, + + // Right shift, close paren + KC_RSPC, + + // Printing + PRINT_ON, + PRINT_OFF, + + // always leave at the end + SAFE_RANGE +}; + +// Ability to use mods in layouts +#define LCTL(kc) (kc | QK_LCTL) +#define LSFT(kc) (kc | QK_LSFT) +#define LALT(kc) (kc | QK_LALT) +#define LGUI(kc) (kc | QK_LGUI) +#define RCTL(kc) (kc | QK_RCTL) +#define RSFT(kc) (kc | QK_RSFT) +#define RALT(kc) (kc | QK_RALT) +#define RGUI(kc) (kc | QK_RGUI) + +#define HYPR(kc) (kc | QK_LCTL | QK_LSFT | QK_LALT | QK_LGUI) +#define MEH(kc) (kc | QK_LCTL | QK_LSFT | QK_LALT) +#define LCAG(kc) (kc | QK_LCTL | QK_LALT | QK_LGUI) +#define ALTG(kc) (kc | QK_RCTL | QK_RALT) + +#define MOD_HYPR 0xf +#define MOD_MEH 0x7 + + +// Aliases for shifted symbols +// Each key has a 4-letter code, and some have longer aliases too. +// While the long aliases are descriptive, the 4-letter codes +// make for nicer grid layouts (everything lines up), and are +// the preferred style for Quantum. +#define KC_TILD LSFT(KC_GRV) // ~ +#define KC_TILDE KC_TILD + +#define KC_EXLM LSFT(KC_1) // ! +#define KC_EXCLAIM KC_EXLM + +#define KC_AT LSFT(KC_2) // @ + +#define KC_HASH LSFT(KC_3) // # + +#define KC_DLR LSFT(KC_4) // $ +#define KC_DOLLAR KC_DLR + +#define KC_PERC LSFT(KC_5) // % +#define KC_PERCENT KC_PERC + +#define KC_CIRC LSFT(KC_6) // ^ +#define KC_CIRCUMFLEX KC_CIRC + +#define KC_AMPR LSFT(KC_7) // & +#define KC_AMPERSAND KC_AMPR + +#define KC_ASTR LSFT(KC_8) // * +#define KC_ASTERISK KC_ASTR + +#define KC_LPRN LSFT(KC_9) // ( +#define KC_LEFT_PAREN KC_LPRN + +#define KC_RPRN LSFT(KC_0) // ) +#define KC_RIGHT_PAREN KC_RPRN + +#define KC_UNDS LSFT(KC_MINS) // _ +#define KC_UNDERSCORE KC_UNDS + +#define KC_PLUS LSFT(KC_EQL) // + + +#define KC_LCBR LSFT(KC_LBRC) // { +#define KC_LEFT_CURLY_BRACE KC_LCBR + +#define KC_RCBR LSFT(KC_RBRC) // } +#define KC_RIGHT_CURLY_BRACE KC_RCBR + +#define KC_LABK LSFT(KC_COMM) // < +#define KC_LEFT_ANGLE_BRACKET KC_LABK + +#define KC_RABK LSFT(KC_DOT) // > +#define KC_RIGHT_ANGLE_BRACKET KC_RABK + +#define KC_COLN LSFT(KC_SCLN) // : +#define KC_COLON KC_COLN + +#define KC_PIPE LSFT(KC_BSLS) // | + +#define KC_LT LSFT(KC_COMM) // < + +#define KC_GT LSFT(KC_DOT) // > + +#define KC_QUES LSFT(KC_SLSH) // ? +#define KC_QUESTION KC_QUES + +#define KC_DQT LSFT(KC_QUOT) // " +#define KC_DOUBLE_QUOTE KC_DQT +#define KC_DQUO KC_DQT + +#define KC_DELT KC_DELETE // Del key (four letter code) + +// Alias for function layers than expand past FN31 +#define FUNC(kc) (kc | QK_FUNCTION) + +// Aliases +#define S(kc) LSFT(kc) +#define F(kc) FUNC(kc) + +#define M(kc) (kc | QK_MACRO) + +#define MACRODOWN(...) (record->event.pressed ? MACRO(__VA_ARGS__) : MACRO_NONE) + +// L-ayer, T-ap - 256 keycode max, 16 layer max +#define LT(layer, kc) (kc | QK_LAYER_TAP | ((layer & 0xF) << 8)) + +#define AG_SWAP MAGIC_SWAP_ALT_GUI +#define AG_NORM MAGIC_UNSWAP_ALT_GUI + +#define BL_ON BL_9 +#define BL_OFF BL_0 + +#define MI_ON MIDI_ON +#define MI_OFF MIDI_OFF + +// GOTO layer - 16 layers max +// when: +// ON_PRESS = 1 +// ON_RELEASE = 2 +// Unless you have a good reason not to do so, prefer ON_PRESS (1) as your default. +// In fact, we changed it to assume ON_PRESS for sanity/simplicity. If needed, you can add your own +// keycode modeled after the old version, kept below for this. +/* #define TO(layer, when) (layer | QK_TO | (when << 0x4)) */ +#define TO(layer) (layer | QK_TO | (ON_PRESS << 0x4)) + +// Momentary switch layer - 256 layer max +#define MO(layer) (layer | QK_MOMENTARY) + +// Set default layer - 256 layer max +#define DF(layer) (layer | QK_DEF_LAYER) + +// Toggle to layer - 256 layer max +#define TG(layer) (layer | QK_TOGGLE_LAYER) + +// One-shot layer - 256 layer max +#define OSL(layer) (layer | QK_ONE_SHOT_LAYER) + +// One-shot mod +#define OSM(mod) (mod | QK_ONE_SHOT_MOD) + +// M-od, T-ap - 256 keycode max +#define MT(mod, kc) (kc | QK_MOD_TAP | ((mod & 0xF) << 8)) +#define CTL_T(kc) MT(MOD_LCTL, kc) +#define SFT_T(kc) MT(MOD_LSFT, kc) +#define ALT_T(kc) MT(MOD_LALT, kc) +#define GUI_T(kc) MT(MOD_LGUI, kc) +#define C_S_T(kc) MT((MOD_LCTL | MOD_LSFT), kc) // Control + Shift e.g. for gnome-terminal +#define MEH_T(kc) MT((MOD_LCTL | MOD_LSFT | MOD_LALT), kc) // Meh is a less hyper version of the Hyper key -- doesn't include Win or Cmd, so just alt+shift+ctrl +#define LCAG_T(kc) MT((MOD_LCTL | MOD_LALT | MOD_LGUI), kc) // Left control alt and gui +#define ALL_T(kc) MT((MOD_LCTL | MOD_LSFT | MOD_LALT | MOD_LGUI), kc) // see http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/ + +// Dedicated keycode versions for Hyper and Meh, if you want to use them as standalone keys rather than mod-tap +#define KC_HYPR HYPR(KC_NO) +#define KC_MEH MEH(KC_NO) + +#ifdef UNICODE_ENABLE + // For sending unicode codes. + // You may not send codes over 7FFF -- this supports most of UTF8. + // To have a key that sends out Å’, go UC(0x0152) + #define UNICODE(n) (n | QK_UNICODE) + #define UC(n) UNICODE(n) +#endif + +#ifdef UNICODEMAP_ENABLE + #define X(n) (n | QK_UNICODE_MAP) +#endif + +#endif // QUANTUM_KEYCODES_H diff --git a/tmk_core/common/keycode.h b/tmk_core/common/keycode.h index 2f208c54e046..54e9c322c1df 100644 --- a/tmk_core/common/keycode.h +++ b/tmk_core/common/keycode.h @@ -85,7 +85,7 @@ along with this program. If not, see . #define KC_LCAP KC_LOCKING_CAPS #define KC_LNUM KC_LOCKING_NUM #define KC_LSCR KC_LOCKING_SCROLL -#define KC_ERAS KC_ALT_ERASE, +#define KC_ERAS KC_ALT_ERASE #define KC_CLR KC_CLEAR /* Japanese specific */ #define KC_ZKHK KC_GRAVE From 48900f83df2c57bde9761c036dc78d4255742b5e Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Tue, 20 Dec 2016 02:43:52 +1100 Subject: [PATCH 02/69] WIP --- keyboards/zeal60/config.h | 2 +- keyboards/zeal60/rules.mk | 6 +-- keyboards/zeal60/zeal60.c | 83 +++++++++++++++++++++++++++++-- keyboards/zeal60/zeal_backlight.c | 79 ++++++++++++++++++++--------- keyboards/zeal60/zeal_backlight.h | 4 +- keyboards/zeal60/zeal_eeprom.c | 4 +- keyboards/zeal60/zeal_keycode.h | 5 +- keyboards/zeal60/zeal_keymap.c | 4 +- 8 files changed, 150 insertions(+), 37 deletions(-) diff --git a/keyboards/zeal60/config.h b/keyboards/zeal60/config.h index 9cbddd2b030d..352575e4bb02 100644 --- a/keyboards/zeal60/config.h +++ b/keyboards/zeal60/config.h @@ -89,6 +89,6 @@ along with this program. If not, see . #define ALPHAS_MODS_ROW_3 0b0010000000000011 #define ALPHAS_MODS_ROW_4 0b0011100000001111 - +#define USE_KEYMAPS_IN_EEPROM 1 #endif diff --git a/keyboards/zeal60/rules.mk b/keyboards/zeal60/rules.mk index 296f13f48000..41f2e95b038f 100644 --- a/keyboards/zeal60/rules.mk +++ b/keyboards/zeal60/rules.mk @@ -64,11 +64,11 @@ OPT_DEFS += -DNO_SUSPEND_POWER_DOWN # change to "no" to disable the options, or define them in the Makefile in # the appropriate keymap folder that will get included automatically # -BOOTMAGIC_ENABLE ?= yes # Virtual DIP switch configuration(+1000) +BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) MOUSEKEY_ENABLE ?= no # Mouse keys(+4700) EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) -CONSOLE_ENABLE ?= yes # Console for debug(+400) -COMMAND_ENABLE ?= yes # Commands for debug and configuration +CONSOLE_ENABLE ?= no # Console for debug(+400) +COMMAND_ENABLE ?= no # Commands for debug and configuration NKRO_ENABLE ?= yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality MIDI_ENABLE ?= no # MIDI controls diff --git a/keyboards/zeal60/zeal60.c b/keyboards/zeal60/zeal60.c index 5037ef4c2cc6..cd9d4cc0a1ec 100644 --- a/keyboards/zeal60/zeal60.c +++ b/keyboards/zeal60/zeal60.c @@ -14,6 +14,7 @@ void raw_hid_receive( uint8_t *data, uint8_t length ) uint8_t command = data[0]; switch ( command ) { +#if USE_KEYMAPS_IN_EEPROM case id_keymap_keycode_load: { uint16_t keycode = keymap_keycode_load(data[1], data[2], data[3]); @@ -33,6 +34,7 @@ void raw_hid_receive( uint8_t *data, uint8_t length ) keymap_default_save(); break; } +#endif // USE_KEYMAPS_IN_EEPROM case id_backlight_config_set_flags: { backlight_config_set_flags(data[1]); @@ -67,9 +69,37 @@ void raw_hid_receive( uint8_t *data, uint8_t length ) #endif +void bootmagic_lite(void) +{ + // The lite version of TMK's bootmagic. + // 100% less potential for accidentally making the + // keyboard do stupid things. + + // We need multiple scans because debouncing can't be turned off. + matrix_scan(); + wait_ms(DEBOUNCING_DELAY); + matrix_scan(); + + // If the Esc and space bar are held down on power up, + // reset the EEPROM valid state and jump to bootloader. + // Assumes Esc is at [0,0] and spacebar is at [4,7]. + // This isn't very generalized, but we need something that doesn't + // rely on user's keymaps in firmware or EEPROM. + if ( ( matrix_get_row(0) & (1<<0) ) && + ( matrix_get_row(4) & (1<<7) ) ) + { + // Set the Zeal60 specific EEPROM state as invalid. + eeprom_set_valid(false); + // Set the TMK/QMK EEPROM state as invalid. + eeconfig_disable(); + // Jump to bootloader. + bootloader_jump(); + } +} void matrix_init_kb(void) { + bootmagic_lite(); #ifndef ZEAL60_TEST // If the EEPROM has the magic, the data is good. @@ -87,6 +117,19 @@ void matrix_init_kb(void) // come from construction of the zeal_backlight_config instance. backlight_config_save(); + // Clear the LED colors stored in EEPROM + for ( int row=0; row < MATRIX_ROWS; row++ ) + { + HSV hsv; + for ( int col=0; col < MATRIX_COLS; col++ ) + { + hsv.h = rand() & 0xFF; + hsv.s = rand() & 0xFF; + hsv.v = 255; + backlight_set_key_color( row, col, hsv ); + } + } + // This saves "empty" keymaps so it falls back to the keymaps // in the firmware (aka. progmem/flash) keymap_default_save(); @@ -113,9 +156,13 @@ void matrix_scan_kb(void) matrix_scan_user(); } -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - // put your per-action keyboard code here - // runs for every action, just before processing by the firmware +bool process_record_kb(uint16_t keycode, keyrecord_t *record) +{ + // Record keypresses for backlight effects + if ( record->event.pressed ) + { + backlight_set_key_hit( record->event.key.row, record->event.key.col ); + } switch(keycode) { @@ -205,6 +252,32 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { } return false; break; + case FN_MO13: + if (record->event.pressed) + { + layer_on(1); + update_tri_layer(1, 2, 3); + } + else + { + layer_off(1); + update_tri_layer(1, 2, 3); + } + return false; + break; + case FN_MO23: + if (record->event.pressed) + { + layer_on(2); + update_tri_layer(1, 2, 3); + } + else + { + layer_off(2); + update_tri_layer(1, 2, 3); + } + return false; + break; } return process_record_user(keycode, record); @@ -232,6 +305,8 @@ uint16_t keymap_function_id_to_action( uint16_t function_id ) } } +#if USE_KEYMAPS_IN_EEPROM + #if 0 // This is how to implement actions stored in EEPROM. // Not yet implemented. Not sure if it's worth the trouble @@ -250,6 +325,8 @@ uint16_t keymap_function_id_to_action( uint16_t function_id ) } #endif +#endif // USE_KEYMAPS_IN_EEPROM + return pgm_read_word(&fn_actions[function_id]); } diff --git a/keyboards/zeal60/zeal_backlight.c b/keyboards/zeal60/zeal_backlight.c index b40e41d7d5f2..630c3b5b2b1a 100644 --- a/keyboards/zeal60/zeal_backlight.c +++ b/keyboards/zeal60/zeal_backlight.c @@ -23,7 +23,7 @@ zeal_backlight_config g_config = { ALPHAS_MODS_ROW_2, ALPHAS_MODS_ROW_3, ALPHAS_MODS_ROW_4 }, - .brightness = 127, + .brightness = 255, .effect = 0, .color_1 = { .h = 0, .s = 255, .v = 0 }, .color_2 = { .h = 127, .s = 255, .v = 0 } @@ -32,6 +32,9 @@ zeal_backlight_config g_config = { // Global tick at 20 Hz uint32_t g_tick = 0; +// Ticks since this key was last hit. +uint8_t g_key_hit[72]; + // This is a 7-bit address, that gets left-shifted and bit 0 // set to 0 for write, 1 for read (as per I2C protocol) #define ISSI_ADDR_1 0x74 @@ -125,12 +128,12 @@ const uint8_t g_map_row_col_to_led[5][14] PROGMEM = { }; -void map_row_col_to_led( uint8_t row, uint8_t col, uint8_t *index ) +void map_row_col_to_led( uint8_t row, uint8_t col, uint8_t *led ) { - *index = 255; + *led = 255; if ( row < MATRIX_ROWS && col < MATRIX_COLS ) { - *index = pgm_read_byte(&g_map_row_col_to_led[row][col]); + *led = pgm_read_byte(&g_map_row_col_to_led[row][col]); } } @@ -149,6 +152,13 @@ void backlight_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) IS31FL3731_set_color_all( red, green, blue ); } +void backlight_set_key_hit(uint8_t row, uint8_t col) +{ + uint8_t led; + map_row_col_to_led(row,col,&led); + g_key_hit[led] = 0; +} + // This is (F_CPU/1024) / 20 Hz // = 15625 Hz / 20 Hz // = 781 @@ -189,7 +199,7 @@ void backlight_effect_test(void) { uint8_t offset = (g_tick<<3) & 0xFF; // Relies on hue being 8-bit and wrapping - HSV hsv = { offset, 255, 127 }; + HSV hsv = { .h = offset, .s = 255, .v = 127 }; RGB rgb = hsv_to_rgb( hsv ); backlight_set_color_all( rgb.r, rgb.g, rgb.b ); @@ -204,7 +214,7 @@ void backlight_effect_all_off(void) // Solid color void backlight_effect_solid_color(void) { - HSV hsv = { g_config.color_1.h, g_config.color_1.s, g_config.brightness }; + HSV hsv = { .h = g_config.color_1.h, .s = g_config.color_1.s, .v = g_config.brightness }; RGB rgb = hsv_to_rgb( hsv ); backlight_set_color_all( rgb.r, rgb.g, rgb.b ); } @@ -254,7 +264,7 @@ void backlight_effect_gradient_up_down(void) // Divide delta by 4, this gives the delta per row delta /= 4; - HSV hsv = { 0, 255, g_config.brightness }; + HSV hsv = { .h = 0, .s = 255, .v = g_config.brightness }; RGB rgb; Point point; for ( int i=0; i<72; i++ ) @@ -272,16 +282,22 @@ void backlight_effect_gradient_up_down(void) void backlight_effect_cycle_all(void) { uint8_t offset = g_tick & 0xFF; + // Relies on hue being 8-bit and wrapping - HSV hsv = { offset, 255, g_config.brightness }; - RGB rgb = hsv_to_rgb( hsv ); - backlight_set_color_all( rgb.r, rgb.g, rgb.b ); + for ( int i=0; i<72; i++ ) + { + uint16_t offset2 = g_key_hit[i]<<2; + offset2 = (offset2<=63) ? (63-offset2) : 0; + HSV hsv = { .h = offset+offset2, .s = 255, .v = g_config.brightness }; + RGB rgb = hsv_to_rgb( hsv ); + backlight_set_color( i, rgb.r, rgb.g, rgb.b ); + } } void backlight_effect_cycle_left_right(void) { uint8_t offset = g_tick & 0xFF; - HSV hsv = { 0, 255, g_config.brightness }; + HSV hsv = { .h = 0, .s = 255, .v = g_config.brightness }; RGB rgb; Point point; for ( int i=0; i<72; i++ ) @@ -297,7 +313,7 @@ void backlight_effect_cycle_all(void) void backlight_effect_cycle_up_down(void) { uint8_t offset = g_tick & 0xFF; - HSV hsv = { 0, 255, g_config.brightness }; + HSV hsv = { .h = 0, .s = 255, .v = g_config.brightness }; RGB rgb; Point point; for ( int i=0; i<72; i++ ) @@ -334,6 +350,14 @@ ISR(TIMER3_COMPA_vect) return; } + for ( int led=0; led<72; led++ ) + { + if ( g_key_hit[led] < 255 ) + { + g_key_hit[led]++; + } + } + // Store backlight config to EEPROM every 6.4 seconds // A slightly hacky way of reducing the number of EEPROM writes // should the user be hammering away on backlight changes @@ -563,6 +587,12 @@ void backlight_init_drivers(void) IS31FL3731_write_register(ISSI_ADDR_2, 0x11, 0b11101111 | (enable_led_LD13<<4)); // TODO: put the 1 second startup delay here? + + // clear the key hits + for ( int led=0; led<72; led++ ) + { + g_key_hit[led] = 255; + } } @@ -581,77 +611,79 @@ uint8_t decrement( uint8_t value, uint8_t step, uint8_t min ) return ( new_value >= min ) ? new_value : min; } -void backlight_set_effect(uint8_t effect) -{ - g_config.effect = effect; -} - void backlight_effect_increase(void) { g_config.effect = increment( g_config.effect, 1, BACKLIGHT_EFFECT_MAX ); + backlight_config_save(); } void backlight_effect_decrease(void) { g_config.effect = decrement( g_config.effect, 1, 0 ); -} - -void backlight_set_brightness(uint8_t brightness) -{ - g_config.brightness = brightness; + backlight_config_save(); } void backlight_brightness_increase(void) { g_config.brightness = increment( g_config.brightness, 8, 255 ); + backlight_config_save(); } void backlight_brightness_decrease(void) { g_config.brightness = decrement( g_config.brightness, 8, 0 ); + backlight_config_save(); } void backlight_color_1_hue_increase(void) { g_config.color_1.h = increment( g_config.color_1.h, 8, 255 ); + backlight_config_save(); } void backlight_color_1_hue_decrease(void) { g_config.color_1.h = decrement( g_config.color_1.h, 8, 0 ); + backlight_config_save(); } void backlight_color_1_sat_increase(void) { g_config.color_1.s = increment( g_config.color_1.s, 8, 255 ); + backlight_config_save(); } void backlight_color_1_sat_decrease(void) { g_config.color_1.s = decrement( g_config.color_1.s, 8, 0 ); + backlight_config_save(); } void backlight_color_2_hue_increase(void) { g_config.color_2.h = increment( g_config.color_2.h, 8, 255 ); + backlight_config_save(); } void backlight_color_2_hue_decrease(void) { g_config.color_2.h = decrement( g_config.color_2.h, 8, 0 ); + backlight_config_save(); } void backlight_color_2_sat_increase(void) { g_config.color_2.s = increment( g_config.color_2.s, 8, 255 ); + backlight_config_save(); } void backlight_color_2_sat_decrease(void) { g_config.color_2.s = decrement( g_config.color_2.s, 8, 0 ); + backlight_config_save(); } -void *backlight_get_custom_key_color_eeprom_address(uint8_t led) +void *backlight_get_custom_key_color_eeprom_address( uint8_t led ) { // 3 bytes per color return EEPROM_BACKLIGHT_KEY_COLOR_ADDR + ( led * 3 ); @@ -659,7 +691,6 @@ void *backlight_get_custom_key_color_eeprom_address(uint8_t led) void backlight_get_key_color( uint8_t led, HSV *hsv ) { - // Pretend 2D array is 1D ;-) void *address = backlight_get_custom_key_color_eeprom_address( led ); hsv->h = eeprom_read_byte(address); hsv->s = eeprom_read_byte(address+1); diff --git a/keyboards/zeal60/zeal_backlight.h b/keyboards/zeal60/zeal_backlight.h index c8ae52a0e2ef..40775ef8a41e 100644 --- a/keyboards/zeal60/zeal_backlight.h +++ b/keyboards/zeal60/zeal_backlight.h @@ -38,11 +38,11 @@ void backlight_timer_disable(void); // If the buffer is dirty, it will update the driver with the buffer. void backlight_update_pwm_buffers(void); -void backlight_set_effect(uint8_t effect); +void backlight_set_key_hit(uint8_t row, uint8_t col); + void backlight_effect_increase(void); void backlight_effect_decrease(void); -void backlight_set_brightness(uint8_t brightness); void backlight_brightness_increase(void); void backlight_brightness_decrease(void); diff --git a/keyboards/zeal60/zeal_eeprom.c b/keyboards/zeal60/zeal_eeprom.c index aac0979d42e0..61be1f7e9488 100644 --- a/keyboards/zeal60/zeal_eeprom.c +++ b/keyboards/zeal60/zeal_eeprom.c @@ -9,6 +9,6 @@ bool eeprom_is_valid(void) void eeprom_set_valid(bool valid) { - eeprom_update_word(EEPROM_MAGIC_ADDR, valid ? EEPROM_MAGIC : 0x0000); - eeprom_update_byte(EEPROM_VERSION_ADDR, valid ? EEPROM_VERSION : 0x00); + eeprom_update_word(EEPROM_MAGIC_ADDR, valid ? EEPROM_MAGIC : 0xFFFF); + eeprom_update_byte(EEPROM_VERSION_ADDR, valid ? EEPROM_VERSION : 0xFF); } diff --git a/keyboards/zeal60/zeal_keycode.h b/keyboards/zeal60/zeal_keycode.h index 33406188a083..df626a7ddf75 100644 --- a/keyboards/zeal60/zeal_keycode.h +++ b/keyboards/zeal60/zeal_keycode.h @@ -17,7 +17,9 @@ enum zeal60_keycodes { H2_INC, H2_DEC, S2_INC, - S2_DEC + S2_DEC, + FN_MO13, + FN_MO23 }; // Zeal60 specific "action functions" @@ -34,5 +36,6 @@ enum zeal60_action_functions { #define FN_TT13 F((0x0F00|TRIPLE_TAP_1_3)) #define FN_TT23 F((0x0F00|TRIPLE_TAP_2_3)) +#define TG_NKRO MAGIC_TOGGLE_NKRO #endif // ZEAL_KEYCODE_H diff --git a/keyboards/zeal60/zeal_keymap.c b/keyboards/zeal60/zeal_keymap.c index 27ae4865bfe6..f400c2fd47b5 100644 --- a/keyboards/zeal60/zeal_keymap.c +++ b/keyboards/zeal60/zeal_keymap.c @@ -4,6 +4,7 @@ #include "keymap.h" // to get keymaps[][][] +#if USE_KEYMAPS_IN_EEPROM void *keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t col) { @@ -44,6 +45,7 @@ void keymap_default_save(void) } } + // This overrides the one in quantum/keymap_common.c uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) { @@ -64,5 +66,5 @@ uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) return pgm_read_word(&keymaps[layer][key.row][key.col]); } - +#endif // USE_KEYMAPS_IN_EEPROM From c5759518b975b808ff792e36f6f69be060834a1b Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Tue, 20 Dec 2016 02:46:50 +1100 Subject: [PATCH 03/69] Fixes issue #900 --- tmk_core/protocol/lufa/descriptor.c | 6 +++--- tmk_core/protocol/lufa/lufa.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tmk_core/protocol/lufa/descriptor.c b/tmk_core/protocol/lufa/descriptor.c index 14d99b50bd77..feeea76df095 100644 --- a/tmk_core/protocol/lufa/descriptor.c +++ b/tmk_core/protocol/lufa/descriptor.c @@ -143,10 +143,10 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM ExtrakeyReport[] = HID_RI_USAGE(8, 0x80), /* System Control */ HID_RI_COLLECTION(8, 0x01), /* Application */ HID_RI_REPORT_ID(8, REPORT_ID_SYSTEM), - HID_RI_LOGICAL_MINIMUM(16, 0x0081), - HID_RI_LOGICAL_MAXIMUM(16, 0x00B7), + HID_RI_LOGICAL_MINIMUM(16, 0x0001), + HID_RI_LOGICAL_MAXIMUM(16, 0x0003), HID_RI_USAGE_MINIMUM(16, 0x0081), /* System Power Down */ - HID_RI_USAGE_MAXIMUM(16, 0x00B7), /* System Display LCD Autoscale */ + HID_RI_USAGE_MAXIMUM(16, 0x0083), /* System Wake Up */ HID_RI_REPORT_SIZE(8, 16), HID_RI_REPORT_COUNT(8, 1), HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_ARRAY | HID_IOF_ABSOLUTE), diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index dd78fe6213bc..097189770668 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -732,7 +732,7 @@ static void send_system(uint16_t data) report_extra_t r = { .report_id = REPORT_ID_SYSTEM, - .usage = data + .usage = data - SYSTEM_POWER_DOWN + 1 }; Endpoint_SelectEndpoint(EXTRAKEY_IN_EPNUM); From b0021bea825a25dad7a2ba337358d63e7436c2ea Mon Sep 17 00:00:00 2001 From: Tushar Singal Date: Wed, 28 Dec 2016 20:47:06 -0500 Subject: [PATCH 04/69] Adding RGB underglow functionality. Fixed a compile-time conflict caused by enabling RGB underglow functionality. --- keyboards/zeal60/keymaps/tusing/Makefile | 10 ++ keyboards/zeal60/keymaps/tusing/README.md | 125 ++++++++++++++++++++++ keyboards/zeal60/keymaps/tusing/config.h | 31 ++++++ keyboards/zeal60/keymaps/tusing/keymap.c | 48 +++++++++ keyboards/zeal60/zeal_color.c | 14 +-- 5 files changed, 221 insertions(+), 7 deletions(-) create mode 100644 keyboards/zeal60/keymaps/tusing/Makefile create mode 100644 keyboards/zeal60/keymaps/tusing/README.md create mode 100644 keyboards/zeal60/keymaps/tusing/config.h create mode 100644 keyboards/zeal60/keymaps/tusing/keymap.c diff --git a/keyboards/zeal60/keymaps/tusing/Makefile b/keyboards/zeal60/keymaps/tusing/Makefile new file mode 100644 index 000000000000..9b0e3654e798 --- /dev/null +++ b/keyboards/zeal60/keymaps/tusing/Makefile @@ -0,0 +1,10 @@ +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +RGBLIGHT_ENABLE = yes +AUDIO_ENABLE = no # Underglow cannot be used with audio. + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif \ No newline at end of file diff --git a/keyboards/zeal60/keymaps/tusing/README.md b/keyboards/zeal60/keymaps/tusing/README.md new file mode 100644 index 000000000000..1a71cfaea5d0 --- /dev/null +++ b/keyboards/zeal60/keymaps/tusing/README.md @@ -0,0 +1,125 @@ +# RGB Underglow Strip on the Zeal60: A Guide + +***WARNING:*** I don't know if any of this is anywhere near correct. If you follow this, your keyboard will probably explode. Right now, I would appreciate if people could find and point out any mistakes in this guide. + +***NOTE:*** As explained in Part C, due to current limits, **underglow will only work on USB 3.0 or above**. If you want to use your keyboard on USB 2.0, make sure either underglow or backlighting is off when you plug in your Zeal60 - or that you have fiddled with the brightness of both to take the board's total consumption under 500mA. + +## A. Connecting the strip +You might find the [**full PCB image**](https://cdn.shopify.com/s/files/1/0490/7329/files/zeal60jumpers.png) helpful. Ignore the red boxes! + +1. Connect V+ and GND to 5V and GND from USB (J1A). + + + * ***Alternatively,*** if you don't want to further mess with the PCB, and you want to deal with the current limits purely in software as described in Part C, connect V+ and GND to the actual USB pinout V+ and GND. + + +2. Connect DI to PB0 (or another unused pin on the 32U4). + + + +## B. Enabling the strip +1. Add the following to your [```Makefile```](https://github.com/Wilba6582/qmk_firmware/blob/zeal60/keyboards/zeal60/Makefile): + + ```Makefile + RGBLIGHT_ENABLE = yes + AUDIO_ENABLE = no # Underglow cannot be used with audio. + ``` +2. Add the following to your [```config.h```](https://github.com/Wilba6582/qmk_firmware/blob/zeal60/keyboards/zeal60/keymaps/default/config.h): + + ```c + #define RGBLIGHT_ANIMATIONS + #define RGB_DI_PIN B0 // The pin your RGB strip is wired to + #define RGBLIGHT_ANIMATIONS // Require for fancier stuff (not compatible with audio) + #define RGBLED_NUM 16 // Number of LEDs + #define RGBLIGHT_HUE_STEP 5 // How much each press of rgb_hue changes hue + #define RGBLIGHT_SAT_STEP 10 // How much each press of rgb_sat changes sat + #define RGBLIGHT_VAL_STEP 10 // How much each press of rgb_val changes val + ``` +3. Keycodes are ```RGB_TOG``` (on/off), ```RGB_MOD``` (step through modes), ```RGB_HUI```, ```RGB_HUD```, ```RGB_SAI```, ```RGB_SAD```, ```RGB_VAI```, ```RGB_VAD``` (HSV increase/decrease). Add these to your keymap. Test it out with **1 LED only** (```RGBLED_NUM 1``` in [```config.h```](https://github.com/Wilba6582/qmk_firmware/blob/zeal60/keyboards/zeal60/keymaps/default/config.h) above). + +## C. Dealing with current limits +USB 2.0 ports on laptops provide up to 500mA max, but USB 3.0 ports can provide up to 900mA; USB 3.1 up to 1.5A; and powered USB hubs even more. We can run our keyboard at a higher brightness if we draw more power. + +An option to halve the Zeal60's current draw is to cut the trace on the pre-connected jumpers and bridge them with a 30kohm resistor. But let's try to limit brightness in software instead. + +Here are some possible configurations with 16 RGB neopixels (6 on top and bottom of PCB; 2 on each side): + +| Zeal60 (500mA maxed) | 16 RGB LEDs (60mA/LED maxed) | Total Current Consumption +|:----------------------:|:--------------------------:|:----------------------:| +| 36% / 180mA | 33% / 20mA | 496mA (USB 2.0) | +| **100% / 500mA** | **41% / 25mA** | **900mA (USB 3.0)** | +| 50% / 250mA | 66% / 40mA | 890mA (USB 3.0) | +| 100% / 500mA | 100% / 60mA | 1460mA (USB 3.1) + +I'll take the second option. Since we have 900-500=400mA left to work with, we need to implement a software solution to limit the strip's brightness. + +If we take a look at [```rgblight.c```](https://github.com/Wilba6582/qmk_firmware/blob/zeal60/quantum/rgblight.c), we'll notice that all lighting actuation trickles down to [```rgblight_set```](https://github.com/Wilba6582/qmk_firmware/blob/zeal60/quantum/rgblight.c#L373). I wrote the following **untested** snippet to limit strip current to 400mA. + +```c +// The folliwng three variables should probably be put in config.h. +#define RGBSTRIP_MAX_CURRENT_PER_LIGHT 60 // mA per light when at max brightness. +#define RGBSTRIP_RGBW 0 // 1 if you have an RGBW strip. +#define RGBSTRIP_CURRENT_LIMIT 400 // Strip current limit in mA. + +void adjust_current(void) { + /** Dims RGB(W) strip if it exceeds defined current limit. */ + // Convert 1 milliamp to an R+G+B+W brightness value. + float rgbw_per_milliamp = 255 * (3 + RGBSTRIP_RGBW) / + (float)RGBSTRIP_MAX_CURRENT_PER_LIGHT; + // Convert strip current limit to brightness limit. + float strip_rgbw_limit = RGBSTRIP_CURRENT_LIMIT * rgbw_per_milliamp; + + // Calculate how much brightness the strip currently uses. + uint8_t strip_rgbw_total = 0; + for (uint8_t i = 0; i < RGBLED_NUM; i++) { + strip_rgbw_total += led[i].r + led[i].g + led[i].b; + if (RGBSTRIP_RGBW) { + strip_rgbw_total += led[i].w; + } + } + + // If we use more brightness than allowed, dim LEDs. + if (strip_rgbw_total > strip_rgbw_limit) { + float multiplier = strip_rgbw_limit / strip_rgbw_total; + for (uint8_t i = 0; i < RGBLED_NUM; i++) { + led[i].r = (uint8_t)(led[i].r * multiplier); + led[i].g = (uint8_t)(led[i].g * multiplier); + led[i].b = (uint8_t)(led[i].b * multiplier); + if (RGBSTRIP_RGBW) { + led[i].w = (uint8_t)(led[i].w * multiplier); + } + } + } +} + +void rgblight_set(void) { + adjust_current(); + // ... rest of function ... +} +``` +1. Insert this snippet into your [```rgblight.c```](https://github.com/Wilba6582/qmk_firmware/blob/zeal60/quantum/rgblight.c) (and remember to adjust [```rgblight_set```](https://github.com/Wilba6582/qmk_firmware/blob/zeal60/quantum/rgblight.c#L373) as described in the the snippet). **Or** find another way to never let your lights exceed 40%. +2. Change the max power draw limit to 900mA by adding ```#define USB_MAX_POWER_CONSUMPTION 900``` to [```config.h```](https://github.com/Wilba6582/qmk_firmware/blob/zeal60/keyboards/zeal60/keymaps/default/config.h). +3. **If you've connected +5V and GND to J1A**, either short or replace the thermistor labeled F1 under the USB port with one that supports your current needs. [Here's a selection](https://goo.gl/748avG) of 900mA-1.5A current hold fuses - look for an SMD 0805-sized fuse. **Otherwise, if you've connected directly to the USB pins**, you don't need to do anything other than limit brightness in software. +4. Enable all LEDs and test it out! + + + + +## D. Additional resources +### A. Connecting the strip. +* [In-depth description of connecting an RGB strip to the GH60](https://www.reddit.com/r/MechanicalKeyboards/comments/4d5or2/my_first_custom_build_satan_gh60_rbg_underglow_in/d1nz3o7/) +* [32U4 Pinout](https://40.media.tumblr.com/93b6bbd4113418c2b45459bb177e67c5/tumblr_mi49a20QMB1s5t695o1_1280.png) +* [Redditor describes connecting RGB strips on his Satan GH60](https://www.reddit.com/r/MechanicalKeyboards/comments/4hbjw4/finally_finished_my_satan_gh60_also_granite_o/d2qn8zx/?context=3) +* [Another Redditor on RGB with the Satan GH60](https://www.reddit.com/r/MechanicalKeyboards/comments/4ewzdx/gh60_satan_with_the_rgb_mod/d251uu6/ ) + +### B. Enabling the strip. +* [QMK Wiki portion on underglow](https://github.com/jackhumbert/qmk_firmware/wiki#rgb-under-glow-mod) +* [**Planck ```Makefile```, ```config.h```, and ```keymap.c``` config example**](https://github.com/jackhumbert/qmk_firmware/tree/master/keyboards/planck/keymaps/yang) +* [Video demonstrating keycode functions on a KC60](https://www.youtube.com/watch?v=VKrpPAHlisY) + +### C. Dealing with current limits. +* [Discussion of cutting jumpers and adding resistors to lower current from Zeal60](https://www.reddit.com/r/MechanicalKeyboards/comments/5hou92/photos_zeal60_lets_just_say_santa_came_early_this/db23qid/) +* [A selection of 900mA-1.5A current hold fuses - look for an SMD 0805-sized fuse.](https://goo.gl/748avG) +* [Video detailing technique to solder 0805 resistors](https://www.youtube.com/watch?v=PU7wLcuqc-I&t=123s&list=FLheMlKEVQ5cmVXazUt6HrxQ&index=2) +* [QMK feature request to implement max power draw limits in ```config.h```](https://github.com/jackhumbert/qmk_firmware/issues/954) +* [Commit enabling max power draw limits in ```config.h```](https://github.com/jackhumbert/qmk_firmware/commit/83e613ad239459582ae28f78b6c81535b9b138d7) \ No newline at end of file diff --git a/keyboards/zeal60/keymaps/tusing/config.h b/keyboards/zeal60/keymaps/tusing/config.h new file mode 100644 index 000000000000..d17a7b43cff0 --- /dev/null +++ b/keyboards/zeal60/keymaps/tusing/config.h @@ -0,0 +1,31 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +/* enable/disable LEDs based on layout */ +#undef USE_SPLIT_BACKSPACE +#define USE_SPLIT_BACKSPACE 0 + +#undef USE_SPLIT_LEFT_SHIFT +#define USE_SPLIT_LEFT_SHIFT 0 + +#undef USE_SPLIT_RIGHT_SHIFT +#define USE_SPLIT_RIGHT_SHIFT 0 + +#undef USE_7U_SPACEBAR +#define USE_7U_SPACEBAR 0 + +#undef USE_ISO_ENTER +#define USE_ISO_ENTER 0 + +// RGB underglow stuff. +#define RGBLIGHT_ANIMATIONS +#define RGB_DI_PIN B0 // The pin your RGB strip is wired to +#define RGBLIGHT_ANIMATIONS // Require for fancier stuff (not compatible with audio) +#define RGBLED_NUM 16 // Number of LEDs +#define RGBLIGHT_HUE_STEP 5 // How much each press of rgb_hue changes hue +#define RGBLIGHT_SAT_STEP 10 // How much each press of rgb_sat changes sat +#define RGBLIGHT_VAL_STEP 10 // How much each press of rgb_val changes val + +#endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/tusing/keymap.c b/keyboards/zeal60/keymaps/tusing/keymap.c new file mode 100644 index 000000000000..e752ad100ea4 --- /dev/null +++ b/keyboards/zeal60/keymaps/tusing/keymap.c @@ -0,0 +1,48 @@ +// Default layout for Zeal60 +#include "zeal60.h" +#include "action_layer.h" + +// For readability. +#define _______ KC_TRNS +#define XXXXXXX KC_NO + +// Zeal60-specific keys: +// EF_INC, EF_DEC, // next/previous backlight effect +// H1_INC, H1_DEC, // Color 1 hue increase/decrease +// S1_INC, S1_DEC, // Color 1 saturation increase/decrease +// H2_INC, H2_DEC, // Color 2 hue increase/decrease +// S2_INC, S2_DEC, // Color 2 saturation increase/decrease +// BR_INC, BR_DEC, // backlight brightness increase/decrease +// FN_MO13, FN_MO23 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +// Default layer: Pressing caps-lock momentarily switches to Layer 1. + [0] = { + {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS}, + {MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, XXXXXXX}, + {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO }, + {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, XXXXXXX, XXXXXXX, XXXXXXX, KC_SPC, XXXXXXX, XXXXXXX, KC_UP, KC_LEFT, KC_RGHT, KC_DOWN} + }, + +// Layer 1: Pressing Ctrl switches to layer 2. + [1] = { + {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, + {KC_VOLD, KC_MUTE, KC_VOLU, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_INS, KC_DEL, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {KC_CAPS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {TO(2), _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PGUP, KC_HOME, KC_END, KC_PGDN} + }, + + +// Layer 2: Zeal60 and backlight configuration. + [2] = { + {RESET, EF_DEC, EF_INC, BR_DEC, BR_INC, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {_______, H1_DEC, H1_INC, S1_DEC, S1_INC, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {RGB_TOG, RGB_HUD, RGB_HUI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {RGB_MOD, RGB_SAD, RGB_SAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {TO(0), RGB_VAD, RGB_VAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} + } + +}; \ No newline at end of file diff --git a/keyboards/zeal60/zeal_color.c b/keyboards/zeal60/zeal_color.c index 0b0212c2f331..9497dd5b2372 100644 --- a/keyboards/zeal60/zeal_color.c +++ b/keyboards/zeal60/zeal_color.c @@ -6,7 +6,7 @@ // Lightness curve using the CIE 1931 lightness formula //Generated by the python script provided in http://jared.geek.nz/2013/feb/linear-led-pwm -const uint8_t DIM_CURVE[] PROGMEM = { +const uint8_t DIM_CURVE_ZEAL[] PROGMEM = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, @@ -50,9 +50,9 @@ RGB hsv_to_rgb( HSV hsv ) return rgb; } - h = hsv.h; - s = hsv.s; - v = hsv.v; + h = hsv.h; + s = hsv.s; + v = hsv.v; region = h / 43; remainder = (h - (region * 43)) * 6; @@ -95,9 +95,9 @@ RGB hsv_to_rgb( HSV hsv ) break; } - rgb.r = pgm_read_byte(&DIM_CURVE[rgb.r]); - rgb.g = pgm_read_byte(&DIM_CURVE[rgb.g]); - rgb.b = pgm_read_byte(&DIM_CURVE[rgb.b]); + rgb.r = pgm_read_byte(&DIM_CURVE_ZEAL[rgb.r]); + rgb.g = pgm_read_byte(&DIM_CURVE_ZEAL[rgb.g]); + rgb.b = pgm_read_byte(&DIM_CURVE_ZEAL[rgb.b]); return rgb; } From 3a5860c4935e6d1a3e6e9635809f228df009615a Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Thu, 29 Dec 2016 17:23:44 +1100 Subject: [PATCH 05/69] Refactor RPC protocol --- keyboards/zeal60/zeal60.c | 38 ++++++++++------- keyboards/zeal60/zeal_backlight.c | 71 +++++++++++++------------------ keyboards/zeal60/zeal_backlight.h | 2 +- keyboards/zeal60/zeal_color.h | 18 +++++++- keyboards/zeal60/zeal_eeprom.h | 19 +++++---- keyboards/zeal60/zeal_rpc.h | 62 ++++++++++++++++++++++++++- 6 files changed, 139 insertions(+), 71 deletions(-) diff --git a/keyboards/zeal60/zeal60.c b/keyboards/zeal60/zeal60.c index cd9d4cc0a1ec..e85fff52ea8b 100644 --- a/keyboards/zeal60/zeal60.c +++ b/keyboards/zeal60/zeal60.c @@ -14,19 +14,23 @@ void raw_hid_receive( uint8_t *data, uint8_t length ) uint8_t command = data[0]; switch ( command ) { + case id_protocol_version: + { + msg_protocol_version *msg = (msg_protocol_version*)&data[1]; + msg->version = PROTOCOL_VERSION; + break; + } #if USE_KEYMAPS_IN_EEPROM case id_keymap_keycode_load: { - uint16_t keycode = keymap_keycode_load(data[1], data[2], data[3]); - data[4] = (uint8_t)(keycode >> 8); - data[5] = (uint8_t)(keycode & 0xFF); + msg_keymap_keycode_load *msg = (msg_keymap_keycode_load*)&data[1]; + msg->keycode = keymap_keycode_load( msg->layer, msg->row, msg->col ); break; } case id_keymap_keycode_save: { - uint16_t keycode = data[4] << 8; - keycode |= data[5]; - keymap_keycode_save(data[1], data[2], data[3], keycode); + msg_keymap_keycode_save *msg = (msg_keymap_keycode_save*)&data[1]; + keymap_keycode_save( msg->layer, msg->row, msg->col, msg->keycode); break; } case id_keymap_default_save: @@ -37,27 +41,29 @@ void raw_hid_receive( uint8_t *data, uint8_t length ) #endif // USE_KEYMAPS_IN_EEPROM case id_backlight_config_set_flags: { - backlight_config_set_flags(data[1]); + msg_backlight_config_set_flags *msg = (msg_backlight_config_set_flags*)&data[1]; + backlight_config_set_flags(msg->flags); backlight_config_save(); backlight_init_drivers(); break; } case id_backlight_config_set_alphas_mods: { - uint16_t alpha_mods[5]; - alpha_mods[0] = data[1] << 8 | data[2]; - alpha_mods[1] = data[3] << 8 | data[4]; - alpha_mods[2] = data[5] << 8 | data[6]; - alpha_mods[3] = data[7] << 8 | data[8]; - alpha_mods[4] = data[9] << 8 | data[10]; - backlight_config_set_alphas_mods( alpha_mods ); + msg_backlight_config_set_alphas_mods *msg = (msg_backlight_config_set_alphas_mods*)&data[1]; + backlight_config_set_alphas_mods( msg->alphas_mods ); backlight_config_save(); break; } case id_backlight_set_key_color: { - HSV hsv = { data[3], data[4], data[5] }; - backlight_set_key_color(data[1], data[2], hsv); + msg_backlight_set_key_color *msg = (msg_backlight_set_key_color*)&data[1]; + backlight_set_key_color(msg->row, msg->col, msg->hsv); + break; + } + default: + { + // Unhandled message. + data[0] = id_unhandled; break; } } diff --git a/keyboards/zeal60/zeal_backlight.c b/keyboards/zeal60/zeal_backlight.c index 630c3b5b2b1a..f980dbbee86a 100644 --- a/keyboards/zeal60/zeal_backlight.c +++ b/keyboards/zeal60/zeal_backlight.c @@ -411,7 +411,7 @@ ISR(TIMER3_COMPA_vect) } } -void backlight_config_set_flags(uint8_t flags) +void backlight_config_set_flags(uint16_t flags) { // TODO: replace with #define bitmasks g_config.use_split_backspace = ( flags&(1<<0) ? true : false ); @@ -423,62 +423,53 @@ void backlight_config_set_flags(uint8_t flags) void backlight_config_set_alphas_mods( uint16_t *alphas_mods ) { - g_config.alphas_mods[0] = alphas_mods[0]; - g_config.alphas_mods[1] = alphas_mods[1]; - g_config.alphas_mods[2] = alphas_mods[2]; - g_config.alphas_mods[3] = alphas_mods[3]; - g_config.alphas_mods[4] = alphas_mods[4]; + for ( int i=0; i<5; i++ ) + { + g_config.alphas_mods[i] = alphas_mods[i]; + } } void backlight_config_load(void) { void *addr = EEPROM_BACKLIGHT_CONFIG_ADDR; - uint8_t flags = eeprom_read_byte(addr++); + uint16_t flags = eeprom_read_word(addr); + addr += 2; backlight_config_set_flags(flags); - g_config.alphas_mods[0] = eeprom_read_byte( addr++ ) << 8; - g_config.alphas_mods[0] |= eeprom_read_byte( addr++ ); - g_config.alphas_mods[1] = eeprom_read_byte( addr++ ) << 8; - g_config.alphas_mods[1] |= eeprom_read_byte( addr++ ); - g_config.alphas_mods[2] = eeprom_read_byte( addr++ ) << 8; - g_config.alphas_mods[2] |= eeprom_read_byte( addr++ ); - g_config.alphas_mods[3] = eeprom_read_byte( addr++ ) << 8; - g_config.alphas_mods[3] |= eeprom_read_byte( addr++ ); - g_config.alphas_mods[4] = eeprom_read_byte( addr++ ) << 8; - g_config.alphas_mods[4] |= eeprom_read_byte( addr++ ); - - g_config.brightness = eeprom_read_byte( EEPROM_BACKLIGHT_CONFIG_ADDR+11 ); - g_config.effect = eeprom_read_byte( EEPROM_BACKLIGHT_CONFIG_ADDR+12 ); - g_config.color_1.h = eeprom_read_byte( EEPROM_BACKLIGHT_CONFIG_ADDR+13 ); - g_config.color_1.s = eeprom_read_byte( EEPROM_BACKLIGHT_CONFIG_ADDR+14 ); - g_config.color_1.v = eeprom_read_byte( EEPROM_BACKLIGHT_CONFIG_ADDR+15 ); - g_config.color_2.h = eeprom_read_byte( EEPROM_BACKLIGHT_CONFIG_ADDR+16 ); - g_config.color_2.s = eeprom_read_byte( EEPROM_BACKLIGHT_CONFIG_ADDR+17 ); - g_config.color_2.v = eeprom_read_byte( EEPROM_BACKLIGHT_CONFIG_ADDR+18 ); + for ( int i=0; i<5; i++ ) + { + g_config.alphas_mods[i] = eeprom_read_word(addr); + addr += 2; + } + + g_config.brightness = eeprom_read_byte( addr++ ); + g_config.effect = eeprom_read_byte( addr++ ); + g_config.color_1.h = eeprom_read_byte( addr++ ); + g_config.color_1.s = eeprom_read_byte( addr++ ); + g_config.color_1.v = eeprom_read_byte( addr++ ); + g_config.color_2.h = eeprom_read_byte( addr++ ); + g_config.color_2.s = eeprom_read_byte( addr++ ); + g_config.color_2.v = eeprom_read_byte( addr++ ); } void backlight_config_save(void) { // TODO: replace with #define bitmasks - uint8_t flags = ( g_config.use_split_backspace ? (1<<0) : 0 ) | + uint16_t flags = ( g_config.use_split_backspace ? (1<<0) : 0 ) | ( g_config.use_split_left_shift ? (1<<1) : 0 ) | ( g_config.use_split_right_shift ? (1<<2) : 0 ) | ( g_config.use_7u_spacebar ? (1<<3) : 0 ) | ( g_config.use_iso_enter ? (1<<4) : 0 ); void *addr = EEPROM_BACKLIGHT_CONFIG_ADDR; - eeprom_update_byte( addr++, flags ); - - eeprom_update_byte( addr++, (uint8_t)(g_config.alphas_mods[0] >> 8) ); - eeprom_update_byte( addr++, (uint8_t)(g_config.alphas_mods[0] & 0xFF) ); - eeprom_update_byte( addr++, (uint8_t)(g_config.alphas_mods[1] >> 8) ); - eeprom_update_byte( addr++, (uint8_t)(g_config.alphas_mods[1] & 0xFF) ); - eeprom_update_byte( addr++, (uint8_t)(g_config.alphas_mods[2] >> 8) ); - eeprom_update_byte( addr++, (uint8_t)(g_config.alphas_mods[2] & 0xFF) ); - eeprom_update_byte( addr++, (uint8_t)(g_config.alphas_mods[3] >> 8) ); - eeprom_update_byte( addr++, (uint8_t)(g_config.alphas_mods[3] & 0xFF) ); - eeprom_update_byte( addr++, (uint8_t)(g_config.alphas_mods[4] >> 8) ); - eeprom_update_byte( addr++, (uint8_t)(g_config.alphas_mods[4] & 0xFF) ); + eeprom_update_word( addr, flags ); + addr += 2; + + for ( int i=0; i<5; i++ ) + { + eeprom_update_word( addr, g_config.alphas_mods[i] ); + addr += 2; + } eeprom_update_byte( addr++, g_config.brightness ); eeprom_update_byte( addr++, g_config.effect ); @@ -488,8 +479,6 @@ void backlight_config_save(void) eeprom_update_byte( addr++, g_config.color_2.h ); eeprom_update_byte( addr++, g_config.color_2.s ); eeprom_update_byte( addr++, g_config.color_2.v ); - - } void backlight_init_drivers(void) diff --git a/keyboards/zeal60/zeal_backlight.h b/keyboards/zeal60/zeal_backlight.h index 40775ef8a41e..1d4821fe8c98 100644 --- a/keyboards/zeal60/zeal_backlight.h +++ b/keyboards/zeal60/zeal_backlight.h @@ -21,7 +21,7 @@ typedef struct zeal_backlight_config HSV color_2; } zeal_backlight_config; -void backlight_config_set_flags(uint8_t value); +void backlight_config_set_flags(uint16_t value); void backlight_config_set_alphas_mods( uint16_t *value ); void backlight_config_load(void); void backlight_config_save(void); diff --git a/keyboards/zeal60/zeal_color.h b/keyboards/zeal60/zeal_color.h index 7452f86976bb..bebec99e3620 100644 --- a/keyboards/zeal60/zeal_color.h +++ b/keyboards/zeal60/zeal_color.h @@ -4,20 +4,34 @@ #include #include -typedef struct RGB +#if defined(__GNUC__) +#define PACKED __attribute__ ((__packed__)) +#else +#define PACKED +#endif + +#if defined(_MSC_VER) +#pragma pack( push, 1 ) +#endif + +typedef struct PACKED { uint8_t r; uint8_t g; uint8_t b; } RGB; -typedef struct HSV +typedef struct PACKED { uint8_t h; uint8_t s; uint8_t v; } HSV; +#if defined(_MSC_VER) +#pragma pack( pop ) +#endif + RGB hsv_to_rgb( HSV hsv ); #endif // ZEAL_COLOR_H diff --git a/keyboards/zeal60/zeal_eeprom.h b/keyboards/zeal60/zeal_eeprom.h index 629495413d8d..566c8fc27d3a 100644 --- a/keyboards/zeal60/zeal_eeprom.h +++ b/keyboards/zeal60/zeal_eeprom.h @@ -6,30 +6,31 @@ #include "tmk_core/common/eeprom.h" #define EEPROM_MAGIC 0x451F -#define EEPROM_MAGIC_ADDR ((void*)16) +#define EEPROM_MAGIC_ADDR ((void*)32) // Bump this every time we change what we store // This will automatically reset the EEPROM with defaults // and avoid loading invalid data from the EEPROM #define EEPROM_VERSION 0x00 -#define EEPROM_VERSION_ADDR ((void*)18) +#define EEPROM_VERSION_ADDR ((void*)34) -#define EEPROM_BACKLIGHT_CONFIG_ADDR ((void*)19) +#define EEPROM_BACKLIGHT_CONFIG_ADDR ((void*)35) -// zeal_backlight_config uses 19 bytes -#define EEPROM_BACKLIGHT_KEY_COLOR_ADDR ((void*)38) +// zeal_backlight_config uses 20 bytes +// 35+20=55 +#define EEPROM_BACKLIGHT_KEY_COLOR_ADDR ((void*)55) // key colors use 72*3=216 -// 38+216=254 +// 55+216=271 -#define EEPROM_KEYMAP_ADDR ((void*)254) +#define EEPROM_KEYMAP_ADDR ((void*)271) #define EEPROM_KEYMAP_MAX 4 // Each keymap is MATRIX_ROWS*MATRIX_COLS*2 bytes // For Zeal60 this is 5*14*2=140 bytes // 4 keymaps = 560 bytes -// 254 + 560 = 814 -// 814 < 1024 :-) +// 271 + 560 = 831 +// 831 < 1024 :-) bool eeprom_is_valid(void); void eeprom_set_valid(bool valid); diff --git a/keyboards/zeal60/zeal_rpc.h b/keyboards/zeal60/zeal_rpc.h index a71b16d7a900..a80971bc82c0 100644 --- a/keyboards/zeal60/zeal_rpc.h +++ b/keyboards/zeal60/zeal_rpc.h @@ -1,15 +1,73 @@ #ifndef ZEAL_RPC_H #define ZEAL_RPC_H +#include "zeal_color.h" + +#define PROTOCOL_VERSION 0x0001 + enum { - id_keymap_keycode_load = 0x42, + id_protocol_version = 0x01, // always 0x01 + id_keymap_keycode_load, id_keymap_keycode_save, id_keymap_default_save, id_backlight_config_set_flags, id_backlight_config_set_alphas_mods, - id_backlight_set_key_color + id_backlight_set_key_color, + id_unhandled = 0xFF, }; +#if defined(__GNUC__) +#define PACKED __attribute__ ((__packed__)) +#else +#define PACKED +#endif + +#if defined(_MSC_VER) +#pragma pack( push, 1 ) +#endif + +typedef struct PACKED +{ + uint16_t version; +} msg_protocol_version; + +typedef struct PACKED +{ + uint8_t layer; + uint8_t row; + uint8_t col; + uint16_t keycode; +} msg_keymap_keycode_load; + +typedef struct PACKED +{ + uint8_t layer; + uint8_t row; + uint8_t col; + uint16_t keycode; +} msg_keymap_keycode_save; + +typedef struct PACKED +{ + uint16_t flags; +} msg_backlight_config_set_flags; + +typedef struct PACKED +{ + uint16_t alphas_mods[5]; +} msg_backlight_config_set_alphas_mods; + +typedef struct PACKED +{ + uint8_t row; + uint8_t col; + HSV hsv; +} msg_backlight_set_key_color; + +#if defined(_MSC_VER) +#pragma pack( pop ) +#endif + #endif // ZEAL_RPC_H From d662a3006a780799e1e097bef2f6b04c63f57bfc Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Thu, 29 Dec 2016 18:10:11 +1100 Subject: [PATCH 06/69] Fix last merge --- quantum/quantum_keycodes.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index 5cd3c8e78058..d39b85012276 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h @@ -11,7 +11,11 @@ enum quantum_keycodes { QK_LSFT = 0x0200, QK_LALT = 0x0400, QK_LGUI = 0x0800, +<<<<<<< HEAD QK_RMODS_MIN = 0x1000, +======= + QK_RMODS_MIN = 0x1000, +>>>>>>> 79ae4c65895962d534145566ab034359dbe286e6 QK_RCTL = 0x1100, QK_RSFT = 0x1200, QK_RALT = 0x1400, From 7f75c6c801e7620b62a514b24d76cdbcc9f5098b Mon Sep 17 00:00:00 2001 From: Tushar Singal Date: Thu, 29 Dec 2016 11:42:58 -0500 Subject: [PATCH 07/69] README for RGB underglow updated. --- keyboards/zeal60/keymaps/tusing/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/keyboards/zeal60/keymaps/tusing/README.md b/keyboards/zeal60/keymaps/tusing/README.md index 1a71cfaea5d0..027dea427b1a 100644 --- a/keyboards/zeal60/keymaps/tusing/README.md +++ b/keyboards/zeal60/keymaps/tusing/README.md @@ -1,6 +1,6 @@ # RGB Underglow Strip on the Zeal60: A Guide -***WARNING:*** I don't know if any of this is anywhere near correct. If you follow this, your keyboard will probably explode. Right now, I would appreciate if people could find and point out any mistakes in this guide. +***WARNING:*** This guide is untested and likely has errors. ***NOTE:*** As explained in Part C, due to current limits, **underglow will only work on USB 3.0 or above**. If you want to use your keyboard on USB 2.0, make sure either underglow or backlighting is off when you plug in your Zeal60 - or that you have fiddled with the brightness of both to take the board's total consumption under 500mA. @@ -58,13 +58,13 @@ If we take a look at [```rgblight.c```](https://github.com/Wilba6582/qmk_firmwar ```c // The folliwng three variables should probably be put in config.h. #define RGBSTRIP_MAX_CURRENT_PER_LIGHT 60 // mA per light when at max brightness. -#define RGBSTRIP_RGBW 0 // 1 if you have an RGBW strip. +#define RGBW 0 // 1 if you have an RGBW strip. #define RGBSTRIP_CURRENT_LIMIT 400 // Strip current limit in mA. void adjust_current(void) { /** Dims RGB(W) strip if it exceeds defined current limit. */ // Convert 1 milliamp to an R+G+B+W brightness value. - float rgbw_per_milliamp = 255 * (3 + RGBSTRIP_RGBW) / + float rgbw_per_milliamp = 255 * (3 + RGBW) / (float)RGBSTRIP_MAX_CURRENT_PER_LIGHT; // Convert strip current limit to brightness limit. float strip_rgbw_limit = RGBSTRIP_CURRENT_LIMIT * rgbw_per_milliamp; @@ -73,7 +73,7 @@ void adjust_current(void) { uint8_t strip_rgbw_total = 0; for (uint8_t i = 0; i < RGBLED_NUM; i++) { strip_rgbw_total += led[i].r + led[i].g + led[i].b; - if (RGBSTRIP_RGBW) { + if (RGBW) { strip_rgbw_total += led[i].w; } } @@ -85,7 +85,7 @@ void adjust_current(void) { led[i].r = (uint8_t)(led[i].r * multiplier); led[i].g = (uint8_t)(led[i].g * multiplier); led[i].b = (uint8_t)(led[i].b * multiplier); - if (RGBSTRIP_RGBW) { + if (RGBW) { led[i].w = (uint8_t)(led[i].w * multiplier); } } From 1bcaca0aa963784ae2adaf6961b18a7f9742b2c8 Mon Sep 17 00:00:00 2001 From: Tushar Singal Date: Thu, 29 Dec 2016 12:28:52 -0500 Subject: [PATCH 08/69] Additional README changes. --- keyboards/zeal60/keymaps/tusing/README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/keyboards/zeal60/keymaps/tusing/README.md b/keyboards/zeal60/keymaps/tusing/README.md index 027dea427b1a..6d651eb8b282 100644 --- a/keyboards/zeal60/keymaps/tusing/README.md +++ b/keyboards/zeal60/keymaps/tusing/README.md @@ -22,14 +22,14 @@ You might find the [**full PCB image**](https://cdn.shopify.com/s/files/1/0490/7 ```Makefile RGBLIGHT_ENABLE = yes - AUDIO_ENABLE = no # Underglow cannot be used with audio. + AUDIO_ENABLE = no #Underglow animations cannot be used with audio. ``` 2. Add the following to your [```config.h```](https://github.com/Wilba6582/qmk_firmware/blob/zeal60/keyboards/zeal60/keymaps/default/config.h): ```c - #define RGBLIGHT_ANIMATIONS + #define RGBLIGHT_ANIMATIONS // Underglow animations. + #define RGBW 0 // 1 if you have an RGBW strip. #define RGB_DI_PIN B0 // The pin your RGB strip is wired to - #define RGBLIGHT_ANIMATIONS // Require for fancier stuff (not compatible with audio) #define RGBLED_NUM 16 // Number of LEDs #define RGBLIGHT_HUE_STEP 5 // How much each press of rgb_hue changes hue #define RGBLIGHT_SAT_STEP 10 // How much each press of rgb_sat changes sat @@ -58,7 +58,6 @@ If we take a look at [```rgblight.c```](https://github.com/Wilba6582/qmk_firmwar ```c // The folliwng three variables should probably be put in config.h. #define RGBSTRIP_MAX_CURRENT_PER_LIGHT 60 // mA per light when at max brightness. -#define RGBW 0 // 1 if you have an RGBW strip. #define RGBSTRIP_CURRENT_LIMIT 400 // Strip current limit in mA. void adjust_current(void) { From a45d11b7ff84f53b2f66e15f9f4bd34c426ca810 Mon Sep 17 00:00:00 2001 From: Tushar Singal Date: Thu, 29 Dec 2016 12:44:03 -0500 Subject: [PATCH 09/69] Adding RGBW strip software-based current-limiting functionality. --- keyboards/zeal60/keymaps/tusing/config.h | 20 +++----------- quantum/rgblight.c | 34 ++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/keyboards/zeal60/keymaps/tusing/config.h b/keyboards/zeal60/keymaps/tusing/config.h index d17a7b43cff0..6975959e1e4b 100644 --- a/keyboards/zeal60/keymaps/tusing/config.h +++ b/keyboards/zeal60/keymaps/tusing/config.h @@ -3,22 +3,6 @@ #include "../../config.h" -/* enable/disable LEDs based on layout */ -#undef USE_SPLIT_BACKSPACE -#define USE_SPLIT_BACKSPACE 0 - -#undef USE_SPLIT_LEFT_SHIFT -#define USE_SPLIT_LEFT_SHIFT 0 - -#undef USE_SPLIT_RIGHT_SHIFT -#define USE_SPLIT_RIGHT_SHIFT 0 - -#undef USE_7U_SPACEBAR -#define USE_7U_SPACEBAR 0 - -#undef USE_ISO_ENTER -#define USE_ISO_ENTER 0 - // RGB underglow stuff. #define RGBLIGHT_ANIMATIONS #define RGB_DI_PIN B0 // The pin your RGB strip is wired to @@ -28,4 +12,8 @@ #define RGBLIGHT_SAT_STEP 10 // How much each press of rgb_sat changes sat #define RGBLIGHT_VAL_STEP 10 // How much each press of rgb_val changes val +// Current limiting. +#define RGBSTRIP_CURRENT_LIMIT 400 // Strip current limit in mA. +#define RGBSTRIP_MAX_CURRENT_PER_LIGHT 60 // mA per light when at max brightness. + #endif //CONFIG_USER_H diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 6e335a4831e0..9b6469e3fba3 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -370,7 +370,41 @@ void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) { rgblight_set(); } +void adjust_current(void) { + /** Dims RGB(W) strip if it exceeds defined current limit. */ + // Convert 1 milliamp to an R+G+B+W brightness value. + float rgbw_per_milliamp = 255 * (3 + RGBW) / + (float)RGBSTRIP_MAX_CURRENT_PER_LIGHT; + // Convert strip current limit to brightness limit. + float strip_rgbw_limit = RGBSTRIP_CURRENT_LIMIT * rgbw_per_milliamp; + + // Calculate how much brightness the strip currently uses. + uint8_t strip_rgbw_total = 0; + for (uint8_t i = 0; i < RGBLED_NUM; i++) { + strip_rgbw_total += led[i].r + led[i].g + led[i].b; + if (RGBW) { + strip_rgbw_total += led[i].w; + } + } + + // If we use more brightness than allowed, dim LEDs. + if (strip_rgbw_total > strip_rgbw_limit) { + float multiplier = strip_rgbw_limit / strip_rgbw_total; + for (uint8_t i = 0; i < RGBLED_NUM; i++) { + led[i].r = (uint8_t)(led[i].r * multiplier); + led[i].g = (uint8_t)(led[i].g * multiplier); + led[i].b = (uint8_t)(led[i].b * multiplier); + if (RGBW) { + led[i].w = (uint8_t)(led[i].w * multiplier); + } + } + } +} + void rgblight_set(void) { +#ifdef RGBSTRIP_CURRENT_LIMIT + adjust_current(); +#endif if (rgblight_config.enable) { #ifdef RGBW ws2812_setleds_rgbw(led, RGBLED_NUM); From 7b8d36611335a8462cf3d7ecab25101cb2d988af Mon Sep 17 00:00:00 2001 From: Tushar Singal Date: Thu, 29 Dec 2016 12:50:39 -0500 Subject: [PATCH 10/69] RGBW current-limiting functionality should be handled by RGBSTRIP_MAX_CURRENT_PER_LIGHT instead. --- quantum/rgblight.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 9b6469e3fba3..2ba0a4990ae6 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -371,9 +371,9 @@ void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) { } void adjust_current(void) { - /** Dims RGB(W) strip if it exceeds defined current limit. */ + /** Dims RGB strip if it exceeds defined current limit. */ // Convert 1 milliamp to an R+G+B+W brightness value. - float rgbw_per_milliamp = 255 * (3 + RGBW) / + float rgbw_per_milliamp = (255 * 3) / (float)RGBSTRIP_MAX_CURRENT_PER_LIGHT; // Convert strip current limit to brightness limit. float strip_rgbw_limit = RGBSTRIP_CURRENT_LIMIT * rgbw_per_milliamp; @@ -382,9 +382,6 @@ void adjust_current(void) { uint8_t strip_rgbw_total = 0; for (uint8_t i = 0; i < RGBLED_NUM; i++) { strip_rgbw_total += led[i].r + led[i].g + led[i].b; - if (RGBW) { - strip_rgbw_total += led[i].w; - } } // If we use more brightness than allowed, dim LEDs. @@ -394,9 +391,6 @@ void adjust_current(void) { led[i].r = (uint8_t)(led[i].r * multiplier); led[i].g = (uint8_t)(led[i].g * multiplier); led[i].b = (uint8_t)(led[i].b * multiplier); - if (RGBW) { - led[i].w = (uint8_t)(led[i].w * multiplier); - } } } } From 5bb0b4830e40a6703c0067ed1f333dcb7fa7e16b Mon Sep 17 00:00:00 2001 From: Tushar Singal Date: Thu, 29 Dec 2016 13:00:02 -0500 Subject: [PATCH 11/69] Updated README to reflect implementation of built-in current limiting. --- keyboards/zeal60/keymaps/tusing/README.md | 60 ++++------------------- keyboards/zeal60/keymaps/tusing/config.h | 1 + quantum/rgblight.c | 4 +- 3 files changed, 13 insertions(+), 52 deletions(-) diff --git a/keyboards/zeal60/keymaps/tusing/README.md b/keyboards/zeal60/keymaps/tusing/README.md index 6d651eb8b282..b5d21c0a97d8 100644 --- a/keyboards/zeal60/keymaps/tusing/README.md +++ b/keyboards/zeal60/keymaps/tusing/README.md @@ -51,58 +51,18 @@ Here are some possible configurations with 16 RGB neopixels (6 on top and bottom | 50% / 250mA | 66% / 40mA | 890mA (USB 3.0) | | 100% / 500mA | 100% / 60mA | 1460mA (USB 3.1) -I'll take the second option. Since we have 900-500=400mA left to work with, we need to implement a software solution to limit the strip's brightness. - -If we take a look at [```rgblight.c```](https://github.com/Wilba6582/qmk_firmware/blob/zeal60/quantum/rgblight.c), we'll notice that all lighting actuation trickles down to [```rgblight_set```](https://github.com/Wilba6582/qmk_firmware/blob/zeal60/quantum/rgblight.c#L373). I wrote the following **untested** snippet to limit strip current to 400mA. - -```c -// The folliwng three variables should probably be put in config.h. -#define RGBSTRIP_MAX_CURRENT_PER_LIGHT 60 // mA per light when at max brightness. -#define RGBSTRIP_CURRENT_LIMIT 400 // Strip current limit in mA. - -void adjust_current(void) { - /** Dims RGB(W) strip if it exceeds defined current limit. */ - // Convert 1 milliamp to an R+G+B+W brightness value. - float rgbw_per_milliamp = 255 * (3 + RGBW) / - (float)RGBSTRIP_MAX_CURRENT_PER_LIGHT; - // Convert strip current limit to brightness limit. - float strip_rgbw_limit = RGBSTRIP_CURRENT_LIMIT * rgbw_per_milliamp; - - // Calculate how much brightness the strip currently uses. - uint8_t strip_rgbw_total = 0; - for (uint8_t i = 0; i < RGBLED_NUM; i++) { - strip_rgbw_total += led[i].r + led[i].g + led[i].b; - if (RGBW) { - strip_rgbw_total += led[i].w; - } - } - - // If we use more brightness than allowed, dim LEDs. - if (strip_rgbw_total > strip_rgbw_limit) { - float multiplier = strip_rgbw_limit / strip_rgbw_total; - for (uint8_t i = 0; i < RGBLED_NUM; i++) { - led[i].r = (uint8_t)(led[i].r * multiplier); - led[i].g = (uint8_t)(led[i].g * multiplier); - led[i].b = (uint8_t)(led[i].b * multiplier); - if (RGBW) { - led[i].w = (uint8_t)(led[i].w * multiplier); - } - } - } -} - -void rgblight_set(void) { - adjust_current(); - // ... rest of function ... -} -``` -1. Insert this snippet into your [```rgblight.c```](https://github.com/Wilba6582/qmk_firmware/blob/zeal60/quantum/rgblight.c) (and remember to adjust [```rgblight_set```](https://github.com/Wilba6582/qmk_firmware/blob/zeal60/quantum/rgblight.c#L373) as described in the the snippet). **Or** find another way to never let your lights exceed 40%. -2. Change the max power draw limit to 900mA by adding ```#define USB_MAX_POWER_CONSUMPTION 900``` to [```config.h```](https://github.com/Wilba6582/qmk_firmware/blob/zeal60/keyboards/zeal60/keymaps/default/config.h). -3. **If you've connected +5V and GND to J1A**, either short or replace the thermistor labeled F1 under the USB port with one that supports your current needs. [Here's a selection](https://goo.gl/748avG) of 900mA-1.5A current hold fuses - look for an SMD 0805-sized fuse. **Otherwise, if you've connected directly to the USB pins**, you don't need to do anything other than limit brightness in software. -4. Enable all LEDs and test it out! - +I'll take the second option. +1. Add the following to your keymap's [```config.h```](https://github.com/Wilba6582/qmk_firmware/blob/zeal60/keyboards/zeal60/keymaps/default/config.h). Change variable definitions based on your needs. + ```c + // Current limiting. + #define USB_MAX_POWER_CONSUMPTION 900 // Limit device max power consumption. + #define RGBSTRIP_CURRENT_LIMIT 400 // Strip current limit in mA. + #define RGBSTRIP_MAX_CURRENT_PER_LIGHT 60 // mA per light when at max brightness. + ``` +3. **If you've connected +5V and GND to J1A**, either short or replace the thermistor labeled F1 under the USB port with one that supports your current needs. [Here's a selection](https://goo.gl/748avG) of 900mA-1.5A current hold fuses - look for an SMD 0805-sized fuse. **Otherwise, if you've connected directly to the USB +5V/GND pins**, you don't need to do anything other than limit brightness in software. +4. Enable all LEDs and test it out! ## D. Additional resources ### A. Connecting the strip. diff --git a/keyboards/zeal60/keymaps/tusing/config.h b/keyboards/zeal60/keymaps/tusing/config.h index 6975959e1e4b..4532550b37db 100644 --- a/keyboards/zeal60/keymaps/tusing/config.h +++ b/keyboards/zeal60/keymaps/tusing/config.h @@ -13,6 +13,7 @@ #define RGBLIGHT_VAL_STEP 10 // How much each press of rgb_val changes val // Current limiting. +#define USB_MAX_POWER_CONSUMPTION 900 #define RGBSTRIP_CURRENT_LIMIT 400 // Strip current limit in mA. #define RGBSTRIP_MAX_CURRENT_PER_LIGHT 60 // mA per light when at max brightness. diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 2ba0a4990ae6..57160fcaecc9 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -372,10 +372,10 @@ void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) { void adjust_current(void) { /** Dims RGB strip if it exceeds defined current limit. */ - // Convert 1 milliamp to an R+G+B+W brightness value. + // Convert 1 milliamp to an R+G+B brightness value. float rgbw_per_milliamp = (255 * 3) / (float)RGBSTRIP_MAX_CURRENT_PER_LIGHT; - // Convert strip current limit to brightness limit. + // Convert strip current limit to a total brightness limit. float strip_rgbw_limit = RGBSTRIP_CURRENT_LIMIT * rgbw_per_milliamp; // Calculate how much brightness the strip currently uses. From eb02a3b05104ce89977f64c960cc16af38ea74dc Mon Sep 17 00:00:00 2001 From: Tushar Singal Date: Thu, 29 Dec 2016 18:44:00 -0500 Subject: [PATCH 12/69] Keymap readability improvements. --- keyboards/zeal60/keymaps/tusing/keymap.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/keyboards/zeal60/keymaps/tusing/keymap.c b/keyboards/zeal60/keymaps/tusing/keymap.c index e752ad100ea4..6ae96107faa2 100644 --- a/keyboards/zeal60/keymaps/tusing/keymap.c +++ b/keyboards/zeal60/keymaps/tusing/keymap.c @@ -4,7 +4,7 @@ // For readability. #define _______ KC_TRNS -#define XXXXXXX KC_NO +#define _x_ KC_NO // Zeal60-specific keys: // EF_INC, EF_DEC, // next/previous backlight effect @@ -21,28 +21,28 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = { {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS}, - {MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, XXXXXXX}, - {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO }, - {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, XXXXXXX, XXXXXXX, XXXXXXX, KC_SPC, XXXXXXX, XXXXXXX, KC_UP, KC_LEFT, KC_RGHT, KC_DOWN} + {MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, _x_ }, + {KC_LSFT, _x_ , KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, _x_ }, + {KC_LCTL, KC_LGUI, KC_LALT, _x_ , _x_ , _x_ , _x_ , KC_SPC, _x_ , _x_ , KC_UP, KC_LEFT, KC_RGHT, KC_DOWN} }, // Layer 1: Pressing Ctrl switches to layer 2. [1] = { {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, {KC_VOLD, KC_MUTE, KC_VOLU, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_INS, KC_DEL, _______}, - {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, - {KC_CAPS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, - {TO(2), _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PGUP, KC_HOME, KC_END, KC_PGDN} + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _x_ }, + {KC_CAPS, _x_ , _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _x_ }, + {TO(2), _______, _______, _x_ , _x_ , _x_ , _x_ , _______, _x_ , _x_ , KC_PGUP, KC_HOME, KC_END, KC_PGDN} }, -// Layer 2: Zeal60 and backlight configuration. +// Layer 2: Zeal60 and backlight configuration. First two rows control Zeal60; next two control RGB underglow. [2] = { {RESET, EF_DEC, EF_INC, BR_DEC, BR_INC, _______, _______, _______, _______, _______, _______, _______, _______, _______}, {_______, H1_DEC, H1_INC, S1_DEC, S1_INC, _______, _______, _______, _______, _______, _______, _______, _______, _______}, - {RGB_TOG, RGB_HUD, RGB_HUI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, - {RGB_MOD, RGB_SAD, RGB_SAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, - {TO(0), RGB_VAD, RGB_VAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} + {RGB_TOG, H2_DEC, H2_INC, S2_DEC, S2_INC, _______, _______, _______, _______, _______, _______, _______, _______, _x_ }, + {RGB_MOD, _x_ , RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, _______, _______, _______, _______, _______, _______, _______, _x_ }, + {TO(0), RGB_VAD, RGB_VAI, _x_ , _x_ , _x_ , _x_ , _______, _x_ , _x_ , _______, _______, _______, _______} } }; \ No newline at end of file From e27a6a8d1c069348165ec11f4a8c52f013732852 Mon Sep 17 00:00:00 2001 From: Tushar Singal Date: Thu, 29 Dec 2016 18:47:50 -0500 Subject: [PATCH 13/69] Minor keymap improvements. --- keyboards/zeal60/keymaps/tusing/keymap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/keyboards/zeal60/keymaps/tusing/keymap.c b/keyboards/zeal60/keymaps/tusing/keymap.c index 6ae96107faa2..1d42959b22ce 100644 --- a/keyboards/zeal60/keymaps/tusing/keymap.c +++ b/keyboards/zeal60/keymaps/tusing/keymap.c @@ -23,7 +23,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS}, {MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, _x_ }, {KC_LSFT, _x_ , KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, _x_ }, - {KC_LCTL, KC_LGUI, KC_LALT, _x_ , _x_ , _x_ , _x_ , KC_SPC, _x_ , _x_ , KC_UP, KC_LEFT, KC_RGHT, KC_DOWN} + {KC_LCTL, KC_LGUI, KC_LALT, _x_ , _x_ , _x_ , _x_ , KC_SPC, _x_ , _x_ , KC_UP, KC_DOWN, KC_LEFT, KC_RGHT} }, // Layer 1: Pressing Ctrl switches to layer 2. @@ -32,11 +32,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { {KC_VOLD, KC_MUTE, KC_VOLU, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_INS, KC_DEL, _______}, {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _x_ }, {KC_CAPS, _x_ , _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _x_ }, - {TO(2), _______, _______, _x_ , _x_ , _x_ , _x_ , _______, _x_ , _x_ , KC_PGUP, KC_HOME, KC_END, KC_PGDN} + {TO(2), _______, _______, _x_ , _x_ , _x_ , _x_ , _______, _x_ , _x_ , KC_PGUP, KC_PGDN, KC_HOME, KC_END} }, -// Layer 2: Zeal60 and backlight configuration. First two rows control Zeal60; next two control RGB underglow. +// Layer 2: Zeal60 and backlight configuration. [2] = { {RESET, EF_DEC, EF_INC, BR_DEC, BR_INC, _______, _______, _______, _______, _______, _______, _______, _______, _______}, {_______, H1_DEC, H1_INC, S1_DEC, S1_INC, _______, _______, _______, _______, _______, _______, _______, _______, _______}, From a4bc8dcdb89971d40ecdd05e4c202ae61656de11 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Tue, 3 Jan 2017 23:45:34 +1100 Subject: [PATCH 14/69] Fixed LED driver init sequence, formatting --- keyboards/zeal60/IS31FL3731_driver.c | 166 +++++++++++++++------------ keyboards/zeal60/config.h | 4 + keyboards/zeal60/zeal_backlight.c | 8 -- 3 files changed, 95 insertions(+), 83 deletions(-) diff --git a/keyboards/zeal60/IS31FL3731_driver.c b/keyboards/zeal60/IS31FL3731_driver.c index d89b791ab54e..d610a501a792 100644 --- a/keyboards/zeal60/IS31FL3731_driver.c +++ b/keyboards/zeal60/IS31FL3731_driver.c @@ -1,4 +1,3 @@ - #include "IS31FL3731_driver.h" #include #include @@ -62,93 +61,110 @@ const uint8_t g_blue_registers[36] PROGMEM = { void IS31FL3731_write_register( uint8_t addr, uint8_t reg, uint8_t data ) { - g_twi_transfer_buffer[0] = (addr<<1) | 0x00; - g_twi_transfer_buffer[1] = reg; - g_twi_transfer_buffer[2] = data; + g_twi_transfer_buffer[0] = (addr << 1) | 0x00; + g_twi_transfer_buffer[1] = reg; + g_twi_transfer_buffer[2] = data; - // Set the error code to have no relevant information + // Set the error code to have no relevant information TWIInfo.errorCode = TWI_NO_RELEVANT_INFO; // Continuously attempt to transmit data until a successful transmission occurs - while (TWIInfo.errorCode != 0xFF) + while ( TWIInfo.errorCode != 0xFF ) { - TWITransmitData(g_twi_transfer_buffer, 3, 0); + TWITransmitData( g_twi_transfer_buffer, 3, 0 ); } } void IS31FL3731_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer ) { - // transmit PWM registers in 9 transfers of 16 bytes - // g_twi_transfer_buffer[] is 20 bytes - - // set the I2C address - g_twi_transfer_buffer[0] = (addr<<1) | 0x00; - - // iterate over the pwm_buffer contents at 16 byte intervals - for ( int i=0; i<144; i+=16 ) - { - // set the first register, e.g. 0x24, 0x34, 0x44, etc. - g_twi_transfer_buffer[1] = 0x24+i; - // copy the data from i to i+15 - // device will auto-increment register for data after the first byte - // thus this sets registers 0x24-0x33, 0x34-0x43, etc. in one transfer - for ( int j=0; j<16; j++ ) - { - g_twi_transfer_buffer[2+j] = pwm_buffer[i+j]; - } - - // Set the error code to have no relevant information - TWIInfo.errorCode = TWI_NO_RELEVANT_INFO; - // Continuously attempt to transmit data until a successful transmission occurs - while (TWIInfo.errorCode != 0xFF) - { - TWITransmitData(g_twi_transfer_buffer, 16+2, 0); - } - } + // assumes bank is already selected + + // transmit PWM registers in 9 transfers of 16 bytes + // g_twi_transfer_buffer[] is 20 bytes + + // set the I2C address + g_twi_transfer_buffer[0] = (addr << 1) | 0x00; + + // iterate over the pwm_buffer contents at 16 byte intervals + for ( int i = 0; i < 144; i += 16 ) + { + // set the first register, e.g. 0x24, 0x34, 0x44, etc. + g_twi_transfer_buffer[1] = 0x24 + i; + // copy the data from i to i+15 + // device will auto-increment register for data after the first byte + // thus this sets registers 0x24-0x33, 0x34-0x43, etc. in one transfer + for ( int j = 0; j < 16; j++ ) + { + g_twi_transfer_buffer[2 + j] = pwm_buffer[i + j]; + } + + // Set the error code to have no relevant information + TWIInfo.errorCode = TWI_NO_RELEVANT_INFO; + // Continuously attempt to transmit data until a successful transmission occurs + while ( TWIInfo.errorCode != 0xFF ) + { + TWITransmitData( g_twi_transfer_buffer, 16 + 2, 0 ); + } + } } void IS31FL3731_init( uint8_t addr ) { - // select "function register" bank - IS31FL3731_write_register( addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG ); - - // shutdown - IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00); - _delay_ms(10); - // out of shutdown - IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x01); - - // picture mode - IS31FL3731_write_register(addr, ISSI_REG_CONFIG, ISSI_REG_CONFIG_PICTUREMODE); - // display frame 0 - IS31FL3731_write_register(addr, ISSI_REG_PICTUREFRAME, 0x00); - // audio sync off - IS31FL3731_write_register(addr, ISSI_REG_AUDIOSYNC, 0x00); - - // select bank 0 - IS31FL3731_write_register(addr, ISSI_COMMANDREGISTER, 0 ); - - // turn off all LEDs in the LED control register - for ( int i=0x00; i<=0x11; i++ ) - { - IS31FL3731_write_register(addr, i, 0x00 ); - } - - // turn off all LEDs in the blink control register (not really needed) - for ( int i=0x12; i<=0x23; i++ ) - { - IS31FL3731_write_register(addr, i, 0x00 ); - } - - // set PWM on all LEDs to 0 - for ( int i=0x24; i<=0xB3; i++ ) - { - IS31FL3731_write_register(addr, i, 0x00 ); - } + // In order to avoid the LEDs being driven with garbage data + // in the LED driver's PWM registers, first enable software shutdown, + // then set up the mode and other settings, clear the PWM registers, + // then disable software shutdown. + + // select "function register" bank + IS31FL3731_write_register( addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG ); + + // enable software shutdown + IS31FL3731_write_register( addr, ISSI_REG_SHUTDOWN, 0x00 ); + // this delay was copied from other drivers, might not be needed + _delay_ms( 10 ); + + // picture mode + IS31FL3731_write_register( addr, ISSI_REG_CONFIG, ISSI_REG_CONFIG_PICTUREMODE ); + // display frame 0 + IS31FL3731_write_register( addr, ISSI_REG_PICTUREFRAME, 0x00 ); + // audio sync off + IS31FL3731_write_register( addr, ISSI_REG_AUDIOSYNC, 0x00 ); + + // select bank 0 + IS31FL3731_write_register( addr, ISSI_COMMANDREGISTER, 0 ); + + // turn off all LEDs in the LED control register + for ( int i = 0x00; i <= 0x11; i++ ) + { + IS31FL3731_write_register( addr, i, 0x00 ); + } + + // turn off all LEDs in the blink control register (not really needed) + for ( int i = 0x12; i <= 0x23; i++ ) + { + IS31FL3731_write_register( addr, i, 0x00 ); + } + + // set PWM on all LEDs to 0 + for ( int i = 0x24; i <= 0xB3; i++ ) + { + IS31FL3731_write_register( addr, i, 0x00 ); + } + + // select "function register" bank + IS31FL3731_write_register( addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG ); + + // disable software shutdown + IS31FL3731_write_register( addr, ISSI_REG_SHUTDOWN, 0x01 ); + + // select bank 0 and leave it selected. + // most usage after initialization is just writing PWM buffers in bank 0 + // as there's not much point in double-buffering + IS31FL3731_write_register( addr, ISSI_COMMANDREGISTER, 0 ); } void IS31FL3731_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) { - if ( index >=0 && index <72 ) + if ( index >= 0 && index < 72 ) { int driver = 0; if ( index >= 36 ) @@ -158,16 +174,16 @@ void IS31FL3731_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) } // Index of LED (0..36) will map to a register. // Subtract 0x24 to get the second index of g_pwm_buffer - g_pwm_buffer[driver][ pgm_read_byte(&g_red_registers[index])-0x24 ] = red; - g_pwm_buffer[driver][ pgm_read_byte(&g_green_registers[index])-0x24 ] = green; - g_pwm_buffer[driver][ pgm_read_byte(&g_blue_registers[index])-0x24 ] = blue; + g_pwm_buffer[driver][ pgm_read_byte(&g_red_registers[index]) - 0x24] = red; + g_pwm_buffer[driver][ pgm_read_byte(&g_green_registers[index]) - 0x24] = green; + g_pwm_buffer[driver][ pgm_read_byte(&g_blue_registers[index]) - 0x24] = blue; g_pwm_buffer_update_required = true; } } void IS31FL3731_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) { - for ( int i=0; i<72; i++ ) + for ( int i = 0; i < 72; i++ ) { IS31FL3731_set_color( i, red, green, blue ); } diff --git a/keyboards/zeal60/config.h b/keyboards/zeal60/config.h index 352575e4bb02..5aa131ada5d3 100644 --- a/keyboards/zeal60/config.h +++ b/keyboards/zeal60/config.h @@ -91,4 +91,8 @@ along with this program. If not, see . #define USE_KEYMAPS_IN_EEPROM 1 +// Uncomment the following for "factory test" firmware +// that just tests the LEDs in a fast color cycle +//#define ZEAL60_TEST + #endif diff --git a/keyboards/zeal60/zeal_backlight.c b/keyboards/zeal60/zeal_backlight.c index f980dbbee86a..5800c3320dee 100644 --- a/keyboards/zeal60/zeal_backlight.c +++ b/keyboards/zeal60/zeal_backlight.c @@ -492,16 +492,8 @@ void backlight_init_drivers(void) // Initialize TWI TWIInit(); - - _delay_ms(100); - IS31FL3731_init( ISSI_ADDR_1 ); - - _delay_ms(100); - IS31FL3731_init( ISSI_ADDR_2 ); - - _delay_ms(100); // This is how you define which LEDs are present in the matrix. // If you don't turn off missing LEDs, the LED driver doesn't work properly. From cf3409d6ac403a452d21a7c8ada03c6bcee7cce3 Mon Sep 17 00:00:00 2001 From: Tushar Singal Date: Wed, 4 Jan 2017 21:02:30 -0500 Subject: [PATCH 15/69] Dimming implementation tested, working. --- keyboards/zeal60/keymaps/tusing/config.h | 18 +++++++++++++++++- quantum/rgblight.c | 4 ++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/keyboards/zeal60/keymaps/tusing/config.h b/keyboards/zeal60/keymaps/tusing/config.h index 4532550b37db..7f4ac326c0ca 100644 --- a/keyboards/zeal60/keymaps/tusing/config.h +++ b/keyboards/zeal60/keymaps/tusing/config.h @@ -3,6 +3,22 @@ #include "../../config.h" +/* enable/disable LEDs based on layout */ +#undef USE_SPLIT_BACKSPACE +#define USE_SPLIT_BACKSPACE 0 + +#undef USE_SPLIT_LEFT_SHIFT +#define USE_SPLIT_LEFT_SHIFT 0 + +#undef USE_SPLIT_RIGHT_SHIFT +#define USE_SPLIT_RIGHT_SHIFT 0 + +#undef USE_7U_SPACEBAR +#define USE_7U_SPACEBAR 0 + +#undef USE_ISO_ENTER +#define USE_ISO_ENTER 0 + // RGB underglow stuff. #define RGBLIGHT_ANIMATIONS #define RGB_DI_PIN B0 // The pin your RGB strip is wired to @@ -14,7 +30,7 @@ // Current limiting. #define USB_MAX_POWER_CONSUMPTION 900 -#define RGBSTRIP_CURRENT_LIMIT 400 // Strip current limit in mA. +#define RGBSTRIP_CURRENT_LIMIT 100 // Strip current limit in mA. #define RGBSTRIP_MAX_CURRENT_PER_LIGHT 60 // mA per light when at max brightness. #endif //CONFIG_USER_H diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 013bafb81a95..a2f51ef7c933 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -379,7 +379,7 @@ void adjust_current(void) { float strip_rgbw_limit = RGBSTRIP_CURRENT_LIMIT * rgbw_per_milliamp; // Calculate how much brightness the strip currently uses. - uint8_t strip_rgbw_total = 0; + uint16_t strip_rgbw_total = 0; for (uint8_t i = 0; i < RGBLED_NUM; i++) { strip_rgbw_total += led[i].r + led[i].g + led[i].b; } @@ -397,7 +397,7 @@ void adjust_current(void) { __attribute__ ((weak)) void rgblight_set(void) { -#ifdef RGBSTRIP_CURRENT_LIMIT +#if defined(RGBSTRIP_CURRENT_LIMIT) && defined(RGBSTRIP_MAX_CURRENT_PER_LIGHT) adjust_current(); #endif if (rgblight_config.enable) { From ecfd716421517b58aacc22938a2efe3467bc57c5 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Thu, 5 Jan 2017 16:16:01 +1100 Subject: [PATCH 16/69] Stab LEDs synced with spacebar hits in effects. --- keyboards/zeal60/zeal_backlight.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/keyboards/zeal60/zeal_backlight.c b/keyboards/zeal60/zeal_backlight.c index 5800c3320dee..b1a0e044ac98 100644 --- a/keyboards/zeal60/zeal_backlight.c +++ b/keyboards/zeal60/zeal_backlight.c @@ -287,6 +287,14 @@ void backlight_effect_cycle_all(void) for ( int i=0; i<72; i++ ) { uint16_t offset2 = g_key_hit[i]<<2; + + // stabilizer LEDs use spacebar hits + if ( i == 36+6 || i == 54+13 || // LC6, LD13 + ( g_config.use_7u_spacebar && i == 54+14 ) ) // LD14 + { + offset2 = g_key_hit[36+0]<<2; + } + offset2 = (offset2<=63) ? (63-offset2) : 0; HSV hsv = { .h = offset+offset2, .s = 255, .v = g_config.brightness }; RGB rgb = hsv_to_rgb( hsv ); From f4cc965dcfd7dc076e168195906411932b947284 Mon Sep 17 00:00:00 2001 From: Tushar Singal Date: Thu, 5 Jan 2017 01:13:14 -0500 Subject: [PATCH 17/69] RGB underglow tested and functional. Simplified README for RGB underglow. --- keyboards/zeal60/keymaps/tusing/README.md | 57 +++++++++-------------- keyboards/zeal60/keymaps/tusing/config.h | 14 +++--- keyboards/zeal60/keymaps/tusing/keymap.c | 8 ++-- 3 files changed, 34 insertions(+), 45 deletions(-) diff --git a/keyboards/zeal60/keymaps/tusing/README.md b/keyboards/zeal60/keymaps/tusing/README.md index b5d21c0a97d8..932427266116 100644 --- a/keyboards/zeal60/keymaps/tusing/README.md +++ b/keyboards/zeal60/keymaps/tusing/README.md @@ -1,59 +1,47 @@ # RGB Underglow Strip on the Zeal60: A Guide -***WARNING:*** This guide is untested and likely has errors. - -***NOTE:*** As explained in Part C, due to current limits, **underglow will only work on USB 3.0 or above**. If you want to use your keyboard on USB 2.0, make sure either underglow or backlighting is off when you plug in your Zeal60 - or that you have fiddled with the brightness of both to take the board's total consumption under 500mA. + ## A. Connecting the strip You might find the [**full PCB image**](https://cdn.shopify.com/s/files/1/0490/7329/files/zeal60jumpers.png) helpful. Ignore the red boxes! -1. Connect V+ and GND to 5V and GND from USB (J1A). - - - * ***Alternatively,*** if you don't want to further mess with the PCB, and you want to deal with the current limits purely in software as described in Part C, connect V+ and GND to the actual USB pinout V+ and GND. - - -2. Connect DI to PB0 (or another unused pin on the 32U4). +1. Connect V+ to the receiving end of the thermistor labeled F1; connect GND to the board's GND pin. (*Avoid connecting +V to the board's +5V pin* - you will likely overload the thermistor, and you will limit your maximum brightness.) + + + +2. Connect DI to PB0. + +3. Should look something like this when finished: + + ## B. Enabling the strip -1. Add the following to your [```Makefile```](https://github.com/Wilba6582/qmk_firmware/blob/zeal60/keyboards/zeal60/Makefile): +1. If it is not present already, add the following to your ***keymap's*** ```Makefile```: ```Makefile RGBLIGHT_ENABLE = yes AUDIO_ENABLE = no #Underglow animations cannot be used with audio. ``` -2. Add the following to your [```config.h```](https://github.com/Wilba6582/qmk_firmware/blob/zeal60/keyboards/zeal60/keymaps/default/config.h): +2. If it is not present already, add the following to your *keymap's* ```config.h```: ```c - #define RGBLIGHT_ANIMATIONS // Underglow animations. - #define RGBW 0 // 1 if you have an RGBW strip. + #define RGBLIGHT_ANIMATIONS // Underglow animations. #define RGB_DI_PIN B0 // The pin your RGB strip is wired to - #define RGBLED_NUM 16 // Number of LEDs + #define RGBLED_NUM 35 // Number of LEDs #define RGBLIGHT_HUE_STEP 5 // How much each press of rgb_hue changes hue #define RGBLIGHT_SAT_STEP 10 // How much each press of rgb_sat changes sat #define RGBLIGHT_VAL_STEP 10 // How much each press of rgb_val changes val ``` -3. Keycodes are ```RGB_TOG``` (on/off), ```RGB_MOD``` (step through modes), ```RGB_HUI```, ```RGB_HUD```, ```RGB_SAI```, ```RGB_SAD```, ```RGB_VAI```, ```RGB_VAD``` (HSV increase/decrease). Add these to your keymap. Test it out with **1 LED only** (```RGBLED_NUM 1``` in [```config.h```](https://github.com/Wilba6582/qmk_firmware/blob/zeal60/keyboards/zeal60/keymaps/default/config.h) above). +3. If they are not present already, add the following keycodes to your keymap to control the RGB strip: ```RGB_TOG``` (on/off), ```RGB_MOD``` (step through modes), ```RGB_HUI```, ```RGB_HUD```, ```RGB_SAI```, ```RGB_SAD```, ```RGB_VAI```, ```RGB_VAD``` (HSV increase/decrease). Add these to your keymap. ## C. Dealing with current limits -USB 2.0 ports on laptops provide up to 500mA max, but USB 3.0 ports can provide up to 900mA; USB 3.1 up to 1.5A; and powered USB hubs even more. We can run our keyboard at a higher brightness if we draw more power. - -An option to halve the Zeal60's current draw is to cut the trace on the pre-connected jumpers and bridge them with a 30kohm resistor. But let's try to limit brightness in software instead. - -Here are some possible configurations with 16 RGB neopixels (6 on top and bottom of PCB; 2 on each side): - -| Zeal60 (500mA maxed) | 16 RGB LEDs (60mA/LED maxed) | Total Current Consumption -|:----------------------:|:--------------------------:|:----------------------:| -| 36% / 180mA | 33% / 20mA | 496mA (USB 2.0) | -| **100% / 500mA** | **41% / 25mA** | **900mA (USB 3.0)** | -| 50% / 250mA | 66% / 40mA | 890mA (USB 3.0) | -| 100% / 500mA | 100% / 60mA | 1460mA (USB 3.1) +USB 2.0 ports on laptops provide up to 500mA max, but USB 3.0 ports can provide up to 900mA; USB 3.1 up to 1.5A; and powered USB hubs even more. We can run our keyboard at a higher brightness if we draw more power. **The Zeal60 uses 500mA at max brightness.** This means that **you have about 400mA remaining for the strip to use on a USB 3.0 port**; 1000mA free on a USB 3.1 port, so on and so forth. -I'll take the second option. +***Warning:*** **This means you will need to turn *off* your RGB strip before connecting to a USB 2.0 port**, as USB 2.0 cannot sustain the current necessary! -1. Add the following to your keymap's [```config.h```](https://github.com/Wilba6582/qmk_firmware/blob/zeal60/keyboards/zeal60/keymaps/default/config.h). Change variable definitions based on your needs. +1. If not present already, add the following to your keymap's ```config.h```. Change variable definitions based on your needs. ```c // Current limiting. @@ -61,10 +49,9 @@ I'll take the second option. #define RGBSTRIP_CURRENT_LIMIT 400 // Strip current limit in mA. #define RGBSTRIP_MAX_CURRENT_PER_LIGHT 60 // mA per light when at max brightness. ``` -3. **If you've connected +5V and GND to J1A**, either short or replace the thermistor labeled F1 under the USB port with one that supports your current needs. [Here's a selection](https://goo.gl/748avG) of 900mA-1.5A current hold fuses - look for an SMD 0805-sized fuse. **Otherwise, if you've connected directly to the USB +5V/GND pins**, you don't need to do anything other than limit brightness in software. -4. Enable all LEDs and test it out! +2. Toggle on the LED strip (```RGB_TOG```) and step through animations (```RGB_MOD```) to test it out! -## D. Additional resources +## D. Sources and resources ### A. Connecting the strip. * [In-depth description of connecting an RGB strip to the GH60](https://www.reddit.com/r/MechanicalKeyboards/comments/4d5or2/my_first_custom_build_satan_gh60_rbg_underglow_in/d1nz3o7/) * [32U4 Pinout](https://40.media.tumblr.com/93b6bbd4113418c2b45459bb177e67c5/tumblr_mi49a20QMB1s5t695o1_1280.png) @@ -73,8 +60,8 @@ I'll take the second option. ### B. Enabling the strip. * [QMK Wiki portion on underglow](https://github.com/jackhumbert/qmk_firmware/wiki#rgb-under-glow-mod) -* [**Planck ```Makefile```, ```config.h```, and ```keymap.c``` config example**](https://github.com/jackhumbert/qmk_firmware/tree/master/keyboards/planck/keymaps/yang) -* [Video demonstrating keycode functions on a KC60](https://www.youtube.com/watch?v=VKrpPAHlisY) +* [Planck ```Makefile```, ```config.h```, and ```keymap.c``` config example](https://github.com/jackhumbert/qmk_firmware/tree/master/keyboards/planck/keymaps/yang) +* [Video demonstrating keycode functions and RGB modes on a KC60](https://www.youtube.com/watch?v=VKrpPAHlisY) ### C. Dealing with current limits. * [Discussion of cutting jumpers and adding resistors to lower current from Zeal60](https://www.reddit.com/r/MechanicalKeyboards/comments/5hou92/photos_zeal60_lets_just_say_santa_came_early_this/db23qid/) diff --git a/keyboards/zeal60/keymaps/tusing/config.h b/keyboards/zeal60/keymaps/tusing/config.h index 7f4ac326c0ca..cd1d26290574 100644 --- a/keyboards/zeal60/keymaps/tusing/config.h +++ b/keyboards/zeal60/keymaps/tusing/config.h @@ -3,7 +3,7 @@ #include "../../config.h" -/* enable/disable LEDs based on layout */ +/* Enable/disable LEDs based on layout. */ #undef USE_SPLIT_BACKSPACE #define USE_SPLIT_BACKSPACE 0 @@ -19,18 +19,18 @@ #undef USE_ISO_ENTER #define USE_ISO_ENTER 0 -// RGB underglow stuff. +// Set up RGB underglow. #define RGBLIGHT_ANIMATIONS #define RGB_DI_PIN B0 // The pin your RGB strip is wired to #define RGBLIGHT_ANIMATIONS // Require for fancier stuff (not compatible with audio) -#define RGBLED_NUM 16 // Number of LEDs +#define RGBLED_NUM 35 // Number of LEDs #define RGBLIGHT_HUE_STEP 5 // How much each press of rgb_hue changes hue #define RGBLIGHT_SAT_STEP 10 // How much each press of rgb_sat changes sat #define RGBLIGHT_VAL_STEP 10 // How much each press of rgb_val changes val -// Current limiting. +// Enable current limiting for RGB underglow. #define USB_MAX_POWER_CONSUMPTION 900 -#define RGBSTRIP_CURRENT_LIMIT 100 // Strip current limit in mA. -#define RGBSTRIP_MAX_CURRENT_PER_LIGHT 60 // mA per light when at max brightness. +#define RGBSTRIP_CURRENT_LIMIT 600 // Strip current limit in mA. +#define RGBSTRIP_MAX_CURRENT_PER_LIGHT 40 // mA per light when at max brightness. -#endif //CONFIG_USER_H +#endif diff --git a/keyboards/zeal60/keymaps/tusing/keymap.c b/keyboards/zeal60/keymaps/tusing/keymap.c index 1d42959b22ce..f386a12d128a 100644 --- a/keyboards/zeal60/keymaps/tusing/keymap.c +++ b/keyboards/zeal60/keymaps/tusing/keymap.c @@ -13,11 +13,11 @@ // H2_INC, H2_DEC, // Color 2 hue increase/decrease // S2_INC, S2_DEC, // Color 2 saturation increase/decrease // BR_INC, BR_DEC, // backlight brightness increase/decrease -// FN_MO13, FN_MO23 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Default layer: Pressing caps-lock momentarily switches to Layer 1. +// This is the default layer. Pressing an invalid keycode on another layer will take you here. [0] = { {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS}, @@ -26,7 +26,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { {KC_LCTL, KC_LGUI, KC_LALT, _x_ , _x_ , _x_ , _x_ , KC_SPC, _x_ , _x_ , KC_UP, KC_DOWN, KC_LEFT, KC_RGHT} }, -// Layer 1: Pressing Ctrl switches to layer 2. +// Layer 1: Pressing Ctrl switches to layer 2. +// This is a momentary layer: once you let go of caps, you'll be back in layer 1. [1] = { {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, {KC_VOLD, KC_MUTE, KC_VOLU, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_INS, KC_DEL, _______}, @@ -36,7 +37,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }, -// Layer 2: Zeal60 and backlight configuration. +// Layer 2: Zeal60 and backlight configuration. (Get here quickly by pressing Caps+Control from Layer 1.) +// This is a persistent layer. Get back to Layer 1 by pressing left control or an unused key. [2] = { {RESET, EF_DEC, EF_INC, BR_DEC, BR_INC, _______, _______, _______, _______, _______, _______, _______, _______, _______}, {_______, H1_DEC, H1_INC, S1_DEC, S1_INC, _______, _______, _______, _______, _______, _______, _______, _______, _______}, From a0f17591ef559a4866600ad8cce984006a9c72cb Mon Sep 17 00:00:00 2001 From: Tushar Singal Date: Thu, 5 Jan 2017 01:26:29 -0500 Subject: [PATCH 18/69] Undid accidental file deletion from previous merge conflict. Safer values for RGB underglow. --- keyboards/zeal60/keymaps/tusing/config.h | 4 +- .../HostTemplate/HostApplication.c | 133 ++++++++++++++++++ .../LUFA/DoxygenPages/Style/Style.css | 93 ++++++++++++ 3 files changed, 228 insertions(+), 2 deletions(-) create mode 100644 tmk_core/protocol/lufa/LUFA-git/LUFA/CodeTemplates/HostTemplate/HostApplication.c create mode 100644 tmk_core/protocol/lufa/LUFA-git/LUFA/DoxygenPages/Style/Style.css diff --git a/keyboards/zeal60/keymaps/tusing/config.h b/keyboards/zeal60/keymaps/tusing/config.h index cd1d26290574..a5d63b11e1c1 100644 --- a/keyboards/zeal60/keymaps/tusing/config.h +++ b/keyboards/zeal60/keymaps/tusing/config.h @@ -30,7 +30,7 @@ // Enable current limiting for RGB underglow. #define USB_MAX_POWER_CONSUMPTION 900 -#define RGBSTRIP_CURRENT_LIMIT 600 // Strip current limit in mA. -#define RGBSTRIP_MAX_CURRENT_PER_LIGHT 40 // mA per light when at max brightness. +#define RGBSTRIP_CURRENT_LIMIT 400 // Strip current limit in mA. +#define RGBSTRIP_MAX_CURRENT_PER_LIGHT 60 // mA per light when at max brightness. #endif diff --git a/tmk_core/protocol/lufa/LUFA-git/LUFA/CodeTemplates/HostTemplate/HostApplication.c b/tmk_core/protocol/lufa/LUFA-git/LUFA/CodeTemplates/HostTemplate/HostApplication.c new file mode 100644 index 000000000000..1ac03788d3f8 --- /dev/null +++ b/tmk_core/protocol/lufa/LUFA-git/LUFA/CodeTemplates/HostTemplate/HostApplication.c @@ -0,0 +1,133 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * + * Main source file for the USB host application. This file contains the + * main tasks of the application and is responsible for the initial + * application hardware configuration. + */ + +#include "HostApplication.h" + +/** Main program entry point. This routine configures the hardware required by the application, then + * enters a loop to run the application tasks in sequence. + */ +int main(void) +{ + SetupHardware(); + + GlobalInterruptEnable(); + + for (;;) + { + USB_USBTask(); + } +} + +/** Configures the board hardware and chip peripherals for the demo's functionality. */ +void SetupHardware(void) +{ + /* Disable watchdog if enabled by bootloader/fuses */ + MCUSR &= ~(1 << WDRF); + wdt_disable(); + + /* Disable clock division */ + clock_prescale_set(clock_div_1); + + /* Hardware Initialization */ + USB_Init(USB_MODE_Host, USB_DEVICE_OPT_FULLSPEED | USB_OPT_AUTO_PLL); +} + +/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and + * starts the library USB task to begin the enumeration and USB management process. + */ +void EVENT_USB_Host_DeviceAttached(void) +{ + +} + +/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and + * stops the library USB task management process. + */ +void EVENT_USB_Host_DeviceUnattached(void) +{ + +} + +/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully + * enumerated by the host and is now ready to be used by the application. + */ +void EVENT_USB_Host_DeviceEnumerationComplete(void) +{ + uint16_t ConfigDescriptorSize; + uint8_t ConfigDescriptorData[512]; + + if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData, + sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful) + { + return; + } + + if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful) + { + return; + } +} + +/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */ +void EVENT_USB_Host_HostError(const uint8_t ErrorCode) +{ + USB_Disable(); + for(;;); +} + +/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while + * enumerating an attached USB device. + */ +void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, + const uint8_t SubErrorCode) +{ + +} + +/* Required callback for retrieving descriptors from a LUFA device - unless the USB_HOST_ONLY configuration + * option is set, this is still required even in an application that uses host mode only. + */ +uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, + const uint8_t wIndex, + const void** const DescriptorAddress +#if defined(HAS_MULTIPLE_DESCRIPTOR_ADDRESS_SPACES) + , uint8_t* const DescriptorMemorySpace +#endif +) +{ + return 0; +} diff --git a/tmk_core/protocol/lufa/LUFA-git/LUFA/DoxygenPages/Style/Style.css b/tmk_core/protocol/lufa/LUFA-git/LUFA/DoxygenPages/Style/Style.css new file mode 100644 index 000000000000..933215546f73 --- /dev/null +++ b/tmk_core/protocol/lufa/LUFA-git/LUFA/DoxygenPages/Style/Style.css @@ -0,0 +1,93 @@ +/* ============================= */ +/* Page Header Formattings */ +/* ============================= */ +#titlearea { + background-color:#E1E7F4; + background-image:url('nav_f.png'); + background-repeat:repeat-x; + color:#20335A; + font-weight:bold; + text-shadow:0 1px 1px rgba(255, 255, 255, 0.9); +} + +#projectlogo { + padding-left: 10px; +} + +/* ============================= */ +/* General Text Formattings */ +/* ============================= */ +body,table,div,p,dl { + font-family:Lucida Grande, Verdana, Geneva, Arial, sans-serif; + font-size:13px; + line-height:1.3; +} + +div.header, div.contents p { + padding-left:12px; +} + +/* ============================= */ +/* API Documentation Formattings */ +/* ============================= */ +div.contents table.memberdecls, .paramname { + font-family:Consolas, Monaco, courier, sans-serif; + font-size:105%; + padding-right:20px; +} + +/* ============================= */ +/* HTML Heading Formattings */ +/* ============================= */ +h1, h2, h3, h4 { + font-family:Lucida Grande, Verdana, Geneva, Arial, sans-serif; +} + +h1 { + font-size:25px; + margin-bottom:10px; +} + +h2 { + color:#42657B; + font-size:17px; +} + +h3 { + font-size:15px; +} + +h4 { + font-size:13px; +} + +/* ============================= */ +/* Code Snippet Formattings */ +/* ============================= */ +span.keyword { + color:#008000; +} + +span.keywordtype { + color:#604020; +} + +span.keywordflow { + color:#e08000; +} + +span.comment { + color:#008000; +} + +span.preprocessor { + color:#806020; +} + +span.stringliteral { + color:#002080; +} + +span.charliteral { + color:#008080; +} From bbb96e484ba514506657bf2fc746fae03475f7cf Mon Sep 17 00:00:00 2001 From: Tushar Singal Date: Fri, 6 Jan 2017 15:18:59 -0500 Subject: [PATCH 19/69] Improved arrow key positions in keymap. --- keyboards/zeal60/keymaps/tusing/config.h | 4 ++-- keyboards/zeal60/keymaps/tusing/keymap.c | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/keyboards/zeal60/keymaps/tusing/config.h b/keyboards/zeal60/keymaps/tusing/config.h index a5d63b11e1c1..cd1d26290574 100644 --- a/keyboards/zeal60/keymaps/tusing/config.h +++ b/keyboards/zeal60/keymaps/tusing/config.h @@ -30,7 +30,7 @@ // Enable current limiting for RGB underglow. #define USB_MAX_POWER_CONSUMPTION 900 -#define RGBSTRIP_CURRENT_LIMIT 400 // Strip current limit in mA. -#define RGBSTRIP_MAX_CURRENT_PER_LIGHT 60 // mA per light when at max brightness. +#define RGBSTRIP_CURRENT_LIMIT 600 // Strip current limit in mA. +#define RGBSTRIP_MAX_CURRENT_PER_LIGHT 40 // mA per light when at max brightness. #endif diff --git a/keyboards/zeal60/keymaps/tusing/keymap.c b/keyboards/zeal60/keymaps/tusing/keymap.c index f386a12d128a..2a9859a2efb7 100644 --- a/keyboards/zeal60/keymaps/tusing/keymap.c +++ b/keyboards/zeal60/keymaps/tusing/keymap.c @@ -6,6 +6,7 @@ #define _______ KC_TRNS #define _x_ KC_NO + // Zeal60-specific keys: // EF_INC, EF_DEC, // next/previous backlight effect // H1_INC, H1_DEC, // Color 1 hue increase/decrease @@ -23,17 +24,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS}, {MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, _x_ }, {KC_LSFT, _x_ , KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, _x_ }, - {KC_LCTL, KC_LGUI, KC_LALT, _x_ , _x_ , _x_ , _x_ , KC_SPC, _x_ , _x_ , KC_UP, KC_DOWN, KC_LEFT, KC_RGHT} + {KC_LCTL, KC_LGUI, KC_LALT, _x_ , _x_ , _x_ , _x_ , KC_SPC, _x_ , _x_ , KC_LEFT, KC_UP, KC_DOWN, KC_RGHT} }, // Layer 1: Pressing Ctrl switches to layer 2. // This is a momentary layer: once you let go of caps, you'll be back in layer 1. [1] = { {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, - {KC_VOLD, KC_MUTE, KC_VOLU, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_INS, KC_DEL, _______}, - {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _x_ }, + {_______, KC_VOLD, KC_MUTE, KC_VOLU, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_INS, KC_DEL, _______}, + {_______, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _x_ }, {KC_CAPS, _x_ , _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _x_ }, - {TO(2), _______, _______, _x_ , _x_ , _x_ , _x_ , _______, _x_ , _x_ , KC_PGUP, KC_PGDN, KC_HOME, KC_END} + {TO(2), _______, _______, _x_ , _x_ , _x_ , _x_ , _______, _x_ , _x_ , KC_HOME, KC_PGUP, KC_PGDN, KC_END} }, From c5be7fd5263c14c7416138cd46b8045cb00cd5fd Mon Sep 17 00:00:00 2001 From: Tushar Singal Date: Sat, 7 Jan 2017 17:14:15 -0500 Subject: [PATCH 20/69] Added functionality to correct uneven RGB underglow. Refactored related code. --- keyboards/zeal60/keymaps/tusing/config.h | 6 ++- quantum/rgblight.c | 55 +++++++++++++++++++++--- 2 files changed, 54 insertions(+), 7 deletions(-) diff --git a/keyboards/zeal60/keymaps/tusing/config.h b/keyboards/zeal60/keymaps/tusing/config.h index cd1d26290574..8f7e1acf150c 100644 --- a/keyboards/zeal60/keymaps/tusing/config.h +++ b/keyboards/zeal60/keymaps/tusing/config.h @@ -30,7 +30,11 @@ // Enable current limiting for RGB underglow. #define USB_MAX_POWER_CONSUMPTION 900 -#define RGBSTRIP_CURRENT_LIMIT 600 // Strip current limit in mA. +#define RGBSTRIP_CURRENT_LIMIT 700 // Strip current limit in mA. #define RGBSTRIP_MAX_CURRENT_PER_LIGHT 40 // mA per light when at max brightness. +// Scale brightnes according to BRIGHTNESS_CORRECTION_TABLE in quantum/rgblight.c. +// This allows to mitigate uneven brightness from LED underglow strips. +#define LED_BRIGHTNESS_CORRECTION + #endif diff --git a/quantum/rgblight.c b/quantum/rgblight.c index a2f51ef7c933..b7d28a695b51 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -56,6 +56,13 @@ const uint8_t RGBLED_BREATHING_TABLE[] PROGMEM = { 10, 9, 7, 6, 5, 5, 4, 3, 2, 2, 1, 1, 1, 0, 0, 0 }; +const float BRIGHTNESS_CORRECTION_TABLE[] PROGMEM = { + 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0 +}; + __attribute__ ((weak)) const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5}; __attribute__ ((weak)) @@ -370,6 +377,38 @@ void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) { rgblight_set(); } +void scale_led(int i, float multiplier) { + /** Scale led[i]'s brightness by multiplier. */ + + // Prevent multipliers greater than 1 from overflowing + // the 8-bit unsigned int that governs LED brightness. + if (multiplier > 1.0) { + uint8_t max_value = 0; + uint8_t led_array[] = {led[i].r, led[i].g, led[i].b}; + for (uint8_t i = 0; i < 3; i++) { + if (led_array[i] > max_value) { + max_value = led_array[i]; + } + } + + if ((max_value * multiplier) > 255) { + multiplier = 255.0 / max_value; + } + } + + led[i].r = (uint8_t)(led[i].r * multiplier); + led[i].g = (uint8_t)(led[i].g * multiplier); + led[i].b = (uint8_t)(led[i].b * multiplier); +} + +void correct_brightness(void) { + /** Correct brightness for uneven underglow LEDs as defined by + scaling factors in BRIGHTNESS_CORRECTION_TABLE. */ + for (uint8_t i = 0; i < RGBLED_NUM; i++) { + scale_led(i, pgm_read_float(&BRIGHTNESS_CORRECTION_TABLE[i])); + } +} + void adjust_current(void) { /** Dims RGB strip if it exceeds defined current limit. */ // Convert 1 milliamp to an R+G+B brightness value. @@ -388,18 +427,22 @@ void adjust_current(void) { if (strip_rgbw_total > strip_rgbw_limit) { float multiplier = strip_rgbw_limit / strip_rgbw_total; for (uint8_t i = 0; i < RGBLED_NUM; i++) { - led[i].r = (uint8_t)(led[i].r * multiplier); - led[i].g = (uint8_t)(led[i].g * multiplier); - led[i].b = (uint8_t)(led[i].b * multiplier); + scale_led(i, multiplier); } } } __attribute__ ((weak)) void rgblight_set(void) { -#if defined(RGBSTRIP_CURRENT_LIMIT) && defined(RGBSTRIP_MAX_CURRENT_PER_LIGHT) - adjust_current(); -#endif + + #ifdef LED_BRIGHTNESS_CORRECTION + correct_brightness(); + #endif + + #if defined(RGBSTRIP_CURRENT_LIMIT) && defined(RGBSTRIP_MAX_CURRENT_PER_LIGHT) + adjust_current(); + #endif + if (rgblight_config.enable) { #ifdef RGBW ws2812_setleds_rgbw(led, RGBLED_NUM); From 490433dd52dcd13460e27211ee443b7d230e63ec Mon Sep 17 00:00:00 2001 From: Tushar Singal Date: Sat, 7 Jan 2017 17:29:05 -0500 Subject: [PATCH 21/69] Reverted to safer values for underglow. --- keyboards/zeal60/keymaps/tusing/config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/zeal60/keymaps/tusing/config.h b/keyboards/zeal60/keymaps/tusing/config.h index 8f7e1acf150c..04596833e8c3 100644 --- a/keyboards/zeal60/keymaps/tusing/config.h +++ b/keyboards/zeal60/keymaps/tusing/config.h @@ -30,8 +30,8 @@ // Enable current limiting for RGB underglow. #define USB_MAX_POWER_CONSUMPTION 900 -#define RGBSTRIP_CURRENT_LIMIT 700 // Strip current limit in mA. -#define RGBSTRIP_MAX_CURRENT_PER_LIGHT 40 // mA per light when at max brightness. +#define RGBSTRIP_CURRENT_LIMIT 400 // Strip current limit in mA. +#define RGBSTRIP_MAX_CURRENT_PER_LIGHT 60 // mA per light when at max brightness. // Scale brightnes according to BRIGHTNESS_CORRECTION_TABLE in quantum/rgblight.c. // This allows to mitigate uneven brightness from LED underglow strips. From 36b4cc142b9846340ac85c02ff08a85f7438c21a Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Mon, 9 Jan 2017 19:36:50 +1100 Subject: [PATCH 22/69] Changes for v0.3 --- keyboards/zeal60/IS31FL3731_driver.c | 114 ++++++ keyboards/zeal60/IS31FL3731_driver.h | 3 + keyboards/zeal60/config.h | 26 +- keyboards/zeal60/keymaps/default/keymap.c | 43 +- keyboards/zeal60/keymaps/hhkb_ansi/keymap.c | 47 +-- keyboards/zeal60/keymaps/poker2_ansi/keymap.c | 41 +- keyboards/zeal60/keymaps/poker2_iso/keymap.c | 41 +- keyboards/zeal60/keymaps/test/config.h | 2 + keyboards/zeal60/keymaps/test/keymap.c | 43 +- keyboards/zeal60/zeal60.c | 52 +-- keyboards/zeal60/zeal_backlight.c | 370 +++++++++--------- keyboards/zeal60/zeal_backlight.h | 40 +- keyboards/zeal60/zeal_color.c | 170 ++++---- keyboards/zeal60/zeal_eeprom.h | 2 +- keyboards/zeal60/zeal_keymap.c | 18 +- keyboards/zeal60/zeal_keymap.h | 6 +- keyboards/zeal60/zeal_rpc.h | 20 +- tmk_core/common/avr/suspend.c | 8 + 18 files changed, 595 insertions(+), 451 deletions(-) diff --git a/keyboards/zeal60/IS31FL3731_driver.c b/keyboards/zeal60/IS31FL3731_driver.c index d610a501a792..a65d7b06e0fd 100644 --- a/keyboards/zeal60/IS31FL3731_driver.c +++ b/keyboards/zeal60/IS31FL3731_driver.c @@ -37,6 +37,9 @@ uint8_t g_twi_transfer_buffer[TXMAXBUFLEN]; uint8_t g_pwm_buffer[2][144]; bool g_pwm_buffer_update_required = false; +uint8_t g_led_control_registers[2][18] = { { 0 }, { 0 } }; +bool g_led_control_registers_update_required = false; + // map of LED index to register (matrix A and matrix B) // i.e. this is LA0..LA17,LB0..LB17 and also LC0..LC17,LD0..LD17 // Index of LED (0..36) will map to a register. @@ -59,6 +62,53 @@ const uint8_t g_blue_registers[36] PROGMEM = { 0x5C, 0x5D, 0x5E, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x81, 0x82, 0x83 }; +typedef struct +{ + uint8_t red_register; + uint8_t red_bit; + uint8_t green_register; + uint8_t green_bit; + uint8_t blue_register; + uint8_t blue_bit; +} led_control_bitmask; + +// This is the bit pattern in the LED control registers +// (for matrix A, add one to register for matrix B) +// +// reg - b7 b6 b5 b4 b3 b2 b1 b0 +// 0x00 - R08,R07,R06,R05,R04,R03,R02,R01 +// 0x02 - G08,G07,G06,G05,G04,G03,G02,R00 +// 0x04 - B08,B07,B06,B05,B04,B03,G01,G00 +// 0x06 - - , - , - , - , - ,B02,B01,B00 +// 0x08 - - , - , - , - , - , - , - , - +// 0x0A - B17,B16,B15, - , - , - , - , - +// 0x0C - G17,G16,B14,B13,B12,B11,B10,B09 +// 0x0E - R17,G15,G14,G13,G12,G11,G10,G09 +// 0x10 - R16,R15,R14,R13,R12,R11,R10,R09 + +const led_control_bitmask g_led_control_bitmask[18] = +{ + { 0x02, 0, 0x04, 0, 0x06, 0 }, // R00,G00,B00 + { 0x00, 0, 0x04, 1, 0x06, 1 }, // R01,G01,B01 + { 0x00, 1, 0x02, 1, 0x06, 2 }, // R02,G02,B02 + { 0x00, 2, 0x02, 2, 0x04, 2 }, // R03,G03,B03 + { 0x00, 3, 0x02, 3, 0x04, 3 }, // R04,G04,B04 + { 0x00, 4, 0x02, 4, 0x04, 4 }, // R05,G05,B05 + { 0x00, 5, 0x02, 5, 0x04, 5 }, // R06,G06,B06 + { 0x00, 6, 0x02, 6, 0x04, 6 }, // R07,G07,B07 + { 0x00, 7, 0x02, 7, 0x04, 7 }, // R08,G08,B08 + + { 0x10, 0, 0x0E, 0, 0x0C, 0 }, // R09,G09,B09 + { 0x10, 1, 0x0E, 1, 0x0C, 1 }, // R10,G10,B10 + { 0x10, 2, 0x0E, 2, 0x0C, 2 }, // R11,G11,B11 + { 0x10, 3, 0x0E, 3, 0x0C, 3 }, // R12,G12,B12 + { 0x10, 4, 0x0E, 4, 0x0C, 4 }, // R13,G13,B13 + { 0x10, 5, 0x0E, 5, 0x0C, 5 }, // R14,G14,B14 + { 0x10, 6, 0x0E, 6, 0x0A, 5 }, // R15,G15,B15 + { 0x10, 7, 0x0C, 6, 0x0A, 6 }, // R16,G16,B16 + { 0x0E, 7, 0x0C, 7, 0x0A, 7 }, // R17,G17,B17 +}; + void IS31FL3731_write_register( uint8_t addr, uint8_t reg, uint8_t data ) { g_twi_transfer_buffer[0] = (addr << 1) | 0x00; @@ -189,6 +239,57 @@ void IS31FL3731_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) } } +void IS31FL3731_set_led_control_register( uint8_t index, bool red, bool green, bool blue ) +{ + uint8_t driver = 0; + if ( index >= 36 ) + { + driver = 1; + index -= 36; + } + + // index now in range 0..35 + uint8_t matrix = 0; // Matrix A + if ( index >= 18 ) + { + matrix = 1; // Matrix B + index -= 18; + } + + led_control_bitmask bitmask = g_led_control_bitmask[index]; + + // Matrix A and B registers are interleaved. + // Add 1 to Matrix A register to get Matrix B register + if ( red ) + { + g_led_control_registers[driver][bitmask.red_register+matrix] |= (1<. //#define NO_ACTION_FUNCTION // enable/disable LEDs based on layout -#define USE_SPLIT_BACKSPACE 0 -#define USE_SPLIT_LEFT_SHIFT 0 -#define USE_SPLIT_RIGHT_SHIFT 0 -#define USE_7U_SPACEBAR 0 -#define USE_ISO_ENTER 0 +#define BACKLIGHT_USE_SPLIT_BACKSPACE 0 +#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 +#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 +#define BACKLIGHT_USE_7U_SPACEBAR 0 +#define BACKLIGHT_USE_ISO_ENTER 0 + +// disable backlight when USB suspended (PC sleep/hibernate/shutdown) +#define BACKLIGHT_DISABLE_WHEN_USB_SUSPENDED 0 + +// disable backlight after timeout in minutes, 0 = no timeout +#define BACKLIGHT_DISABLE_AFTER_TIMEOUT 0 // These define which keys in the matrix are alphas/mods // Used for backlight effects so colors are different for // alphas vs. mods // Each value is for a row, bit 0 is column 13 // Alpha=0 Mod=1 -#define ALPHAS_MODS_ROW_0 0b0010000000000001 -#define ALPHAS_MODS_ROW_1 0b0010000000000000 -#define ALPHAS_MODS_ROW_2 0b0010000000000010 -#define ALPHAS_MODS_ROW_3 0b0010000000000011 -#define ALPHAS_MODS_ROW_4 0b0011100000001111 +#define BACKLIGHT_ALPHAS_MODS_ROW_0 0b0010000000000001 +#define BACKLIGHT_ALPHAS_MODS_ROW_1 0b0010000000000000 +#define BACKLIGHT_ALPHAS_MODS_ROW_2 0b0010000000000010 +#define BACKLIGHT_ALPHAS_MODS_ROW_3 0b0010000000000011 +#define BACKLIGHT_ALPHAS_MODS_ROW_4 0b0011100000001111 #define USE_KEYMAPS_IN_EEPROM 1 diff --git a/keyboards/zeal60/keymaps/default/keymap.c b/keyboards/zeal60/keymaps/default/keymap.c index 6134783b048f..6e7a848d9989 100644 --- a/keyboards/zeal60/keymaps/default/keymap.c +++ b/keyboards/zeal60/keymaps/default/keymap.c @@ -1,7 +1,6 @@ // Default layout for Zeal60 #include "zeal60.h" -#include "action_layer.h" // [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace // [1,13] is either backslash or ISO Enter @@ -14,38 +13,38 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Default layer [0] = { - {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS}, - {KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_NO }, - {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO }, - {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RALT, FN_TT13, FN_TT23, KC_RCTL} + {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS}, + {KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_NO }, + {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO }, + {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RALT, FN_MO13, FN_MO23, KC_RCTL} }, -// Fn1 LayerS +// Fn1 Layer [1] = { - {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, - {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS}, - {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} + {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, + {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS}, + {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} }, // Fn2 Layer [2] = { - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} }, // Fn3 Layer (zeal60 Configuration) [3] = { - {RESET, EF_DEC, EF_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} + {KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} } }; diff --git a/keyboards/zeal60/keymaps/hhkb_ansi/keymap.c b/keyboards/zeal60/keymaps/hhkb_ansi/keymap.c index f6d56fb9e0fc..889c380366dd 100644 --- a/keyboards/zeal60/keymaps/hhkb_ansi/keymap.c +++ b/keyboards/zeal60/keymaps/hhkb_ansi/keymap.c @@ -1,7 +1,6 @@ // HHKB layout for Zeal60 #include "zeal60.h" -#include "action_layer.h" // [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace // [1,13] is either backslash or ISO Enter @@ -14,44 +13,38 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Default layer [0] = { - {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS}, - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC}, - {KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_GRV }, - {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, FN_TT13}, - {KC_NO, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_NO, KC_RALT, FN_TT23, KC_NO } + {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS}, + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC}, + {KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_GRV }, + {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, FN_MO13}, + {KC_NO, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_NO, KC_RALT, FN_MO23, KC_NO } }, // Fn1 Layer [1] = { - {KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS }, - {KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_EJCT, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_TRNS, KC_DEL }, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} + {KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS }, + {KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_EJCT, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_TRNS, KC_DEL }, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} }, // Fn2 Layer [2] = { - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} }, // Fn3 Layer (zeal60 Configuration) [3] = { - {RESET, EF_DEC, EF_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} + {KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} } }; - -const uint16_t PROGMEM fn_actions[] = { -}; - - - diff --git a/keyboards/zeal60/keymaps/poker2_ansi/keymap.c b/keyboards/zeal60/keymaps/poker2_ansi/keymap.c index dce36252a0be..94e9471ab47b 100644 --- a/keyboards/zeal60/keymaps/poker2_ansi/keymap.c +++ b/keyboards/zeal60/keymaps/poker2_ansi/keymap.c @@ -1,7 +1,6 @@ // Poker2 ANSI layout for Zeal60 #include "zeal60.h" -#include "action_layer.h" // [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace // [1,13] is either backslash or ISO Enter @@ -14,38 +13,38 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Default layer [0] = { - {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS}, - {KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_NO }, - {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO }, - {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RALT, FN_TT13, FN_TT23, KC_RCTL} + {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS}, + {KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_NO }, + {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO }, + {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RALT, FN_MO13, FN_MO23, KC_RCTL} }, // Fn1 Layer [1] = { - {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, - {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS}, - {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} + {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, + {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS}, + {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} }, // Fn2 Layer [2] = { - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} }, // Fn3 Layer (zeal60 Configuration) [3] = { - {RESET, EF_DEC, EF_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} + {KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} } }; diff --git a/keyboards/zeal60/keymaps/poker2_iso/keymap.c b/keyboards/zeal60/keymaps/poker2_iso/keymap.c index 46acebfa11f9..8ce15fae3c70 100644 --- a/keyboards/zeal60/keymaps/poker2_iso/keymap.c +++ b/keyboards/zeal60/keymaps/poker2_iso/keymap.c @@ -1,7 +1,6 @@ // Poker2 ANSI layout for Zeal60 #include "zeal60.h" -#include "action_layer.h" // [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace // [1,13] is either backslash or ISO Enter @@ -14,38 +13,38 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Default layer [0] = { - {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_ENT }, - {KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_NO }, - {KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO }, - {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RALT, FN_TT13, FN_TT23, KC_RCTL} + {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_ENT }, + {KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_NO }, + {KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO }, + {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RALT, FN_MO13, FN_MO23, KC_RCTL} }, // Fn1 Layer [1] = { - {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, - {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS}, - {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} + {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, + {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS}, + {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} }, // Fn2 Layer [2] = { - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} }, // Fn3 Layer (zeal60 Configuration) [3] = { - {RESET, EF_DEC, EF_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} + {KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} } }; diff --git a/keyboards/zeal60/keymaps/test/config.h b/keyboards/zeal60/keymaps/test/config.h index 6150f938718d..7053731fcf9f 100644 --- a/keyboards/zeal60/keymaps/test/config.h +++ b/keyboards/zeal60/keymaps/test/config.h @@ -1,3 +1,5 @@ +// This is only used for factory test, some features are disabled + #ifndef CONFIG_USER_H #define CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/test/keymap.c b/keyboards/zeal60/keymaps/test/keymap.c index de2d02b3dfd5..4a978ffd364f 100644 --- a/keyboards/zeal60/keymaps/test/keymap.c +++ b/keyboards/zeal60/keymaps/test/keymap.c @@ -1,7 +1,6 @@ -// Poker2 ANSI layout for Zeal60 +// Test layout for Zeal60 - This is only used for factory test, some features are disabled #include "zeal60.h" -#include "action_layer.h" // [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace // [1,13] is either backslash or ISO Enter @@ -14,38 +13,38 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Default layer [0] = { - {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS}, - {KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_NO }, - {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO }, - {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RALT, FN_TT13, FN_TT23, KC_RCTL} + {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS}, + {KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_NO }, + {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO }, + {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RALT, FN_MO13, FN_MO23, KC_RCTL} }, // Fn1 Layer [1] = { - {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, - {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS}, - {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_NO }, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} + {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, + {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS}, + {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} }, // Fn2 Layer [2] = { - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} }, // Fn3 Layer (zeal60 Configuration) [3] = { - {RESET, EF_DEC, EF_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} + {KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} } }; diff --git a/keyboards/zeal60/zeal60.c b/keyboards/zeal60/zeal60.c index e85fff52ea8b..ec9d13a24d0e 100644 --- a/keyboards/zeal60/zeal60.c +++ b/keyboards/zeal60/zeal60.c @@ -24,13 +24,13 @@ void raw_hid_receive( uint8_t *data, uint8_t length ) case id_keymap_keycode_load: { msg_keymap_keycode_load *msg = (msg_keymap_keycode_load*)&data[1]; - msg->keycode = keymap_keycode_load( msg->layer, msg->row, msg->col ); + msg->keycode = keymap_keycode_load( msg->layer, msg->row, msg->column ); break; } case id_keymap_keycode_save: { msg_keymap_keycode_save *msg = (msg_keymap_keycode_save*)&data[1]; - keymap_keycode_save( msg->layer, msg->row, msg->col, msg->keycode); + keymap_keycode_save( msg->layer, msg->row, msg->column, msg->keycode); break; } case id_keymap_default_save: @@ -39,10 +39,10 @@ void raw_hid_receive( uint8_t *data, uint8_t length ) break; } #endif // USE_KEYMAPS_IN_EEPROM - case id_backlight_config_set_flags: + case id_backlight_config_set_values: { - msg_backlight_config_set_flags *msg = (msg_backlight_config_set_flags*)&data[1]; - backlight_config_set_flags(msg->flags); + msg_backlight_config_set_values *msg = (msg_backlight_config_set_values*)&data[1]; + backlight_config_set_values(msg); backlight_config_save(); backlight_init_drivers(); break; @@ -57,7 +57,7 @@ void raw_hid_receive( uint8_t *data, uint8_t length ) case id_backlight_set_key_color: { msg_backlight_set_key_color *msg = (msg_backlight_set_key_color*)&data[1]; - backlight_set_key_color(msg->row, msg->col, msg->hsv); + backlight_set_key_color(msg->row, msg->column, msg->hsv); break; } default: @@ -88,17 +88,17 @@ void bootmagic_lite(void) // If the Esc and space bar are held down on power up, // reset the EEPROM valid state and jump to bootloader. - // Assumes Esc is at [0,0] and spacebar is at [4,7]. - // This isn't very generalized, but we need something that doesn't - // rely on user's keymaps in firmware or EEPROM. - if ( ( matrix_get_row(0) & (1<<0) ) && - ( matrix_get_row(4) & (1<<7) ) ) + // Assumes Esc is at [0,0] and spacebar is at [4,7]. + // This isn't very generalized, but we need something that doesn't + // rely on user's keymaps in firmware or EEPROM. + if ( ( matrix_get_row(0) & (1<<0) ) && + ( matrix_get_row(4) & (1<<7) ) ) { - // Set the Zeal60 specific EEPROM state as invalid. + // Set the Zeal60 specific EEPROM state as invalid. eeprom_set_valid(false); - // Set the TMK/QMK EEPROM state as invalid. + // Set the TMK/QMK EEPROM state as invalid. eeconfig_disable(); - // Jump to bootloader. + // Jump to bootloader. bootloader_jump(); } } @@ -127,12 +127,12 @@ void matrix_init_kb(void) for ( int row=0; row < MATRIX_ROWS; row++ ) { HSV hsv; - for ( int col=0; col < MATRIX_COLS; col++ ) + for ( int column=0; column < MATRIX_COLS; column++ ) { hsv.h = rand() & 0xFF; hsv.s = rand() & 0xFF; hsv.v = 255; - backlight_set_key_color( row, col, hsv ); + backlight_set_key_color( row, column, hsv ); } } @@ -141,12 +141,12 @@ void matrix_init_kb(void) keymap_default_save(); // Save the magic number last, in case saving was interrupted - eeprom_set_valid(true); + eeprom_set_valid(true); } #endif - // Initialize LED drivers for backlight. - backlight_init_drivers(); + // Initialize LED drivers for backlight. + backlight_init_drivers(); backlight_timer_init(); backlight_timer_enable(); @@ -371,20 +371,28 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) void led_set_kb(uint8_t usb_led) { if (usb_led & (1<x += 4; - break; + break; case 36+16: // LC16A if ( !g_config.use_split_left_shift ) point->x += 8; @@ -119,7 +127,7 @@ void map_led_to_point( uint8_t index, Point *point ) // C16, C15, C5, C4, C3, C2, C1, D9, D10, D11, D12, D6, D7, D8, // C17, C8, C7, C6, ---, ---, ---, C0, ---, D13, D14, D15, D16, D17, // -const uint8_t g_map_row_col_to_led[5][14] PROGMEM = { +const uint8_t g_map_row_column_to_led[5][14] PROGMEM = { { 0+17, 0+16, 0+15, 0+14, 0+13, 0+12, 0+11, 0+10, 0+9, 18+0, 18+1, 18+2, 18+3, 18+4 }, { 0+7, 0+6, 0+5, 0+4, 0+3, 0+2, 0+1, 0+0, 18+9, 18+10, 18+11, 18+12, 18+13, 18+14 }, { 0+8, 36+14, 36+13, 36+12, 36+11, 36+10, 36+9, 54+0, 54+1, 54+2, 54+3, 54+4, 54+5, 18+5 }, @@ -128,18 +136,19 @@ const uint8_t g_map_row_col_to_led[5][14] PROGMEM = { }; -void map_row_col_to_led( uint8_t row, uint8_t col, uint8_t *led ) +void map_row_column_to_led( uint8_t row, uint8_t column, uint8_t *led ) { *led = 255; - if ( row < MATRIX_ROWS && col < MATRIX_COLS ) + if ( row < MATRIX_ROWS && column < MATRIX_COLS ) { - *led = pgm_read_byte(&g_map_row_col_to_led[row][col]); + *led = pgm_read_byte(&g_map_row_column_to_led[row][column]); } } void backlight_update_pwm_buffers(void) { IS31FL3731_update_pwm_buffers( ISSI_ADDR_1, ISSI_ADDR_2 ); + IS31FL3731_update_led_control_registers( ISSI_ADDR_1, ISSI_ADDR_2 ); } void backlight_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) @@ -152,11 +161,13 @@ void backlight_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) IS31FL3731_set_color_all( red, green, blue ); } -void backlight_set_key_hit(uint8_t row, uint8_t col) +void backlight_set_key_hit(uint8_t row, uint8_t column) { uint8_t led; - map_row_col_to_led(row,col,&led); + map_row_column_to_led(row,column,&led); g_key_hit[led] = 0; + + g_any_key_hit = 0; } // This is (F_CPU/1024) / 20 Hz @@ -195,15 +206,71 @@ void backlight_timer_disable(void) TIMSK3 &= ~_BV(OCIE3A); } +void backlight_set_suspend_state(bool state) +{ + g_suspend_state = state; +} + +// This tests the LEDs +// Note that it will change the LED control registers +// in the LED drivers, and leave them in an invalid +// state for other backlight effects. +// ONLY USE THIS FOR TESTING LEDS! void backlight_effect_test(void) { - uint8_t offset = (g_tick<<3) & 0xFF; - // Relies on hue being 8-bit and wrapping - HSV hsv = { .h = offset, .s = 255, .v = 127 }; - RGB rgb = hsv_to_rgb( hsv ); + if ( g_tick < 4*20 ) + { + backlight_set_color_all( 255, 0, 0 ); + return; + } + else if ( g_tick < 7*20 ) + { + backlight_set_color_all( 0, 255, 0 ); + return; + } + else if ( g_tick < 10*20 ) + { + backlight_set_color_all( 0, 0, 255 ); + return; + } + else if ( g_tick < 13*20 ) + { + backlight_set_color_all( 255, 255, 255 ); + return; + } - backlight_set_color_all( rgb.r, rgb.g, rgb.b ); - } + static uint8_t color = 0; // 0,1,2 for R,G,B + static uint8_t row = 0; + static uint8_t column = 0; + + static uint8_t tick = 0; + tick++; + + if ( tick > 2 ) + { + tick = 0; + column++; + } + if ( column > 14 ) + { + column = 0; + row++; + } + if ( row > 4 ) + { + row = 0; + color++; + } + if ( color > 2 ) + { + color = 0; + } + + uint8_t index; + map_row_column_to_led( row, column, &index ); + backlight_set_color_all( 255, 255, 255 ); + backlight_test_led( index, color==0, color==1, color==2 ); +} // All LEDs off void backlight_effect_all_off(void) @@ -227,13 +294,13 @@ void backlight_effect_alphas_mods(void) for ( int row = 0; row < MATRIX_ROWS; row++ ) { - for ( int col = 0; col < MATRIX_COLS; col++ ) + for ( int column = 0; column < MATRIX_COLS; column++ ) { uint8_t index; - map_row_col_to_led( row, col, &index ); + map_row_column_to_led( row, column, &index ); if ( index < 72 ) { - if ( ( g_config.alphas_mods[row] & (0b0010000000000000>>col) ) == 0 ) + if ( ( g_config.alphas_mods[row] & (0b0010000000000000>>column) ) == 0 ) { backlight_set_color( index, rgb1.r, rgb1.g, rgb1.b ); } @@ -287,15 +354,14 @@ void backlight_effect_cycle_all(void) for ( int i=0; i<72; i++ ) { uint16_t offset2 = g_key_hit[i]<<2; - // stabilizer LEDs use spacebar hits if ( i == 36+6 || i == 54+13 || // LC6, LD13 ( g_config.use_7u_spacebar && i == 54+14 ) ) // LD14 { offset2 = g_key_hit[36+0]<<2; } - offset2 = (offset2<=63) ? (63-offset2) : 0; + HSV hsv = { .h = offset+offset2, .s = 255, .v = g_config.brightness }; RGB rgb = hsv_to_rgb( hsv ); backlight_set_color( i, rgb.r, rgb.g, rgb.b ); @@ -310,14 +376,23 @@ void backlight_effect_cycle_all(void) Point point; for ( int i=0; i<72; i++ ) { + uint16_t offset2 = g_key_hit[i]<<2; + // stabilizer LEDs use spacebar hits + if ( i == 36+6 || i == 54+13 || // LC6, LD13 + ( g_config.use_7u_spacebar && i == 54+14 ) ) // LD14 + { + offset2 = g_key_hit[36+0]<<2; + } + offset2 = (offset2<=63) ? (63-offset2) : 0; + map_led_to_point( i, &point ); // Relies on hue being 8-bit and wrapping - hsv.h = point.x + offset; + hsv.h = point.x + offset + offset2; rgb = hsv_to_rgb( hsv ); backlight_set_color( i, rgb.r, rgb.g, rgb.b ); - } + } } - + void backlight_effect_cycle_up_down(void) { uint8_t offset = g_tick & 0xFF; @@ -326,9 +401,18 @@ void backlight_effect_cycle_up_down(void) Point point; for ( int i=0; i<72; i++ ) { + uint16_t offset2 = g_key_hit[i]<<2; + // stabilizer LEDs use spacebar hits + if ( i == 36+6 || i == 54+13 || // LC6, LD13 + ( g_config.use_7u_spacebar && i == 54+14 ) ) // LD14 + { + offset2 = g_key_hit[36+0]<<2; + } + offset2 = (offset2<=63) ? (63-offset2) : 0; + map_led_to_point( i, &point ); // Relies on hue being 8-bit and wrapping - hsv.h = point.y + offset; + hsv.h = point.y + offset + offset2; rgb = hsv_to_rgb( hsv ); backlight_set_color( i, rgb.r, rgb.g, rgb.b ); } @@ -352,6 +436,11 @@ ISR(TIMER3_COMPA_vect) { g_tick++; + if ( g_any_key_hit < 0xFFFFFFFF ) + { + g_any_key_hit++; + } + // delay 1 second before driving LEDs if ( g_tick < 20 ) { @@ -366,67 +455,63 @@ ISR(TIMER3_COMPA_vect) } } - // Store backlight config to EEPROM every 6.4 seconds - // A slightly hacky way of reducing the number of EEPROM writes - // should the user be hammering away on backlight changes - // Paranoid? Probably... - // Note this will only write if it's different, so it's safe to - // call often. - if ( ( g_tick & 0x7F ) == 0 ) - { - backlight_config_save(); - } - #ifdef ZEAL60_TEST backlight_effect_test(); - return; + return; #endif + // Ideally we would also stop sending zeros to the LED driver PWM buffers + // while suspended and just do a software shutdown. This is a cheap hack for now. + uint8_t effect = ( ( g_suspend_state && g_config.disable_when_usb_suspended ) || + ( g_config.disable_after_timeout > 0 && g_any_key_hit > g_config.disable_after_timeout*60*20 ) ) + ? 0 : g_config.effect; + // this gets ticked at 20 Hz. // each effect can opt to do calculations // and/or request PWM buffer updates. - if ( g_config.effect == 0 ) + if ( effect == 0 ) { backlight_effect_all_off(); } - else if ( g_config.effect == 1 ) + else if ( effect == 1 ) { backlight_effect_solid_color(); } - else if ( g_config.effect == 2 ) + else if ( effect == 2 ) { backlight_effect_alphas_mods(); } - else if ( g_config.effect == 3 ) + else if ( effect == 3 ) { backlight_effect_gradient_up_down(); } - else if ( g_config.effect == 4 ) + else if ( effect == 4 ) { backlight_effect_cycle_all(); } - else if ( g_config.effect == 5 ) + else if ( effect == 5 ) { backlight_effect_cycle_left_right(); } - else if ( g_config.effect == 6 ) + else if ( effect == 6 ) { backlight_effect_cycle_up_down(); } - else if ( g_config.effect >= 7 ) + else if ( effect >= 7 ) { backlight_effect_custom(); } } -void backlight_config_set_flags(uint16_t flags) +void backlight_config_set_values(msg_backlight_config_set_values *values) { - // TODO: replace with #define bitmasks - g_config.use_split_backspace = ( flags&(1<<0) ? true : false ); - g_config.use_split_left_shift = ( flags&(1<<1) ? true : false ); - g_config.use_split_right_shift = ( flags&(1<<2) ? true : false ); - g_config.use_7u_spacebar = ( flags&(1<<3) ? true : false ); - g_config.use_iso_enter = ( flags&(1<<4) ? true : false ); + g_config.use_split_backspace = values->use_split_backspace; + g_config.use_split_left_shift = values->use_split_left_shift; + g_config.use_split_right_shift = values->use_split_right_shift; + g_config.use_7u_spacebar = values->use_7u_spacebar; + g_config.use_iso_enter = values->use_iso_enter; + g_config.disable_when_usb_suspended = values->disable_when_usb_suspended; + g_config.disable_after_timeout = values->disable_after_timeout; } void backlight_config_set_alphas_mods( uint16_t *alphas_mods ) @@ -435,145 +520,49 @@ void backlight_config_set_alphas_mods( uint16_t *alphas_mods ) { g_config.alphas_mods[i] = alphas_mods[i]; } + + backlight_config_save(); } void backlight_config_load(void) { - void *addr = EEPROM_BACKLIGHT_CONFIG_ADDR; - uint16_t flags = eeprom_read_word(addr); - addr += 2; - backlight_config_set_flags(flags); - - for ( int i=0; i<5; i++ ) - { - g_config.alphas_mods[i] = eeprom_read_word(addr); - addr += 2; - } - - g_config.brightness = eeprom_read_byte( addr++ ); - g_config.effect = eeprom_read_byte( addr++ ); - g_config.color_1.h = eeprom_read_byte( addr++ ); - g_config.color_1.s = eeprom_read_byte( addr++ ); - g_config.color_1.v = eeprom_read_byte( addr++ ); - g_config.color_2.h = eeprom_read_byte( addr++ ); - g_config.color_2.s = eeprom_read_byte( addr++ ); - g_config.color_2.v = eeprom_read_byte( addr++ ); + eeprom_read_block( &g_config, EEPROM_BACKLIGHT_CONFIG_ADDR, sizeof(zeal_backlight_config) ); } void backlight_config_save(void) { - // TODO: replace with #define bitmasks - uint16_t flags = ( g_config.use_split_backspace ? (1<<0) : 0 ) | - ( g_config.use_split_left_shift ? (1<<1) : 0 ) | - ( g_config.use_split_right_shift ? (1<<2) : 0 ) | - ( g_config.use_7u_spacebar ? (1<<3) : 0 ) | - ( g_config.use_iso_enter ? (1<<4) : 0 ); - - void *addr = EEPROM_BACKLIGHT_CONFIG_ADDR; - eeprom_update_word( addr, flags ); - addr += 2; - - for ( int i=0; i<5; i++ ) - { - eeprom_update_word( addr, g_config.alphas_mods[i] ); - addr += 2; - } - - eeprom_update_byte( addr++, g_config.brightness ); - eeprom_update_byte( addr++, g_config.effect ); - eeprom_update_byte( addr++, g_config.color_1.h ); - eeprom_update_byte( addr++, g_config.color_1.s ); - eeprom_update_byte( addr++, g_config.color_1.v ); - eeprom_update_byte( addr++, g_config.color_2.h ); - eeprom_update_byte( addr++, g_config.color_2.s ); - eeprom_update_byte( addr++, g_config.color_2.v ); + eeprom_update_block( &g_config, EEPROM_BACKLIGHT_CONFIG_ADDR, sizeof(zeal_backlight_config) ); } void backlight_init_drivers(void) { - uint8_t enable_led_LB5 = g_config.use_split_backspace; - uint8_t enable_led_LC15 = g_config.use_split_left_shift; - uint8_t enable_led_LD8 = g_config.use_split_right_shift; - uint8_t enable_led_LD13 = g_config.use_7u_spacebar ? 0 : 1; - sei(); // Initialize TWI TWIInit(); IS31FL3731_init( ISSI_ADDR_1 ); IS31FL3731_init( ISSI_ADDR_2 ); - - // This is how you define which LEDs are present in the matrix. - // If you don't turn off missing LEDs, the LED driver doesn't work properly. - - // This is the bit pattern in the LED control registers - // (per matrix) - // - // R08,R07,R06,R05,R04,R03,R02,R01 - // G08,G07,G06,G05,G04,G03,G02,R00 - // B08,B07,B06,B05,B04,B03,G01,G00 - // - , - , - , - , - ,B02,B01,B00 - // - , - , - , - , - , - , - , - - // B17,B16,B15, - , - , - , - , - - // G17,G16,B14,B13,B12,B11,B19,B09 - // R17,G15,G14,G13,G12,G11,G10,G09 - // R16,R15,R14,R13,R12,R11,R10,R09 - // - // I could probably write some fancy wrapper for this to allow easy - // reconfiguration, but it's really too much work and will probably use - // up program/data. Easier to just work out which LEDs are not being used - // by referencing the Nth LED per matrix and replacing some 1s with 0s below. - // - // Since this never needs to change at runtime, and only happens once, - // it doesn't matter that it's 36 discrete calls ;-) - // - - // Driver 1, Matrix A (LA0-LA17) - IS31FL3731_write_register(ISSI_ADDR_1, 0x00, 0b11111111 ); - IS31FL3731_write_register(ISSI_ADDR_1, 0x02, 0b11111111 ); - IS31FL3731_write_register(ISSI_ADDR_1, 0x04, 0b11111111 ); - IS31FL3731_write_register(ISSI_ADDR_1, 0x06, 0b00000111 ); - IS31FL3731_write_register(ISSI_ADDR_1, 0x08, 0b00000000 ); - IS31FL3731_write_register(ISSI_ADDR_1, 0x0A, 0b11100000 ); - IS31FL3731_write_register(ISSI_ADDR_1, 0x0C, 0b11111111 ); - IS31FL3731_write_register(ISSI_ADDR_1, 0x0E, 0b11111111 ); - IS31FL3731_write_register(ISSI_ADDR_1, 0x10, 0b11111111 ); - - // Driver 1, Matrix B (LB0-LB17) - // Disabled LB6 LB7 LB8 LB15 LB16 LB17 - // Not present on Zeal60. Present on Zeal65 - - IS31FL3731_write_register(ISSI_ADDR_1, 0x01, 0b00001111 | (enable_led_LB5<<4)); - IS31FL3731_write_register(ISSI_ADDR_1, 0x03, 0b00001111 | (enable_led_LB5<<4)); - IS31FL3731_write_register(ISSI_ADDR_1, 0x05, 0b00001111 | (enable_led_LB5<<4)); - IS31FL3731_write_register(ISSI_ADDR_1, 0x07, 0b00000111 ); - IS31FL3731_write_register(ISSI_ADDR_1, 0x09, 0b00000000 ); - IS31FL3731_write_register(ISSI_ADDR_1, 0x0B, 0b00000000 ); - IS31FL3731_write_register(ISSI_ADDR_1, 0x0D, 0b00111111 ); - IS31FL3731_write_register(ISSI_ADDR_1, 0x0F, 0b00111111 ); - IS31FL3731_write_register(ISSI_ADDR_1, 0x11, 0b00111111 ); - - // Driver 2, Matrix A (LC0-LC17) - IS31FL3731_write_register(ISSI_ADDR_2, 0x00, 0b11111111 ); - IS31FL3731_write_register(ISSI_ADDR_2, 0x02, 0b11111111 ); - IS31FL3731_write_register(ISSI_ADDR_2, 0x04, 0b11111111 ); - IS31FL3731_write_register(ISSI_ADDR_2, 0x06, 0b00000111 ); - IS31FL3731_write_register(ISSI_ADDR_2, 0x08, 0b00000000 ); - IS31FL3731_write_register(ISSI_ADDR_2, 0x0A, 0b11000000 | (enable_led_LC15<<5)); - IS31FL3731_write_register(ISSI_ADDR_2, 0x0C, 0b11111111 ); - IS31FL3731_write_register(ISSI_ADDR_2, 0x0E, 0b10111111 | (enable_led_LC15<<6)); - IS31FL3731_write_register(ISSI_ADDR_2, 0x10, 0b10111111 | (enable_led_LC15<<6)); - - // Driver 2, Matrix B (LD0-LD17) - IS31FL3731_write_register(ISSI_ADDR_2, 0x01, 0b01111111 | (enable_led_LD8<<7)); - IS31FL3731_write_register(ISSI_ADDR_2, 0x03, 0b01111111 | (enable_led_LD8<<7)); - IS31FL3731_write_register(ISSI_ADDR_2, 0x05, 0b01111111 | (enable_led_LD8<<7)); - IS31FL3731_write_register(ISSI_ADDR_2, 0x07, 0b00000111 ); - IS31FL3731_write_register(ISSI_ADDR_2, 0x09, 0b00000000 ); - IS31FL3731_write_register(ISSI_ADDR_2, 0x0B, 0b11100000 ); - IS31FL3731_write_register(ISSI_ADDR_2, 0x0D, 0b11101111 | (enable_led_LD13<<4)); - IS31FL3731_write_register(ISSI_ADDR_2, 0x0F, 0b11101111 | (enable_led_LD13<<4)); - IS31FL3731_write_register(ISSI_ADDR_2, 0x11, 0b11101111 | (enable_led_LD13<<4)); + + for ( int index = 0; index < 72; index++ ) + { + // OR the possible "disabled" cases together, then NOT the result to get the enabled state + // LB6 LB7 LB8 LB15 LB16 LB17 not present on Zeal60, but present on Zeal65 + bool enabled = !( ( index == 18+5 && !g_config.use_split_backspace ) || // LB5 + ( index == 36+15 && !g_config.use_split_left_shift ) || // LC15 + ( index == 54+8 && !g_config.use_split_right_shift ) || // LD8 + ( index == 54+13 && g_config.use_7u_spacebar ) || // LD13 + ( index == 18+6 ) || // LB6 + ( index == 18+7 ) || // LB7 + ( index == 18+8 ) || // LB8 + ( index == 18+15 ) || // LB15 + ( index == 18+16 ) || // LB16 + ( index == 18+17 ) ); // LB17 + + // This only caches it for later + IS31FL3731_set_led_control_register( index, enabled, enabled, enabled ); + } + // This actually updates the LED drivers + IS31FL3731_update_led_control_registers( ISSI_ADDR_1, ISSI_ADDR_2 ); // TODO: put the 1 second startup delay here? @@ -686,10 +675,10 @@ void backlight_get_key_color( uint8_t led, HSV *hsv ) hsv->v = eeprom_read_byte(address+2); } -void backlight_set_key_color( uint8_t row, uint8_t col, HSV hsv ) +void backlight_set_key_color( uint8_t row, uint8_t column, HSV hsv ) { uint8_t led; - map_row_col_to_led( row, col, &led ); + map_row_column_to_led( row, column, &led ); if ( led < 72 ) { void *address = backlight_get_custom_key_color_eeprom_address(led); @@ -698,3 +687,18 @@ void backlight_set_key_color( uint8_t row, uint8_t col, HSV hsv ) eeprom_update_byte(address+2, hsv.v); } } + +void backlight_test_led( uint8_t index, bool red, bool green, bool blue ) +{ + for ( int i=0; i<72; i++ ) + { + if ( i == index ) + { + IS31FL3731_set_led_control_register( i, red, green, blue ); + } + else + { + IS31FL3731_set_led_control_register( i, false, false, false ); + } + } +} diff --git a/keyboards/zeal60/zeal_backlight.h b/keyboards/zeal60/zeal_backlight.h index 1d4821fe8c98..de7c6e2eaa8f 100644 --- a/keyboards/zeal60/zeal_backlight.h +++ b/keyboards/zeal60/zeal_backlight.h @@ -5,23 +5,27 @@ #include #include "zeal_color.h" +#include "zeal_rpc.h" -typedef struct zeal_backlight_config +typedef struct { - bool use_split_backspace:1; - bool use_split_left_shift:1; - bool use_split_right_shift:1; - bool use_7u_spacebar:1; - bool use_iso_enter:1; - uint16_t alphas_mods[5]; - uint8_t brightness; - uint8_t effect; - - HSV color_1; - HSV color_2; -} zeal_backlight_config; - -void backlight_config_set_flags(uint16_t value); + bool use_split_backspace:1; // | + bool use_split_left_shift:1; // | + bool use_split_right_shift:1; // | + bool use_7u_spacebar:1; // | + bool use_iso_enter:1; // | + bool disable_when_usb_suspended:1; // | + bool __pad6:1; // | + bool __pad7:1; // 1 byte + uint8_t disable_after_timeout; // 1 byte + uint16_t alphas_mods[5]; // 10 bytes + uint8_t brightness; // 1 byte + uint8_t effect; // 1 byte + HSV color_1; // 3 bytes + HSV color_2; // 3 bytes +} zeal_backlight_config; // = 20 bytes + +void backlight_config_set_values(msg_backlight_config_set_values *values); void backlight_config_set_alphas_mods( uint16_t *value ); void backlight_config_load(void); void backlight_config_save(void); @@ -32,6 +36,8 @@ void backlight_timer_init(void); void backlight_timer_enable(void); void backlight_timer_disable(void); +void backlight_set_suspend_state(bool state); + // This should not be called from an interrupt // (eg. from a timer interrupt). // Call this while idle (in between matrix scans). @@ -57,6 +63,8 @@ void backlight_color_2_sat_decrease(void); void *backlight_get_key_color_eeprom_address(uint8_t led); void backlight_get_key_color( uint8_t led, HSV *hsv ); -void backlight_set_key_color( uint8_t row, uint8_t col, HSV hsv ); +void backlight_set_key_color( uint8_t row, uint8_t column, HSV hsv ); + +void backlight_test_led( uint8_t index, bool red, bool green, bool blue ); #endif //ZEAL_BACKLIGHT_H diff --git a/keyboards/zeal60/zeal_color.c b/keyboards/zeal60/zeal_color.c index 9497dd5b2372..974f4156cc06 100644 --- a/keyboards/zeal60/zeal_color.c +++ b/keyboards/zeal60/zeal_color.c @@ -1,105 +1,101 @@ - #include "zeal_color.h" #include "progmem.h" - // Lightness curve using the CIE 1931 lightness formula -//Generated by the python script provided in http://jared.geek.nz/2013/feb/linear-led-pwm -const uint8_t DIM_CURVE_ZEAL[] PROGMEM = { - 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, - 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, - 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, - 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, - 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, - 13, 14, 14, 15, 15, 15, 16, 16, 17, 17, - 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, - 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, - 28, 28, 29, 29, 30, 31, 31, 32, 32, 33, - 34, 34, 35, 36, 37, 37, 38, 39, 39, 40, - 41, 42, 43, 43, 44, 45, 46, 47, 47, 48, - 49, 50, 51, 52, 53, 54, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 70, 71, 72, 73, 74, 75, 76, 77, 79, - 80, 81, 82, 83, 85, 86, 87, 88, 90, 91, - 92, 94, 95, 96, 98, 99, 100, 102, 103, 105, - 106, 108, 109, 110, 112, 113, 115, 116, 118, 120, - 121, 123, 124, 126, 128, 129, 131, 132, 134, 136, - 138, 139, 141, 143, 145, 146, 148, 150, 152, 154, - 155, 157, 159, 161, 163, 165, 167, 169, 171, 173, - 175, 177, 179, 181, 183, 185, 187, 189, 191, 193, - 196, 198, 200, 202, 204, 207, 209, 211, 214, 216, - 218, 220, 223, 225, 228, 230, 232, 235, 237, 240, - 242, 245, 247, 250, 252, 255, +// Generated by the python script provided in http://jared.geek.nz/2013/feb/linear-led-pwm +const uint8_t g_cie_curve[] PROGMEM = { + 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, + 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, + 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, + 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, + 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, + 13, 14, 14, 15, 15, 15, 16, 16, 17, 17, + 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, + 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, + 28, 28, 29, 29, 30, 31, 31, 32, 32, 33, + 34, 34, 35, 36, 37, 37, 38, 39, 39, 40, + 41, 42, 43, 43, 44, 45, 46, 47, 47, 48, + 49, 50, 51, 52, 53, 54, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 70, 71, 72, 73, 74, 75, 76, 77, 79, + 80, 81, 82, 83, 85, 86, 87, 88, 90, 91, + 92, 94, 95, 96, 98, 99, 100, 102, 103, 105, + 106, 108, 109, 110, 112, 113, 115, 116, 118, 120, + 121, 123, 124, 126, 128, 129, 131, 132, 134, 136, + 138, 139, 141, 143, 145, 146, 148, 150, 152, 154, + 155, 157, 159, 161, 163, 165, 167, 169, 171, 173, + 175, 177, 179, 181, 183, 185, 187, 189, 191, 193, + 196, 198, 200, 202, 204, 207, 209, 211, 214, 216, + 218, 220, 223, 225, 228, 230, 232, 235, 237, 240, + 242, 245, 247, 250, 252, 255, }; - RGB hsv_to_rgb( HSV hsv ) { - RGB rgb; - uint8_t region, p, q, t; - uint16_t h, s, v, remainder; + RGB rgb; + uint8_t region, p, q, t; + uint16_t h, s, v, remainder; - if (hsv.s == 0) - { - rgb.r = hsv.v; - rgb.g = hsv.v; - rgb.b = hsv.v; - return rgb; - } + if ( hsv.s == 0 ) + { + rgb.r = hsv.v; + rgb.g = hsv.v; + rgb.b = hsv.v; + return rgb; + } - h = hsv.h; - s = hsv.s; - v = hsv.v; + h = hsv.h; + s = hsv.s; + v = hsv.v; - region = h / 43; - remainder = (h - (region * 43)) * 6; + region = h / 43; + remainder = (h - (region * 43)) * 6; - p = (v * (255 - s)) >> 8; - q = (v * (255 - ((s * remainder) >> 8))) >> 8; - t = (v * (255 - ((s * (255 - remainder)) >> 8))) >> 8; + p = (v * (255 - s)) >> 8; + q = (v * (255 - ((s * remainder) >> 8))) >> 8; + t = (v * (255 - ((s * (255 - remainder)) >> 8))) >> 8; - switch (region) - { - case 0: - rgb.r = v; - rgb.g = t; - rgb.b = p; - break; - case 1: - rgb.r = q; - rgb.g = v; - rgb.b = p; - break; - case 2: - rgb.r = p; - rgb.g = v; - rgb.b = t; - break; - case 3: - rgb.r = p; - rgb.g = q; - rgb.b = v; - break; - case 4: - rgb.r = t; - rgb.g = p; - rgb.b = v; - break; - default: - rgb.r = v; - rgb.g = p; - rgb.b = q; - break; - } + switch ( region ) + { + case 0: + rgb.r = v; + rgb.g = t; + rgb.b = p; + break; + case 1: + rgb.r = q; + rgb.g = v; + rgb.b = p; + break; + case 2: + rgb.r = p; + rgb.g = v; + rgb.b = t; + break; + case 3: + rgb.r = p; + rgb.g = q; + rgb.b = v; + break; + case 4: + rgb.r = t; + rgb.g = p; + rgb.b = v; + break; + default: + rgb.r = v; + rgb.g = p; + rgb.b = q; + break; + } - rgb.r = pgm_read_byte(&DIM_CURVE_ZEAL[rgb.r]); - rgb.g = pgm_read_byte(&DIM_CURVE_ZEAL[rgb.g]); - rgb.b = pgm_read_byte(&DIM_CURVE_ZEAL[rgb.b]); + rgb.r = pgm_read_byte( &g_cie_curve[rgb.r] ); + rgb.g = pgm_read_byte( &g_cie_curve[rgb.g] ); + rgb.b = pgm_read_byte( &g_cie_curve[rgb.b] ); - return rgb; + return rgb; } - diff --git a/keyboards/zeal60/zeal_eeprom.h b/keyboards/zeal60/zeal_eeprom.h index 566c8fc27d3a..f88d9c2d9656 100644 --- a/keyboards/zeal60/zeal_eeprom.h +++ b/keyboards/zeal60/zeal_eeprom.h @@ -11,7 +11,7 @@ // Bump this every time we change what we store // This will automatically reset the EEPROM with defaults // and avoid loading invalid data from the EEPROM -#define EEPROM_VERSION 0x00 +#define EEPROM_VERSION 0x01 #define EEPROM_VERSION_ADDR ((void*)34) #define EEPROM_BACKLIGHT_CONFIG_ADDR ((void*)35) diff --git a/keyboards/zeal60/zeal_keymap.c b/keyboards/zeal60/zeal_keymap.c index f400c2fd47b5..b4d2b614cb28 100644 --- a/keyboards/zeal60/zeal_keymap.c +++ b/keyboards/zeal60/zeal_keymap.c @@ -6,25 +6,25 @@ #if USE_KEYMAPS_IN_EEPROM -void *keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t col) +void *keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t column) { // TODO: optimize this with some left shifts return EEPROM_KEYMAP_ADDR + ( layer * MATRIX_ROWS * MATRIX_COLS * 2 ) + - ( row * MATRIX_COLS * 2 ) + ( col * 2 ); + ( row * MATRIX_COLS * 2 ) + ( column * 2 ); } -uint16_t keymap_keycode_load(uint8_t layer, uint8_t row, uint8_t col) +uint16_t keymap_keycode_load(uint8_t layer, uint8_t row, uint8_t column) { - void *address = keymap_key_to_eeprom_address(layer, row, col); + void *address = keymap_key_to_eeprom_address(layer, row, column); // Big endian, so we can read/write EEPROM directly from host if we want uint16_t keycode = eeprom_read_byte(address) << 8; keycode |= eeprom_read_byte(address + 1); return keycode; } -void keymap_keycode_save(uint8_t layer, uint8_t row, uint8_t col, uint16_t keycode) +void keymap_keycode_save(uint8_t layer, uint8_t row, uint8_t column, uint16_t keycode) { - void *address = keymap_key_to_eeprom_address(layer, row, col); + void *address = keymap_key_to_eeprom_address(layer, row, column); // Big endian, so we can read/write EEPROM directly from host if we want eeprom_update_byte(address, (uint8_t)(keycode >> 8)); eeprom_update_byte(address+1, (uint8_t)(keycode & 0xFF)); @@ -37,9 +37,9 @@ void keymap_default_save(void) { for ( int row = 0; row < MATRIX_ROWS; row++ ) { - for ( int col = 0; col < MATRIX_COLS; col++ ) + for ( int column = 0; column < MATRIX_COLS; column++ ) { - keymap_keycode_save(layer, row, col, KC_EENULL); + keymap_keycode_save(layer, row, column, KC_EENULL); } } } @@ -64,7 +64,7 @@ uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) } } - return pgm_read_word(&keymaps[layer][key.row][key.col]); + return pgm_read_word(&keymaps[layer][key.row][key.col]); } #endif // USE_KEYMAPS_IN_EEPROM diff --git a/keyboards/zeal60/zeal_keymap.h b/keyboards/zeal60/zeal_keymap.h index 5631400ae1f8..5578a0de12c5 100644 --- a/keyboards/zeal60/zeal_keymap.h +++ b/keyboards/zeal60/zeal_keymap.h @@ -6,9 +6,9 @@ #include "zeal_keycode.h" -void *keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t col); -uint16_t keymap_keycode_load(uint8_t layer, uint8_t row, uint8_t col); -void keymap_keycode_save(uint8_t layer, uint8_t row, uint8_t col, uint16_t keycode); +void *keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t column); +uint16_t keymap_keycode_load(uint8_t layer, uint8_t row, uint8_t column); +void keymap_keycode_save(uint8_t layer, uint8_t row, uint8_t column, uint16_t keycode); void keymap_default_save(void); // This overrides the one in quantum/keymap_common.c diff --git a/keyboards/zeal60/zeal_rpc.h b/keyboards/zeal60/zeal_rpc.h index a80971bc82c0..81831d01de27 100644 --- a/keyboards/zeal60/zeal_rpc.h +++ b/keyboards/zeal60/zeal_rpc.h @@ -3,7 +3,7 @@ #include "zeal_color.h" -#define PROTOCOL_VERSION 0x0001 +#define PROTOCOL_VERSION 0x0002 enum { @@ -11,7 +11,7 @@ enum id_keymap_keycode_load, id_keymap_keycode_save, id_keymap_default_save, - id_backlight_config_set_flags, + id_backlight_config_set_values, id_backlight_config_set_alphas_mods, id_backlight_set_key_color, @@ -37,7 +37,7 @@ typedef struct PACKED { uint8_t layer; uint8_t row; - uint8_t col; + uint8_t column; uint16_t keycode; } msg_keymap_keycode_load; @@ -45,14 +45,20 @@ typedef struct PACKED { uint8_t layer; uint8_t row; - uint8_t col; + uint8_t column; uint16_t keycode; } msg_keymap_keycode_save; typedef struct PACKED { - uint16_t flags; -} msg_backlight_config_set_flags; + bool use_split_backspace:1; + bool use_split_left_shift:1; + bool use_split_right_shift:1; + bool use_7u_spacebar:1; + bool use_iso_enter:1; + bool disable_when_usb_suspended:1; + uint8_t disable_after_timeout; +} msg_backlight_config_set_values; typedef struct PACKED { @@ -62,7 +68,7 @@ typedef struct PACKED typedef struct PACKED { uint8_t row; - uint8_t col; + uint8_t column; HSV hsv; } msg_backlight_set_key_color; diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c index 0c81e8361213..3ceeaaf4e9c1 100644 --- a/tmk_core/common/avr/suspend.c +++ b/tmk_core/common/avr/suspend.c @@ -102,8 +102,12 @@ static void power_down(uint8_t wdto) } #endif +__attribute__ ((weak)) void suspend_power_down_kb(void) {} + void suspend_power_down(void) { + suspend_power_down_kb(); + #ifndef NO_SUSPEND_POWER_DOWN power_down(WDTO_15MS); #endif @@ -122,9 +126,13 @@ bool suspend_wakeup_condition(void) return false; } +__attribute__ ((weak)) void suspend_wakeup_init_kb(void) {} + // run immediately after wakeup void suspend_wakeup_init(void) { + suspend_wakeup_init_kb(); + // clear keyboard state clear_keyboard(); #ifdef BACKLIGHT_ENABLE From 4f32bcb604b6a72b17841caeb42097746ab72d77 Mon Sep 17 00:00:00 2001 From: Tushar Singal Date: Wed, 18 Jan 2017 03:39:11 -0800 Subject: [PATCH 23/69] Custom LED brightness scaling will take place after current adjustment in order to avoid being overridden. --- keyboards/zeal60/keymaps/tusing/config.h | 6 +++--- keyboards/zeal60/keymaps/tusing/keymap.c | 4 ++-- quantum/rgblight.c | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/keyboards/zeal60/keymaps/tusing/config.h b/keyboards/zeal60/keymaps/tusing/config.h index 04596833e8c3..c92aaea12649 100644 --- a/keyboards/zeal60/keymaps/tusing/config.h +++ b/keyboards/zeal60/keymaps/tusing/config.h @@ -30,11 +30,11 @@ // Enable current limiting for RGB underglow. #define USB_MAX_POWER_CONSUMPTION 900 -#define RGBSTRIP_CURRENT_LIMIT 400 // Strip current limit in mA. -#define RGBSTRIP_MAX_CURRENT_PER_LIGHT 60 // mA per light when at max brightness. +#define RGBSTRIP_CURRENT_LIMIT 800 // Strip current limit in mA. +#define RGBSTRIP_MAX_CURRENT_PER_LIGHT 40 // mA per light when at max brightness. // Scale brightnes according to BRIGHTNESS_CORRECTION_TABLE in quantum/rgblight.c. // This allows to mitigate uneven brightness from LED underglow strips. -#define LED_BRIGHTNESS_CORRECTION +// #define LED_BRIGHTNESS_CORRECTION #endif diff --git a/keyboards/zeal60/keymaps/tusing/keymap.c b/keyboards/zeal60/keymaps/tusing/keymap.c index 2a9859a2efb7..b1caeefa423b 100644 --- a/keyboards/zeal60/keymaps/tusing/keymap.c +++ b/keyboards/zeal60/keymaps/tusing/keymap.c @@ -20,7 +20,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Default layer: Pressing caps-lock momentarily switches to Layer 1. // This is the default layer. Pressing an invalid keycode on another layer will take you here. [0] = { - {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS}, {MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, _x_ }, {KC_LSFT, _x_ , KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, _x_ }, @@ -30,7 +30,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Layer 1: Pressing Ctrl switches to layer 2. // This is a momentary layer: once you let go of caps, you'll be back in layer 1. [1] = { - {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, + {KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, {_______, KC_VOLD, KC_MUTE, KC_VOLU, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_INS, KC_DEL, _______}, {_______, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _x_ }, {KC_CAPS, _x_ , _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _x_ }, diff --git a/quantum/rgblight.c b/quantum/rgblight.c index b7d28a695b51..51017929eb94 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -434,15 +434,15 @@ void adjust_current(void) { __attribute__ ((weak)) void rgblight_set(void) { + + #if defined(RGBSTRIP_CURRENT_LIMIT) && defined(RGBSTRIP_MAX_CURRENT_PER_LIGHT) + adjust_current(); + #endif #ifdef LED_BRIGHTNESS_CORRECTION correct_brightness(); #endif - #if defined(RGBSTRIP_CURRENT_LIMIT) && defined(RGBSTRIP_MAX_CURRENT_PER_LIGHT) - adjust_current(); - #endif - if (rgblight_config.enable) { #ifdef RGBW ws2812_setleds_rgbw(led, RGBLED_NUM); From 350f1c9d62b51defde2717b72d22677415163b86 Mon Sep 17 00:00:00 2001 From: Ryan MacLean Date: Thu, 19 Jan 2017 23:39:23 -0800 Subject: [PATCH 24/69] Create keymap.c Added split backspace and split shift to ISO layout --- keyboards/zeal60/keymaps/ryanmaclean/keymap.c | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 keyboards/zeal60/keymaps/ryanmaclean/keymap.c diff --git a/keyboards/zeal60/keymaps/ryanmaclean/keymap.c b/keyboards/zeal60/keymaps/ryanmaclean/keymap.c new file mode 100644 index 000000000000..1d389a9e3c81 --- /dev/null +++ b/keyboards/zeal60/keymaps/ryanmaclean/keymap.c @@ -0,0 +1,50 @@ +// Default layout for Zeal60 + +#include "zeal60.h" + +// [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace +// [1,13] is either backslash or ISO Enter +// [2,12] is either ANSI Enter or key left of ISO Enter +// [2,13] is right key of split backspace (e.g. HHKB `~ key) +// [3,1] is right key of split left-shift (e.g ISO key) +// [3,13] is right key of split right-shift (e.g. HHKB Fn key) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +// Default layer +[0] = { + {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS}, + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC}, + {KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_GRV}, + {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, FN_MO13}, + {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RALT, KC_RGUI, FN_MO23, KC_RCTL} +}, + +// Fn1 Layer +[1] = { + {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, + {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS}, + {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, + +// Fn2 Layer +[2] = { + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, + +// Fn3 Layer (zeal60 Configuration) +[3] = { + {KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +} + +}; From 340219d9777e3e43b6fa40a20c8ac15e425aad98 Mon Sep 17 00:00:00 2001 From: Ryan MacLean Date: Thu, 19 Jan 2017 23:40:44 -0800 Subject: [PATCH 25/69] Create config.h Turned on LEDs for new layout --- keyboards/zeal60/keymaps/ryanmaclean/config.h | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 keyboards/zeal60/keymaps/ryanmaclean/config.h diff --git a/keyboards/zeal60/keymaps/ryanmaclean/config.h b/keyboards/zeal60/keymaps/ryanmaclean/config.h new file mode 100644 index 000000000000..81e3c08338aa --- /dev/null +++ b/keyboards/zeal60/keymaps/ryanmaclean/config.h @@ -0,0 +1,24 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +/* enable/disable LEDs based on layout */ +#undef USE_SPLIT_BACKSPACE +#define USE_SPLIT_BACKSPACE 1 + +#undef USE_SPLIT_LEFT_SHIFT +#define USE_SPLIT_LEFT_SHIFT 0 + +#undef USE_SPLIT_RIGHT_SHIFT +#define USE_SPLIT_RIGHT_SHIFT 1 + +#undef USE_7U_SPACEBAR +#define USE_7U_SPACEBAR 0 + +#undef USE_ISO_ENTER +#define USE_ISO_ENTER 0 + + + +#endif //CONFIG_USER_H From 1e100733e7239d1a68c5240aa778083ba5d16d78 Mon Sep 17 00:00:00 2001 From: Tushar Singal Date: Mon, 23 Jan 2017 15:43:48 -0800 Subject: [PATCH 26/69] Fixed bug where left spacebar stabilizer LED (LC06) would adopt color of row above. --- keyboards/zeal60/zeal_backlight.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/zeal60/zeal_backlight.c b/keyboards/zeal60/zeal_backlight.c index 9a5785ff5f28..cf6cf7616f25 100644 --- a/keyboards/zeal60/zeal_backlight.c +++ b/keyboards/zeal60/zeal_backlight.c @@ -64,7 +64,7 @@ const Point g_map_led_to_point[72] PROGMEM = { {144,0}, {160,0}, {176,0}, {192,0}, {216,0}, {224,0}, {255,255}, {255,255}, {255,255}, {136,16}, {152,16}, {168,16}, {184,16}, {200,16}, {220,16}, {255,255}, {255,255}, {255,255}, // LC0..LC17 - {102,64}, {100,48}, {84,48}, {68,48}, {52,48}, {36,48}, {60,48}, {43,64}, {23,64}, + {102,64}, {100,48}, {84,48}, {68,48}, {52,48}, {36,48}, {60,64}, {43,64}, {23,64}, {108,32}, {92,32}, {76,32}, {60,32}, {44,32}, {28,32}, {20,48}, {2,48}, {3,64}, // LD0..LD17 {124,32}, {140,32}, {156,32}, {172,32}, {188,32}, {214,32}, {180,48}, {210,48}, {224,48}, From 47cffecda4851b8ebb75227e79259d670ac7bd56 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Tue, 24 Jan 2017 19:00:07 +1100 Subject: [PATCH 27/69] Added hhkb_wilba keymap --- keyboards/zeal60/keymaps/hhkb_wilba/config.h | 24 +++++++++ keyboards/zeal60/keymaps/hhkb_wilba/keymap.c | 52 ++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 keyboards/zeal60/keymaps/hhkb_wilba/config.h create mode 100644 keyboards/zeal60/keymaps/hhkb_wilba/keymap.c diff --git a/keyboards/zeal60/keymaps/hhkb_wilba/config.h b/keyboards/zeal60/keymaps/hhkb_wilba/config.h new file mode 100644 index 000000000000..be7910b63a39 --- /dev/null +++ b/keyboards/zeal60/keymaps/hhkb_wilba/config.h @@ -0,0 +1,24 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +/* enable/disable LEDs based on layout */ +#undef USE_SPLIT_BACKSPACE +#define USE_SPLIT_BACKSPACE 1 + +#undef USE_SPLIT_LEFT_SHIFT +#define USE_SPLIT_LEFT_SHIFT 0 + +#undef USE_SPLIT_RIGHT_SHIFT +#define USE_SPLIT_RIGHT_SHIFT 1 + +#undef USE_7U_SPACEBAR +#define USE_7U_SPACEBAR 1 + +#undef USE_ISO_ENTER +#define USE_ISO_ENTER 0 + + + +#endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/hhkb_wilba/keymap.c b/keyboards/zeal60/keymaps/hhkb_wilba/keymap.c new file mode 100644 index 000000000000..efffcd0cf398 --- /dev/null +++ b/keyboards/zeal60/keymaps/hhkb_wilba/keymap.c @@ -0,0 +1,52 @@ +// Wilba's HHKB layout for Zeal60 + +#include "zeal60.h" + +// [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace +// [1,13] is either backslash or ISO Enter +// [2,12] is either ANSI Enter or key left of ISO Enter +// [2,13] is right key of split backspace (e.g. HHKB `~ key) +// [3,1] is right key of split left-shift (e.g ISO key) +// [3,13] is right key of split right-shift (e.g. HHKB Fn key) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +// Default layer +[0] = { + {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS}, + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC}, + {KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_GRV }, + {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, FN_MO13}, + {KC_NO, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_NO, KC_RALT, FN_MO23, KC_NO } +}, + +// Fn1 Layer +[1] = { + {KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS }, + {KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_EJCT, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_TRNS, KC_DEL }, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, + +// Fn2 Layer +[2] = { + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_CALC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, + +// Fn3 Layer (zeal60 Configuration) +[3] = { + {RESET, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +} + +}; + + From f10009a56cd4bc57096aa8ff5b00a8fd1beaf4a5 Mon Sep 17 00:00:00 2001 From: Ryan MacLean Date: Tue, 24 Jan 2017 13:19:34 -0800 Subject: [PATCH 28/69] Update keymap.c --- keyboards/zeal60/keymaps/ryanmaclean/keymap.c | 50 +++++++++++++++---- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/keyboards/zeal60/keymaps/ryanmaclean/keymap.c b/keyboards/zeal60/keymaps/ryanmaclean/keymap.c index 1d389a9e3c81..f41ae1fdf81c 100644 --- a/keyboards/zeal60/keymaps/ryanmaclean/keymap.c +++ b/keyboards/zeal60/keymaps/ryanmaclean/keymap.c @@ -1,4 +1,4 @@ -// Default layout for Zeal60 +// Ryan MacLean's layout for Zeal60 #include "zeal60.h" @@ -9,22 +9,54 @@ // [3,1] is right key of split left-shift (e.g ISO key) // [3,13] is right key of split right-shift (e.g. HHKB Fn key) + + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) // this is the function signature -- just copy/paste it into your keymap file as it is. KC_LSFT KC_LALT KC_LGUI KC_4 +{ + switch(id) { + case 0: // this would trigger when you hit a key mapped as M(0) + if (record->event.pressed) { + return MACRO( D(LSFT), D(LCTL), D(LGUI), T(4), U(LSFT), U(LCTL), U(LGUI), W(255), END ); // this sends the string 'hello' when the macro executes + } + break; + case 1: // this would trigger when you hit a key mapped as M(0) + if (record->event.pressed) { + return MACRO( D(LSFT), D(LGUI), T(4), U(LSFT), U(LGUI), W(255), END ); // this sends the string 'hello' when the macro executes + } + break; + case 2: // this would trigger when you hit a key mapped as M(0) + if (record->event.pressed) { + return MACRO( D(LSFT), D(LCTL), D(LGUI), T(3), U(LSFT), U(LCTL), U(LGUI), W(255), END ); // this sends the string 'hello' when the macro executes + } + break; + case 3: // this would trigger when you hit a key mapped as M(0) + if (record->event.pressed) { + return MACRO( D(LSFT), D(LGUI), T(3), U(LSFT), U(LGUI), W(255), END ); // this sends the string 'hello' when the macro executes + } + break; + } + return MACRO_NONE; +}; + +#define CADETL MT(KC_LSFT, KC_LBRC) +#define CADETR MT(KC_RSFT, KC_RBRC) + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Default layer [0] = { {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS}, {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC}, - {KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_GRV}, - {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, FN_MO13}, - {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RALT, KC_RGUI, FN_MO23, KC_RCTL} + {KC_LGUI, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_GRV}, + {KC_LSPO, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, FN_MO13}, + {KC_LCTL, KC_LALT, KC_LGUI, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RGUI, KC_RALT, KC_RCTL, FN_MO23} }, // Fn1 Layer [1] = { - {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, - {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS}, - {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_TRNS}, + {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS}, + {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_DEL}, + {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_LEFT, KC_UP, KC_DOWN, KC_RGHT, KC_HOME, KC_PGUP, KC_TRNS, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} }, @@ -32,8 +64,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Fn2 Layer [2] = { {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, M(2), M(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, M(1), M(0), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} }, From 9c51c80684c3b9dae09038743e48b2a48c048020 Mon Sep 17 00:00:00 2001 From: Ryan MacLean Date: Tue, 24 Jan 2017 13:22:14 -0800 Subject: [PATCH 29/69] Update keymap.c --- keyboards/zeal60/keymaps/ryanmaclean/keymap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/keyboards/zeal60/keymaps/ryanmaclean/keymap.c b/keyboards/zeal60/keymaps/ryanmaclean/keymap.c index f41ae1fdf81c..7e13a24c114b 100644 --- a/keyboards/zeal60/keymaps/ryanmaclean/keymap.c +++ b/keyboards/zeal60/keymaps/ryanmaclean/keymap.c @@ -14,22 +14,22 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) // this is the function signature -- just copy/paste it into your keymap file as it is. KC_LSFT KC_LALT KC_LGUI KC_4 { switch(id) { - case 0: // this would trigger when you hit a key mapped as M(0) + case 0: // macOS screenshot to capture are to clipboard - this would trigger when you hit a key mapped as M(0) if (record->event.pressed) { return MACRO( D(LSFT), D(LCTL), D(LGUI), T(4), U(LSFT), U(LCTL), U(LGUI), W(255), END ); // this sends the string 'hello' when the macro executes } break; - case 1: // this would trigger when you hit a key mapped as M(0) + case 1: // macOS screenshot capture area to file - this would trigger when you hit a key mapped as M(1) if (record->event.pressed) { return MACRO( D(LSFT), D(LGUI), T(4), U(LSFT), U(LGUI), W(255), END ); // this sends the string 'hello' when the macro executes } break; - case 2: // this would trigger when you hit a key mapped as M(0) + case 2: // macOS screenshot to clipboard - this would trigger when you hit a key mapped as M(2) if (record->event.pressed) { return MACRO( D(LSFT), D(LCTL), D(LGUI), T(3), U(LSFT), U(LCTL), U(LGUI), W(255), END ); // this sends the string 'hello' when the macro executes } break; - case 3: // this would trigger when you hit a key mapped as M(0) + case 3: // macOS screenshot to file - this would trigger when you hit a key mapped as M(3) if (record->event.pressed) { return MACRO( D(LSFT), D(LGUI), T(3), U(LSFT), U(LGUI), W(255), END ); // this sends the string 'hello' when the macro executes } From 8bd3c099e690160c3f9eec386cfdfc4b7363ed06 Mon Sep 17 00:00:00 2001 From: Ryan MacLean Date: Tue, 24 Jan 2017 13:24:26 -0800 Subject: [PATCH 30/69] Update keymap.c --- keyboards/zeal60/keymaps/ryanmaclean/keymap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/keyboards/zeal60/keymaps/ryanmaclean/keymap.c b/keyboards/zeal60/keymaps/ryanmaclean/keymap.c index 7e13a24c114b..5d2d901ca849 100644 --- a/keyboards/zeal60/keymaps/ryanmaclean/keymap.c +++ b/keyboards/zeal60/keymaps/ryanmaclean/keymap.c @@ -1,4 +1,7 @@ // Ryan MacLean's layout for Zeal60 +// Note that LGUI and RGUI are swapped with LALT and RALT respectively, for use with Macs +// Also note that Control has replaced Caps Lock, and that pressing left or right shift once +// will output left parenthese and right parenthese respectively. #include "zeal60.h" From 41ce152a10bb73ca0d16c2596cd11c21bbee9a01 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Wed, 25 Jan 2017 14:12:52 +1100 Subject: [PATCH 31/69] Added indicators, full param setting via host --- keyboards/zeal60/config.h | 4 - keyboards/zeal60/zeal60.c | 7 +- keyboards/zeal60/zeal_backlight.c | 284 +++++++++++++++++++++++++----- keyboards/zeal60/zeal_backlight.h | 15 +- keyboards/zeal60/zeal_eeprom.h | 16 +- keyboards/zeal60/zeal_rpc.h | 19 +- 6 files changed, 283 insertions(+), 62 deletions(-) diff --git a/keyboards/zeal60/config.h b/keyboards/zeal60/config.h index a55dc21e8492..94c93c144bf3 100644 --- a/keyboards/zeal60/config.h +++ b/keyboards/zeal60/config.h @@ -97,8 +97,4 @@ along with this program. If not, see . #define USE_KEYMAPS_IN_EEPROM 1 -// Uncomment the following for "factory test" firmware -// that just tests the LEDs in a fast color cycle -//#define ZEAL60_TEST - #endif diff --git a/keyboards/zeal60/zeal60.c b/keyboards/zeal60/zeal60.c index ec9d13a24d0e..8ebb1f2981ed 100644 --- a/keyboards/zeal60/zeal60.c +++ b/keyboards/zeal60/zeal60.c @@ -130,7 +130,7 @@ void matrix_init_kb(void) for ( int column=0; column < MATRIX_COLS; column++ ) { hsv.h = rand() & 0xFF; - hsv.s = rand() & 0xFF; + hsv.s = rand() & 0x7F; hsv.v = 255; backlight_set_key_color( row, column, hsv ); } @@ -370,6 +370,8 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) void led_set_kb(uint8_t usb_led) { + +#if 0 if (usb_led & (1< @@ -10,7 +11,7 @@ #include "zeal_color.h" #include "IS31FL3731_driver.h" -#define BACKLIGHT_EFFECT_MAX 7 +#define BACKLIGHT_EFFECT_MAX 9 zeal_backlight_config g_config = { .use_split_backspace = BACKLIGHT_USE_SPLIT_BACKSPACE, @@ -20,19 +21,24 @@ zeal_backlight_config g_config = { .use_iso_enter = BACKLIGHT_USE_ISO_ENTER, .disable_when_usb_suspended = BACKLIGHT_DISABLE_WHEN_USB_SUSPENDED, .disable_after_timeout = BACKLIGHT_DISABLE_AFTER_TIMEOUT, + .brightness = 255, + .effect = 0, + .color_1 = { .h = 0, .s = 255, .v = 255 }, + .color_2 = { .h = 127, .s = 255, .v = 255 }, + .caps_lock_indicator = { .color = { .h = 0, .s = 0, .v = 255 }, .index = 255 }, + .layer_1_indicator = { .color = { .h = 0, .s = 0, .v = 255 }, .index = 255 }, + .layer_2_indicator = { .color = { .h = 0, .s = 0, .v = 255 }, .index = 255 }, + .layer_3_indicator = { .color = { .h = 0, .s = 0, .v = 255 }, .index = 255 }, .alphas_mods = { BACKLIGHT_ALPHAS_MODS_ROW_0, BACKLIGHT_ALPHAS_MODS_ROW_1, BACKLIGHT_ALPHAS_MODS_ROW_2, BACKLIGHT_ALPHAS_MODS_ROW_3, - BACKLIGHT_ALPHAS_MODS_ROW_4 }, - .brightness = 255, - .effect = 0, - .color_1 = { .h = 0, .s = 255, .v = 0 }, - .color_2 = { .h = 127, .s = 255, .v = 0 }, + BACKLIGHT_ALPHAS_MODS_ROW_4 } }; bool g_suspend_state = false; +uint8_t g_inidicator_state = 0; // Global tick at 20 Hz uint32_t g_tick = 0; @@ -211,6 +217,11 @@ void backlight_set_suspend_state(bool state) g_suspend_state = state; } +void backlight_set_indicator_state(uint8_t state) +{ + g_inidicator_state = state; +} + // This tests the LEDs // Note that it will change the LED control registers // in the LED drivers, and leave them in an invalid @@ -266,10 +277,10 @@ void backlight_effect_test(void) color = 0; } - uint8_t index; - map_row_column_to_led( row, column, &index ); + uint8_t led; + map_row_column_to_led( row, column, &led ); backlight_set_color_all( 255, 255, 255 ); - backlight_test_led( index, color==0, color==1, color==2 ); + backlight_test_led( led, color==0, color==1, color==2 ); } // All LEDs off @@ -317,19 +328,23 @@ void backlight_effect_gradient_up_down(void) { int16_t h1 = g_config.color_1.h; int16_t h2 = g_config.color_2.h; - int16_t delta = h2 - h1; + int16_t deltaH = h2 - h1; // Take the shortest path between hues - if ( delta > 127 ) + if ( deltaH > 127 ) { - delta -= 256; + deltaH -= 256; } - else if ( delta < -127 ) + else if ( deltaH < -127 ) { - delta += 256; + deltaH += 256; } // Divide delta by 4, this gives the delta per row - delta /= 4; + deltaH /= 4; + + int16_t s1 = g_config.color_1.s; + int16_t s2 = g_config.color_2.s; + int16_t deltaS = ( s2 - s1 ) / 4; HSV hsv = { .h = 0, .s = 255, .v = g_config.brightness }; RGB rgb; @@ -338,14 +353,59 @@ void backlight_effect_gradient_up_down(void) { map_led_to_point( i, &point ); // The y range will be 0..64, map this to 0..4 - int16_t offset = delta * (point.y>>4); + uint8_t y = (point.y>>4); // Relies on hue being 8-bit and wrapping - hsv.h = g_config.color_1.h + offset; + hsv.h = g_config.color_1.h + ( deltaH * y ); + hsv.s = g_config.color_1.s + ( deltaS * y ); rgb = hsv_to_rgb( hsv ); backlight_set_color( i, rgb.r, rgb.g, rgb.b ); } } +void backlight_effect_raindrops(bool initialize) +{ + int16_t h1 = g_config.color_1.h; + int16_t h2 = g_config.color_2.h; + int16_t deltaH = h2 - h1; + deltaH /= 4; + + // Take the shortest path between hues + if ( deltaH > 127 ) + { + deltaH -= 256; + } + else if ( deltaH < -127 ) + { + deltaH += 256; + } + + int16_t s1 = g_config.color_1.s; + int16_t s2 = g_config.color_2.s; + int16_t deltaS = ( s2 - s1 ) / 4; + + HSV hsv; + RGB rgb; + + // Change one LED every tick + uint8_t led_to_change = ( g_tick & 0x000 ) == 0 ? rand() % 72 : 255; + + for ( int i=0; i<72; i++ ) + { + // If initialize, all get set to random colors + // If not, all but one will stay the same as before. + if ( initialize || i == led_to_change ) + { + hsv.h = h1 + ( deltaH * ( rand() & 0x03 ) ); + hsv.s = s1 + ( deltaS * ( rand() & 0x03 ) ); + // Override brightness with global brightness control + hsv.v = g_config.brightness;; + + rgb = hsv_to_rgb( hsv ); + backlight_set_color( i, rgb.r, rgb.g, rgb.b ); + } + } +} + void backlight_effect_cycle_all(void) { uint8_t offset = g_tick & 0xFF; @@ -418,6 +478,31 @@ void backlight_effect_cycle_up_down(void) } } +void backlight_effect_jellybean_raindrops( bool initialize ) +{ + HSV hsv; + RGB rgb; + + // Change one LED every tick + uint8_t led_to_change = ( g_tick & 0x000 ) == 0 ? rand() % 72 : 255; + + for ( int i=0; i<72; i++ ) + { + // If initialize, all get set to random colors + // If not, all but one will stay the same as before. + if ( initialize || i == led_to_change ) + { + hsv.h = rand() & 0xFF; + hsv.s = rand() & 0xFF; + // Override brightness with global brightness control + hsv.v = g_config.brightness;; + + rgb = hsv_to_rgb( hsv ); + backlight_set_color( i, rgb.r, rgb.g, rgb.b ); + } + } +} + void backlight_effect_custom(void) { HSV hsv; @@ -432,6 +517,74 @@ void backlight_effect_custom(void) } } +void backlight_effect_indicators_set_colors( uint8_t index, HSV hsv ) +{ + RGB rgb = hsv_to_rgb( hsv ); + if ( index == 254 ) + { + backlight_set_color_all( rgb.r, rgb.g, rgb.b ); + } + else + { + backlight_set_color( index, rgb.r, rgb.g, rgb.b ); + + // If the spacebar LED is the indicator, + // do the same for the spacebar stabilizers + if ( index == 36+0 ) // LC0 + { + backlight_set_color( 36+6, rgb.r, rgb.g, rgb.b ); // LC6 + backlight_set_color( 54+13, rgb.r, rgb.g, rgb.b ); // LD13 + if ( g_config.use_7u_spacebar ) + { + backlight_set_color( 54+14, rgb.r, rgb.g, rgb.b ); // LD14 + } + } + } +} + +// This runs after another backlight effect and replaces +// colors already set +void backlight_effect_indicators(void) +{ + if ( g_config.caps_lock_indicator.index != 255 && + ( g_inidicator_state & (1< 0 && g_any_key_hit > g_config.disable_after_timeout*60*20 ) ) - ? 0 : g_config.effect; + bool suspend_backlight = ((g_suspend_state && g_config.disable_when_usb_suspended) || + (g_config.disable_after_timeout > 0 && g_any_key_hit > g_config.disable_after_timeout * 60 * 20)); + uint8_t effect = suspend_backlight ? 0 : g_config.effect; + + // Keep track of the effect used last time, + // detect change in effect, so each effect can + // have an optional initialization. + static uint8_t effect_last = 255; + bool initialize = effect != effect_last; + effect_last = effect; // this gets ticked at 20 Hz. // each effect can opt to do calculations // and/or request PWM buffer updates. - if ( effect == 0 ) - { - backlight_effect_all_off(); - } - else if ( effect == 1 ) + switch ( effect ) { - backlight_effect_solid_color(); - } - else if ( effect == 2 ) - { - backlight_effect_alphas_mods(); - } - else if ( effect == 3 ) - { - backlight_effect_gradient_up_down(); - } - else if ( effect == 4 ) - { - backlight_effect_cycle_all(); + case 0: + backlight_effect_all_off(); + break; + case 1: + backlight_effect_solid_color(); + break; + case 2: + backlight_effect_alphas_mods(); + break; + case 3: + backlight_effect_gradient_up_down(); + break; + case 4: + backlight_effect_raindrops( initialize ); + break; + case 5: + backlight_effect_cycle_all(); + break; + case 6: + backlight_effect_cycle_left_right(); + break; + case 7: + backlight_effect_cycle_up_down(); + break; + case 8: + backlight_effect_jellybean_raindrops( initialize ); + break; + case 9: + default: + backlight_effect_custom(); + break; } - else if ( effect == 5 ) + + if ( ! suspend_backlight ) { - backlight_effect_cycle_left_right(); + backlight_effect_indicators(); } - else if ( effect == 6 ) + +} + +void backlight_set_indicator_index( uint8_t *index, uint8_t row, uint8_t column ) +{ + if ( row >= MATRIX_ROWS ) { - backlight_effect_cycle_up_down(); + // Special value, 255=none, 254=all + *index = row; } - else if ( effect >= 7 ) + else { - backlight_effect_custom(); + map_row_column_to_led( row, column, index ); } } @@ -512,6 +693,19 @@ void backlight_config_set_values(msg_backlight_config_set_values *values) g_config.use_iso_enter = values->use_iso_enter; g_config.disable_when_usb_suspended = values->disable_when_usb_suspended; g_config.disable_after_timeout = values->disable_after_timeout; + + g_config.brightness = values->brightness; + g_config.effect = values->effect; + g_config.color_1 = values->color_1; + g_config.color_2 = values->color_2; + g_config.caps_lock_indicator.color = values->caps_lock_indicator_color; + backlight_set_indicator_index( &g_config.caps_lock_indicator.index, values->caps_lock_indicator_row, values->caps_lock_indicator_column ); + g_config.layer_1_indicator.color = values->layer_1_indicator_color; + backlight_set_indicator_index( &g_config.layer_1_indicator.index, values->layer_1_indicator_row, values->layer_1_indicator_column ); + g_config.layer_2_indicator.color = values->layer_2_indicator_color; + backlight_set_indicator_index( &g_config.layer_2_indicator.index, values->layer_2_indicator_row, values->layer_2_indicator_column ); + g_config.layer_3_indicator.color = values->layer_3_indicator_color; + backlight_set_indicator_index( &g_config.layer_3_indicator.index, values->layer_3_indicator_row, values->layer_3_indicator_column ); } void backlight_config_set_alphas_mods( uint16_t *alphas_mods ) diff --git a/keyboards/zeal60/zeal_backlight.h b/keyboards/zeal60/zeal_backlight.h index de7c6e2eaa8f..ab7318238c5f 100644 --- a/keyboards/zeal60/zeal_backlight.h +++ b/keyboards/zeal60/zeal_backlight.h @@ -7,6 +7,12 @@ #include "zeal_color.h" #include "zeal_rpc.h" +typedef struct +{ + HSV color; + uint8_t index; +} zeal_indicator; + typedef struct { bool use_split_backspace:1; // | @@ -18,12 +24,16 @@ typedef struct bool __pad6:1; // | bool __pad7:1; // 1 byte uint8_t disable_after_timeout; // 1 byte - uint16_t alphas_mods[5]; // 10 bytes uint8_t brightness; // 1 byte uint8_t effect; // 1 byte HSV color_1; // 3 bytes HSV color_2; // 3 bytes -} zeal_backlight_config; // = 20 bytes + zeal_indicator caps_lock_indicator; // 4 bytes + zeal_indicator layer_1_indicator; // 4 bytes + zeal_indicator layer_2_indicator; // 4 bytes + zeal_indicator layer_3_indicator; // 4 bytes + uint16_t alphas_mods[5]; // 10 bytes +} zeal_backlight_config; // = 36 bytes void backlight_config_set_values(msg_backlight_config_set_values *values); void backlight_config_set_alphas_mods( uint16_t *value ); @@ -37,6 +47,7 @@ void backlight_timer_enable(void); void backlight_timer_disable(void); void backlight_set_suspend_state(bool state); +void backlight_set_indicator_state(uint8_t state); // This should not be called from an interrupt // (eg. from a timer interrupt). diff --git a/keyboards/zeal60/zeal_eeprom.h b/keyboards/zeal60/zeal_eeprom.h index f88d9c2d9656..d86746545081 100644 --- a/keyboards/zeal60/zeal_eeprom.h +++ b/keyboards/zeal60/zeal_eeprom.h @@ -11,26 +11,26 @@ // Bump this every time we change what we store // This will automatically reset the EEPROM with defaults // and avoid loading invalid data from the EEPROM -#define EEPROM_VERSION 0x01 +#define EEPROM_VERSION 0x03 #define EEPROM_VERSION_ADDR ((void*)34) #define EEPROM_BACKLIGHT_CONFIG_ADDR ((void*)35) -// zeal_backlight_config uses 20 bytes -// 35+20=55 -#define EEPROM_BACKLIGHT_KEY_COLOR_ADDR ((void*)55) +// zeal_backlight_config uses 36 bytes +// 35+36=71 +#define EEPROM_BACKLIGHT_KEY_COLOR_ADDR ((void*)71) // key colors use 72*3=216 -// 55+216=271 +// 71+216=287 -#define EEPROM_KEYMAP_ADDR ((void*)271) +#define EEPROM_KEYMAP_ADDR ((void*)287) #define EEPROM_KEYMAP_MAX 4 // Each keymap is MATRIX_ROWS*MATRIX_COLS*2 bytes // For Zeal60 this is 5*14*2=140 bytes // 4 keymaps = 560 bytes -// 271 + 560 = 831 -// 831 < 1024 :-) +// 287 + 560 = 847 +// 847 < 1024 :-) bool eeprom_is_valid(void); void eeprom_set_valid(bool valid); diff --git a/keyboards/zeal60/zeal_rpc.h b/keyboards/zeal60/zeal_rpc.h index 81831d01de27..eff2ad2f1bc7 100644 --- a/keyboards/zeal60/zeal_rpc.h +++ b/keyboards/zeal60/zeal_rpc.h @@ -3,7 +3,7 @@ #include "zeal_color.h" -#define PROTOCOL_VERSION 0x0002 +#define PROTOCOL_VERSION 0x0003 enum { @@ -58,6 +58,23 @@ typedef struct PACKED bool use_iso_enter:1; bool disable_when_usb_suspended:1; uint8_t disable_after_timeout; + uint8_t brightness; + uint8_t effect; + HSV color_1; + HSV color_2; + HSV caps_lock_indicator_color; + uint8_t caps_lock_indicator_row; + uint8_t caps_lock_indicator_column; + HSV layer_1_indicator_color; + uint8_t layer_1_indicator_row; + uint8_t layer_1_indicator_column; + HSV layer_2_indicator_color; + uint8_t layer_2_indicator_row; + uint8_t layer_2_indicator_column; + HSV layer_3_indicator_color; + uint8_t layer_3_indicator_row; + uint8_t layer_3_indicator_column; + // This is close to the packet size limit of 32 } msg_backlight_config_set_values; typedef struct PACKED From 9762cacda9d21875b0c4d1c560d9663d29dcf4bb Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Thu, 26 Jan 2017 12:56:11 +1100 Subject: [PATCH 32/69] Added "mousekey" layout --- keyboards/zeal60/keymaps/mousekey/Makefile | 5 +++ keyboards/zeal60/keymaps/mousekey/config.h | 24 +++++++++++ keyboards/zeal60/keymaps/mousekey/keymap.c | 50 ++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 keyboards/zeal60/keymaps/mousekey/Makefile create mode 100644 keyboards/zeal60/keymaps/mousekey/config.h create mode 100644 keyboards/zeal60/keymaps/mousekey/keymap.c diff --git a/keyboards/zeal60/keymaps/mousekey/Makefile b/keyboards/zeal60/keymaps/mousekey/Makefile new file mode 100644 index 000000000000..f6505b063111 --- /dev/null +++ b/keyboards/zeal60/keymaps/mousekey/Makefile @@ -0,0 +1,5 @@ +MOUSEKEY_ENABLE = yes + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif \ No newline at end of file diff --git a/keyboards/zeal60/keymaps/mousekey/config.h b/keyboards/zeal60/keymaps/mousekey/config.h new file mode 100644 index 000000000000..8b76f1bddf93 --- /dev/null +++ b/keyboards/zeal60/keymaps/mousekey/config.h @@ -0,0 +1,24 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +/* enable/disable LEDs based on layout */ +#undef USE_SPLIT_BACKSPACE +#define USE_SPLIT_BACKSPACE 0 + +#undef USE_SPLIT_LEFT_SHIFT +#define USE_SPLIT_LEFT_SHIFT 0 + +#undef USE_SPLIT_RIGHT_SHIFT +#define USE_SPLIT_RIGHT_SHIFT 0 + +#undef USE_7U_SPACEBAR +#define USE_7U_SPACEBAR 0 + +#undef USE_ISO_ENTER +#define USE_ISO_ENTER 0 + + + +#endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/mousekey/keymap.c b/keyboards/zeal60/keymaps/mousekey/keymap.c new file mode 100644 index 000000000000..6e7a848d9989 --- /dev/null +++ b/keyboards/zeal60/keymaps/mousekey/keymap.c @@ -0,0 +1,50 @@ +// Default layout for Zeal60 + +#include "zeal60.h" + +// [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace +// [1,13] is either backslash or ISO Enter +// [2,12] is either ANSI Enter or key left of ISO Enter +// [2,13] is right key of split backspace (e.g. HHKB `~ key) +// [3,1] is right key of split left-shift (e.g ISO key) +// [3,13] is right key of split right-shift (e.g. HHKB Fn key) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +// Default layer +[0] = { + {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS}, + {KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_NO }, + {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO }, + {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RALT, FN_MO13, FN_MO23, KC_RCTL} +}, + +// Fn1 Layer +[1] = { + {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, + {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS}, + {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, + +// Fn2 Layer +[2] = { + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, + +// Fn3 Layer (zeal60 Configuration) +[3] = { + {KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +} + +}; From 1896525c5c8c094552eeef66a68604994de812bd Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Thu, 13 Apr 2017 21:50:35 +1000 Subject: [PATCH 33/69] Added Zeal65 support, factory test mode --- keyboards/zeal60/config.h | 10 +- keyboards/zeal60/keymaps/default/config.h | 2 - keyboards/zeal60/zeal60.c | 9 +- keyboards/zeal60/zeal_backlight.c | 184 +++++++++++++++------- keyboards/zeal60/zeal_backlight.h | 1 + keyboards/zeal60/zeal_eeprom.h | 5 + keyboards/zeal60/zeal_rpc.h | 11 +- keyboards/zeal65/Makefile | 3 + keyboards/zeal65/config.h | 104 ++++++++++++ keyboards/zeal65/keymaps/default/config.h | 22 +++ keyboards/zeal65/keymaps/default/keymap.c | 50 ++++++ keyboards/zeal65/rules.mk | 84 ++++++++++ keyboards/zeal65/zeal65.c | 5 + 13 files changed, 421 insertions(+), 69 deletions(-) create mode 100644 keyboards/zeal65/Makefile create mode 100644 keyboards/zeal65/config.h create mode 100644 keyboards/zeal65/keymaps/default/config.h create mode 100644 keyboards/zeal65/keymaps/default/keymap.c create mode 100644 keyboards/zeal65/rules.mk create mode 100644 keyboards/zeal65/zeal65.c diff --git a/keyboards/zeal60/config.h b/keyboards/zeal60/config.h index 94c93c144bf3..69bdbce26c20 100644 --- a/keyboards/zeal60/config.h +++ b/keyboards/zeal60/config.h @@ -87,13 +87,13 @@ along with this program. If not, see . // These define which keys in the matrix are alphas/mods // Used for backlight effects so colors are different for // alphas vs. mods -// Each value is for a row, bit 0 is column 13 +// Each value is for a row, bit 0 is column 0 // Alpha=0 Mod=1 #define BACKLIGHT_ALPHAS_MODS_ROW_0 0b0010000000000001 -#define BACKLIGHT_ALPHAS_MODS_ROW_1 0b0010000000000000 -#define BACKLIGHT_ALPHAS_MODS_ROW_2 0b0010000000000010 -#define BACKLIGHT_ALPHAS_MODS_ROW_3 0b0010000000000011 -#define BACKLIGHT_ALPHAS_MODS_ROW_4 0b0011100000001111 +#define BACKLIGHT_ALPHAS_MODS_ROW_1 0b0000000000000001 +#define BACKLIGHT_ALPHAS_MODS_ROW_2 0b0001000000000001 +#define BACKLIGHT_ALPHAS_MODS_ROW_3 0b0011000000000001 +#define BACKLIGHT_ALPHAS_MODS_ROW_4 0b0011110000000111 #define USE_KEYMAPS_IN_EEPROM 1 diff --git a/keyboards/zeal60/keymaps/default/config.h b/keyboards/zeal60/keymaps/default/config.h index 8b76f1bddf93..e9afa84a1370 100644 --- a/keyboards/zeal60/keymaps/default/config.h +++ b/keyboards/zeal60/keymaps/default/config.h @@ -19,6 +19,4 @@ #undef USE_ISO_ENTER #define USE_ISO_ENTER 0 - - #endif //CONFIG_USER_H diff --git a/keyboards/zeal60/zeal60.c b/keyboards/zeal60/zeal60.c index 8ebb1f2981ed..f6b7a56389f0 100644 --- a/keyboards/zeal60/zeal60.c +++ b/keyboards/zeal60/zeal60.c @@ -60,6 +60,12 @@ void raw_hid_receive( uint8_t *data, uint8_t length ) backlight_set_key_color(msg->row, msg->column, msg->hsv); break; } + case id_system_get_state: + { + msg_system_state *msg = (msg_system_state*)&data[1]; + msg->value = backlight_get_tick(); + break; + } default: { // Unhandled message. @@ -107,7 +113,6 @@ void matrix_init_kb(void) { bootmagic_lite(); -#ifndef ZEAL60_TEST // If the EEPROM has the magic, the data is good. // OK to load from EEPROM. if (eeprom_is_valid()) @@ -143,7 +148,6 @@ void matrix_init_kb(void) // Save the magic number last, in case saving was interrupted eeprom_set_valid(true); } -#endif // Initialize LED drivers for backlight. backlight_init_drivers(); @@ -158,7 +162,6 @@ void matrix_scan_kb(void) { // This only updates the LED driver buffers if something has changed. backlight_update_pwm_buffers(); - matrix_scan_user(); } diff --git a/keyboards/zeal60/zeal_backlight.c b/keyboards/zeal60/zeal_backlight.c index ae19eb975873..3de68f7f1d92 100644 --- a/keyboards/zeal60/zeal_backlight.c +++ b/keyboards/zeal60/zeal_backlight.c @@ -22,7 +22,7 @@ zeal_backlight_config g_config = { .disable_when_usb_suspended = BACKLIGHT_DISABLE_WHEN_USB_SUSPENDED, .disable_after_timeout = BACKLIGHT_DISABLE_AFTER_TIMEOUT, .brightness = 255, - .effect = 0, + .effect = 255, // Default to RGB test, so Zeal can flash and test in one pass! .color_1 = { .h = 0, .s = 255, .v = 255 }, .color_2 = { .h = 127, .s = 255, .v = 255 }, .caps_lock_indicator = { .color = { .h = 0, .s = 0, .v = 255 }, .index = 255 }, @@ -59,9 +59,26 @@ typedef struct Point { uint8_t y; } Point; + // index in range 0..71 (LA0..LA17, LB0..LB17, LC0..LC17, LD0..LD17) // point values in range x=0..224 y=0..64 // origin is center of top-left key (i.e Esc) +#ifdef CONFIG_ZEAL65 +const Point g_map_led_to_point[72] PROGMEM = { + // LA0..LA17 + {120,16}, {104,16}, {88,16}, {72,16}, {56,16}, {40,16}, {24,16}, {4,16}, {4,32}, + {128,0}, {112,0}, {96,0}, {80,0}, {64,0}, {48,0}, {32,0}, {16,0}, {0,0}, + // LB0..LB17 + {144,0}, {160,0}, {176,0}, {192,0}, {216,0}, {224,0}, {240,0}, {240,16}, {240,32}, + {136,16}, {152,16}, {168,16}, {184,16}, {200,16}, {220,16}, {240,48}, {240,64}, {224,64}, + // LC0..LC17 + {96,64}, {100,48}, {84,48}, {68,48}, {52,48}, {36,48}, {60,64}, {48,60}, {28,64}, + {108,32}, {92,32}, {76,32}, {60,32}, {44,32}, {28,32}, {20,48}, {2,48}, {4,64}, + // LD0..LD17 + {124,32}, {140,32}, {156,32}, {172,32}, {188,32}, {214,32}, {180,48}, {210,48}, {224,48}, + {116,48}, {132,48}, {148,48}, {164,48}, {255,255}, {144,60}, {164,64}, {188,64}, {208,64} +}; +#else const Point g_map_led_to_point[72] PROGMEM = { // LA0..LA17 {120,16}, {104,16}, {88,16}, {72,16}, {56,16}, {40,16}, {24,16}, {4,16}, {4,32}, @@ -76,6 +93,7 @@ const Point g_map_led_to_point[72] PROGMEM = { {124,32}, {140,32}, {156,32}, {172,32}, {188,32}, {214,32}, {180,48}, {210,48}, {224,48}, {116,48}, {132,48}, {148,48}, {164,48}, {144,64}, {161,64}, {181,64}, {201,64}, {221,64} }; +#endif // ZEAL65_PROTO // This may seem counter-intuitive, but it's quite flexible. // For each LED, get it's position to decide what color to make it. @@ -98,6 +116,7 @@ void map_led_to_point( uint8_t index, Point *point ) if ( g_config.use_iso_enter ) point->y += 8; // extremely pedantic break; +#ifndef ZEAL65_PROTO case 36+0: // LC0A if ( g_config.use_7u_spacebar ) point->x += 10; @@ -106,6 +125,7 @@ void map_led_to_point( uint8_t index, Point *point ) if ( g_config.use_7u_spacebar ) point->x += 4; break; +#endif case 36+16: // LC16A if ( !g_config.use_split_left_shift ) point->x += 8; @@ -124,6 +144,25 @@ void map_led_to_point( uint8_t index, Point *point ) // // Maps switch matrix coordinate (row,col) to LED index // + + +#ifdef CONFIG_ZEAL65 +// Note: Left spacebar stab is at 4,3 (LC7) +// Right spacebar stab is at 4,9 (D14) +// +// A17, A16, A15, A14, A13, A12, A11, A10, A9, B0, B1, B2, B3, B4, B6 +// A7, A6, A5, A4, A3, A2, A1, A0, B9, B10, B11, B12, B13, B14, B7 +// A8, C14, C13, C12, C11, C10, C9, D0, D1, D2, D3, D4, D5, B5, B8 +// C16, C15, C5, C4, C3, C2, C1, D9, D10, D11, D12, D6, D7, D8, B15 +// C17, C8, C7, ---, ---, ---, ---, C0, ---, D14, D15, D16, D17, B17, B16 +const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { + { 0+17, 0+16, 0+15, 0+14, 0+13, 0+12, 0+11, 0+10, 0+9, 18+0, 18+1, 18+2, 18+3, 18+4, 18+6 }, + { 0+7, 0+6, 0+5, 0+4, 0+3, 0+2, 0+1, 0+0, 18+9, 18+10, 18+11, 18+12, 18+13, 18+14, 18+7 }, + { 0+8, 36+14, 36+13, 36+12, 36+11, 36+10, 36+9, 54+0, 54+1, 54+2, 54+3, 54+4, 54+5, 18+5, 18+8 }, + { 36+16, 36+15, 36+5, 36+4, 36+3, 36+2, 36+1, 54+9, 54+10, 54+11, 54+12, 54+6, 54+7, 54+8, 18+15 }, + { 36+17, 36+8, 36+7, 255, 255, 255, 255, 36+0, 255, 54+14, 54+15, 54+16, 54+17, 18+17, 18+16 } +}; +#else // Note: Left spacebar stab is at 4,3 (LC6) // Right spacebar stab is at 4,9 (LD13) or 4,10 (LD14) // @@ -132,15 +171,14 @@ void map_led_to_point( uint8_t index, Point *point ) // A8, C14, C13, C12, C11, C10, C9, D0, D1, D2, D3, D4, D5, B5, // C16, C15, C5, C4, C3, C2, C1, D9, D10, D11, D12, D6, D7, D8, // C17, C8, C7, C6, ---, ---, ---, C0, ---, D13, D14, D15, D16, D17, -// -const uint8_t g_map_row_column_to_led[5][14] PROGMEM = { +const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { { 0+17, 0+16, 0+15, 0+14, 0+13, 0+12, 0+11, 0+10, 0+9, 18+0, 18+1, 18+2, 18+3, 18+4 }, { 0+7, 0+6, 0+5, 0+4, 0+3, 0+2, 0+1, 0+0, 18+9, 18+10, 18+11, 18+12, 18+13, 18+14 }, { 0+8, 36+14, 36+13, 36+12, 36+11, 36+10, 36+9, 54+0, 54+1, 54+2, 54+3, 54+4, 54+5, 18+5 }, { 36+16, 36+15, 36+5, 36+4, 36+3, 36+2, 36+1, 54+9, 54+10, 54+11, 54+12, 54+6, 54+7, 54+8 }, { 36+17, 36+8, 36+7, 36+6, 255, 255, 255, 36+0, 255, 54+13, 54+14, 54+15, 54+16, 54+17 } }; - +#endif void map_row_column_to_led( uint8_t row, uint8_t column, uint8_t *led ) { @@ -222,34 +260,42 @@ void backlight_set_indicator_state(uint8_t state) g_inidicator_state = state; } +void backlight_effect_rgb_test(void) +{ + // Mask out bits 4 and 5 + // This 2-bit value will stay the same for 16 ticks. + switch ( (g_tick & 0x30) >> 4 ) + { + case 0: + { + backlight_set_color_all( 255, 0, 0 ); + break; + } + case 1: + { + backlight_set_color_all( 0, 255, 0 ); + break; + } + case 2: + { + backlight_set_color_all( 0, 0, 255 ); + break; + } + case 3: + { + backlight_set_color_all( 255, 255, 255 ); + break; + } + } +} + // This tests the LEDs // Note that it will change the LED control registers // in the LED drivers, and leave them in an invalid // state for other backlight effects. // ONLY USE THIS FOR TESTING LEDS! -void backlight_effect_test(void) +void backlight_effect_single_LED_test(void) { - if ( g_tick < 4*20 ) - { - backlight_set_color_all( 255, 0, 0 ); - return; - } - else if ( g_tick < 7*20 ) - { - backlight_set_color_all( 0, 255, 0 ); - return; - } - else if ( g_tick < 10*20 ) - { - backlight_set_color_all( 0, 0, 255 ); - return; - } - else if ( g_tick < 13*20 ) - { - backlight_set_color_all( 255, 255, 255 ); - return; - } - static uint8_t color = 0; // 0,1,2 for R,G,B static uint8_t row = 0; static uint8_t column = 0; @@ -311,7 +357,7 @@ void backlight_effect_alphas_mods(void) map_row_column_to_led( row, column, &index ); if ( index < 72 ) { - if ( ( g_config.alphas_mods[row] & (0b0010000000000000>>column) ) == 0 ) + if ( ( g_config.alphas_mods[row] & (1<= min ) ? new_value : min; + return MIN( MAX( new_value, min ), max ); } void backlight_effect_increase(void) { - g_config.effect = increment( g_config.effect, 1, BACKLIGHT_EFFECT_MAX ); + g_config.effect = increment( g_config.effect, 1, 0, BACKLIGHT_EFFECT_MAX ); backlight_config_save(); } void backlight_effect_decrease(void) { - g_config.effect = decrement( g_config.effect, 1, 0 ); + g_config.effect = decrement( g_config.effect, 1, 0, BACKLIGHT_EFFECT_MAX ); backlight_config_save(); } void backlight_brightness_increase(void) { - g_config.brightness = increment( g_config.brightness, 8, 255 ); + g_config.brightness = increment( g_config.brightness, 8, 0, 255 ); backlight_config_save(); } void backlight_brightness_decrease(void) { - g_config.brightness = decrement( g_config.brightness, 8, 0 ); + g_config.brightness = decrement( g_config.brightness, 8, 0, 255 ); backlight_config_save(); } void backlight_color_1_hue_increase(void) { - g_config.color_1.h = increment( g_config.color_1.h, 8, 255 ); + g_config.color_1.h = increment( g_config.color_1.h, 8, 0, 255 ); backlight_config_save(); } void backlight_color_1_hue_decrease(void) { - g_config.color_1.h = decrement( g_config.color_1.h, 8, 0 ); + g_config.color_1.h = decrement( g_config.color_1.h, 8, 0, 255 ); backlight_config_save(); } void backlight_color_1_sat_increase(void) { - g_config.color_1.s = increment( g_config.color_1.s, 8, 255 ); + g_config.color_1.s = increment( g_config.color_1.s, 8, 0, 255 ); backlight_config_save(); } void backlight_color_1_sat_decrease(void) { - g_config.color_1.s = decrement( g_config.color_1.s, 8, 0 ); + g_config.color_1.s = decrement( g_config.color_1.s, 8, 0, 255 ); backlight_config_save(); } void backlight_color_2_hue_increase(void) { - g_config.color_2.h = increment( g_config.color_2.h, 8, 255 ); + g_config.color_2.h = increment( g_config.color_2.h, 8, 0, 255 ); backlight_config_save(); } void backlight_color_2_hue_decrease(void) { - g_config.color_2.h = decrement( g_config.color_2.h, 8, 0 ); + g_config.color_2.h = decrement( g_config.color_2.h, 8, 0, 255 ); backlight_config_save(); } void backlight_color_2_sat_increase(void) { - g_config.color_2.s = increment( g_config.color_2.s, 8, 255 ); + g_config.color_2.s = increment( g_config.color_2.s, 8, 0, 255 ); backlight_config_save(); } void backlight_color_2_sat_decrease(void) { - g_config.color_2.s = decrement( g_config.color_2.s, 8, 0 ); + g_config.color_2.s = decrement( g_config.color_2.s, 8, 0, 255 ); backlight_config_save(); } @@ -896,3 +960,9 @@ void backlight_test_led( uint8_t index, bool red, bool green, bool blue ) } } } + +uint32_t backlight_get_tick(void) +{ + return g_tick; +} + diff --git a/keyboards/zeal60/zeal_backlight.h b/keyboards/zeal60/zeal_backlight.h index ab7318238c5f..ad1d0fad7f21 100644 --- a/keyboards/zeal60/zeal_backlight.h +++ b/keyboards/zeal60/zeal_backlight.h @@ -77,5 +77,6 @@ void backlight_get_key_color( uint8_t led, HSV *hsv ); void backlight_set_key_color( uint8_t row, uint8_t column, HSV hsv ); void backlight_test_led( uint8_t index, bool red, bool green, bool blue ); +uint32_t backlight_get_tick(void); #endif //ZEAL_BACKLIGHT_H diff --git a/keyboards/zeal60/zeal_eeprom.h b/keyboards/zeal60/zeal_eeprom.h index d86746545081..f8b5db44d89e 100644 --- a/keyboards/zeal60/zeal_eeprom.h +++ b/keyboards/zeal60/zeal_eeprom.h @@ -32,6 +32,11 @@ // 287 + 560 = 847 // 847 < 1024 :-) +// For Zeal65 this is 5*15*2=150 bytes +// 4 keymaps = 600 bytes +// 287 + 600 = 887 +// 887 < 1024 :-) + bool eeprom_is_valid(void); void eeprom_set_valid(bool valid); diff --git a/keyboards/zeal60/zeal_rpc.h b/keyboards/zeal60/zeal_rpc.h index eff2ad2f1bc7..8d7ddf925132 100644 --- a/keyboards/zeal60/zeal_rpc.h +++ b/keyboards/zeal60/zeal_rpc.h @@ -3,7 +3,7 @@ #include "zeal_color.h" -#define PROTOCOL_VERSION 0x0003 +#define PROTOCOL_VERSION 0x0004 enum { @@ -14,7 +14,8 @@ enum id_backlight_config_set_values, id_backlight_config_set_alphas_mods, id_backlight_set_key_color, - + id_system_get_state, + id_system_set_state, id_unhandled = 0xFF, }; @@ -89,6 +90,12 @@ typedef struct PACKED HSV hsv; } msg_backlight_set_key_color; +typedef struct PACKED +{ + uint8_t id; + uint32_t value; +} msg_system_state; + #if defined(_MSC_VER) #pragma pack( pop ) #endif diff --git a/keyboards/zeal65/Makefile b/keyboards/zeal65/Makefile new file mode 100644 index 000000000000..4e2a6f00fd8e --- /dev/null +++ b/keyboards/zeal65/Makefile @@ -0,0 +1,3 @@ +ifndef MAKEFILE_INCLUDED + include ../../Makefile +endif \ No newline at end of file diff --git a/keyboards/zeal65/config.h b/keyboards/zeal65/config.h new file mode 100644 index 000000000000..02c251174f5a --- /dev/null +++ b/keyboards/zeal65/config.h @@ -0,0 +1,104 @@ +/* +Copyright 2012 Jun Wako + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +// This conditionally compiles the backlight code for Zeal65 specifics +#define CONFIG_ZEAL65 + +// USB Device descriptor parameter +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6065 +#define DEVICE_VER 0x0001 +#define MANUFACTURER ZealPC +#define PRODUCT Zeal65 +#define DESCRIPTION Zeal65 (QMK Firmware) + +// key matrix size +#define MATRIX_ROWS 5 +#define MATRIX_COLS 15 + +// Zeal60 PCB default pin-out +#define MATRIX_ROW_PINS { F0, F1, F4, F6, F7 } +#define MATRIX_COL_PINS { F5, D5, B1, B2, B3, D3, D2, C7, C6, B6, B5, B4, D7, D6, D4 } +#define UNUSED_PINS + +// COL2ROW or ROW2COL +#define DIODE_DIRECTION COL2ROW + +// Set 0 if debouncing isn't needed +#define DEBOUNCING_DELAY 5 + +// Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap +#define LOCKING_SUPPORT_ENABLE +// Locking resynchronize hack +#define LOCKING_RESYNC_ENABLE + +// key combination for command +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +// disable debug print +//#define NO_DEBUG + +// disable print +//#define NO_PRINT + +// disable action features +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +// enable/disable LEDs based on layout +#define BACKLIGHT_USE_SPLIT_BACKSPACE 0 +#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 +#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 +#define BACKLIGHT_USE_7U_SPACEBAR 0 +#define BACKLIGHT_USE_ISO_ENTER 0 + +// disable backlight when USB suspended (PC sleep/hibernate/shutdown) +#define BACKLIGHT_DISABLE_WHEN_USB_SUSPENDED 0 + +// disable backlight after timeout in minutes, 0 = no timeout +#define BACKLIGHT_DISABLE_AFTER_TIMEOUT 0 + +// These define which keys in the matrix are alphas/mods +// Used for backlight effects so colors are different for +// alphas vs. mods +// Each value is for a row, bit 0 is column 0 +// Alpha=0 Mod=1 +#define BACKLIGHT_ALPHAS_MODS_ROW_0 0b0110000000000001 +#define BACKLIGHT_ALPHAS_MODS_ROW_1 0b0100000000000001 +#define BACKLIGHT_ALPHAS_MODS_ROW_2 0b0101000000000001 +#define BACKLIGHT_ALPHAS_MODS_ROW_3 0b0111000000000001 +#define BACKLIGHT_ALPHAS_MODS_ROW_4 0b0111110000000011 + + +#define USE_KEYMAPS_IN_EEPROM 1 + +#endif diff --git a/keyboards/zeal65/keymaps/default/config.h b/keyboards/zeal65/keymaps/default/config.h new file mode 100644 index 000000000000..e9afa84a1370 --- /dev/null +++ b/keyboards/zeal65/keymaps/default/config.h @@ -0,0 +1,22 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +/* enable/disable LEDs based on layout */ +#undef USE_SPLIT_BACKSPACE +#define USE_SPLIT_BACKSPACE 0 + +#undef USE_SPLIT_LEFT_SHIFT +#define USE_SPLIT_LEFT_SHIFT 0 + +#undef USE_SPLIT_RIGHT_SHIFT +#define USE_SPLIT_RIGHT_SHIFT 0 + +#undef USE_7U_SPACEBAR +#define USE_7U_SPACEBAR 0 + +#undef USE_ISO_ENTER +#define USE_ISO_ENTER 0 + +#endif //CONFIG_USER_H diff --git a/keyboards/zeal65/keymaps/default/keymap.c b/keyboards/zeal65/keymaps/default/keymap.c new file mode 100644 index 000000000000..3f7606105dfb --- /dev/null +++ b/keyboards/zeal65/keymaps/default/keymap.c @@ -0,0 +1,50 @@ +// Default layout for Zeal60 + +#include "../zeal60/zeal60.h" + +// [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace +// [1,13] is either backslash or ISO Enter +// [2,12] is either ANSI Enter or key left of ISO Enter +// [2,13] is right key of split backspace (e.g. HHKB `~ key) +// [3,1] is right key of split left-shift (e.g ISO key) +// [3,13] is right key of split right-shift (e.g. HHKB Fn key) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +// Default layer +[0] = { + {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NO }, + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_NO }, + {KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_NO, KC_NO }, + {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO, KC_NO }, + {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RALT, FN_MO13, FN_MO23, KC_RCTL, KC_NO } +}, + +// Fn1 Layer +[1] = { + {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_TRNS}, + {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, + +// Fn2 Layer +[2] = { + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, + +// Fn3 Layer (zeal60 Configuration) +[3] = { + {KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +} + +}; diff --git a/keyboards/zeal65/rules.mk b/keyboards/zeal65/rules.mk new file mode 100644 index 000000000000..b8bcc79dac49 --- /dev/null +++ b/keyboards/zeal65/rules.mk @@ -0,0 +1,84 @@ + + +# project specific files +SRC = ../zeal60/zeal60.c \ + ../zeal60/zeal_backlight.c \ + ../zeal60/zeal_color.c \ + ../zeal60/zeal_eeprom.c \ + ../zeal60/zeal_keymap.c \ + ../zeal60/IS31FL3731_driver.c \ + ../zeal60/TWIlib.c + +# MCU name +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + +# Do not put the microcontroller into power saving mode +# when we get USB suspend event. We want it to keep updating +# backlight effects. +OPT_DEFS += -DNO_SUSPEND_POWER_DOWN + +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE ?= no # Mouse keys(+4700) +EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) +CONSOLE_ENABLE ?= no # Console for debug(+400) +COMMAND_ENABLE ?= no # Commands for debug and configuration +NKRO_ENABLE ?= yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE ?= no # MIDI controls +AUDIO_ENABLE ?= no # Audio output on port C6 +UNICODE_ENABLE ?= no # Unicode +BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend + +RAW_ENABLE = yes diff --git a/keyboards/zeal65/zeal65.c b/keyboards/zeal65/zeal65.c new file mode 100644 index 000000000000..726732326ff1 --- /dev/null +++ b/keyboards/zeal65/zeal65.c @@ -0,0 +1,5 @@ +#include "config.h" + +#ifndef CONFIG_ZEAL65 +#error CONFIG_ZEAL65 not defined, you done goofed somehao, brah +#endif From f7f957c534f8e00c06e2b62b890ca1ec8520ff1c Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Thu, 13 Apr 2017 23:09:31 +1000 Subject: [PATCH 34/69] Keycode safe range changed, caused bugs --- keyboards/zeal60/zeal60.c | 17 +---------------- keyboards/zeal60/zeal_backlight.c | 22 ++++++++++++++++++---- keyboards/zeal60/zeal_backlight.h | 1 + keyboards/zeal60/zeal_keycode.h | 3 ++- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/keyboards/zeal60/zeal60.c b/keyboards/zeal60/zeal60.c index f6b7a56389f0..1439abea1307 100644 --- a/keyboards/zeal60/zeal60.c +++ b/keyboards/zeal60/zeal60.c @@ -373,23 +373,8 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) void led_set_kb(uint8_t usb_led) { - -#if 0 - if (usb_led & (1< Date: Fri, 14 Apr 2017 10:27:08 +1000 Subject: [PATCH 35/69] Bumped EEPROM version due to change in QMK keycodes --- keyboards/zeal60/zeal_eeprom.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/zeal60/zeal_eeprom.h b/keyboards/zeal60/zeal_eeprom.h index f8b5db44d89e..a92a43d6f58c 100644 --- a/keyboards/zeal60/zeal_eeprom.h +++ b/keyboards/zeal60/zeal_eeprom.h @@ -11,7 +11,7 @@ // Bump this every time we change what we store // This will automatically reset the EEPROM with defaults // and avoid loading invalid data from the EEPROM -#define EEPROM_VERSION 0x03 +#define EEPROM_VERSION 0x04 #define EEPROM_VERSION_ADDR ((void*)34) #define EEPROM_BACKLIGHT_CONFIG_ADDR ((void*)35) From e0cb4ae35453ea20aca307ecf577a378a9509dc9 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Sat, 19 Aug 2017 14:14:41 +1000 Subject: [PATCH 36/69] Disable HHKB "blocked" LEDs if KC_NO in keymap --- keyboards/zeal60/zeal_backlight.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/keyboards/zeal60/zeal_backlight.c b/keyboards/zeal60/zeal_backlight.c index 9eba1bc5f596..ef8346b6ca72 100644 --- a/keyboards/zeal60/zeal_backlight.c +++ b/keyboards/zeal60/zeal_backlight.c @@ -792,6 +792,14 @@ void backlight_init_drivers(void) IS31FL3731_init( ISSI_ADDR_1 ); IS31FL3731_init( ISSI_ADDR_2 ); +#ifdef CONFIG_ZEAL65 +#else + keypos_t lctrl_key = { .col = 0, .row = 4 }; + bool lctrl_enabled = keymap_key_to_keycode(0, lctrl_key) != KC_NO; + keypos_t rctrl_key = { .col = 13, .row = 4 }; + bool rctrl_enabled = keymap_key_to_keycode(0, rctrl_key) != KC_NO; +#endif + for ( int index = 0; index < 72; index++ ) { // OR the possible "disabled" cases together, then NOT the result to get the enabled state @@ -809,6 +817,8 @@ void backlight_init_drivers(void) ( index == 36+15 && !g_config.use_split_left_shift ) || // LC15 ( index == 54+8 && !g_config.use_split_right_shift ) || // LD8 ( index == 54+13 && g_config.use_7u_spacebar ) || // LD13 + ( index == 36+17 && !lctrl_enabled ) || // LC17 + ( index == 54+17 && !rctrl_enabled ) || // LD17 ( index == 18+6 ) || // LB6 ( index == 18+7 ) || // LB7 ( index == 18+8 ) || // LB8 From 80c79269aba30506e1a9857cfb6d4b03ad6597df Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Sat, 19 Aug 2017 17:24:55 +1000 Subject: [PATCH 37/69] Added "disable_hhkb_blocker_leds" --- keyboards/zeal60/config.h | 1 + keyboards/zeal60/keymaps/default/config.h | 3 +++ keyboards/zeal60/keymaps/hhkb_ansi/config.h | 3 ++- keyboards/zeal60/keymaps/hhkb_wilba/config.h | 3 ++- keyboards/zeal60/keymaps/mousekey/config.h | 3 ++- keyboards/zeal60/keymaps/poker2_ansi/config.h | 5 +++-- keyboards/zeal60/keymaps/poker2_iso/config.h | 5 +++-- keyboards/zeal60/keymaps/ryanmaclean/config.h | 3 ++- keyboards/zeal60/keymaps/test/config.h | 3 ++- keyboards/zeal60/keymaps/tusing/config.h | 3 +++ keyboards/zeal60/zeal_backlight.c | 15 +++++---------- keyboards/zeal60/zeal_backlight.h | 2 +- keyboards/zeal60/zeal_eeprom.h | 2 +- keyboards/zeal60/zeal_rpc.h | 3 ++- 14 files changed, 32 insertions(+), 22 deletions(-) diff --git a/keyboards/zeal60/config.h b/keyboards/zeal60/config.h index 69bdbce26c20..e61a61b67e6d 100644 --- a/keyboards/zeal60/config.h +++ b/keyboards/zeal60/config.h @@ -77,6 +77,7 @@ along with this program. If not, see . #define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 #define BACKLIGHT_USE_7U_SPACEBAR 0 #define BACKLIGHT_USE_ISO_ENTER 0 +#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 // disable backlight when USB suspended (PC sleep/hibernate/shutdown) #define BACKLIGHT_DISABLE_WHEN_USB_SUSPENDED 0 diff --git a/keyboards/zeal60/keymaps/default/config.h b/keyboards/zeal60/keymaps/default/config.h index e9afa84a1370..c63b926278a8 100644 --- a/keyboards/zeal60/keymaps/default/config.h +++ b/keyboards/zeal60/keymaps/default/config.h @@ -19,4 +19,7 @@ #undef USE_ISO_ENTER #define USE_ISO_ENTER 0 +#undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS +#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 + #endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/hhkb_ansi/config.h b/keyboards/zeal60/keymaps/hhkb_ansi/config.h index be7910b63a39..3352a3d6414b 100644 --- a/keyboards/zeal60/keymaps/hhkb_ansi/config.h +++ b/keyboards/zeal60/keymaps/hhkb_ansi/config.h @@ -19,6 +19,7 @@ #undef USE_ISO_ENTER #define USE_ISO_ENTER 0 - +#undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS +#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 1 #endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/hhkb_wilba/config.h b/keyboards/zeal60/keymaps/hhkb_wilba/config.h index be7910b63a39..3352a3d6414b 100644 --- a/keyboards/zeal60/keymaps/hhkb_wilba/config.h +++ b/keyboards/zeal60/keymaps/hhkb_wilba/config.h @@ -19,6 +19,7 @@ #undef USE_ISO_ENTER #define USE_ISO_ENTER 0 - +#undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS +#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 1 #endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/mousekey/config.h b/keyboards/zeal60/keymaps/mousekey/config.h index 8b76f1bddf93..c63b926278a8 100644 --- a/keyboards/zeal60/keymaps/mousekey/config.h +++ b/keyboards/zeal60/keymaps/mousekey/config.h @@ -19,6 +19,7 @@ #undef USE_ISO_ENTER #define USE_ISO_ENTER 0 - +#undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS +#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 #endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/poker2_ansi/config.h b/keyboards/zeal60/keymaps/poker2_ansi/config.h index e3b070ce6557..0413e14d1a7c 100644 --- a/keyboards/zeal60/keymaps/poker2_ansi/config.h +++ b/keyboards/zeal60/keymaps/poker2_ansi/config.h @@ -20,6 +20,7 @@ #undef USE_ISO_ENTER #define USE_ISO_ENTER 0 +#undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS +#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 - -#endif //CONFIG_USER_H \ No newline at end of file +#endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/poker2_iso/config.h b/keyboards/zeal60/keymaps/poker2_iso/config.h index 3b04288cc0c2..9de1bbccc4ec 100644 --- a/keyboards/zeal60/keymaps/poker2_iso/config.h +++ b/keyboards/zeal60/keymaps/poker2_iso/config.h @@ -20,6 +20,7 @@ #undef USE_ISO_ENTER #define USE_ISO_ENTER 1 +#undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS +#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 - -#endif //CONFIG_USER_H \ No newline at end of file +#endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/ryanmaclean/config.h b/keyboards/zeal60/keymaps/ryanmaclean/config.h index 81e3c08338aa..e5795b40be98 100644 --- a/keyboards/zeal60/keymaps/ryanmaclean/config.h +++ b/keyboards/zeal60/keymaps/ryanmaclean/config.h @@ -19,6 +19,7 @@ #undef USE_ISO_ENTER #define USE_ISO_ENTER 0 - +#undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS +#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 #endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/test/config.h b/keyboards/zeal60/keymaps/test/config.h index 7053731fcf9f..e8b669f56827 100644 --- a/keyboards/zeal60/keymaps/test/config.h +++ b/keyboards/zeal60/keymaps/test/config.h @@ -24,6 +24,7 @@ #undef USE_ISO_ENTER #define USE_ISO_ENTER 0 - +#undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS +#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 #endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/tusing/config.h b/keyboards/zeal60/keymaps/tusing/config.h index c92aaea12649..9014db1bbed1 100644 --- a/keyboards/zeal60/keymaps/tusing/config.h +++ b/keyboards/zeal60/keymaps/tusing/config.h @@ -19,6 +19,9 @@ #undef USE_ISO_ENTER #define USE_ISO_ENTER 0 +#undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS +#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 + // Set up RGB underglow. #define RGBLIGHT_ANIMATIONS #define RGB_DI_PIN B0 // The pin your RGB strip is wired to diff --git a/keyboards/zeal60/zeal_backlight.c b/keyboards/zeal60/zeal_backlight.c index ef8346b6ca72..914243e04752 100644 --- a/keyboards/zeal60/zeal_backlight.c +++ b/keyboards/zeal60/zeal_backlight.c @@ -19,6 +19,7 @@ zeal_backlight_config g_config = { .use_split_right_shift = BACKLIGHT_USE_SPLIT_RIGHT_SHIFT, .use_7u_spacebar = BACKLIGHT_USE_7U_SPACEBAR, .use_iso_enter = BACKLIGHT_USE_ISO_ENTER, + .disable_hhkb_blocker_leds = BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS, .disable_when_usb_suspended = BACKLIGHT_DISABLE_WHEN_USB_SUSPENDED, .disable_after_timeout = BACKLIGHT_DISABLE_AFTER_TIMEOUT, .brightness = 255, @@ -746,6 +747,8 @@ void backlight_config_set_values(msg_backlight_config_set_values *values) g_config.use_split_right_shift = values->use_split_right_shift; g_config.use_7u_spacebar = values->use_7u_spacebar; g_config.use_iso_enter = values->use_iso_enter; + g_config.disable_hhkb_blocker_leds = values->disable_hhkb_blocker_leds; + g_config.disable_when_usb_suspended = values->disable_when_usb_suspended; g_config.disable_after_timeout = values->disable_after_timeout; @@ -792,14 +795,6 @@ void backlight_init_drivers(void) IS31FL3731_init( ISSI_ADDR_1 ); IS31FL3731_init( ISSI_ADDR_2 ); -#ifdef CONFIG_ZEAL65 -#else - keypos_t lctrl_key = { .col = 0, .row = 4 }; - bool lctrl_enabled = keymap_key_to_keycode(0, lctrl_key) != KC_NO; - keypos_t rctrl_key = { .col = 13, .row = 4 }; - bool rctrl_enabled = keymap_key_to_keycode(0, rctrl_key) != KC_NO; -#endif - for ( int index = 0; index < 72; index++ ) { // OR the possible "disabled" cases together, then NOT the result to get the enabled state @@ -817,8 +812,8 @@ void backlight_init_drivers(void) ( index == 36+15 && !g_config.use_split_left_shift ) || // LC15 ( index == 54+8 && !g_config.use_split_right_shift ) || // LD8 ( index == 54+13 && g_config.use_7u_spacebar ) || // LD13 - ( index == 36+17 && !lctrl_enabled ) || // LC17 - ( index == 54+17 && !rctrl_enabled ) || // LD17 + ( index == 36+17 && g_config.disable_hhkb_blocker_leds ) || // LC17 + ( index == 54+17 && g_config.disable_hhkb_blocker_leds ) || // LD17 ( index == 18+6 ) || // LB6 ( index == 18+7 ) || // LB7 ( index == 18+8 ) || // LB8 diff --git a/keyboards/zeal60/zeal_backlight.h b/keyboards/zeal60/zeal_backlight.h index 837173931e18..f37185f03747 100644 --- a/keyboards/zeal60/zeal_backlight.h +++ b/keyboards/zeal60/zeal_backlight.h @@ -21,7 +21,7 @@ typedef struct bool use_7u_spacebar:1; // | bool use_iso_enter:1; // | bool disable_when_usb_suspended:1; // | - bool __pad6:1; // | + bool disable_hhkb_blocker_leds:1; // | bool __pad7:1; // 1 byte uint8_t disable_after_timeout; // 1 byte uint8_t brightness; // 1 byte diff --git a/keyboards/zeal60/zeal_eeprom.h b/keyboards/zeal60/zeal_eeprom.h index a92a43d6f58c..0a0dc6415abc 100644 --- a/keyboards/zeal60/zeal_eeprom.h +++ b/keyboards/zeal60/zeal_eeprom.h @@ -11,7 +11,7 @@ // Bump this every time we change what we store // This will automatically reset the EEPROM with defaults // and avoid loading invalid data from the EEPROM -#define EEPROM_VERSION 0x04 +#define EEPROM_VERSION 0x05 #define EEPROM_VERSION_ADDR ((void*)34) #define EEPROM_BACKLIGHT_CONFIG_ADDR ((void*)35) diff --git a/keyboards/zeal60/zeal_rpc.h b/keyboards/zeal60/zeal_rpc.h index 8d7ddf925132..f44eb5b65831 100644 --- a/keyboards/zeal60/zeal_rpc.h +++ b/keyboards/zeal60/zeal_rpc.h @@ -3,7 +3,7 @@ #include "zeal_color.h" -#define PROTOCOL_VERSION 0x0004 +#define PROTOCOL_VERSION 0x0005 enum { @@ -58,6 +58,7 @@ typedef struct PACKED bool use_7u_spacebar:1; bool use_iso_enter:1; bool disable_when_usb_suspended:1; + bool disable_hhkb_blocker_leds:1; uint8_t disable_after_timeout; uint8_t brightness; uint8_t effect; From 959746e045a0443290031f35f7caa839620d0e74 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Sat, 19 Aug 2017 17:32:08 +1000 Subject: [PATCH 38/69] Required overridden function for keymaps in EEPROM --- quantum/keymap_common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c index 1c522e8b8bae..b1460c53cceb 100644 --- a/quantum/keymap_common.c +++ b/quantum/keymap_common.c @@ -169,6 +169,7 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) } // translates key to keycode +__attribute__ ((weak)) uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) { // Read entire word (16bits) From 0220134a473e887c7c82d73a2d87e766f37cd927 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Sat, 2 Sep 2017 16:17:48 +1000 Subject: [PATCH 39/69] Added polar coordinate mapping, effect speed --- keyboards/zeal60/zeal60.c | 15 ++++- keyboards/zeal60/zeal_backlight.c | 105 ++++++++++++++++++++++++++++-- keyboards/zeal60/zeal_backlight.h | 7 +- keyboards/zeal60/zeal_eeprom.h | 20 +++--- keyboards/zeal60/zeal_keycode.h | 2 + keyboards/zeal60/zeal_rpc.h | 3 +- 6 files changed, 135 insertions(+), 17 deletions(-) diff --git a/keyboards/zeal60/zeal60.c b/keyboards/zeal60/zeal60.c index 1439abea1307..1b2bb4798b7e 100644 --- a/keyboards/zeal60/zeal60.c +++ b/keyboards/zeal60/zeal60.c @@ -44,7 +44,6 @@ void raw_hid_receive( uint8_t *data, uint8_t length ) msg_backlight_config_set_values *msg = (msg_backlight_config_set_values*)&data[1]; backlight_config_set_values(msg); backlight_config_save(); - backlight_init_drivers(); break; } case id_backlight_config_set_alphas_mods: @@ -203,6 +202,20 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) } return false; break; + case ES_INC: + if (record->event.pressed) + { + backlight_effect_speed_increase(); + } + return false; + break; + case ES_DEC: + if (record->event.pressed) + { + backlight_effect_speed_decrease(); + } + return false; + break; case H1_INC: if (record->event.pressed) { diff --git a/keyboards/zeal60/zeal_backlight.c b/keyboards/zeal60/zeal_backlight.c index 914243e04752..c47289b8e85a 100644 --- a/keyboards/zeal60/zeal_backlight.c +++ b/keyboards/zeal60/zeal_backlight.c @@ -11,7 +11,7 @@ #include "zeal_color.h" #include "IS31FL3731_driver.h" -#define BACKLIGHT_EFFECT_MAX 9 +#define BACKLIGHT_EFFECT_MAX 11 zeal_backlight_config g_config = { .use_split_backspace = BACKLIGHT_USE_SPLIT_BACKSPACE, @@ -24,6 +24,7 @@ zeal_backlight_config g_config = { .disable_after_timeout = BACKLIGHT_DISABLE_AFTER_TIMEOUT, .brightness = 255, .effect = 255, // Default to RGB test, so Zeal can flash and test in one pass! + .effect_speed = 0, .color_1 = { .h = 0, .s = 255, .v = 255 }, .color_2 = { .h = 127, .s = 255, .v = 255 }, .caps_lock_indicator = { .color = { .h = 0, .s = 0, .v = 255 }, .index = 255 }, @@ -96,6 +97,23 @@ const Point g_map_led_to_point[72] PROGMEM = { }; #endif // ZEAL65_PROTO +const Point g_map_led_to_point_polar[72] PROGMEM = { + // LA0..LA17 + {58,129}, {70,129}, {80,139}, {89,157}, {96,181}, {101,208}, {105,238}, {109,255}, {128,247}, {58,255}, + {64,255}, {70,255}, {75,255}, {80,255}, {85,255}, {89,255}, {93,255}, {96,255}, + // LB0..LB17 + {53,255}, {48,255}, {43,255}, {39,255}, {34,255}, {32,255}, {255,255}, {255,255}, {255,255}, + {48,139}, {39,157}, {32,181}, {27,208}, {23,238}, {19,255}, {255,255}, {255,255}, {255,255}, + // LC0..LC17 + {188,255}, {183,131}, {173,143}, {165,163}, {159,188}, {154,216}, {172,252}, {170,255}, {165,255}, + {128,9}, {128,46}, {128,82}, {128,119}, {128,155}, {128,192}, {150,244}, {147,255}, {161,255}, + // LD0..LD17 + {0,27}, {0,64}, {0,101}, {0,137}, {0,174}, {255,233}, {228,201}, {235,255}, {237,255}, + {195,128}, {206,136}, {215,152}, {222,175}, {205,234}, {209,255}, {214,255}, {219,255}, {223,255} +}; + + + // This may seem counter-intuitive, but it's quite flexible. // For each LED, get it's position to decide what color to make it. // This solves the issue of LEDs (and switches) not aligning to a grid, @@ -142,6 +160,14 @@ void map_led_to_point( uint8_t index, Point *point ) } } +void map_led_to_point_polar( uint8_t index, Point *point ) +{ + // Slightly messy way to get Point structs out of progmem. + uint8_t *addr = (uint8_t*)&g_map_led_to_point_polar[index]; + point->x = pgm_read_byte(addr); + point->y = pgm_read_byte(addr+1); +} + // // Maps switch matrix coordinate (row,col) to LED index // @@ -455,7 +481,7 @@ void backlight_effect_raindrops(bool initialize) void backlight_effect_cycle_all(void) { - uint8_t offset = g_tick & 0xFF; + uint8_t offset = ( g_tick << g_config.effect_speed ) & 0xFF; // Relies on hue being 8-bit and wrapping for ( int i=0; i<72; i++ ) @@ -477,7 +503,7 @@ void backlight_effect_cycle_all(void) void backlight_effect_cycle_left_right(void) { - uint8_t offset = g_tick & 0xFF; + uint8_t offset = ( g_tick << g_config.effect_speed ) & 0xFF; HSV hsv = { .h = 0, .s = 255, .v = g_config.brightness }; RGB rgb; Point point; @@ -502,7 +528,7 @@ void backlight_effect_cycle_left_right(void) void backlight_effect_cycle_up_down(void) { - uint8_t offset = g_tick & 0xFF; + uint8_t offset = ( g_tick << g_config.effect_speed ) & 0xFF; HSV hsv = { .h = 0, .s = 255, .v = g_config.brightness }; RGB rgb; Point point; @@ -550,6 +576,46 @@ void backlight_effect_jellybean_raindrops( bool initialize ) } } +void backlight_effect_cycle_radial1(void) +{ + uint8_t offset = ( g_tick << g_config.effect_speed ) & 0xFF; + HSV hsv = { .h = 0, .s = 255, .v = g_config.brightness }; + RGB rgb; + Point point; + for ( int i=0; i<72; i++ ) + { + map_led_to_point_polar( i, &point ); + // Relies on hue being 8-bit and wrapping + hsv.h = point.x + offset; + hsv.s = point.y; + rgb = hsv_to_rgb( hsv ); + backlight_set_color( i, rgb.r, rgb.g, rgb.b ); + } +} + +void backlight_effect_cycle_radial2(void) +{ + uint8_t offset = ( g_tick << g_config.effect_speed ) & 0xFF; + + HSV hsv = { .h = 0, .s = g_config.color_1.s, .v = g_config.brightness }; + RGB rgb; + Point point; + for ( int i=0; i<72; i++ ) + { + map_led_to_point_polar( i, &point ); + uint8_t offset2 = offset + point.x; + if ( offset2 & 0x80 ) + { + offset2 = ~offset2; + } + offset2 = offset2 >> 2; + hsv.h = g_config.color_1.h + offset2; + hsv.s = 127 + ( point.y >> 1 ); + rgb = hsv_to_rgb( hsv ); + backlight_set_color( i, rgb.r, rgb.g, rgb.b ); + } +} + void backlight_effect_custom(void) { HSV hsv; @@ -715,6 +781,11 @@ ISR(TIMER3_COMPA_vect) backlight_effect_jellybean_raindrops( initialize ); break; case 9: + backlight_effect_cycle_radial1(); + break; + case 10: + backlight_effect_cycle_radial2(); + break; default: backlight_effect_custom(); break; @@ -742,6 +813,14 @@ void backlight_set_indicator_index( uint8_t *index, uint8_t row, uint8_t column void backlight_config_set_values(msg_backlight_config_set_values *values) { + bool needs_init = ( + g_config.use_split_backspace != values->use_split_backspace || + g_config.use_split_left_shift != values->use_split_left_shift || + g_config.use_split_right_shift != values->use_split_right_shift || + g_config.use_7u_spacebar != values->use_7u_spacebar || + g_config.use_iso_enter != values->use_iso_enter || + g_config.disable_hhkb_blocker_leds != values->disable_hhkb_blocker_leds ); + g_config.use_split_backspace = values->use_split_backspace; g_config.use_split_left_shift = values->use_split_left_shift; g_config.use_split_right_shift = values->use_split_right_shift; @@ -754,6 +833,7 @@ void backlight_config_set_values(msg_backlight_config_set_values *values) g_config.brightness = values->brightness; g_config.effect = values->effect; + g_config.effect_speed = values->effect_speed; g_config.color_1 = values->color_1; g_config.color_2 = values->color_2; g_config.caps_lock_indicator.color = values->caps_lock_indicator_color; @@ -764,6 +844,11 @@ void backlight_config_set_values(msg_backlight_config_set_values *values) backlight_set_indicator_index( &g_config.layer_2_indicator.index, values->layer_2_indicator_row, values->layer_2_indicator_column ); g_config.layer_3_indicator.color = values->layer_3_indicator_color; backlight_set_indicator_index( &g_config.layer_3_indicator.index, values->layer_3_indicator_row, values->layer_3_indicator_column ); + + if ( needs_init ) + { + backlight_init_drivers(); + } } void backlight_config_set_alphas_mods( uint16_t *alphas_mods ) @@ -863,6 +948,18 @@ void backlight_effect_decrease(void) backlight_config_save(); } +void backlight_effect_speed_increase(void) +{ + g_config.effect_speed = increment( g_config.effect_speed, 1, 0, 3 ); + backlight_config_save(); +} + +void backlight_effect_speed_decrease(void) +{ + g_config.effect_speed = decrement( g_config.effect_speed, 1, 0, 3 ); + backlight_config_save(); +} + void backlight_brightness_increase(void) { g_config.brightness = increment( g_config.brightness, 8, 0, 255 ); diff --git a/keyboards/zeal60/zeal_backlight.h b/keyboards/zeal60/zeal_backlight.h index f37185f03747..939e7477ae56 100644 --- a/keyboards/zeal60/zeal_backlight.h +++ b/keyboards/zeal60/zeal_backlight.h @@ -26,6 +26,7 @@ typedef struct uint8_t disable_after_timeout; // 1 byte uint8_t brightness; // 1 byte uint8_t effect; // 1 byte + uint8_t effect_speed; // 1 byte HSV color_1; // 3 bytes HSV color_2; // 3 bytes zeal_indicator caps_lock_indicator; // 4 bytes @@ -33,7 +34,7 @@ typedef struct zeal_indicator layer_2_indicator; // 4 bytes zeal_indicator layer_3_indicator; // 4 bytes uint16_t alphas_mods[5]; // 10 bytes -} zeal_backlight_config; // = 36 bytes +} zeal_backlight_config; // = 37 bytes void backlight_config_set_values(msg_backlight_config_set_values *values); void backlight_config_set_alphas_mods( uint16_t *value ); @@ -59,6 +60,8 @@ void backlight_set_key_hit(uint8_t row, uint8_t col); void backlight_effect_increase(void); void backlight_effect_decrease(void); +void backlight_effect_speed_increase(void); +void backlight_effect_speed_decrease(void); void backlight_brightness_increase(void); void backlight_brightness_decrease(void); @@ -72,6 +75,8 @@ void backlight_color_2_hue_decrease(void); void backlight_color_2_sat_increase(void); void backlight_color_2_sat_decrease(void); + + void *backlight_get_key_color_eeprom_address(uint8_t led); void backlight_get_key_color( uint8_t led, HSV *hsv ); void backlight_set_key_color( uint8_t row, uint8_t column, HSV hsv ); diff --git a/keyboards/zeal60/zeal_eeprom.h b/keyboards/zeal60/zeal_eeprom.h index 0a0dc6415abc..0cd18f06bdbb 100644 --- a/keyboards/zeal60/zeal_eeprom.h +++ b/keyboards/zeal60/zeal_eeprom.h @@ -11,31 +11,31 @@ // Bump this every time we change what we store // This will automatically reset the EEPROM with defaults // and avoid loading invalid data from the EEPROM -#define EEPROM_VERSION 0x05 +#define EEPROM_VERSION 0x06 #define EEPROM_VERSION_ADDR ((void*)34) #define EEPROM_BACKLIGHT_CONFIG_ADDR ((void*)35) -// zeal_backlight_config uses 36 bytes -// 35+36=71 -#define EEPROM_BACKLIGHT_KEY_COLOR_ADDR ((void*)71) +// zeal_backlight_config uses 37 bytes +// 35+37=72 +#define EEPROM_BACKLIGHT_KEY_COLOR_ADDR ((void*)72) // key colors use 72*3=216 -// 71+216=287 +// 72+216=288 -#define EEPROM_KEYMAP_ADDR ((void*)287) +#define EEPROM_KEYMAP_ADDR ((void*)288) #define EEPROM_KEYMAP_MAX 4 // Each keymap is MATRIX_ROWS*MATRIX_COLS*2 bytes // For Zeal60 this is 5*14*2=140 bytes // 4 keymaps = 560 bytes -// 287 + 560 = 847 -// 847 < 1024 :-) +// 288 + 560 = 848 +// 848 < 1024 :-) // For Zeal65 this is 5*15*2=150 bytes // 4 keymaps = 600 bytes -// 287 + 600 = 887 -// 887 < 1024 :-) +// 288 + 600 = 888 +// 888 < 1024 :-) bool eeprom_is_valid(void); void eeprom_set_valid(bool valid); diff --git a/keyboards/zeal60/zeal_keycode.h b/keyboards/zeal60/zeal_keycode.h index 12d31e2eee9f..37ff383b592a 100644 --- a/keyboards/zeal60/zeal_keycode.h +++ b/keyboards/zeal60/zeal_keycode.h @@ -11,6 +11,8 @@ enum zeal60_keycodes { BR_DEC, // backlight brightness decrease EF_INC, // backlight effect increase EF_DEC, // backlight effect decrease + ES_INC, + ES_DEC, H1_INC, H1_DEC, S1_INC, diff --git a/keyboards/zeal60/zeal_rpc.h b/keyboards/zeal60/zeal_rpc.h index f44eb5b65831..7afe00c5e04b 100644 --- a/keyboards/zeal60/zeal_rpc.h +++ b/keyboards/zeal60/zeal_rpc.h @@ -3,7 +3,7 @@ #include "zeal_color.h" -#define PROTOCOL_VERSION 0x0005 +#define PROTOCOL_VERSION 0x0006 enum { @@ -62,6 +62,7 @@ typedef struct PACKED uint8_t disable_after_timeout; uint8_t brightness; uint8_t effect; + uint8_t effect_speed; HSV color_1; HSV color_2; HSV caps_lock_indicator_color; From cc05713c045dd7f583d1e74cb595bdae3df64d80 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Sun, 3 Sep 2017 01:01:42 +1000 Subject: [PATCH 40/69] Force Raw HID interface number to 1 always --- tmk_core/protocol/lufa/descriptor.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/tmk_core/protocol/lufa/descriptor.h b/tmk_core/protocol/lufa/descriptor.h index 43001c977817..61c42c9dfc0d 100644 --- a/tmk_core/protocol/lufa/descriptor.h +++ b/tmk_core/protocol/lufa/descriptor.h @@ -133,10 +133,19 @@ typedef struct /* index of interface */ #define KEYBOARD_INTERFACE 0 +// It is important that the Raw HID interface is at a constant +// interface number, to support Linux/OSX platforms and chrome.hid +// If Raw HID is enabled, let it be always 1. +#ifdef RAW_ENABLE +# define RAW_INTERFACE (KEYBOARD_INTERFACE + 1) +#else +# define RAW_INTERFACE KEYBOARD_INTERFACE +#endif + #ifdef MOUSE_ENABLE -# define MOUSE_INTERFACE (KEYBOARD_INTERFACE + 1) +# define MOUSE_INTERFACE (RAW_INTERFACE + 1) #else -# define MOUSE_INTERFACE KEYBOARD_INTERFACE +# define MOUSE_INTERFACE RAW_INTERFACE #endif #ifdef EXTRAKEY_ENABLE @@ -145,16 +154,10 @@ typedef struct # define EXTRAKEY_INTERFACE MOUSE_INTERFACE #endif -#ifdef RAW_ENABLE -# define RAW_INTERFACE (EXTRAKEY_INTERFACE + 1) -#else -# define RAW_INTERFACE EXTRAKEY_INTERFACE -#endif - #ifdef CONSOLE_ENABLE -# define CONSOLE_INTERFACE (RAW_INTERFACE + 1) +# define CONSOLE_INTERFACE (EXTRAKEY_INTERFACE + 1) #else -# define CONSOLE_INTERFACE RAW_INTERFACE +# define CONSOLE_INTERFACE EXTRAKEY_INTERFACE #endif #ifdef NKRO_ENABLE From 9f967e4e0ea2035c78a1e7071cb62cac3661289d Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Thu, 7 Sep 2017 22:12:29 +1000 Subject: [PATCH 41/69] Fixed last merge from master --- quantum/rgblight.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 898ee2c0e238..eeeabd9e0977 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -22,8 +22,6 @@ #include "debug.h" #include "led_tables.h" -<<<<<<< HEAD - const float BRIGHTNESS_CORRECTION_TABLE[] PROGMEM = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, @@ -31,8 +29,6 @@ const float BRIGHTNESS_CORRECTION_TABLE[] PROGMEM = { 1.0, 1.0, 1.0, 1.0 }; -======= ->>>>>>> master __attribute__ ((weak)) const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5}; __attribute__ ((weak)) From fe07413f36c646483da6d34c5b4feeb8bba16771 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Thu, 7 Sep 2017 22:58:04 +1000 Subject: [PATCH 42/69] Added effect speed to default keymaps --- keyboards/zeal60/keymaps/default/keymap.c | 2 +- keyboards/zeal60/keymaps/hhkb_ansi/keymap.c | 2 +- keyboards/zeal60/keymaps/hhkb_wilba/keymap.c | 2 +- keyboards/zeal60/keymaps/mousekey/keymap.c | 2 +- keyboards/zeal60/keymaps/poker2_ansi/keymap.c | 2 +- keyboards/zeal60/keymaps/poker2_iso/keymap.c | 2 +- keyboards/zeal60/keymaps/test/keymap.c | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/keyboards/zeal60/keymaps/default/keymap.c b/keyboards/zeal60/keymaps/default/keymap.c index 6e7a848d9989..b5a887932abc 100644 --- a/keyboards/zeal60/keymaps/default/keymap.c +++ b/keyboards/zeal60/keymaps/default/keymap.c @@ -41,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Fn3 Layer (zeal60 Configuration) [3] = { {KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} diff --git a/keyboards/zeal60/keymaps/hhkb_ansi/keymap.c b/keyboards/zeal60/keymaps/hhkb_ansi/keymap.c index 889c380366dd..199758c1bbe6 100644 --- a/keyboards/zeal60/keymaps/hhkb_ansi/keymap.c +++ b/keyboards/zeal60/keymaps/hhkb_ansi/keymap.c @@ -41,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Fn3 Layer (zeal60 Configuration) [3] = { {KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} diff --git a/keyboards/zeal60/keymaps/hhkb_wilba/keymap.c b/keyboards/zeal60/keymaps/hhkb_wilba/keymap.c index efffcd0cf398..b3d41b815ded 100644 --- a/keyboards/zeal60/keymaps/hhkb_wilba/keymap.c +++ b/keyboards/zeal60/keymaps/hhkb_wilba/keymap.c @@ -41,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Fn3 Layer (zeal60 Configuration) [3] = { {RESET, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} diff --git a/keyboards/zeal60/keymaps/mousekey/keymap.c b/keyboards/zeal60/keymaps/mousekey/keymap.c index 6e7a848d9989..b5a887932abc 100644 --- a/keyboards/zeal60/keymaps/mousekey/keymap.c +++ b/keyboards/zeal60/keymaps/mousekey/keymap.c @@ -41,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Fn3 Layer (zeal60 Configuration) [3] = { {KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} diff --git a/keyboards/zeal60/keymaps/poker2_ansi/keymap.c b/keyboards/zeal60/keymaps/poker2_ansi/keymap.c index 94e9471ab47b..ee254cbc4641 100644 --- a/keyboards/zeal60/keymaps/poker2_ansi/keymap.c +++ b/keyboards/zeal60/keymaps/poker2_ansi/keymap.c @@ -41,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Fn3 Layer (zeal60 Configuration) [3] = { {KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} diff --git a/keyboards/zeal60/keymaps/poker2_iso/keymap.c b/keyboards/zeal60/keymaps/poker2_iso/keymap.c index 8ce15fae3c70..2c21ae7a4a66 100644 --- a/keyboards/zeal60/keymaps/poker2_iso/keymap.c +++ b/keyboards/zeal60/keymaps/poker2_iso/keymap.c @@ -41,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Fn3 Layer (zeal60 Configuration) [3] = { {KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} diff --git a/keyboards/zeal60/keymaps/test/keymap.c b/keyboards/zeal60/keymaps/test/keymap.c index 4a978ffd364f..4d0848f78c43 100644 --- a/keyboards/zeal60/keymaps/test/keymap.c +++ b/keyboards/zeal60/keymaps/test/keymap.c @@ -41,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Fn3 Layer (zeal60 Configuration) [3] = { {KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} From a8c30c940cf3dcb274213f2eb20e9ba247df0637 Mon Sep 17 00:00:00 2001 From: Joe Ferreira Date: Thu, 7 Sep 2017 21:11:40 -0700 Subject: [PATCH 43/69] add BACKLIGHT_ prefix to vars --- keyboards/zeal60/keymaps/default/config.h | 20 +++++++++---------- keyboards/zeal60/keymaps/hhkb_ansi/config.h | 20 +++++++++---------- keyboards/zeal60/keymaps/hhkb_wilba/config.h | 20 +++++++++---------- keyboards/zeal60/keymaps/mousekey/config.h | 20 +++++++++---------- keyboards/zeal60/keymaps/poker2_ansi/config.h | 20 +++++++++---------- keyboards/zeal60/keymaps/poker2_iso/config.h | 20 +++++++++---------- keyboards/zeal60/keymaps/ryanmaclean/config.h | 20 +++++++++---------- keyboards/zeal60/keymaps/test/config.h | 20 +++++++++---------- 8 files changed, 80 insertions(+), 80 deletions(-) diff --git a/keyboards/zeal60/keymaps/default/config.h b/keyboards/zeal60/keymaps/default/config.h index c63b926278a8..155e53157b58 100644 --- a/keyboards/zeal60/keymaps/default/config.h +++ b/keyboards/zeal60/keymaps/default/config.h @@ -4,20 +4,20 @@ #include "../../config.h" /* enable/disable LEDs based on layout */ -#undef USE_SPLIT_BACKSPACE -#define USE_SPLIT_BACKSPACE 0 +#undef BACKLIGHT_USE_SPLIT_BACKSPACE +#define BACKLIGHT_USE_SPLIT_BACKSPACE 0 -#undef USE_SPLIT_LEFT_SHIFT -#define USE_SPLIT_LEFT_SHIFT 0 +#undef BACKLIGHT_USE_SPLIT_LEFT_SHIFT +#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 -#undef USE_SPLIT_RIGHT_SHIFT -#define USE_SPLIT_RIGHT_SHIFT 0 +#undef BACKLIGHT_USE_SPLIT_RIGHT_SHIFT +#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 -#undef USE_7U_SPACEBAR -#define USE_7U_SPACEBAR 0 +#undef BACKLIGHT_USE_7U_SPACEBAR +#define BACKLIGHT_USE_7U_SPACEBAR 0 -#undef USE_ISO_ENTER -#define USE_ISO_ENTER 0 +#undef BACKLIGHT_USE_ISO_ENTER +#define BACKLIGHT_USE_ISO_ENTER 0 #undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS #define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 diff --git a/keyboards/zeal60/keymaps/hhkb_ansi/config.h b/keyboards/zeal60/keymaps/hhkb_ansi/config.h index 3352a3d6414b..3ee536c9341b 100644 --- a/keyboards/zeal60/keymaps/hhkb_ansi/config.h +++ b/keyboards/zeal60/keymaps/hhkb_ansi/config.h @@ -4,20 +4,20 @@ #include "../../config.h" /* enable/disable LEDs based on layout */ -#undef USE_SPLIT_BACKSPACE -#define USE_SPLIT_BACKSPACE 1 +#undef BACKLIGHT_USE_SPLIT_BACKSPACE +#define BACKLIGHT_USE_SPLIT_BACKSPACE 1 -#undef USE_SPLIT_LEFT_SHIFT -#define USE_SPLIT_LEFT_SHIFT 0 +#undef BACKLIGHT_USE_SPLIT_LEFT_SHIFT +#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 -#undef USE_SPLIT_RIGHT_SHIFT -#define USE_SPLIT_RIGHT_SHIFT 1 +#undef BACKLIGHT_USE_SPLIT_RIGHT_SHIFT +#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 1 -#undef USE_7U_SPACEBAR -#define USE_7U_SPACEBAR 1 +#undef BACKLIGHT_USE_7U_SPACEBAR +#define BACKLIGHT_USE_7U_SPACEBAR 1 -#undef USE_ISO_ENTER -#define USE_ISO_ENTER 0 +#undef BACKLIGHT_USE_ISO_ENTER +#define BACKLIGHT_USE_ISO_ENTER 0 #undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS #define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 1 diff --git a/keyboards/zeal60/keymaps/hhkb_wilba/config.h b/keyboards/zeal60/keymaps/hhkb_wilba/config.h index 3352a3d6414b..3ee536c9341b 100644 --- a/keyboards/zeal60/keymaps/hhkb_wilba/config.h +++ b/keyboards/zeal60/keymaps/hhkb_wilba/config.h @@ -4,20 +4,20 @@ #include "../../config.h" /* enable/disable LEDs based on layout */ -#undef USE_SPLIT_BACKSPACE -#define USE_SPLIT_BACKSPACE 1 +#undef BACKLIGHT_USE_SPLIT_BACKSPACE +#define BACKLIGHT_USE_SPLIT_BACKSPACE 1 -#undef USE_SPLIT_LEFT_SHIFT -#define USE_SPLIT_LEFT_SHIFT 0 +#undef BACKLIGHT_USE_SPLIT_LEFT_SHIFT +#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 -#undef USE_SPLIT_RIGHT_SHIFT -#define USE_SPLIT_RIGHT_SHIFT 1 +#undef BACKLIGHT_USE_SPLIT_RIGHT_SHIFT +#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 1 -#undef USE_7U_SPACEBAR -#define USE_7U_SPACEBAR 1 +#undef BACKLIGHT_USE_7U_SPACEBAR +#define BACKLIGHT_USE_7U_SPACEBAR 1 -#undef USE_ISO_ENTER -#define USE_ISO_ENTER 0 +#undef BACKLIGHT_USE_ISO_ENTER +#define BACKLIGHT_USE_ISO_ENTER 0 #undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS #define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 1 diff --git a/keyboards/zeal60/keymaps/mousekey/config.h b/keyboards/zeal60/keymaps/mousekey/config.h index c63b926278a8..155e53157b58 100644 --- a/keyboards/zeal60/keymaps/mousekey/config.h +++ b/keyboards/zeal60/keymaps/mousekey/config.h @@ -4,20 +4,20 @@ #include "../../config.h" /* enable/disable LEDs based on layout */ -#undef USE_SPLIT_BACKSPACE -#define USE_SPLIT_BACKSPACE 0 +#undef BACKLIGHT_USE_SPLIT_BACKSPACE +#define BACKLIGHT_USE_SPLIT_BACKSPACE 0 -#undef USE_SPLIT_LEFT_SHIFT -#define USE_SPLIT_LEFT_SHIFT 0 +#undef BACKLIGHT_USE_SPLIT_LEFT_SHIFT +#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 -#undef USE_SPLIT_RIGHT_SHIFT -#define USE_SPLIT_RIGHT_SHIFT 0 +#undef BACKLIGHT_USE_SPLIT_RIGHT_SHIFT +#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 -#undef USE_7U_SPACEBAR -#define USE_7U_SPACEBAR 0 +#undef BACKLIGHT_USE_7U_SPACEBAR +#define BACKLIGHT_USE_7U_SPACEBAR 0 -#undef USE_ISO_ENTER -#define USE_ISO_ENTER 0 +#undef BACKLIGHT_USE_ISO_ENTER +#define BACKLIGHT_USE_ISO_ENTER 0 #undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS #define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 diff --git a/keyboards/zeal60/keymaps/poker2_ansi/config.h b/keyboards/zeal60/keymaps/poker2_ansi/config.h index 0413e14d1a7c..b6978cda3dae 100644 --- a/keyboards/zeal60/keymaps/poker2_ansi/config.h +++ b/keyboards/zeal60/keymaps/poker2_ansi/config.h @@ -5,20 +5,20 @@ /* enable/disable LEDs based on layout */ -#undef USE_SPLIT_BACKSPACE -#define USE_SPLIT_BACKSPACE 0 +#undef BACKLIGHT_USE_SPLIT_BACKSPACE +#define BACKLIGHT_USE_SPLIT_BACKSPACE 0 -#undef USE_SPLIT_LEFT_SHIFT -#define USE_SPLIT_LEFT_SHIFT 0 +#undef BACKLIGHT_USE_SPLIT_LEFT_SHIFT +#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 -#undef USE_SPLIT_RIGHT_SHIFT -#define USE_SPLIT_RIGHT_SHIFT 0 +#undef BACKLIGHT_USE_SPLIT_RIGHT_SHIFT +#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 -#undef USE_7U_SPACEBAR -#define USE_7U_SPACEBAR 0 +#undef BACKLIGHT_USE_7U_SPACEBAR +#define BACKLIGHT_USE_7U_SPACEBAR 0 -#undef USE_ISO_ENTER -#define USE_ISO_ENTER 0 +#undef BACKLIGHT_USE_ISO_ENTER +#define BACKLIGHT_USE_ISO_ENTER 0 #undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS #define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 diff --git a/keyboards/zeal60/keymaps/poker2_iso/config.h b/keyboards/zeal60/keymaps/poker2_iso/config.h index 9de1bbccc4ec..2b29669f31c7 100644 --- a/keyboards/zeal60/keymaps/poker2_iso/config.h +++ b/keyboards/zeal60/keymaps/poker2_iso/config.h @@ -5,20 +5,20 @@ /* enable/disable LEDs based on layout */ -#undef USE_SPLIT_BACKSPACE -#define USE_SPLIT_BACKSPACE 0 +#undef BACKLIGHT_USE_SPLIT_BACKSPACE +#define BACKLIGHT_USE_SPLIT_BACKSPACE 0 -#undef USE_SPLIT_LEFT_SHIFT -#define USE_SPLIT_LEFT_SHIFT 0 +#undef BACKLIGHT_USE_SPLIT_LEFT_SHIFT +#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 -#undef USE_SPLIT_RIGHT_SHIFT -#define USE_SPLIT_RIGHT_SHIFT 0 +#undef BACKLIGHT_USE_SPLIT_RIGHT_SHIFT +#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 -#undef USE_7U_SPACEBAR -#define USE_7U_SPACEBAR 0 +#undef BACKLIGHT_USE_7U_SPACEBAR +#define BACKLIGHT_USE_7U_SPACEBAR 0 -#undef USE_ISO_ENTER -#define USE_ISO_ENTER 1 +#undef BACKLIGHT_USE_ISO_ENTER +#define BACKLIGHT_USE_ISO_ENTER 1 #undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS #define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 diff --git a/keyboards/zeal60/keymaps/ryanmaclean/config.h b/keyboards/zeal60/keymaps/ryanmaclean/config.h index e5795b40be98..7a0486bcdbc2 100644 --- a/keyboards/zeal60/keymaps/ryanmaclean/config.h +++ b/keyboards/zeal60/keymaps/ryanmaclean/config.h @@ -4,20 +4,20 @@ #include "../../config.h" /* enable/disable LEDs based on layout */ -#undef USE_SPLIT_BACKSPACE -#define USE_SPLIT_BACKSPACE 1 +#undef BACKLIGHT_USE_SPLIT_BACKSPACE +#define BACKLIGHT_USE_SPLIT_BACKSPACE 1 -#undef USE_SPLIT_LEFT_SHIFT -#define USE_SPLIT_LEFT_SHIFT 0 +#undef BACKLIGHT_USE_SPLIT_LEFT_SHIFT +#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 -#undef USE_SPLIT_RIGHT_SHIFT -#define USE_SPLIT_RIGHT_SHIFT 1 +#undef BACKLIGHT_USE_SPLIT_RIGHT_SHIFT +#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 1 -#undef USE_7U_SPACEBAR -#define USE_7U_SPACEBAR 0 +#undef BACKLIGHT_USE_7U_SPACEBAR +#define BACKLIGHT_USE_7U_SPACEBAR 0 -#undef USE_ISO_ENTER -#define USE_ISO_ENTER 0 +#undef BACKLIGHT_USE_ISO_ENTER +#define BACKLIGHT_USE_ISO_ENTER 0 #undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS #define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 diff --git a/keyboards/zeal60/keymaps/test/config.h b/keyboards/zeal60/keymaps/test/config.h index e8b669f56827..c85ca84b60a1 100644 --- a/keyboards/zeal60/keymaps/test/config.h +++ b/keyboards/zeal60/keymaps/test/config.h @@ -9,20 +9,20 @@ #undef RAW_ENABLE /* enable/disable LEDs based on layout */ -#undef USE_SPLIT_BACKSPACE -#define USE_SPLIT_BACKSPACE 0 +#undef BACKLIGHT_USE_SPLIT_BACKSPACE +#define BACKLIGHT_USE_SPLIT_BACKSPACE 0 -#undef USE_SPLIT_LEFT_SHIFT -#define USE_SPLIT_LEFT_SHIFT 0 +#undef BACKLIGHT_USE_SPLIT_LEFT_SHIFT +#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 -#undef USE_SPLIT_RIGHT_SHIFT -#define USE_SPLIT_RIGHT_SHIFT 0 +#undef BACKLIGHT_USE_SPLIT_RIGHT_SHIFT +#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 -#undef USE_7U_SPACEBAR -#define USE_7U_SPACEBAR 0 +#undef BACKLIGHT_USE_7U_SPACEBAR +#define BACKLIGHT_USE_7U_SPACEBAR 0 -#undef USE_ISO_ENTER -#define USE_ISO_ENTER 0 +#undef BACKLIGHT_USE_ISO_ENTER +#define BACKLIGHT_USE_ISO_ENTER 0 #undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS #define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 From 2ec33ddb143140e67a72f711d66fdee0d6213c3d Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Fri, 8 Sep 2017 20:59:56 +1000 Subject: [PATCH 44/69] add BACKLIGHT_ prefix to vars --- keyboards/zeal60/keymaps/tusing/config.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/keyboards/zeal60/keymaps/tusing/config.h b/keyboards/zeal60/keymaps/tusing/config.h index 9014db1bbed1..4ca4ac80f145 100644 --- a/keyboards/zeal60/keymaps/tusing/config.h +++ b/keyboards/zeal60/keymaps/tusing/config.h @@ -4,20 +4,20 @@ #include "../../config.h" /* Enable/disable LEDs based on layout. */ -#undef USE_SPLIT_BACKSPACE -#define USE_SPLIT_BACKSPACE 0 +#undef BACKLIGHT_USE_SPLIT_BACKSPACE +#define BACKLIGHT_USE_SPLIT_BACKSPACE 0 -#undef USE_SPLIT_LEFT_SHIFT -#define USE_SPLIT_LEFT_SHIFT 0 +#undef BACKLIGHT_USE_SPLIT_LEFT_SHIFT +#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 -#undef USE_SPLIT_RIGHT_SHIFT -#define USE_SPLIT_RIGHT_SHIFT 0 +#undef BACKLIGHT_USE_SPLIT_RIGHT_SHIFT +#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 -#undef USE_7U_SPACEBAR -#define USE_7U_SPACEBAR 0 +#undef BACKLIGHT_USE_7U_SPACEBAR +#define BACKLIGHT_USE_7U_SPACEBAR 0 -#undef USE_ISO_ENTER -#define USE_ISO_ENTER 0 +#undef BACKLIGHT_USE_ISO_ENTER +#define BACKLIGHT_USE_ISO_ENTER 0 #undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS #define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 From a23b63e60de1bd72a4ced05c247cc9f33df0d73b Mon Sep 17 00:00:00 2001 From: tusing Date: Wed, 4 Oct 2017 18:28:10 -0700 Subject: [PATCH 45/69] Keymap speed effect; keymap improvements/fixes Readme updated to match changes --- keyboards/zeal60/keymaps/tusing/README.md | 27 +++++++++++++++-------- keyboards/zeal60/keymaps/tusing/config.h | 7 +++--- keyboards/zeal60/keymaps/tusing/keymap.c | 27 +++++++++++------------ 3 files changed, 35 insertions(+), 26 deletions(-) diff --git a/keyboards/zeal60/keymaps/tusing/README.md b/keyboards/zeal60/keymaps/tusing/README.md index 932427266116..edddf1c58fcd 100644 --- a/keyboards/zeal60/keymaps/tusing/README.md +++ b/keyboards/zeal60/keymaps/tusing/README.md @@ -2,6 +2,12 @@ +## Requirements + +- WS2812B RGB strip, preferably 60 LEDs/meter +- Wire, solder +- Tape, hot glue, or some sort of adhesive + ## A. Connecting the strip You might find the [**full PCB image**](https://cdn.shopify.com/s/files/1/0490/7329/files/zeal60jumpers.png) helpful. Ignore the red boxes! @@ -12,11 +18,13 @@ You might find the [**full PCB image**](https://cdn.shopify.com/s/files/1/0490/7 2. Connect DI to PB0. - + 3. Should look something like this when finished: +*Optional:* To allow considerably more light to escape, consider angling the strip outwards by using some sort of fulcrum under the strip. (I used a thick wire.) + ## B. Enabling the strip 1. If it is not present already, add the following to your ***keymap's*** ```Makefile```: @@ -24,31 +32,32 @@ You might find the [**full PCB image**](https://cdn.shopify.com/s/files/1/0490/7 RGBLIGHT_ENABLE = yes AUDIO_ENABLE = no #Underglow animations cannot be used with audio. ``` -2. If it is not present already, add the following to your *keymap's* ```config.h```: +2. If it is not present already, add the following to your *keymap's* ```config.h```, and edit the values as necessary: ```c - #define RGBLIGHT_ANIMATIONS // Underglow animations. + // Set up RGB underglow. #define RGB_DI_PIN B0 // The pin your RGB strip is wired to + #define RGBLIGHT_ANIMATIONS // Require for fancier stuff (not compatible with audio) #define RGBLED_NUM 35 // Number of LEDs #define RGBLIGHT_HUE_STEP 5 // How much each press of rgb_hue changes hue #define RGBLIGHT_SAT_STEP 10 // How much each press of rgb_sat changes sat #define RGBLIGHT_VAL_STEP 10 // How much each press of rgb_val changes val ``` -3. If they are not present already, add the following keycodes to your keymap to control the RGB strip: ```RGB_TOG``` (on/off), ```RGB_MOD``` (step through modes), ```RGB_HUI```, ```RGB_HUD```, ```RGB_SAI```, ```RGB_SAD```, ```RGB_VAI```, ```RGB_VAD``` (HSV increase/decrease). Add these to your keymap. +3. If they are not present already, add the following keycodes to your keymap to control the RGB strip: ```RGB_TOG``` (on/off), ```RGB_MOD``` (step through modes), ```RGB_HUI```, ```RGB_HUD```, ```RGB_SAI```, ```RGB_SAD```, ```RGB_VAI```, ```RGB_VAD``` (HSV increase/decrease). Add these to your keymap. ## C. Dealing with current limits USB 2.0 ports on laptops provide up to 500mA max, but USB 3.0 ports can provide up to 900mA; USB 3.1 up to 1.5A; and powered USB hubs even more. We can run our keyboard at a higher brightness if we draw more power. **The Zeal60 uses 500mA at max brightness.** This means that **you have about 400mA remaining for the strip to use on a USB 3.0 port**; 1000mA free on a USB 3.1 port, so on and so forth. ***Warning:*** **This means you will need to turn *off* your RGB strip before connecting to a USB 2.0 port**, as USB 2.0 cannot sustain the current necessary! -1. If not present already, add the following to your keymap's ```config.h```. Change variable definitions based on your needs. +1. If not present already, add the following to your keymap's ```config.h```. Change the numbers based on your needs. The ones below are safe underestimates. ```c - // Current limiting. - #define USB_MAX_POWER_CONSUMPTION 900 // Limit device max power consumption. - #define RGBSTRIP_CURRENT_LIMIT 400 // Strip current limit in mA. - #define RGBSTRIP_MAX_CURRENT_PER_LIGHT 60 // mA per light when at max brightness. + // Enable current limiting for RGB underglow. + #define RGBSTRIP_CURRENT_LIMIT 400 // Strip current limit in mA. (USB amperage - 500mA for keyboard) + #define RGBSTRIP_MAX_CURRENT_PER_LIGHT 50 // mA per light when at max brightness. ``` + *Example:* I use a USB port capable of providing 1800 mA. The keyboard uses 500mA, so my personal value (in the `tusing` keymap) for `RGBSTRIP_CURRENT_LIMIT` is 1300. The particular WS2812B RGB strip I have uses a maximum of 60 mA per LED, so that is my personal value for `RGBSTRIP_MAX_CURRENT_PER_LIGHT`. 2. Toggle on the LED strip (```RGB_TOG```) and step through animations (```RGB_MOD```) to test it out! ## D. Sources and resources diff --git a/keyboards/zeal60/keymaps/tusing/config.h b/keyboards/zeal60/keymaps/tusing/config.h index 4ca4ac80f145..c0de92826df0 100644 --- a/keyboards/zeal60/keymaps/tusing/config.h +++ b/keyboards/zeal60/keymaps/tusing/config.h @@ -23,7 +23,6 @@ #define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 // Set up RGB underglow. -#define RGBLIGHT_ANIMATIONS #define RGB_DI_PIN B0 // The pin your RGB strip is wired to #define RGBLIGHT_ANIMATIONS // Require for fancier stuff (not compatible with audio) #define RGBLED_NUM 35 // Number of LEDs @@ -32,12 +31,14 @@ #define RGBLIGHT_VAL_STEP 10 // How much each press of rgb_val changes val // Enable current limiting for RGB underglow. -#define USB_MAX_POWER_CONSUMPTION 900 -#define RGBSTRIP_CURRENT_LIMIT 800 // Strip current limit in mA. +#define RGBSTRIP_CURRENT_LIMIT 1300 // Strip current limit in mA. (USB amperage - 500mA for keyboard) #define RGBSTRIP_MAX_CURRENT_PER_LIGHT 40 // mA per light when at max brightness. // Scale brightnes according to BRIGHTNESS_CORRECTION_TABLE in quantum/rgblight.c. // This allows to mitigate uneven brightness from LED underglow strips. // #define LED_BRIGHTNESS_CORRECTION +// Prevent modifiers on layer 1 from persisting after we let go +#define PREVENT_STUCK_MODIFIERS + #endif diff --git a/keyboards/zeal60/keymaps/tusing/keymap.c b/keyboards/zeal60/keymaps/tusing/keymap.c index b1caeefa423b..1c8bf4fddde8 100644 --- a/keyboards/zeal60/keymaps/tusing/keymap.c +++ b/keyboards/zeal60/keymaps/tusing/keymap.c @@ -5,7 +5,9 @@ // For readability. #define _______ KC_TRNS #define _x_ KC_NO - +#define AUD_PRV LCTL(KC_MPRV) // Previous music track +#define AUD_PLY LCTL(KC_MPLY) // Pause music +#define AUD_NXT LCTL(KC_MNXT) // Next music track // Zeal60-specific keys: // EF_INC, EF_DEC, // next/previous backlight effect @@ -16,9 +18,8 @@ // BR_INC, BR_DEC, // backlight brightness increase/decrease const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - // Default layer: Pressing caps-lock momentarily switches to Layer 1. -// This is the default layer. Pressing an invalid keycode on another layer will take you here. +// This is the default layer. Pressing an empty keycode on another layer will take you here. [0] = { {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS}, @@ -27,25 +28,23 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { {KC_LCTL, KC_LGUI, KC_LALT, _x_ , _x_ , _x_ , _x_ , KC_SPC, _x_ , _x_ , KC_LEFT, KC_UP, KC_DOWN, KC_RGHT} }, -// Layer 1: Pressing Ctrl switches to layer 2. +// Layer 1: Pressing enter switches to layer 2, where backlight controls live. // This is a momentary layer: once you let go of caps, you'll be back in layer 1. [1] = { {KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, {_______, KC_VOLD, KC_MUTE, KC_VOLU, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_INS, KC_DEL, _______}, - {_______, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _x_ }, + {_______, AUD_PRV, AUD_PLY, AUD_NXT, _______, _______, _______, _______, _______, _______, _______, _______, TO(2) , _x_ }, {KC_CAPS, _x_ , _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _x_ }, - {TO(2), _______, _______, _x_ , _x_ , _x_ , _x_ , _______, _x_ , _x_ , KC_HOME, KC_PGUP, KC_PGDN, KC_END} + {KC_RCTL, KC_RGUI, KC_RALT, _x_ , _x_ , _x_ , _x_ , _______, _x_ , _x_ , KC_HOME, KC_PGUP, KC_PGDN, KC_END} }, - -// Layer 2: Zeal60 and backlight configuration. (Get here quickly by pressing Caps+Control from Layer 1.) -// This is a persistent layer. Get back to Layer 1 by pressing left control or an unused key. +// Layer 2: Zeal60 and backlight configuration. (Get here quickly by pressing Caps+Enter from Layer 1.) +// This is a persistent layer. Get back to the default layer by pressing enter. [2] = { - {RESET, EF_DEC, EF_INC, BR_DEC, BR_INC, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {RESET, EF_DEC, EF_INC, BR_DEC, BR_INC, ES_DEC, ES_INC, _______, _______, _______, _______, _______, _______, _______}, {_______, H1_DEC, H1_INC, S1_DEC, S1_INC, _______, _______, _______, _______, _______, _______, _______, _______, _______}, - {RGB_TOG, H2_DEC, H2_INC, S2_DEC, S2_INC, _______, _______, _______, _______, _______, _______, _______, _______, _x_ }, + {_______, H2_DEC, H2_INC, S2_DEC, S2_INC, _______, _______, _______, _______, _______, _______, _______, TO(0) , _x_ }, {RGB_MOD, _x_ , RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, _______, _______, _______, _______, _______, _______, _______, _x_ }, - {TO(0), RGB_VAD, RGB_VAI, _x_ , _x_ , _x_ , _x_ , _______, _x_ , _x_ , _______, _______, _______, _______} + {RGB_TOG, RGB_VAD, RGB_VAI, _x_ , _x_ , _x_ , _x_ , _______, _x_ , _x_ , _______, _______, _______, _______} } - -}; \ No newline at end of file +}; From e7b5b869ff2d56fe1d0fce916bb00318961a6837 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Sun, 20 May 2018 15:49:05 +1000 Subject: [PATCH 46/69] Refactored to use common IS31FL3731/I2C drivers --- drivers/avr/is31fl3731.c | 12 +- keyboards/zeal60/IS31FL3731_driver.c | 314 ------------------ keyboards/zeal60/IS31FL3731_driver.h | 23 -- keyboards/zeal60/TWIlib.c | 232 ------------- keyboards/zeal60/TWIlib.h | 82 ----- keyboards/zeal60/config.h | 4 + keyboards/zeal60/keymaps/m60_a_proto/config.h | 30 ++ keyboards/zeal60/keymaps/m60_a_proto/keymap.c | 52 +++ keyboards/zeal60/rules.mk | 4 +- keyboards/zeal60/zeal_backlight.c | 142 +++++++- keyboards/zeal65/config.h | 5 + keyboards/zeal65/rules.mk | 4 +- 12 files changed, 232 insertions(+), 672 deletions(-) delete mode 100644 keyboards/zeal60/IS31FL3731_driver.c delete mode 100644 keyboards/zeal60/IS31FL3731_driver.h delete mode 100644 keyboards/zeal60/TWIlib.c delete mode 100644 keyboards/zeal60/TWIlib.h create mode 100644 keyboards/zeal60/keymaps/m60_a_proto/config.h create mode 100644 keyboards/zeal60/keymaps/m60_a_proto/keymap.c diff --git a/drivers/avr/is31fl3731.c b/drivers/avr/is31fl3731.c index c7a99e3a3d71..132aef654d75 100644 --- a/drivers/avr/is31fl3731.c +++ b/drivers/avr/is31fl3731.c @@ -192,12 +192,12 @@ void IS31FL3731_set_led_control_register( uint8_t index, bool red, bool green, b { is31_led led = g_is31_leds[index]; - uint8_t control_register_r = (led.r - 0x24) / 8; - uint8_t control_register_g = (led.g - 0x24) / 8; - uint8_t control_register_b = (led.b - 0x24) / 8; - uint8_t bit_r = (led.r - 0x24) % 8; - uint8_t bit_g = (led.g - 0x24) % 8; - uint8_t bit_b = (led.b - 0x24) % 8; + uint8_t control_register_r = (led.r - 0x24) / 8; + uint8_t control_register_g = (led.g - 0x24) / 8; + uint8_t control_register_b = (led.b - 0x24) / 8; + uint8_t bit_r = (led.r - 0x24) % 8; + uint8_t bit_g = (led.g - 0x24) % 8; + uint8_t bit_b = (led.b - 0x24) % 8; if ( red ) { g_led_control_registers[led.driver][control_register_r] |= (1 << bit_r); diff --git a/keyboards/zeal60/IS31FL3731_driver.c b/keyboards/zeal60/IS31FL3731_driver.c deleted file mode 100644 index a65d7b06e0fd..000000000000 --- a/keyboards/zeal60/IS31FL3731_driver.c +++ /dev/null @@ -1,314 +0,0 @@ -#include "IS31FL3731_driver.h" -#include -#include -#include -#include "TWIlib.h" -#include "progmem.h" - -// This is a 7-bit address, that gets left-shifted and bit 0 -// set to 0 for write, 1 for read (as per I2C protocol) -#define ISSI_ADDR_DEFAULT 0x74 - -#define ISSI_REG_CONFIG 0x00 -#define ISSI_REG_CONFIG_PICTUREMODE 0x00 -#define ISSI_REG_CONFIG_AUTOPLAYMODE 0x08 -#define ISSI_REG_CONFIG_AUDIOPLAYMODE 0x18 - -#define ISSI_CONF_PICTUREMODE 0x00 -#define ISSI_CONF_AUTOFRAMEMODE 0x04 -#define ISSI_CONF_AUDIOMODE 0x08 - -#define ISSI_REG_PICTUREFRAME 0x01 - -#define ISSI_REG_SHUTDOWN 0x0A -#define ISSI_REG_AUDIOSYNC 0x06 - -#define ISSI_COMMANDREGISTER 0xFD -#define ISSI_BANK_FUNCTIONREG 0x0B // helpfully called 'page nine' - -// Transfer buffer for TWITransmitData() -uint8_t g_twi_transfer_buffer[TXMAXBUFLEN]; - -// These buffers match the IS31FL3731 PWM registers 0x24-0xB3. -// Storing them like this is optimal for I2C transfers to the registers. -// We could optimize this and take out the unused registers from these -// buffers and the transfers in IS31FL3731_write_pwm_buffer() but it's -// probably not worth the extra complexity. -uint8_t g_pwm_buffer[2][144]; -bool g_pwm_buffer_update_required = false; - -uint8_t g_led_control_registers[2][18] = { { 0 }, { 0 } }; -bool g_led_control_registers_update_required = false; - -// map of LED index to register (matrix A and matrix B) -// i.e. this is LA0..LA17,LB0..LB17 and also LC0..LC17,LD0..LD17 -// Index of LED (0..36) will map to a register. -// Subtract 0x24 to get the second index of g_pwm_buffer -const uint8_t g_red_registers[36] PROGMEM = { - 0x34, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, - 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0x9B, - 0x3C, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, - 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xA3 }; - -const uint8_t g_green_registers[36] PROGMEM = { - 0x44, 0x45, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, - 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x8A, 0x8B, - 0x4C, 0x4D, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, - 0x9C, 0x9D, 0x9E, 0x9F, 0xA0, 0xA1, 0xA2, 0x92, 0x93 }; - -const uint8_t g_blue_registers[36] PROGMEM = { - 0x54, 0x55, 0x56, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, - 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x79, 0x7A, 0x7B, - 0x5C, 0x5D, 0x5E, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, - 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x81, 0x82, 0x83 }; - -typedef struct -{ - uint8_t red_register; - uint8_t red_bit; - uint8_t green_register; - uint8_t green_bit; - uint8_t blue_register; - uint8_t blue_bit; -} led_control_bitmask; - -// This is the bit pattern in the LED control registers -// (for matrix A, add one to register for matrix B) -// -// reg - b7 b6 b5 b4 b3 b2 b1 b0 -// 0x00 - R08,R07,R06,R05,R04,R03,R02,R01 -// 0x02 - G08,G07,G06,G05,G04,G03,G02,R00 -// 0x04 - B08,B07,B06,B05,B04,B03,G01,G00 -// 0x06 - - , - , - , - , - ,B02,B01,B00 -// 0x08 - - , - , - , - , - , - , - , - -// 0x0A - B17,B16,B15, - , - , - , - , - -// 0x0C - G17,G16,B14,B13,B12,B11,B10,B09 -// 0x0E - R17,G15,G14,G13,G12,G11,G10,G09 -// 0x10 - R16,R15,R14,R13,R12,R11,R10,R09 - -const led_control_bitmask g_led_control_bitmask[18] = -{ - { 0x02, 0, 0x04, 0, 0x06, 0 }, // R00,G00,B00 - { 0x00, 0, 0x04, 1, 0x06, 1 }, // R01,G01,B01 - { 0x00, 1, 0x02, 1, 0x06, 2 }, // R02,G02,B02 - { 0x00, 2, 0x02, 2, 0x04, 2 }, // R03,G03,B03 - { 0x00, 3, 0x02, 3, 0x04, 3 }, // R04,G04,B04 - { 0x00, 4, 0x02, 4, 0x04, 4 }, // R05,G05,B05 - { 0x00, 5, 0x02, 5, 0x04, 5 }, // R06,G06,B06 - { 0x00, 6, 0x02, 6, 0x04, 6 }, // R07,G07,B07 - { 0x00, 7, 0x02, 7, 0x04, 7 }, // R08,G08,B08 - - { 0x10, 0, 0x0E, 0, 0x0C, 0 }, // R09,G09,B09 - { 0x10, 1, 0x0E, 1, 0x0C, 1 }, // R10,G10,B10 - { 0x10, 2, 0x0E, 2, 0x0C, 2 }, // R11,G11,B11 - { 0x10, 3, 0x0E, 3, 0x0C, 3 }, // R12,G12,B12 - { 0x10, 4, 0x0E, 4, 0x0C, 4 }, // R13,G13,B13 - { 0x10, 5, 0x0E, 5, 0x0C, 5 }, // R14,G14,B14 - { 0x10, 6, 0x0E, 6, 0x0A, 5 }, // R15,G15,B15 - { 0x10, 7, 0x0C, 6, 0x0A, 6 }, // R16,G16,B16 - { 0x0E, 7, 0x0C, 7, 0x0A, 7 }, // R17,G17,B17 -}; - -void IS31FL3731_write_register( uint8_t addr, uint8_t reg, uint8_t data ) -{ - g_twi_transfer_buffer[0] = (addr << 1) | 0x00; - g_twi_transfer_buffer[1] = reg; - g_twi_transfer_buffer[2] = data; - - // Set the error code to have no relevant information - TWIInfo.errorCode = TWI_NO_RELEVANT_INFO; - // Continuously attempt to transmit data until a successful transmission occurs - while ( TWIInfo.errorCode != 0xFF ) - { - TWITransmitData( g_twi_transfer_buffer, 3, 0 ); - } -} - -void IS31FL3731_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer ) -{ - // assumes bank is already selected - - // transmit PWM registers in 9 transfers of 16 bytes - // g_twi_transfer_buffer[] is 20 bytes - - // set the I2C address - g_twi_transfer_buffer[0] = (addr << 1) | 0x00; - - // iterate over the pwm_buffer contents at 16 byte intervals - for ( int i = 0; i < 144; i += 16 ) - { - // set the first register, e.g. 0x24, 0x34, 0x44, etc. - g_twi_transfer_buffer[1] = 0x24 + i; - // copy the data from i to i+15 - // device will auto-increment register for data after the first byte - // thus this sets registers 0x24-0x33, 0x34-0x43, etc. in one transfer - for ( int j = 0; j < 16; j++ ) - { - g_twi_transfer_buffer[2 + j] = pwm_buffer[i + j]; - } - - // Set the error code to have no relevant information - TWIInfo.errorCode = TWI_NO_RELEVANT_INFO; - // Continuously attempt to transmit data until a successful transmission occurs - while ( TWIInfo.errorCode != 0xFF ) - { - TWITransmitData( g_twi_transfer_buffer, 16 + 2, 0 ); - } - } -} - -void IS31FL3731_init( uint8_t addr ) -{ - // In order to avoid the LEDs being driven with garbage data - // in the LED driver's PWM registers, first enable software shutdown, - // then set up the mode and other settings, clear the PWM registers, - // then disable software shutdown. - - // select "function register" bank - IS31FL3731_write_register( addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG ); - - // enable software shutdown - IS31FL3731_write_register( addr, ISSI_REG_SHUTDOWN, 0x00 ); - // this delay was copied from other drivers, might not be needed - _delay_ms( 10 ); - - // picture mode - IS31FL3731_write_register( addr, ISSI_REG_CONFIG, ISSI_REG_CONFIG_PICTUREMODE ); - // display frame 0 - IS31FL3731_write_register( addr, ISSI_REG_PICTUREFRAME, 0x00 ); - // audio sync off - IS31FL3731_write_register( addr, ISSI_REG_AUDIOSYNC, 0x00 ); - - // select bank 0 - IS31FL3731_write_register( addr, ISSI_COMMANDREGISTER, 0 ); - - // turn off all LEDs in the LED control register - for ( int i = 0x00; i <= 0x11; i++ ) - { - IS31FL3731_write_register( addr, i, 0x00 ); - } - - // turn off all LEDs in the blink control register (not really needed) - for ( int i = 0x12; i <= 0x23; i++ ) - { - IS31FL3731_write_register( addr, i, 0x00 ); - } - - // set PWM on all LEDs to 0 - for ( int i = 0x24; i <= 0xB3; i++ ) - { - IS31FL3731_write_register( addr, i, 0x00 ); - } - - // select "function register" bank - IS31FL3731_write_register( addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG ); - - // disable software shutdown - IS31FL3731_write_register( addr, ISSI_REG_SHUTDOWN, 0x01 ); - - // select bank 0 and leave it selected. - // most usage after initialization is just writing PWM buffers in bank 0 - // as there's not much point in double-buffering - IS31FL3731_write_register( addr, ISSI_COMMANDREGISTER, 0 ); -} - -void IS31FL3731_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) -{ - if ( index >= 0 && index < 72 ) - { - int driver = 0; - if ( index >= 36 ) - { - driver = 1; - index -= 36; - } - // Index of LED (0..36) will map to a register. - // Subtract 0x24 to get the second index of g_pwm_buffer - g_pwm_buffer[driver][ pgm_read_byte(&g_red_registers[index]) - 0x24] = red; - g_pwm_buffer[driver][ pgm_read_byte(&g_green_registers[index]) - 0x24] = green; - g_pwm_buffer[driver][ pgm_read_byte(&g_blue_registers[index]) - 0x24] = blue; - g_pwm_buffer_update_required = true; - } -} - -void IS31FL3731_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) -{ - for ( int i = 0; i < 72; i++ ) - { - IS31FL3731_set_color( i, red, green, blue ); - } -} - -void IS31FL3731_set_led_control_register( uint8_t index, bool red, bool green, bool blue ) -{ - uint8_t driver = 0; - if ( index >= 36 ) - { - driver = 1; - index -= 36; - } - - // index now in range 0..35 - uint8_t matrix = 0; // Matrix A - if ( index >= 18 ) - { - matrix = 1; // Matrix B - index -= 18; - } - - led_control_bitmask bitmask = g_led_control_bitmask[index]; - - // Matrix A and B registers are interleaved. - // Add 1 to Matrix A register to get Matrix B register - if ( red ) - { - g_led_control_registers[driver][bitmask.red_register+matrix] |= (1< -#include - -void IS31FL3731_init( uint8_t addr ); -void IS31FL3731_write_register( uint8_t addr, uint8_t reg, uint8_t data ); -void IS31FL3731_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer ); - -void IS31FL3731_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ); -void IS31FL3731_set_color_all( uint8_t red, uint8_t green, uint8_t blue ); - -void IS31FL3731_set_led_control_register( uint8_t index, bool red, bool green, bool blue ); - -// This should not be called from an interrupt -// (eg. from a timer interrupt). -// Call this while idle (in between matrix scans). -// If the buffer is dirty, it will update the driver with the buffer. -void IS31FL3731_update_pwm_buffers( uint8_t addr1, uint8_t addr2 ); -void IS31FL3731_update_led_control_registers( uint8_t addr1, uint8_t addr2 ); - -#endif // IS31FL3731_DRIVER_H diff --git a/keyboards/zeal60/TWIlib.c b/keyboards/zeal60/TWIlib.c deleted file mode 100644 index b39e3054a5c7..000000000000 --- a/keyboards/zeal60/TWIlib.c +++ /dev/null @@ -1,232 +0,0 @@ -/* - * TWIlib.c - * - * Created: 6/01/2014 10:41:33 PM - * Author: Chris Herring - * http://www.chrisherring.net/all/tutorial-interrupt-driven-twi-interface-for-avr-part1/ - */ - -#include -#include -#include "TWIlib.h" -#include "util/delay.h" - -void TWIInit() -{ - TWIInfo.mode = Ready; - TWIInfo.errorCode = 0xFF; - TWIInfo.repStart = 0; - // Set pre-scalers (no pre-scaling) - TWSR = 0; - // Set bit rate - TWBR = ((F_CPU / TWI_FREQ) - 16) / 2; - // Enable TWI and interrupt - TWCR = (1 << TWIE) | (1 << TWEN); -} - -uint8_t isTWIReady() -{ - if ( (TWIInfo.mode == Ready) | (TWIInfo.mode == RepeatedStartSent) ) - { - return 1; - } - else - { - return 0; - } -} - -uint8_t TWITransmitData(void *const TXdata, uint8_t dataLen, uint8_t repStart) -{ - if (dataLen <= TXMAXBUFLEN) - { - // Wait until ready - while (!isTWIReady()) {_delay_us(1);} - // Set repeated start mode - TWIInfo.repStart = repStart; - // Copy data into the transmit buffer - uint8_t *data = (uint8_t *)TXdata; - for (int i = 0; i < dataLen; i++) - { - TWITransmitBuffer[i] = data[i]; - } - // Copy transmit info to global variables - TXBuffLen = dataLen; - TXBuffIndex = 0; - - // If a repeated start has been sent, then devices are already listening for an address - // and another start does not need to be sent. - if (TWIInfo.mode == RepeatedStartSent) - { - TWIInfo.mode = Initializing; - TWDR = TWITransmitBuffer[TXBuffIndex++]; // Load data to transmit buffer - TWISendTransmit(); // Send the data - } - else // Otherwise, just send the normal start signal to begin transmission. - { - TWIInfo.mode = Initializing; - TWISendStart(); - } - - } - else - { - return 1; // return an error if data length is longer than buffer - } - return 0; -} - -uint8_t TWIReadData(uint8_t TWIaddr, uint8_t bytesToRead, uint8_t repStart) -{ - // Check if number of bytes to read can fit in the RXbuffer - if (bytesToRead < RXMAXBUFLEN) - { - // Reset buffer index and set RXBuffLen to the number of bytes to read - RXBuffIndex = 0; - RXBuffLen = bytesToRead; - // Create the one value array for the address to be transmitted - uint8_t TXdata[1]; - // Shift the address and AND a 1 into the read write bit (set to write mode) - TXdata[0] = (TWIaddr << 1) | 0x01; - // Use the TWITransmitData function to initialize the transfer and address the slave - TWITransmitData(TXdata, 1, repStart); - } - else - { - return 0; - } - return 1; -} - -ISR (TWI_vect) -{ - switch (TWI_STATUS) - { - // ----\/ ---- MASTER TRANSMITTER OR WRITING ADDRESS ----\/ ---- // - case TWI_MT_SLAW_ACK: // SLA+W transmitted and ACK received - // Set mode to Master Transmitter - TWIInfo.mode = MasterTransmitter; - case TWI_START_SENT: // Start condition has been transmitted - case TWI_MT_DATA_ACK: // Data byte has been transmitted, ACK received - if (TXBuffIndex < TXBuffLen) // If there is more data to send - { - TWDR = TWITransmitBuffer[TXBuffIndex++]; // Load data to transmit buffer - TWIInfo.errorCode = TWI_NO_RELEVANT_INFO; - TWISendTransmit(); // Send the data - } - // This transmission is complete however do not release bus yet - else if (TWIInfo.repStart) - { - TWIInfo.errorCode = 0xFF; - TWISendStart(); - } - // All transmissions are complete, exit - else - { - TWIInfo.mode = Ready; - TWIInfo.errorCode = 0xFF; - TWISendStop(); - } - break; - - // ----\/ ---- MASTER RECEIVER ----\/ ---- // - - case TWI_MR_SLAR_ACK: // SLA+R has been transmitted, ACK has been received - // Switch to Master Receiver mode - TWIInfo.mode = MasterReceiver; - // If there is more than one byte to be read, receive data byte and return an ACK - if (RXBuffIndex < RXBuffLen-1) - { - TWIInfo.errorCode = TWI_NO_RELEVANT_INFO; - TWISendACK(); - } - // Otherwise when a data byte (the only data byte) is received, return NACK - else - { - TWIInfo.errorCode = TWI_NO_RELEVANT_INFO; - TWISendNACK(); - } - break; - - case TWI_MR_DATA_ACK: // Data has been received, ACK has been transmitted. - - /// -- HANDLE DATA BYTE --- /// - TWIReceiveBuffer[RXBuffIndex++] = TWDR; - // If there is more than one byte to be read, receive data byte and return an ACK - if (RXBuffIndex < RXBuffLen-1) - { - TWIInfo.errorCode = TWI_NO_RELEVANT_INFO; - TWISendACK(); - } - // Otherwise when a data byte (the only data byte) is received, return NACK - else - { - TWIInfo.errorCode = TWI_NO_RELEVANT_INFO; - TWISendNACK(); - } - break; - - case TWI_MR_DATA_NACK: // Data byte has been received, NACK has been transmitted. End of transmission. - - /// -- HANDLE DATA BYTE --- /// - TWIReceiveBuffer[RXBuffIndex++] = TWDR; - // This transmission is complete however do not release bus yet - if (TWIInfo.repStart) - { - TWIInfo.errorCode = 0xFF; - TWISendStart(); - } - // All transmissions are complete, exit - else - { - TWIInfo.mode = Ready; - TWIInfo.errorCode = 0xFF; - TWISendStop(); - } - break; - - // ----\/ ---- MT and MR common ----\/ ---- // - - case TWI_MR_SLAR_NACK: // SLA+R transmitted, NACK received - case TWI_MT_SLAW_NACK: // SLA+W transmitted, NACK received - case TWI_MT_DATA_NACK: // Data byte has been transmitted, NACK received - case TWI_LOST_ARBIT: // Arbitration has been lost - // Return error and send stop and set mode to ready - if (TWIInfo.repStart) - { - TWIInfo.errorCode = TWI_STATUS; - TWISendStart(); - } - // All transmissions are complete, exit - else - { - TWIInfo.mode = Ready; - TWIInfo.errorCode = TWI_STATUS; - TWISendStop(); - } - break; - case TWI_REP_START_SENT: // Repeated start has been transmitted - // Set the mode but DO NOT clear TWINT as the next data is not yet ready - TWIInfo.mode = RepeatedStartSent; - break; - - // ----\/ ---- SLAVE RECEIVER ----\/ ---- // - - // TODO IMPLEMENT SLAVE RECEIVER FUNCTIONALITY - - // ----\/ ---- SLAVE TRANSMITTER ----\/ ---- // - - // TODO IMPLEMENT SLAVE TRANSMITTER FUNCTIONALITY - - // ----\/ ---- MISCELLANEOUS STATES ----\/ ---- // - case TWI_NO_RELEVANT_INFO: // It is not really possible to get into this ISR on this condition - // Rather, it is there to be manually set between operations - break; - case TWI_ILLEGAL_START_STOP: // Illegal START/STOP, abort and return error - TWIInfo.errorCode = TWI_ILLEGAL_START_STOP; - TWIInfo.mode = Ready; - TWISendStop(); - break; - } - -} diff --git a/keyboards/zeal60/TWIlib.h b/keyboards/zeal60/TWIlib.h deleted file mode 100644 index 23fd1f09aa9f..000000000000 --- a/keyboards/zeal60/TWIlib.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * TWIlib.h - * - * Created: 6/01/2014 10:38:42 PM - * Author: Chris Herring - * http://www.chrisherring.net/all/tutorial-interrupt-driven-twi-interface-for-avr-part1/ - */ - - -#ifndef TWILIB_H_ -#define TWILIB_H_ -// TWI bit rate (was 100000) -#define TWI_FREQ 400000 -// Get TWI status -#define TWI_STATUS (TWSR & 0xF8) -// Transmit buffer length -#define TXMAXBUFLEN 20 -// Receive buffer length -#define RXMAXBUFLEN 20 -// Global transmit buffer -uint8_t TWITransmitBuffer[TXMAXBUFLEN]; -// Global receive buffer -volatile uint8_t TWIReceiveBuffer[RXMAXBUFLEN]; -// Buffer indexes -volatile int TXBuffIndex; // Index of the transmit buffer. Is volatile, can change at any time. -int RXBuffIndex; // Current index in the receive buffer -// Buffer lengths -int TXBuffLen; // The total length of the transmit buffer -int RXBuffLen; // The total number of bytes to read (should be less than RXMAXBUFFLEN) - -typedef enum { - Ready, - Initializing, - RepeatedStartSent, - MasterTransmitter, - MasterReceiver, - SlaceTransmitter, - SlaveReciever - } TWIMode; - - typedef struct TWIInfoStruct{ - TWIMode mode; - uint8_t errorCode; - uint8_t repStart; - }TWIInfoStruct; -TWIInfoStruct TWIInfo; - - -// TWI Status Codes -#define TWI_START_SENT 0x08 // Start sent -#define TWI_REP_START_SENT 0x10 // Repeated Start sent -// Master Transmitter Mode -#define TWI_MT_SLAW_ACK 0x18 // SLA+W sent and ACK received -#define TWI_MT_SLAW_NACK 0x20 // SLA+W sent and NACK received -#define TWI_MT_DATA_ACK 0x28 // DATA sent and ACK received -#define TWI_MT_DATA_NACK 0x30 // DATA sent and NACK received -// Master Receiver Mode -#define TWI_MR_SLAR_ACK 0x40 // SLA+R sent, ACK received -#define TWI_MR_SLAR_NACK 0x48 // SLA+R sent, NACK received -#define TWI_MR_DATA_ACK 0x50 // Data received, ACK returned -#define TWI_MR_DATA_NACK 0x58 // Data received, NACK returned - -// Miscellaneous States -#define TWI_LOST_ARBIT 0x38 // Arbitration has been lost -#define TWI_NO_RELEVANT_INFO 0xF8 // No relevant information available -#define TWI_ILLEGAL_START_STOP 0x00 // Illegal START or STOP condition has been detected -#define TWI_SUCCESS 0xFF // Successful transfer, this state is impossible from TWSR as bit2 is 0 and read only - - -#define TWISendStart() (TWCR = (1<. #define MATRIX_COL_PINS { F5, D5, B1, B2, B3, D3, D2, C7, C6, B6, B5, B4, D7, D6 } #define UNUSED_PINS +// IS31FL3731 driver +#define DRIVER_COUNT 2 +#define DRIVER_LED_TOTAL 72 + // COL2ROW or ROW2COL #define DIODE_DIRECTION COL2ROW diff --git a/keyboards/zeal60/keymaps/m60_a_proto/config.h b/keyboards/zeal60/keymaps/m60_a_proto/config.h new file mode 100644 index 000000000000..db27bf052be1 --- /dev/null +++ b/keyboards/zeal60/keymaps/m60_a_proto/config.h @@ -0,0 +1,30 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#undef DIODE_DIRECTION +#define DIODE_DIRECTION ROW2COL + +#define M60_A_PROTO + +/* enable/disable LEDs based on layout */ +#undef BACKLIGHT_USE_SPLIT_BACKSPACE +#define BACKLIGHT_USE_SPLIT_BACKSPACE 1 + +#undef BACKLIGHT_USE_SPLIT_LEFT_SHIFT +#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 + +#undef BACKLIGHT_USE_SPLIT_RIGHT_SHIFT +#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 1 + +#undef BACKLIGHT_USE_7U_SPACEBAR +#define BACKLIGHT_USE_7U_SPACEBAR 1 + +#undef BACKLIGHT_USE_ISO_ENTER +#define BACKLIGHT_USE_ISO_ENTER 0 + +#undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS +#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 1 + +#endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/m60_a_proto/keymap.c b/keyboards/zeal60/keymaps/m60_a_proto/keymap.c new file mode 100644 index 000000000000..b3d41b815ded --- /dev/null +++ b/keyboards/zeal60/keymaps/m60_a_proto/keymap.c @@ -0,0 +1,52 @@ +// Wilba's HHKB layout for Zeal60 + +#include "zeal60.h" + +// [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace +// [1,13] is either backslash or ISO Enter +// [2,12] is either ANSI Enter or key left of ISO Enter +// [2,13] is right key of split backspace (e.g. HHKB `~ key) +// [3,1] is right key of split left-shift (e.g ISO key) +// [3,13] is right key of split right-shift (e.g. HHKB Fn key) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +// Default layer +[0] = { + {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS}, + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC}, + {KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_GRV }, + {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, FN_MO13}, + {KC_NO, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_NO, KC_RALT, FN_MO23, KC_NO } +}, + +// Fn1 Layer +[1] = { + {KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS }, + {KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_EJCT, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_TRNS, KC_DEL }, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, + +// Fn2 Layer +[2] = { + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_CALC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, + +// Fn3 Layer (zeal60 Configuration) +[3] = { + {RESET, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +} + +}; + + diff --git a/keyboards/zeal60/rules.mk b/keyboards/zeal60/rules.mk index 41f2e95b038f..2f55174480e6 100644 --- a/keyboards/zeal60/rules.mk +++ b/keyboards/zeal60/rules.mk @@ -5,8 +5,8 @@ SRC = zeal_backlight.c \ zeal_color.c \ zeal_eeprom.c \ zeal_keymap.c \ - IS31FL3731_driver.c \ - TWIlib.c + ../../drivers/avr/is31fl3731.c \ + ../../drivers/avr/i2c_master.c # MCU name MCU = atmega32u4 diff --git a/keyboards/zeal60/zeal_backlight.c b/keyboards/zeal60/zeal_backlight.c index c47289b8e85a..72280d7e510d 100644 --- a/keyboards/zeal60/zeal_backlight.c +++ b/keyboards/zeal60/zeal_backlight.c @@ -2,14 +2,15 @@ #include "zeal_backlight.h" #include -#include "TWIlib.h" #include #include +#include "i2c_master.h" #include "progmem.h" #include "config.h" #include "zeal_eeprom.h" #include "zeal_color.h" -#include "IS31FL3731_driver.h" + +#include "is31fl3731.h" #define BACKLIGHT_EFFECT_MAX 11 @@ -56,6 +57,95 @@ uint32_t g_any_key_hit = 0; #define ISSI_ADDR_1 0x74 #define ISSI_ADDR_2 0x76 + + + +const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +/* Refer to IS31 manual for these locations + * driver + * | R location + * | | G location + * | | | B location + * | | | | */ + {0, C2_1, C3_1, C4_1}, // LA0 + {0, C1_1, C3_2, C4_2}, // LA1 + {0, C1_2, C2_2, C4_3}, // LA2 + {0, C1_3, C2_3, C3_3}, // LA3 + {0, C1_4, C2_4, C3_4}, // LA4 + {0, C1_5, C2_5, C3_5}, // LA5 + {0, C1_6, C2_6, C3_6}, // LA6 + {0, C1_7, C2_7, C3_7}, // LA7 + {0, C1_8, C2_8, C3_8}, // LA8 + {0, C9_1, C8_1, C7_1}, // LA9 + {0, C9_2, C8_2, C7_2}, // LA10 + {0, C9_3, C8_3, C7_3}, // LA11 + {0, C9_4, C8_4, C7_4}, // LA12 + {0, C9_5, C8_5, C7_5}, // LA13 + {0, C9_6, C8_6, C7_6}, // LA14 + {0, C9_7, C8_7, C6_6}, // LA15 + {0, C9_8, C7_7, C6_7}, // LA16 + {0, C8_8, C7_8, C6_8}, // LA17 + + {0, C2_9, C3_9, C4_9}, // LB0 + {0, C1_9, C3_10, C4_10}, // LB1 + {0, C1_10, C2_10, C4_11}, // LB2 + {0, C1_11, C2_11, C3_11}, // LB3 + {0, C1_12, C2_12, C3_12}, // LB4 + {0, C1_13, C2_13, C3_13}, // LB5 + {0, C1_14, C2_14, C3_14}, // LB6 + {0, C1_15, C2_15, C3_15}, // LB7 + {0, C1_16, C2_16, C3_16}, // LB8 + {0, C9_9, C8_9, C7_9}, // LB9 + {0, C9_10, C8_10, C7_10}, // LB10 + {0, C9_11, C8_11, C7_11}, // LB11 + {0, C9_12, C8_12, C7_12}, // LB12 + {0, C9_13, C8_13, C7_13}, // LB13 + {0, C9_14, C8_14, C7_14}, // LB14 + {0, C9_15, C8_15, C6_14}, // LB15 + {0, C9_16, C7_15, C6_15}, // LB16 + {0, C8_16, C7_16, C6_16}, // LB17 + + {1, C2_1, C3_1, C4_1}, // LC0 + {1, C1_1, C3_2, C4_2}, // LC1 + {1, C1_2, C2_2, C4_3}, // LC2 + {1, C1_3, C2_3, C3_3}, // LC3 + {1, C1_4, C2_4, C3_4}, // LC4 + {1, C1_5, C2_5, C3_5}, // LC5 + {1, C1_6, C2_6, C3_6}, // LC6 + {1, C1_7, C2_7, C3_7}, // LC7 + {1, C1_8, C2_8, C3_8}, // LC8 + {1, C9_1, C8_1, C7_1}, // LC9 + {1, C9_2, C8_2, C7_2}, // LC10 + {1, C9_3, C8_3, C7_3}, // LC11 + {1, C9_4, C8_4, C7_4}, // LC12 + {1, C9_5, C8_5, C7_5}, // LC13 + {1, C9_6, C8_6, C7_6}, // LC14 + {1, C9_7, C8_7, C6_6}, // LC15 + {1, C9_8, C7_7, C6_7}, // LC16 + {1, C8_8, C7_8, C6_8}, // LC17 + + {1, C2_9, C3_9, C4_9}, // LD0 + {1, C1_9, C3_10, C4_10}, // LD1 + {1, C1_10, C2_10, C4_11}, // LD2 + {1, C1_11, C2_11, C3_11}, // LD3 + {1, C1_12, C2_12, C3_12}, // LD4 + {1, C1_13, C2_13, C3_13}, // LD5 + {1, C1_14, C2_14, C3_14}, // LD6 + {1, C1_15, C2_15, C3_15}, // LD7 + {1, C1_16, C2_16, C3_16}, // LD8 + {1, C9_9, C8_9, C7_9}, // LD9 + {1, C9_10, C8_10, C7_10}, // LD10 + {1, C9_11, C8_11, C7_11}, // LD11 + {1, C9_12, C8_12, C7_12}, // LD12 + {1, C9_13, C8_13, C7_13}, // LD13 + {1, C9_14, C8_14, C7_14}, // LD14 + {1, C9_15, C8_15, C6_14}, // LD15 + {1, C9_16, C7_15, C6_15}, // LD16 + {1, C8_16, C7_16, C6_16}, // LD17 +}; + + + typedef struct Point { uint8_t x; uint8_t y; @@ -74,12 +164,26 @@ const Point g_map_led_to_point[72] PROGMEM = { {144,0}, {160,0}, {176,0}, {192,0}, {216,0}, {224,0}, {240,0}, {240,16}, {240,32}, {136,16}, {152,16}, {168,16}, {184,16}, {200,16}, {220,16}, {240,48}, {240,64}, {224,64}, // LC0..LC17 - {96,64}, {100,48}, {84,48}, {68,48}, {52,48}, {36,48}, {60,64}, {48,60}, {28,64}, - {108,32}, {92,32}, {76,32}, {60,32}, {44,32}, {28,32}, {20,48}, {2,48}, {4,64}, + {96,64}, {100,48}, {84,48}, {68,48}, {52,48}, {36,48}, {255,255}, {48,60}, {28,64}, + {108,32}, {92,32}, {76,32}, {60,32}, {44,32}, {28,32}, {20,44}, {10,48}, {4,64}, // LD0..LD17 - {124,32}, {140,32}, {156,32}, {172,32}, {188,32}, {214,32}, {180,48}, {210,48}, {224,48}, + {124,32}, {140,32}, {156,32}, {172,32}, {188,32}, {214,32}, {180,48}, {202,48}, {224,48}, {116,48}, {132,48}, {148,48}, {164,48}, {255,255}, {144,60}, {164,64}, {188,64}, {208,64} }; +const Point g_map_led_to_point_polar[72] PROGMEM = { + // LA0..LA17 + {64,128}, {75,132}, {84,145}, {91,164}, {97,187}, {102,213}, {105,242}, {109,255}, {128,247}, + {61,255}, {67,255}, {72,255}, {77,255}, {82,255}, {86,255}, {90,255}, {93,255}, {96,255}, + // LB0..LB17 + {56,255}, {51,255}, {46,255}, {42,255}, {37,255}, {35,255}, {32,255}, {19,255}, {0,255}, + {53,132}, {44,145}, {37,164}, {31,187}, {26,213}, {22,249}, {237,255}, {224,255}, {221,255}, + // LC0..LC17 + {184,255}, {179,135}, {170,149}, {163,169}, {157,193}, {153,220}, {255,255}, {167,255}, {165,255}, + {128,26}, {128,60}, {128,94}, {128,128}, {128,162}, {128,196}, {145,233}, {148,255}, {161,255}, + // LD0..LD17 + {0,9}, {0,43}, {0,77}, {0,111}, {0,145}, {255,201}, {224,181}, {230,217}, {235,255}, + {189,128}, {200,131}, {210,141}, {218,159}, {201,228}, {201,228}, {206,255}, {213,255}, {218,255} +}; #else const Point g_map_led_to_point[72] PROGMEM = { // LA0..LA17 @@ -95,8 +199,6 @@ const Point g_map_led_to_point[72] PROGMEM = { {124,32}, {140,32}, {156,32}, {172,32}, {188,32}, {214,32}, {180,48}, {210,48}, {224,48}, {116,48}, {132,48}, {148,48}, {164,48}, {144,64}, {161,64}, {181,64}, {201,64}, {221,64} }; -#endif // ZEAL65_PROTO - const Point g_map_led_to_point_polar[72] PROGMEM = { // LA0..LA17 {58,129}, {70,129}, {80,139}, {89,157}, {96,181}, {101,208}, {105,238}, {109,255}, {128,247}, {58,255}, @@ -111,6 +213,11 @@ const Point g_map_led_to_point_polar[72] PROGMEM = { {0,27}, {0,64}, {0,101}, {0,137}, {0,174}, {255,233}, {228,201}, {235,255}, {237,255}, {195,128}, {206,136}, {215,152}, {222,175}, {205,234}, {209,255}, {214,255}, {219,255}, {223,255} }; +#endif // ZEAL65_PROTO + + + + @@ -873,10 +980,8 @@ void backlight_config_save(void) void backlight_init_drivers(void) { - sei(); - // Initialize TWI - TWIInit(); + i2c_init(); IS31FL3731_init( ISSI_ADDR_1 ); IS31FL3731_init( ISSI_ADDR_2 ); @@ -891,7 +996,21 @@ void backlight_init_drivers(void) ( index == 36+6 ) || // LC6 ( index == 54+13 ) ); // LD13 #else - +#ifdef M60_A_PROTO + bool enabled = !( + // LB6 LB7 LB8 LB15 LB16 LB17 not present on M60-A + ( index == 18+6 ) || // LB6 + ( index == 18+7 ) || // LB7 + ( index == 18+8 ) || // LB8 + ( index == 18+15 ) || // LB15 + ( index == 18+16 ) || // LB16 + ( index == 18+17 ) || // LB17 + // HHKB blockers (LC17, LD17) and ISO extra keys (LC15,LD13) not present on M60-A + ( index == 36+17 ) || // LC17 + ( index == 54+17 ) || // LD17 + ( index == 36+15 ) || // LC15 + ( index == 54+13 ) ); // LD13 +#else // LB6 LB7 LB8 LB15 LB16 LB17 not present on Zeal60 bool enabled = !( ( index == 18+5 && !g_config.use_split_backspace ) || // LB5 ( index == 36+15 && !g_config.use_split_left_shift ) || // LC15 @@ -905,6 +1024,7 @@ void backlight_init_drivers(void) ( index == 18+15 ) || // LB15 ( index == 18+16 ) || // LB16 ( index == 18+17 ) ); // LB17 +#endif #endif // This only caches it for later IS31FL3731_set_led_control_register( index, enabled, enabled, enabled ); diff --git a/keyboards/zeal65/config.h b/keyboards/zeal65/config.h index 02c251174f5a..823ab55054cf 100644 --- a/keyboards/zeal65/config.h +++ b/keyboards/zeal65/config.h @@ -40,6 +40,10 @@ along with this program. If not, see . #define MATRIX_COL_PINS { F5, D5, B1, B2, B3, D3, D2, C7, C6, B6, B5, B4, D7, D6, D4 } #define UNUSED_PINS +// IS31FL3731 driver +#define DRIVER_COUNT 2 +#define DRIVER_LED_TOTAL 72 + // COL2ROW or ROW2COL #define DIODE_DIRECTION COL2ROW @@ -80,6 +84,7 @@ along with this program. If not, see . #define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 #define BACKLIGHT_USE_7U_SPACEBAR 0 #define BACKLIGHT_USE_ISO_ENTER 0 +#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 // disable backlight when USB suspended (PC sleep/hibernate/shutdown) #define BACKLIGHT_DISABLE_WHEN_USB_SUSPENDED 0 diff --git a/keyboards/zeal65/rules.mk b/keyboards/zeal65/rules.mk index b8bcc79dac49..23a53f567cf6 100644 --- a/keyboards/zeal65/rules.mk +++ b/keyboards/zeal65/rules.mk @@ -6,8 +6,8 @@ SRC = ../zeal60/zeal60.c \ ../zeal60/zeal_color.c \ ../zeal60/zeal_eeprom.c \ ../zeal60/zeal_keymap.c \ - ../zeal60/IS31FL3731_driver.c \ - ../zeal60/TWIlib.c + ../../drivers/avr/is31fl3731.c \ + ../../drivers/avr/i2c_master.c # MCU name MCU = atmega32u4 From 81c1e314a6281b3d13103c8636955fce489585a8 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Mon, 21 May 2018 23:20:49 +1000 Subject: [PATCH 47/69] Fixed make rules, backlight disabled feature --- keyboards/zeal60/config.h | 1 + .../keymaps/backlight_disabled/config.h | 9 ++++ .../keymaps/backlight_disabled/keymap.c | 50 +++++++++++++++++++ keyboards/zeal60/rules.mk | 4 +- keyboards/zeal60/zeal60.c | 30 ++++++++++- keyboards/zeal60/zeal_backlight.c | 8 +-- keyboards/zeal60/zeal_backlight.h | 5 ++ keyboards/zeal65/config.h | 1 + keyboards/zeal65/rules.mk | 4 +- 9 files changed, 103 insertions(+), 9 deletions(-) create mode 100644 keyboards/zeal60/keymaps/backlight_disabled/config.h create mode 100644 keyboards/zeal60/keymaps/backlight_disabled/keymap.c diff --git a/keyboards/zeal60/config.h b/keyboards/zeal60/config.h index d99bae5029d4..f7f1d833bd5d 100644 --- a/keyboards/zeal60/config.h +++ b/keyboards/zeal60/config.h @@ -75,6 +75,7 @@ along with this program. If not, see . //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION +#define BACKLIGHT_ENABLED 1 // enable/disable LEDs based on layout #define BACKLIGHT_USE_SPLIT_BACKSPACE 0 #define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 diff --git a/keyboards/zeal60/keymaps/backlight_disabled/config.h b/keyboards/zeal60/keymaps/backlight_disabled/config.h new file mode 100644 index 000000000000..1f253459ec63 --- /dev/null +++ b/keyboards/zeal60/keymaps/backlight_disabled/config.h @@ -0,0 +1,9 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#undef BACKLIGHT_ENABLED +#define BACKLIGHT_ENABLED 0 + +#endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/backlight_disabled/keymap.c b/keyboards/zeal60/keymaps/backlight_disabled/keymap.c new file mode 100644 index 000000000000..b5a887932abc --- /dev/null +++ b/keyboards/zeal60/keymaps/backlight_disabled/keymap.c @@ -0,0 +1,50 @@ +// Default layout for Zeal60 + +#include "zeal60.h" + +// [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace +// [1,13] is either backslash or ISO Enter +// [2,12] is either ANSI Enter or key left of ISO Enter +// [2,13] is right key of split backspace (e.g. HHKB `~ key) +// [3,1] is right key of split left-shift (e.g ISO key) +// [3,13] is right key of split right-shift (e.g. HHKB Fn key) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +// Default layer +[0] = { + {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS}, + {KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_NO }, + {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO }, + {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RALT, FN_MO13, FN_MO23, KC_RCTL} +}, + +// Fn1 Layer +[1] = { + {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, + {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS}, + {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, + +// Fn2 Layer +[2] = { + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, + +// Fn3 Layer (zeal60 Configuration) +[3] = { + {KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +} + +}; diff --git a/keyboards/zeal60/rules.mk b/keyboards/zeal60/rules.mk index 2f55174480e6..407768b69bd1 100644 --- a/keyboards/zeal60/rules.mk +++ b/keyboards/zeal60/rules.mk @@ -5,8 +5,8 @@ SRC = zeal_backlight.c \ zeal_color.c \ zeal_eeprom.c \ zeal_keymap.c \ - ../../drivers/avr/is31fl3731.c \ - ../../drivers/avr/i2c_master.c + is31fl3731.c \ + i2c_master.c # MCU name MCU = atmega32u4 diff --git a/keyboards/zeal60/zeal60.c b/keyboards/zeal60/zeal60.c index 1b2bb4798b7e..6f8123f52621 100644 --- a/keyboards/zeal60/zeal60.c +++ b/keyboards/zeal60/zeal60.c @@ -1,5 +1,8 @@ #include "zeal60.h" +// Check that no backlight functions are called +#if BACKLIGHT_ENABLED #include "zeal_backlight.h" +#endif // BACKLIGHT_ENABLED #include "zeal_keymap.h" #include "zeal_eeprom.h" #include "zeal_rpc.h" @@ -39,6 +42,7 @@ void raw_hid_receive( uint8_t *data, uint8_t length ) break; } #endif // USE_KEYMAPS_IN_EEPROM +#if BACKLIGHT_ENABLED case id_backlight_config_set_values: { msg_backlight_config_set_values *msg = (msg_backlight_config_set_values*)&data[1]; @@ -59,10 +63,15 @@ void raw_hid_receive( uint8_t *data, uint8_t length ) backlight_set_key_color(msg->row, msg->column, msg->hsv); break; } +#endif // BACKLIGHT_ENABLED case id_system_get_state: { msg_system_state *msg = (msg_system_state*)&data[1]; +#if BACKLIGHT_ENABLED msg->value = backlight_get_tick(); +#else + msg->value = 1; // TODO: need to decouple "uptime" from backlight +#endif // BACKLIGHT_ENABLED break; } default: @@ -89,6 +98,7 @@ void bootmagic_lite(void) // We need multiple scans because debouncing can't be turned off. matrix_scan(); wait_ms(DEBOUNCING_DELAY); + wait_ms(DEBOUNCING_DELAY); matrix_scan(); // If the Esc and space bar are held down on power up, @@ -116,12 +126,14 @@ void matrix_init_kb(void) // OK to load from EEPROM. if (eeprom_is_valid()) { +#if BACKLIGHT_ENABLED backlight_config_load(); - +#endif // BACKLIGHT_ENABLED // TODO: do something to "turn on" keymaps in EEPROM? } else { +#if BACKLIGHT_ENABLED // If the EEPROM has not been saved before, or is out of date, // save the default values to the EEPROM. Default values // come from construction of the zeal_backlight_config instance. @@ -139,6 +151,7 @@ void matrix_init_kb(void) backlight_set_key_color( row, column, hsv ); } } +#endif // BACKLIGHT_ENABLED // This saves "empty" keymaps so it falls back to the keymaps // in the firmware (aka. progmem/flash) @@ -148,19 +161,23 @@ void matrix_init_kb(void) eeprom_set_valid(true); } +#if BACKLIGHT_ENABLED // Initialize LED drivers for backlight. backlight_init_drivers(); backlight_timer_init(); backlight_timer_enable(); +#endif // BACKLIGHT_ENABLED matrix_init_user(); } void matrix_scan_kb(void) { +#if BACKLIGHT_ENABLED // This only updates the LED driver buffers if something has changed. backlight_update_pwm_buffers(); +#endif // BACKLIGHT_ENABLED matrix_scan_user(); } @@ -169,11 +186,14 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) // Record keypresses for backlight effects if ( record->event.pressed ) { +#if BACKLIGHT_ENABLED backlight_set_key_hit( record->event.key.row, record->event.key.col ); +#endif // BACKLIGHT_ENABLED } switch(keycode) { +#if BACKLIGHT_ENABLED case BR_INC: if (record->event.pressed) { @@ -274,6 +294,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) } return false; break; +#endif // BACKLIGHT_ENABLED case FN_MO13: if (record->event.pressed) { @@ -386,17 +407,22 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) void led_set_kb(uint8_t usb_led) { +#if BACKLIGHT_ENABLED backlight_set_indicator_state(usb_led); - //backlight_debug_led(usb_led & (1< #include #include @@ -902,7 +903,6 @@ ISR(TIMER3_COMPA_vect) { backlight_effect_indicators(); } - } void backlight_set_indicator_index( uint8_t *index, uint8_t row, uint8_t column ) @@ -980,7 +980,7 @@ void backlight_config_save(void) void backlight_init_drivers(void) { - // Initialize TWI + // Initialize I2C i2c_init(); IS31FL3731_init( ISSI_ADDR_1 ); IS31FL3731_init( ISSI_ADDR_2 ); @@ -1202,3 +1202,5 @@ void backlight_debug_led( bool state ) PORTE &= ~(1<<6); } } + +#endif // BACKLIGHT_ENABLED diff --git a/keyboards/zeal60/zeal_backlight.h b/keyboards/zeal60/zeal_backlight.h index 939e7477ae56..52195b819a9a 100644 --- a/keyboards/zeal60/zeal_backlight.h +++ b/keyboards/zeal60/zeal_backlight.h @@ -1,6 +1,11 @@ #ifndef ZEAL_BACKLIGHT_H #define ZEAL_BACKLIGHT_H +#if BACKLIGHT_ENABLED +#else +#error zeal_backlight.h included when BACKLIGHT_ENABLED == 0 +#endif // BACKLIGHT_ENABLED + #include #include diff --git a/keyboards/zeal65/config.h b/keyboards/zeal65/config.h index 823ab55054cf..67dd70929223 100644 --- a/keyboards/zeal65/config.h +++ b/keyboards/zeal65/config.h @@ -78,6 +78,7 @@ along with this program. If not, see . //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION +#define BACKLIGHT_ENABLED 1 // enable/disable LEDs based on layout #define BACKLIGHT_USE_SPLIT_BACKSPACE 0 #define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 diff --git a/keyboards/zeal65/rules.mk b/keyboards/zeal65/rules.mk index 23a53f567cf6..5ea42cc32195 100644 --- a/keyboards/zeal65/rules.mk +++ b/keyboards/zeal65/rules.mk @@ -6,8 +6,8 @@ SRC = ../zeal60/zeal60.c \ ../zeal60/zeal_color.c \ ../zeal60/zeal_eeprom.c \ ../zeal60/zeal_keymap.c \ - ../../drivers/avr/is31fl3731.c \ - ../../drivers/avr/i2c_master.c + is31fl3731.c \ + i2c_master.c # MCU name MCU = atmega32u4 From 077bb41ec5677e44c12fb8cda87c1804da540909 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Wed, 11 Jul 2018 23:13:16 +1000 Subject: [PATCH 48/69] Make split rightshift default for Zeal65 --- keyboards/zeal65/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/zeal65/config.h b/keyboards/zeal65/config.h index 67dd70929223..7201271c022e 100644 --- a/keyboards/zeal65/config.h +++ b/keyboards/zeal65/config.h @@ -82,7 +82,7 @@ along with this program. If not, see . // enable/disable LEDs based on layout #define BACKLIGHT_USE_SPLIT_BACKSPACE 0 #define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 -#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 +#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 1 #define BACKLIGHT_USE_7U_SPACEBAR 0 #define BACKLIGHT_USE_ISO_ENTER 0 #define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 From 534037ed75bd154e17838c6734db6180ebd84aa5 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Sat, 18 Aug 2018 13:51:55 +1000 Subject: [PATCH 49/69] Added M60-A as a "version" of Zeal60. --- keyboards/zeal60/keymaps/m60_a/config.h | 28 ++++++++++ keyboards/zeal60/keymaps/m60_a/keymap.c | 52 +++++++++++++++++++ keyboards/zeal60/keymaps/m60_a_proto/config.h | 4 +- keyboards/zeal60/zeal_backlight.c | 4 +- 4 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 keyboards/zeal60/keymaps/m60_a/config.h create mode 100644 keyboards/zeal60/keymaps/m60_a/keymap.c diff --git a/keyboards/zeal60/keymaps/m60_a/config.h b/keyboards/zeal60/keymaps/m60_a/config.h new file mode 100644 index 000000000000..8f977a4e4c28 --- /dev/null +++ b/keyboards/zeal60/keymaps/m60_a/config.h @@ -0,0 +1,28 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +// This conditionally compiles the backlight code for M60-A specifics +#define CONFIG_M60_A + +/* enable/disable LEDs based on layout */ +#undef BACKLIGHT_USE_SPLIT_BACKSPACE +#define BACKLIGHT_USE_SPLIT_BACKSPACE 1 + +#undef BACKLIGHT_USE_SPLIT_LEFT_SHIFT +#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 + +#undef BACKLIGHT_USE_SPLIT_RIGHT_SHIFT +#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 1 + +#undef BACKLIGHT_USE_7U_SPACEBAR +#define BACKLIGHT_USE_7U_SPACEBAR 1 + +#undef BACKLIGHT_USE_ISO_ENTER +#define BACKLIGHT_USE_ISO_ENTER 0 + +#undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS +#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 1 + +#endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/m60_a/keymap.c b/keyboards/zeal60/keymaps/m60_a/keymap.c new file mode 100644 index 000000000000..b3d41b815ded --- /dev/null +++ b/keyboards/zeal60/keymaps/m60_a/keymap.c @@ -0,0 +1,52 @@ +// Wilba's HHKB layout for Zeal60 + +#include "zeal60.h" + +// [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace +// [1,13] is either backslash or ISO Enter +// [2,12] is either ANSI Enter or key left of ISO Enter +// [2,13] is right key of split backspace (e.g. HHKB `~ key) +// [3,1] is right key of split left-shift (e.g ISO key) +// [3,13] is right key of split right-shift (e.g. HHKB Fn key) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +// Default layer +[0] = { + {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS}, + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC}, + {KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_GRV }, + {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, FN_MO13}, + {KC_NO, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_NO, KC_RALT, FN_MO23, KC_NO } +}, + +// Fn1 Layer +[1] = { + {KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS }, + {KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_EJCT, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_TRNS, KC_DEL }, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, + +// Fn2 Layer +[2] = { + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_CALC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, + +// Fn3 Layer (zeal60 Configuration) +[3] = { + {RESET, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +} + +}; + + diff --git a/keyboards/zeal60/keymaps/m60_a_proto/config.h b/keyboards/zeal60/keymaps/m60_a_proto/config.h index db27bf052be1..5e25fe9ded71 100644 --- a/keyboards/zeal60/keymaps/m60_a_proto/config.h +++ b/keyboards/zeal60/keymaps/m60_a_proto/config.h @@ -3,10 +3,12 @@ #include "../../config.h" +// This fixes the diodes mounted reversed (fab fail) on M60-A prototype #undef DIODE_DIRECTION #define DIODE_DIRECTION ROW2COL -#define M60_A_PROTO +// This conditionally compiles the backlight code for M60-A specifics +#define CONFIG_M60_A /* enable/disable LEDs based on layout */ #undef BACKLIGHT_USE_SPLIT_BACKSPACE diff --git a/keyboards/zeal60/zeal_backlight.c b/keyboards/zeal60/zeal_backlight.c index d7b1483142d9..69d45df56fa7 100644 --- a/keyboards/zeal60/zeal_backlight.c +++ b/keyboards/zeal60/zeal_backlight.c @@ -996,7 +996,7 @@ void backlight_init_drivers(void) ( index == 36+6 ) || // LC6 ( index == 54+13 ) ); // LD13 #else -#ifdef M60_A_PROTO +#ifdef CONFIG_M60_A bool enabled = !( // LB6 LB7 LB8 LB15 LB16 LB17 not present on M60-A ( index == 18+6 ) || // LB6 @@ -1010,7 +1010,7 @@ void backlight_init_drivers(void) ( index == 54+17 ) || // LD17 ( index == 36+15 ) || // LC15 ( index == 54+13 ) ); // LD13 -#else +#else // Zeal60 // LB6 LB7 LB8 LB15 LB16 LB17 not present on Zeal60 bool enabled = !( ( index == 18+5 && !g_config.use_split_backspace ) || // LB5 ( index == 36+15 && !g_config.use_split_left_shift ) || // LC15 From 8891f4247bf0ed25db7d2d81fa300951c9007638 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Sat, 8 Sep 2018 11:22:20 +1000 Subject: [PATCH 50/69] Renamed IS31FL3731 driver functions --- drivers/is31fl3731.c | 50 ++++++++++++++++++++++---------------------- drivers/is31fl3731.h | 16 +++++++------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/drivers/is31fl3731.c b/drivers/is31fl3731.c index 0524feb49f6b..4d0d6b8a5e7f 100644 --- a/drivers/is31fl3731.c +++ b/drivers/is31fl3731.c @@ -91,7 +91,7 @@ bool g_led_control_registers_update_required = false; // 0x10 - R16,R15,R14,R13,R12,R11,R10,R09 -void IS31_write_register( uint8_t addr, uint8_t reg, uint8_t data ) +void IS31FL3731_write_register( uint8_t addr, uint8_t reg, uint8_t data ) { g_twi_transfer_buffer[0] = reg; g_twi_transfer_buffer[1] = data; @@ -106,7 +106,7 @@ void IS31_write_register( uint8_t addr, uint8_t reg, uint8_t data ) #endif } -void IS31_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer ) +void IS31FL3731_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer ) { // assumes bank is already selected @@ -135,7 +135,7 @@ void IS31_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer ) } } -void IS31_init( uint8_t addr ) +void IS31FL3731_init( uint8_t addr ) { // In order to avoid the LEDs being driven with garbage data // in the LED driver's PWM registers, first enable software shutdown, @@ -143,10 +143,10 @@ void IS31_init( uint8_t addr ) // then disable software shutdown. // select "function register" bank - IS31_write_register( addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG ); + IS31FL3731_write_register( addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG ); // enable software shutdown - IS31_write_register( addr, ISSI_REG_SHUTDOWN, 0x00 ); + IS31FL3731_write_register( addr, ISSI_REG_SHUTDOWN, 0x00 ); // this delay was copied from other drivers, might not be needed #ifdef __AVR__ _delay_ms( 10 ); @@ -155,47 +155,47 @@ void IS31_init( uint8_t addr ) #endif // picture mode - IS31_write_register( addr, ISSI_REG_CONFIG, ISSI_REG_CONFIG_PICTUREMODE ); + IS31FL3731_write_register( addr, ISSI_REG_CONFIG, ISSI_REG_CONFIG_PICTUREMODE ); // display frame 0 - IS31_write_register( addr, ISSI_REG_PICTUREFRAME, 0x00 ); + IS31FL3731_write_register( addr, ISSI_REG_PICTUREFRAME, 0x00 ); // audio sync off - IS31_write_register( addr, ISSI_REG_AUDIOSYNC, 0x00 ); + IS31FL3731_write_register( addr, ISSI_REG_AUDIOSYNC, 0x00 ); // select bank 0 - IS31_write_register( addr, ISSI_COMMANDREGISTER, 0 ); + IS31FL3731_write_register( addr, ISSI_COMMANDREGISTER, 0 ); // turn off all LEDs in the LED control register for ( int i = 0x00; i <= 0x11; i++ ) { - IS31_write_register( addr, i, 0x00 ); + IS31FL3731_write_register( addr, i, 0x00 ); } // turn off all LEDs in the blink control register (not really needed) for ( int i = 0x12; i <= 0x23; i++ ) { - IS31_write_register( addr, i, 0x00 ); + IS31FL3731_write_register( addr, i, 0x00 ); } // set PWM on all LEDs to 0 for ( int i = 0x24; i <= 0xB3; i++ ) { - IS31_write_register( addr, i, 0x00 ); + IS31FL3731_write_register( addr, i, 0x00 ); } // select "function register" bank - IS31_write_register( addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG ); + IS31FL3731_write_register( addr, ISSI_COMMANDREGISTER, ISSI_BANK_FUNCTIONREG ); // disable software shutdown - IS31_write_register( addr, ISSI_REG_SHUTDOWN, 0x01 ); + IS31FL3731_write_register( addr, ISSI_REG_SHUTDOWN, 0x01 ); // select bank 0 and leave it selected. // most usage after initialization is just writing PWM buffers in bank 0 // as there's not much point in double-buffering - IS31_write_register( addr, ISSI_COMMANDREGISTER, 0 ); + IS31FL3731_write_register( addr, ISSI_COMMANDREGISTER, 0 ); } -void IS31_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) +void IS31FL3731_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) { if ( index >= 0 && index < DRIVER_LED_TOTAL ) { is31_led led = g_is31_leds[index]; @@ -208,15 +208,15 @@ void IS31_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) } } -void IS31_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) +void IS31FL3731_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) { for ( int i = 0; i < DRIVER_LED_TOTAL; i++ ) { - IS31_set_color( i, red, green, blue ); + IS31FL3731_set_color( i, red, green, blue ); } } -void IS31_set_led_control_register( uint8_t index, bool red, bool green, bool blue ) +void IS31FL3731_set_led_control_register( uint8_t index, bool red, bool green, bool blue ) { is31_led led = g_is31_leds[index]; @@ -247,24 +247,24 @@ void IS31_set_led_control_register( uint8_t index, bool red, bool green, bool bl } -void IS31_update_pwm_buffers( uint8_t addr1, uint8_t addr2 ) +void IS31FL3731_update_pwm_buffers( uint8_t addr1, uint8_t addr2 ) { if ( g_pwm_buffer_update_required ) { - IS31_write_pwm_buffer( addr1, g_pwm_buffer[0] ); - IS31_write_pwm_buffer( addr2, g_pwm_buffer[1] ); + IS31FL3731_write_pwm_buffer( addr1, g_pwm_buffer[0] ); + IS31FL3731_write_pwm_buffer( addr2, g_pwm_buffer[1] ); } g_pwm_buffer_update_required = false; } -void IS31_update_led_control_registers( uint8_t addr1, uint8_t addr2 ) +void IS31FL3731_update_led_control_registers( uint8_t addr1, uint8_t addr2 ) { if ( g_led_control_registers_update_required ) { for ( int i=0; i<18; i++ ) { - IS31_write_register(addr1, i, g_led_control_registers[0][i] ); - IS31_write_register(addr2, i, g_led_control_registers[1][i] ); + IS31FL3731_write_register(addr1, i, g_led_control_registers[0][i] ); + IS31FL3731_write_register(addr2, i, g_led_control_registers[1][i] ); } } } diff --git a/drivers/is31fl3731.h b/drivers/is31fl3731.h index 9e195c240efc..f354a12db2b3 100644 --- a/drivers/is31fl3731.h +++ b/drivers/is31fl3731.h @@ -31,21 +31,21 @@ typedef struct is31_led { extern const is31_led g_is31_leds[DRIVER_LED_TOTAL]; -void IS31_init( uint8_t addr ); -void IS31_write_register( uint8_t addr, uint8_t reg, uint8_t data ); -void IS31_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer ); +void IS31FL3731_init( uint8_t addr ); +void IS31FL3731_write_register( uint8_t addr, uint8_t reg, uint8_t data ); +void IS31FL3731_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer ); -void IS31_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ); -void IS31_set_color_all( uint8_t red, uint8_t green, uint8_t blue ); +void IS31FL3731_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ); +void IS31FL3731_set_color_all( uint8_t red, uint8_t green, uint8_t blue ); -void IS31_set_led_control_register( uint8_t index, bool red, bool green, bool blue ); +void IS31FL3731_set_led_control_register( uint8_t index, bool red, bool green, bool blue ); // This should not be called from an interrupt // (eg. from a timer interrupt). // Call this while idle (in between matrix scans). // If the buffer is dirty, it will update the driver with the buffer. -void IS31_update_pwm_buffers( uint8_t addr1, uint8_t addr2 ); -void IS31_update_led_control_registers( uint8_t addr1, uint8_t addr2 ); +void IS31FL3731_update_pwm_buffers( uint8_t addr1, uint8_t addr2 ); +void IS31FL3731_update_led_control_registers( uint8_t addr1, uint8_t addr2 ); #define C1_1 0x24 #define C1_2 0x25 From a3f728847ba0b4d3b906127a6fdecf4b611b8db5 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Sat, 8 Sep 2018 11:24:19 +1000 Subject: [PATCH 51/69] Fix suspend_wakeup_init_kb() being defined twice --- tmk_core/common/avr/suspend.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c index b185ac1f164b..2cbe39dd3447 100644 --- a/tmk_core/common/avr/suspend.c +++ b/tmk_core/common/avr/suspend.c @@ -185,9 +185,6 @@ void suspend_wakeup_init_kb(void) { * * FIXME: needs doc */ - -__attribute__ ((weak)) void suspend_wakeup_init_kb(void) {} - void suspend_wakeup_init(void) { suspend_wakeup_init_kb(); From 39d2e700e249b255a4e1603b9313aa43df2c40e7 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Sat, 8 Sep 2018 11:25:53 +1000 Subject: [PATCH 52/69] First pass refactor dynamic keymaps --- common_features.mk | 5 ++ keyboards/zeal60/config.h | 4 +- keyboards/zeal60/rules.mk | 2 +- keyboards/zeal60/zeal60.c | 11 ++--- keyboards/zeal60/zeal_eeprom.h | 5 +- keyboards/zeal60/zeal_keycode.h | 2 - keyboards/zeal60/zeal_keymap.c | 70 ---------------------------- keyboards/zeal60/zeal_keymap.h | 17 ------- quantum/dynamic_keymap.c | 81 +++++++++++++++++++++++++++++++++ quantum/dynamic_keymap.h | 17 +++++++ 10 files changed, 115 insertions(+), 99 deletions(-) delete mode 100644 keyboards/zeal60/zeal_keymap.c delete mode 100644 keyboards/zeal60/zeal_keymap.h create mode 100644 quantum/dynamic_keymap.c create mode 100644 quantum/dynamic_keymap.h diff --git a/common_features.mk b/common_features.mk index b78f04d2a820..26162ac25c65 100644 --- a/common_features.mk +++ b/common_features.mk @@ -123,6 +123,11 @@ ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) CIE1931_CURVE = yes endif +ifeq ($(strip $(DYNAMIC_KEYMAP_ENABLE)), yes) + OPT_DEFS += -DDYNAMIC_KEYMAP_ENABLE + SRC += $(QUANTUM_DIR)/dynamic_keymap.c +endif + ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) OPT_DEFS += -DTAP_DANCE_ENABLE SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c diff --git a/keyboards/zeal60/config.h b/keyboards/zeal60/config.h index f7f1d833bd5d..f2249e3d7866 100644 --- a/keyboards/zeal60/config.h +++ b/keyboards/zeal60/config.h @@ -101,6 +101,8 @@ along with this program. If not, see . #define BACKLIGHT_ALPHAS_MODS_ROW_3 0b0011000000000001 #define BACKLIGHT_ALPHAS_MODS_ROW_4 0b0011110000000111 -#define USE_KEYMAPS_IN_EEPROM 1 +#define DYNAMIC_KEYMAP_BASE_ADDR 288 +#define DYNAMIC_KEYMAP_LAYER_COUNT 4 + #endif diff --git a/keyboards/zeal60/rules.mk b/keyboards/zeal60/rules.mk index 407768b69bd1..135168c5d657 100644 --- a/keyboards/zeal60/rules.mk +++ b/keyboards/zeal60/rules.mk @@ -4,7 +4,6 @@ SRC = zeal_backlight.c \ zeal_color.c \ zeal_eeprom.c \ - zeal_keymap.c \ is31fl3731.c \ i2c_master.c @@ -81,3 +80,4 @@ RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend RAW_ENABLE = yes +DYNAMIC_KEYMAP_ENABLE = yes diff --git a/keyboards/zeal60/zeal60.c b/keyboards/zeal60/zeal60.c index 6f8123f52621..c9dd03ff6853 100644 --- a/keyboards/zeal60/zeal60.c +++ b/keyboards/zeal60/zeal60.c @@ -3,12 +3,11 @@ #if BACKLIGHT_ENABLED #include "zeal_backlight.h" #endif // BACKLIGHT_ENABLED -#include "zeal_keymap.h" #include "zeal_eeprom.h" #include "zeal_rpc.h" #include "raw_hid.h" -#include "config.h" +#include "dynamic_keymap.h" #ifdef RAW_ENABLE @@ -27,18 +26,18 @@ void raw_hid_receive( uint8_t *data, uint8_t length ) case id_keymap_keycode_load: { msg_keymap_keycode_load *msg = (msg_keymap_keycode_load*)&data[1]; - msg->keycode = keymap_keycode_load( msg->layer, msg->row, msg->column ); + msg->keycode = dynamic_keymap_keycode_load( msg->layer, msg->row, msg->column ); break; } case id_keymap_keycode_save: { msg_keymap_keycode_save *msg = (msg_keymap_keycode_save*)&data[1]; - keymap_keycode_save( msg->layer, msg->row, msg->column, msg->keycode); + dynamic_keymap_keycode_save( msg->layer, msg->row, msg->column, msg->keycode); break; } case id_keymap_default_save: { - keymap_default_save(); + dynamic_keymap_default_save(); break; } #endif // USE_KEYMAPS_IN_EEPROM @@ -155,7 +154,7 @@ void matrix_init_kb(void) // This saves "empty" keymaps so it falls back to the keymaps // in the firmware (aka. progmem/flash) - keymap_default_save(); + dynamic_keymap_default_save(); // Save the magic number last, in case saving was interrupted eeprom_set_valid(true); diff --git a/keyboards/zeal60/zeal_eeprom.h b/keyboards/zeal60/zeal_eeprom.h index 0cd18f06bdbb..d1fe676c887b 100644 --- a/keyboards/zeal60/zeal_eeprom.h +++ b/keyboards/zeal60/zeal_eeprom.h @@ -23,8 +23,9 @@ // key colors use 72*3=216 // 72+216=288 -#define EEPROM_KEYMAP_ADDR ((void*)288) -#define EEPROM_KEYMAP_MAX 4 +// Reconcile with config.h +//#define EEPROM_KEYMAP_ADDR ((void*)288) +//#define EEPROM_KEYMAP_MAX 4 // Each keymap is MATRIX_ROWS*MATRIX_COLS*2 bytes // For Zeal60 this is 5*14*2=140 bytes diff --git a/keyboards/zeal60/zeal_keycode.h b/keyboards/zeal60/zeal_keycode.h index 37ff383b592a..96f87696227d 100644 --- a/keyboards/zeal60/zeal_keycode.h +++ b/keyboards/zeal60/zeal_keycode.h @@ -1,8 +1,6 @@ #ifndef ZEAL_KEYCODE_H #define ZEAL_KEYCODE_H -#define KC_EENULL 0xFFFF // TODO: move to enum quantum_keycodes - // Can't use SAFE_RANGE here, it might change if someone adds // new values to enum quantum_keycodes. // Need to keep checking 0x5F00 is still in the safe range. diff --git a/keyboards/zeal60/zeal_keymap.c b/keyboards/zeal60/zeal_keymap.c deleted file mode 100644 index b4d2b614cb28..000000000000 --- a/keyboards/zeal60/zeal_keymap.c +++ /dev/null @@ -1,70 +0,0 @@ -#include "zeal_keymap.h" -#include "zeal_eeprom.h" -#include "config.h" -#include "keymap.h" // to get keymaps[][][] - - -#if USE_KEYMAPS_IN_EEPROM - -void *keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t column) -{ - // TODO: optimize this with some left shifts - return EEPROM_KEYMAP_ADDR + ( layer * MATRIX_ROWS * MATRIX_COLS * 2 ) + - ( row * MATRIX_COLS * 2 ) + ( column * 2 ); -} - -uint16_t keymap_keycode_load(uint8_t layer, uint8_t row, uint8_t column) -{ - void *address = keymap_key_to_eeprom_address(layer, row, column); - // Big endian, so we can read/write EEPROM directly from host if we want - uint16_t keycode = eeprom_read_byte(address) << 8; - keycode |= eeprom_read_byte(address + 1); - return keycode; -} - -void keymap_keycode_save(uint8_t layer, uint8_t row, uint8_t column, uint16_t keycode) -{ - void *address = keymap_key_to_eeprom_address(layer, row, column); - // Big endian, so we can read/write EEPROM directly from host if we want - eeprom_update_byte(address, (uint8_t)(keycode >> 8)); - eeprom_update_byte(address+1, (uint8_t)(keycode & 0xFF)); -} - -void keymap_default_save(void) -{ - // Save "empty" keymaps. - for ( int layer = 0; layer < EEPROM_KEYMAP_MAX; layer++ ) - { - for ( int row = 0; row < MATRIX_ROWS; row++ ) - { - for ( int column = 0; column < MATRIX_COLS; column++ ) - { - keymap_keycode_save(layer, row, column, KC_EENULL); - } - } - } -} - - -// This overrides the one in quantum/keymap_common.c -uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) -{ - if ( eeprom_is_valid() && - layer < EEPROM_KEYMAP_MAX && - key.row < MATRIX_ROWS && // possibly redundant - key.col < MATRIX_COLS ) // possibly redundant - { - uint16_t keycode = keymap_keycode_load(layer, key.row, key.col); - - // If keycode is not "empty", return it, otherwise - // drop down to return the one in flash - if ( keycode != KC_EENULL) - { - return keycode; - } - } - - return pgm_read_word(&keymaps[layer][key.row][key.col]); -} -#endif // USE_KEYMAPS_IN_EEPROM - diff --git a/keyboards/zeal60/zeal_keymap.h b/keyboards/zeal60/zeal_keymap.h deleted file mode 100644 index 5578a0de12c5..000000000000 --- a/keyboards/zeal60/zeal_keymap.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef ZEAL_KEYMAP_H -#define ZEAL_KEYMAP_H - -#include -#include - -#include "zeal_keycode.h" - -void *keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t column); -uint16_t keymap_keycode_load(uint8_t layer, uint8_t row, uint8_t column); -void keymap_keycode_save(uint8_t layer, uint8_t row, uint8_t column, uint16_t keycode); -void keymap_default_save(void); - -// This overrides the one in quantum/keymap_common.c -// uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key); - -#endif //ZEAL_EEPROM_H diff --git a/quantum/dynamic_keymap.c b/quantum/dynamic_keymap.c new file mode 100644 index 000000000000..ee48b0d3638c --- /dev/null +++ b/quantum/dynamic_keymap.c @@ -0,0 +1,81 @@ +#include "config.h" +#include "keymap.h" // to get keymaps[][][] + +#include "dynamic_keymap.h" + +#ifdef DYNAMIC_KEYMAP_ENABLE + +#ifndef DYNAMIC_KEYMAP_BASE_ADDR +#error DYNAMIC_KEYMAP_BASE_ADDR not defined +#endif + +#ifndef DYNAMIC_KEYMAP_LAYER_COUNT +#error DYNAMIC_KEYMAP_LAYER_COUNT not defined +#endif + +#define KC_EENULL 0xFFFF // TODO: move to enum quantum_keycodes + +void *dynamic_keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t column) +{ + // TODO: optimize this with some left shifts + return ((void*)DYNAMIC_KEYMAP_BASE_ADDR) + ( layer * MATRIX_ROWS * MATRIX_COLS * 2 ) + + ( row * MATRIX_COLS * 2 ) + ( column * 2 ); +} + +uint16_t dynamic_keymap_keycode_load(uint8_t layer, uint8_t row, uint8_t column) +{ + void *address = dynamic_keymap_key_to_eeprom_address(layer, row, column); + // Big endian, so we can read/write EEPROM directly from host if we want + uint16_t keycode = eeprom_read_byte(address) << 8; + keycode |= eeprom_read_byte(address + 1); + return keycode; +} + +void dynamic_keymap_keycode_save(uint8_t layer, uint8_t row, uint8_t column, uint16_t keycode) +{ + void *address = dynamic_keymap_key_to_eeprom_address(layer, row, column); + // Big endian, so we can read/write EEPROM directly from host if we want + eeprom_update_byte(address, (uint8_t)(keycode >> 8)); + eeprom_update_byte(address+1, (uint8_t)(keycode & 0xFF)); +} + +void dynamic_keymap_default_save(void) +{ + // Save "empty" keymaps. + for ( int layer = 0; layer < DYNAMIC_KEYMAP_LAYER_COUNT; layer++ ) + { + for ( int row = 0; row < MATRIX_ROWS; row++ ) + { + for ( int column = 0; column < MATRIX_COLS; column++ ) + { + dynamic_keymap_keycode_save(layer, row, column, KC_EENULL); + } + } + } +} + +// This overrides the one in quantum/keymap_common.c +uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) +{ + // This used to test EEPROM for magic bytes, but it was redundant. + // Test for EEPROM usage change (fresh install, address change, etc.) + // externally and call dynamic_keymap_default_save() + if ( layer < DYNAMIC_KEYMAP_LAYER_COUNT && + key.row < MATRIX_ROWS && // possibly redundant + key.col < MATRIX_COLS ) // possibly redundant + { + uint16_t keycode = dynamic_keymap_keycode_load(layer, key.row, key.col); + + // If keycode is not "empty", return it, otherwise + // drop down to return the one in flash + if ( keycode != KC_EENULL) + { + return keycode; + } + } + + return pgm_read_word(&keymaps[layer][key.row][key.col]); +} + +#endif // DYNAMIC_KEYMAP_ENABLE + diff --git a/quantum/dynamic_keymap.h b/quantum/dynamic_keymap.h new file mode 100644 index 000000000000..ba559dc076c4 --- /dev/null +++ b/quantum/dynamic_keymap.h @@ -0,0 +1,17 @@ +#ifndef DYNAMIC_KEYMAP_H +#define DYNAMIC_KEYMAP_H + +#include +#include + +#include "zeal_keycode.h" + +void *dynamic_keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t column); +uint16_t dynamic_keymap_keycode_load(uint8_t layer, uint8_t row, uint8_t column); +void dynamic_keymap_keycode_save(uint8_t layer, uint8_t row, uint8_t column, uint16_t keycode); +void dynamic_keymap_default_save(void); + +// This overrides the one in quantum/keymap_common.c +// uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key); + +#endif //DYNAMIC_KEYMAP_H From 74c8a0592c599d52e3b7005b7e285ea126c9c028 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Sat, 8 Sep 2018 11:46:18 +1000 Subject: [PATCH 53/69] Updated to changed I2C and ISSI drivers --- common_features.mk | 5 +++++ keyboards/zeal60/rules.mk | 4 ++-- keyboards/zeal60/zeal_backlight.c | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/common_features.mk b/common_features.mk index e0d4ca297cc1..c637582d457c 100644 --- a/common_features.mk +++ b/common_features.mk @@ -227,6 +227,11 @@ ifeq ($(strip $(HD44780_ENABLE)), yes) OPT_DEFS += -DHD44780_ENABLE endif +ifeq ($(strip $(DYNAMIC_KEYMAP_ENABLE)), yes) + OPT_DEFS += -DDYNAMIC_KEYMAP_ENABLE + SRC += $(QUANTUM_DIR)/dynamic_keymap.c +endif + QUANTUM_SRC:= \ $(QUANTUM_DIR)/quantum.c \ $(QUANTUM_DIR)/keymap_common.c \ diff --git a/keyboards/zeal60/rules.mk b/keyboards/zeal60/rules.mk index 135168c5d657..1f9aa5033f98 100644 --- a/keyboards/zeal60/rules.mk +++ b/keyboards/zeal60/rules.mk @@ -4,8 +4,8 @@ SRC = zeal_backlight.c \ zeal_color.c \ zeal_eeprom.c \ - is31fl3731.c \ - i2c_master.c + drivers/issi/is31fl3731.c \ + drivers/avr/i2c_master.c # MCU name MCU = atmega32u4 diff --git a/keyboards/zeal60/zeal_backlight.c b/keyboards/zeal60/zeal_backlight.c index 69d45df56fa7..22a54859b3d5 100644 --- a/keyboards/zeal60/zeal_backlight.c +++ b/keyboards/zeal60/zeal_backlight.c @@ -5,13 +5,13 @@ #include #include #include -#include "i2c_master.h" #include "progmem.h" #include "config.h" #include "zeal_eeprom.h" #include "zeal_color.h" -#include "is31fl3731.h" +#include "drivers/avr/i2c_master.h" +#include "drivers/issi/is31fl3731.h" #define BACKLIGHT_EFFECT_MAX 11 From 8bd142c878a4af9bb973aef300ea7d3cd99d9976 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Sat, 8 Sep 2018 11:57:49 +1000 Subject: [PATCH 54/69] Refactor zeal_color.* usage to quantum/color.* --- keyboards/zeal60/rules.mk | 4 +- keyboards/zeal60/zeal_backlight.c | 2 +- keyboards/zeal60/zeal_backlight.h | 2 +- keyboards/zeal60/zeal_color.c | 101 ------------------------------ keyboards/zeal60/zeal_color.h | 37 ----------- keyboards/zeal60/zeal_rpc.h | 2 +- 6 files changed, 6 insertions(+), 142 deletions(-) delete mode 100644 keyboards/zeal60/zeal_color.c delete mode 100644 keyboards/zeal60/zeal_color.h diff --git a/keyboards/zeal60/rules.mk b/keyboards/zeal60/rules.mk index 1f9aa5033f98..797c0bc7b72b 100644 --- a/keyboards/zeal60/rules.mk +++ b/keyboards/zeal60/rules.mk @@ -2,8 +2,8 @@ # project specific files SRC = zeal_backlight.c \ - zeal_color.c \ zeal_eeprom.c \ + quantum/color.c \ drivers/issi/is31fl3731.c \ drivers/avr/i2c_master.c @@ -81,3 +81,5 @@ SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend RAW_ENABLE = yes DYNAMIC_KEYMAP_ENABLE = yes +CIE1931_CURVE = yes + diff --git a/keyboards/zeal60/zeal_backlight.c b/keyboards/zeal60/zeal_backlight.c index 22a54859b3d5..b160da17735d 100644 --- a/keyboards/zeal60/zeal_backlight.c +++ b/keyboards/zeal60/zeal_backlight.c @@ -8,8 +8,8 @@ #include "progmem.h" #include "config.h" #include "zeal_eeprom.h" -#include "zeal_color.h" +#include "quantum/color.h" #include "drivers/avr/i2c_master.h" #include "drivers/issi/is31fl3731.h" diff --git a/keyboards/zeal60/zeal_backlight.h b/keyboards/zeal60/zeal_backlight.h index 52195b819a9a..c40112a00bec 100644 --- a/keyboards/zeal60/zeal_backlight.h +++ b/keyboards/zeal60/zeal_backlight.h @@ -9,7 +9,7 @@ #include #include -#include "zeal_color.h" +#include "quantum/color.h" #include "zeal_rpc.h" typedef struct diff --git a/keyboards/zeal60/zeal_color.c b/keyboards/zeal60/zeal_color.c deleted file mode 100644 index 974f4156cc06..000000000000 --- a/keyboards/zeal60/zeal_color.c +++ /dev/null @@ -1,101 +0,0 @@ -#include "zeal_color.h" - -#include "progmem.h" - -// Lightness curve using the CIE 1931 lightness formula -// Generated by the python script provided in http://jared.geek.nz/2013/feb/linear-led-pwm -const uint8_t g_cie_curve[] PROGMEM = { - 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, - 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, - 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, - 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, - 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, - 13, 14, 14, 15, 15, 15, 16, 16, 17, 17, - 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, - 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, - 28, 28, 29, 29, 30, 31, 31, 32, 32, 33, - 34, 34, 35, 36, 37, 37, 38, 39, 39, 40, - 41, 42, 43, 43, 44, 45, 46, 47, 47, 48, - 49, 50, 51, 52, 53, 54, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 70, 71, 72, 73, 74, 75, 76, 77, 79, - 80, 81, 82, 83, 85, 86, 87, 88, 90, 91, - 92, 94, 95, 96, 98, 99, 100, 102, 103, 105, - 106, 108, 109, 110, 112, 113, 115, 116, 118, 120, - 121, 123, 124, 126, 128, 129, 131, 132, 134, 136, - 138, 139, 141, 143, 145, 146, 148, 150, 152, 154, - 155, 157, 159, 161, 163, 165, 167, 169, 171, 173, - 175, 177, 179, 181, 183, 185, 187, 189, 191, 193, - 196, 198, 200, 202, 204, 207, 209, 211, 214, 216, - 218, 220, 223, 225, 228, 230, 232, 235, 237, 240, - 242, 245, 247, 250, 252, 255, -}; - -RGB hsv_to_rgb( HSV hsv ) -{ - RGB rgb; - uint8_t region, p, q, t; - uint16_t h, s, v, remainder; - - if ( hsv.s == 0 ) - { - rgb.r = hsv.v; - rgb.g = hsv.v; - rgb.b = hsv.v; - return rgb; - } - - h = hsv.h; - s = hsv.s; - v = hsv.v; - - region = h / 43; - remainder = (h - (region * 43)) * 6; - - p = (v * (255 - s)) >> 8; - q = (v * (255 - ((s * remainder) >> 8))) >> 8; - t = (v * (255 - ((s * (255 - remainder)) >> 8))) >> 8; - - switch ( region ) - { - case 0: - rgb.r = v; - rgb.g = t; - rgb.b = p; - break; - case 1: - rgb.r = q; - rgb.g = v; - rgb.b = p; - break; - case 2: - rgb.r = p; - rgb.g = v; - rgb.b = t; - break; - case 3: - rgb.r = p; - rgb.g = q; - rgb.b = v; - break; - case 4: - rgb.r = t; - rgb.g = p; - rgb.b = v; - break; - default: - rgb.r = v; - rgb.g = p; - rgb.b = q; - break; - } - - rgb.r = pgm_read_byte( &g_cie_curve[rgb.r] ); - rgb.g = pgm_read_byte( &g_cie_curve[rgb.g] ); - rgb.b = pgm_read_byte( &g_cie_curve[rgb.b] ); - - return rgb; -} - diff --git a/keyboards/zeal60/zeal_color.h b/keyboards/zeal60/zeal_color.h deleted file mode 100644 index bebec99e3620..000000000000 --- a/keyboards/zeal60/zeal_color.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef ZEAL_COLOR_H -#define ZEAL_COLOR_H - -#include -#include - -#if defined(__GNUC__) -#define PACKED __attribute__ ((__packed__)) -#else -#define PACKED -#endif - -#if defined(_MSC_VER) -#pragma pack( push, 1 ) -#endif - -typedef struct PACKED -{ - uint8_t r; - uint8_t g; - uint8_t b; -} RGB; - -typedef struct PACKED -{ - uint8_t h; - uint8_t s; - uint8_t v; -} HSV; - -#if defined(_MSC_VER) -#pragma pack( pop ) -#endif - -RGB hsv_to_rgb( HSV hsv ); - -#endif // ZEAL_COLOR_H diff --git a/keyboards/zeal60/zeal_rpc.h b/keyboards/zeal60/zeal_rpc.h index 7afe00c5e04b..39672ff0c4c8 100644 --- a/keyboards/zeal60/zeal_rpc.h +++ b/keyboards/zeal60/zeal_rpc.h @@ -1,7 +1,7 @@ #ifndef ZEAL_RPC_H #define ZEAL_RPC_H -#include "zeal_color.h" +#include "quantum/color.h" #define PROTOCOL_VERSION 0x0006 From ef100b60ae25c1b1f54d0278dbec924300b23139 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Sat, 8 Sep 2018 12:04:35 +1000 Subject: [PATCH 55/69] Updated Zeal65, fixed dynamic_keymap --- keyboards/zeal65/config.h | 3 ++- keyboards/zeal65/rules.mk | 10 ++++++---- quantum/dynamic_keymap.h | 2 -- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/keyboards/zeal65/config.h b/keyboards/zeal65/config.h index 7201271c022e..e0a407ef76ae 100644 --- a/keyboards/zeal65/config.h +++ b/keyboards/zeal65/config.h @@ -104,7 +104,8 @@ along with this program. If not, see . #define BACKLIGHT_ALPHAS_MODS_ROW_3 0b0111000000000001 #define BACKLIGHT_ALPHAS_MODS_ROW_4 0b0111110000000011 +#define DYNAMIC_KEYMAP_BASE_ADDR 288 +#define DYNAMIC_KEYMAP_LAYER_COUNT 4 -#define USE_KEYMAPS_IN_EEPROM 1 #endif diff --git a/keyboards/zeal65/rules.mk b/keyboards/zeal65/rules.mk index 5ea42cc32195..e62c8c2951fd 100644 --- a/keyboards/zeal65/rules.mk +++ b/keyboards/zeal65/rules.mk @@ -3,11 +3,10 @@ # project specific files SRC = ../zeal60/zeal60.c \ ../zeal60/zeal_backlight.c \ - ../zeal60/zeal_color.c \ ../zeal60/zeal_eeprom.c \ - ../zeal60/zeal_keymap.c \ - is31fl3731.c \ - i2c_master.c + quantum/color.c \ + drivers/issi/is31fl3731.c \ + drivers/avr/i2c_master.c # MCU name MCU = atmega32u4 @@ -82,3 +81,6 @@ RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend RAW_ENABLE = yes +DYNAMIC_KEYMAP_ENABLE = yes +CIE1931_CURVE = yes + diff --git a/quantum/dynamic_keymap.h b/quantum/dynamic_keymap.h index ba559dc076c4..10293dd226af 100644 --- a/quantum/dynamic_keymap.h +++ b/quantum/dynamic_keymap.h @@ -4,8 +4,6 @@ #include #include -#include "zeal_keycode.h" - void *dynamic_keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t column); uint16_t dynamic_keymap_keycode_load(uint8_t layer, uint8_t row, uint8_t column); void dynamic_keymap_keycode_save(uint8_t layer, uint8_t row, uint8_t column, uint16_t keycode); From 404db53906a32431084176dc881d1adba1d54a54 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Sat, 8 Sep 2018 22:34:11 +1000 Subject: [PATCH 56/69] Major refactoring of Zeal60 backlight and API --- keyboards/zeal60/config.h | 23 +- .../{zeal_backlight.c => rgb_backlight.c} | 472 +++++++++++++++--- .../{zeal_backlight.h => rgb_backlight.h} | 33 +- keyboards/zeal60/rgb_backlight_api.h | 31 ++ keyboards/zeal60/rgb_backlight_keycodes.h | 23 + keyboards/zeal60/rules.mk | 3 +- keyboards/zeal60/zeal60.c | 221 +++----- keyboards/zeal60/zeal60.h | 6 +- keyboards/zeal60/zeal60_api.h | 21 + .../{zeal_keycode.h => zeal60_keycodes.h} | 24 +- keyboards/zeal60/zeal_eeprom.c | 14 - keyboards/zeal60/zeal_eeprom.h | 48 -- keyboards/zeal60/zeal_rpc.h | 105 ---- keyboards/zeal65/config.h | 20 +- keyboards/zeal65/rules.mk | 3 +- quantum/dynamic_keymap.c | 32 +- quantum/dynamic_keymap.h | 22 +- 17 files changed, 633 insertions(+), 468 deletions(-) rename keyboards/zeal60/{zeal_backlight.c => rgb_backlight.c} (79%) rename keyboards/zeal60/{zeal_backlight.h => rgb_backlight.h} (76%) create mode 100644 keyboards/zeal60/rgb_backlight_api.h create mode 100644 keyboards/zeal60/rgb_backlight_keycodes.h create mode 100644 keyboards/zeal60/zeal60_api.h rename keyboards/zeal60/{zeal_keycode.h => zeal60_keycodes.h} (64%) delete mode 100644 keyboards/zeal60/zeal_eeprom.c delete mode 100644 keyboards/zeal60/zeal_eeprom.h delete mode 100644 keyboards/zeal60/zeal_rpc.h diff --git a/keyboards/zeal60/config.h b/keyboards/zeal60/config.h index f2249e3d7866..14374a993fb1 100644 --- a/keyboards/zeal60/config.h +++ b/keyboards/zeal60/config.h @@ -76,6 +76,9 @@ along with this program. If not, see . //#define NO_ACTION_FUNCTION #define BACKLIGHT_ENABLED 1 + +#define BACKLIGHT_KEYCODES_START 0x5F00 + // enable/disable LEDs based on layout #define BACKLIGHT_USE_SPLIT_BACKSPACE 0 #define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 @@ -90,6 +93,9 @@ along with this program. If not, see . // disable backlight after timeout in minutes, 0 = no timeout #define BACKLIGHT_DISABLE_AFTER_TIMEOUT 0 +// the default effect (RGB test) +#define BACKLIGHT_EFFECT 255 + // These define which keys in the matrix are alphas/mods // Used for backlight effects so colors are different for // alphas vs. mods @@ -101,8 +107,23 @@ along with this program. If not, see . #define BACKLIGHT_ALPHAS_MODS_ROW_3 0b0011000000000001 #define BACKLIGHT_ALPHAS_MODS_ROW_4 0b0011110000000111 -#define DYNAMIC_KEYMAP_BASE_ADDR 288 #define DYNAMIC_KEYMAP_LAYER_COUNT 4 +// EEPROM usage + +// TODO: refactor with new user EEPROM code (coming soon) +#define EEPROM_MAGIC 0x451F +#define EEPROM_MAGIC_ADDR 32 +// Bump this every time we change what we store +// This will automatically reset the EEPROM with defaults +// and avoid loading invalid data from the EEPROM +#define EEPROM_VERSION 0x07 +#define EEPROM_VERSION_ADDR 34 + +// Backlight config starts after EEPROM version +#define BACKLIGHT_CONFIG_EEPROM_ADDR 35 +// Dynamic keymap starts after backlight config (35+37) +#define DYNAMIC_KEYMAP_EEPROM_ADDR 72 + #endif diff --git a/keyboards/zeal60/zeal_backlight.c b/keyboards/zeal60/rgb_backlight.c similarity index 79% rename from keyboards/zeal60/zeal_backlight.c rename to keyboards/zeal60/rgb_backlight.c index b160da17735d..7dbfd80140ed 100644 --- a/keyboards/zeal60/zeal_backlight.c +++ b/keyboards/zeal60/rgb_backlight.c @@ -1,21 +1,24 @@ + #if BACKLIGHT_ENABLED #include "zeal60.h" -#include "zeal_backlight.h" +#include "rgb_backlight.h" +#include "rgb_backlight_api.h" +#include "rgb_backlight_keycodes.h" + #include #include #include #include "progmem.h" #include "config.h" -#include "zeal_eeprom.h" #include "quantum/color.h" #include "drivers/avr/i2c_master.h" #include "drivers/issi/is31fl3731.h" -#define BACKLIGHT_EFFECT_MAX 11 +#define BACKLIGHT_EFFECT_MAX 10 -zeal_backlight_config g_config = { +backlight_config g_config = { .use_split_backspace = BACKLIGHT_USE_SPLIT_BACKSPACE, .use_split_left_shift = BACKLIGHT_USE_SPLIT_LEFT_SHIFT, .use_split_right_shift = BACKLIGHT_USE_SPLIT_RIGHT_SHIFT, @@ -25,7 +28,7 @@ zeal_backlight_config g_config = { .disable_when_usb_suspended = BACKLIGHT_DISABLE_WHEN_USB_SUSPENDED, .disable_after_timeout = BACKLIGHT_DISABLE_AFTER_TIMEOUT, .brightness = 255, - .effect = 255, // Default to RGB test, so Zeal can flash and test in one pass! + .effect = BACKLIGHT_EFFECT, .effect_speed = 0, .color_1 = { .h = 0, .s = 255, .v = 255 }, .color_2 = { .h = 127, .s = 255, .v = 255 }, @@ -724,20 +727,6 @@ void backlight_effect_cycle_radial2(void) } } -void backlight_effect_custom(void) -{ - HSV hsv; - RGB rgb; - for ( int i=0; i<72; i++ ) - { - backlight_get_key_color(i, &hsv); - // Override brightness with global brightness control - hsv.v = g_config.brightness; - rgb = hsv_to_rgb( hsv ); - backlight_set_color( i, rgb.r, rgb.g, rgb.b ); - } -} - void backlight_effect_indicators_set_colors( uint8_t index, HSV hsv ) { RGB rgb = hsv_to_rgb( hsv ); @@ -895,7 +884,7 @@ ISR(TIMER3_COMPA_vect) backlight_effect_cycle_radial2(); break; default: - backlight_effect_custom(); + backlight_effect_all_off(); break; } @@ -918,46 +907,275 @@ void backlight_set_indicator_index( uint8_t *index, uint8_t row, uint8_t column } } -void backlight_config_set_values(msg_backlight_config_set_values *values) +// Some helpers for setting/getting HSV +void _set_color( HSV *color, uint8_t *data ) { - bool needs_init = ( - g_config.use_split_backspace != values->use_split_backspace || - g_config.use_split_left_shift != values->use_split_left_shift || - g_config.use_split_right_shift != values->use_split_right_shift || - g_config.use_7u_spacebar != values->use_7u_spacebar || - g_config.use_iso_enter != values->use_iso_enter || - g_config.disable_hhkb_blocker_leds != values->disable_hhkb_blocker_leds ); - - g_config.use_split_backspace = values->use_split_backspace; - g_config.use_split_left_shift = values->use_split_left_shift; - g_config.use_split_right_shift = values->use_split_right_shift; - g_config.use_7u_spacebar = values->use_7u_spacebar; - g_config.use_iso_enter = values->use_iso_enter; - g_config.disable_hhkb_blocker_leds = values->disable_hhkb_blocker_leds; - - g_config.disable_when_usb_suspended = values->disable_when_usb_suspended; - g_config.disable_after_timeout = values->disable_after_timeout; - - g_config.brightness = values->brightness; - g_config.effect = values->effect; - g_config.effect_speed = values->effect_speed; - g_config.color_1 = values->color_1; - g_config.color_2 = values->color_2; - g_config.caps_lock_indicator.color = values->caps_lock_indicator_color; - backlight_set_indicator_index( &g_config.caps_lock_indicator.index, values->caps_lock_indicator_row, values->caps_lock_indicator_column ); - g_config.layer_1_indicator.color = values->layer_1_indicator_color; - backlight_set_indicator_index( &g_config.layer_1_indicator.index, values->layer_1_indicator_row, values->layer_1_indicator_column ); - g_config.layer_2_indicator.color = values->layer_2_indicator_color; - backlight_set_indicator_index( &g_config.layer_2_indicator.index, values->layer_2_indicator_row, values->layer_2_indicator_column ); - g_config.layer_3_indicator.color = values->layer_3_indicator_color; - backlight_set_indicator_index( &g_config.layer_3_indicator.index, values->layer_3_indicator_row, values->layer_3_indicator_column ); - - if ( needs_init ) + color->h = data[0]; + color->s = data[1]; + color->v = data[2]; +} + +void _get_color( HSV *color, uint8_t *data ) +{ + data[0] = color->h; + data[1] = color->s; + data[2] = color->v; +} + +void backlight_config_set_value( uint8_t *data ) +{ + bool reinitialize = false; + uint8_t *value_id = &(data[0]); + uint8_t *value_data = &(data[1]); + switch ( *value_id ) + { + case id_use_split_backspace: + { + g_config.use_split_backspace = (bool)*value_data; + reinitialize = true; + break; + } + case id_use_split_left_shift: + { + g_config.use_split_left_shift = (bool)*value_data; + reinitialize = true; + break; + } + case id_use_split_right_shift: + { + g_config.use_split_right_shift = (bool)*value_data; + reinitialize = true; + break; + } + case id_use_7u_spacebar: + { + g_config.use_7u_spacebar = (bool)*value_data; + reinitialize = true; + break; + } + case id_use_iso_enter: + { + g_config.use_iso_enter = (bool)*value_data; + reinitialize = true; + break; + } + case id_disable_when_usb_suspended: + { + g_config.disable_when_usb_suspended = (bool)*value_data; + break; + } + case id_disable_hhkb_blocker_leds: + { + g_config.disable_hhkb_blocker_leds = (bool)*value_data; + break; + } + case id_disable_after_timeout: + { + g_config.disable_after_timeout = *value_data; + break; + } + case id_brightness: + { + g_config.brightness = *value_data; + break; + } + case id_effect: + { + g_config.effect = *value_data; + break; + } + case id_effect_speed: + { + g_config.effect_speed = *value_data; + break; + } + case id_color_1: + { + _set_color( &(g_config.color_1), value_data ); + break; + } + case id_color_2: + { + _set_color( &(g_config.color_2), value_data ); + break; + } + case id_caps_lock_indicator_color: + { + _set_color( &(g_config.caps_lock_indicator.color), value_data ); + break; + } + case id_caps_lock_indicator_row_col: + { + backlight_set_indicator_index( &(g_config.caps_lock_indicator.index), value_data[0], value_data[1] ); + break; + } + case id_layer_1_indicator_color: + { + _set_color( &(g_config.layer_1_indicator.color), value_data ); + break; + } + case id_layer_1_indicator_row_col: + { + backlight_set_indicator_index( &(g_config.layer_1_indicator.index), value_data[0], value_data[1] ); + break; + } + case id_layer_2_indicator_color: + { + _set_color( &(g_config.layer_2_indicator.color), value_data ); + break; + } + case id_layer_2_indicator_row_col: + { + backlight_set_indicator_index( &(g_config.layer_2_indicator.index), value_data[0], value_data[1] ); + break; + } + case id_layer_3_indicator_color: + { + _set_color( &(g_config.layer_3_indicator.color), value_data ); + break; + } + case id_layer_3_indicator_row_col: + { + backlight_set_indicator_index( &(g_config.layer_3_indicator.index), value_data[0], value_data[1] ); + break; + } + case id_alphas_mods: + { + for ( int i=0; i<5; i++ ) + { + g_config.alphas_mods[i] = ( *(value_data+i*2) << 8 ) | ( *(value_data+i*2+1) ); + } + } + } + + if ( reinitialize ) { backlight_init_drivers(); } } +void backlight_config_get_value( uint8_t *data ) +{ + uint8_t *value_id = &(data[0]); + uint8_t *value_data = &(data[1]); + switch ( *value_id ) + { + case id_use_split_backspace: + { + *value_data = ( g_config.use_split_backspace ? 1 : 0 ); + break; + } + case id_use_split_left_shift: + { + *value_data = ( g_config.use_split_left_shift ? 1 : 0 ); + break; + } + case id_use_split_right_shift: + { + *value_data = ( g_config.use_split_right_shift ? 1 : 0 ); + break; + } + case id_use_7u_spacebar: + { + *value_data = ( g_config.use_7u_spacebar ? 1 : 0 ); + break; + } + case id_use_iso_enter: + { + *value_data = ( g_config.use_iso_enter ? 1 : 0 ); + break; + } + case id_disable_when_usb_suspended: + { + *value_data = ( g_config.disable_when_usb_suspended ? 1 : 0 ); + break; + } + case id_disable_hhkb_blocker_leds: + { + *value_data = ( g_config.disable_hhkb_blocker_leds ? 1 : 0 ); + break; + } + case id_disable_after_timeout: + { + *value_data = g_config.disable_after_timeout; + break; + } + case id_brightness: + { + *value_data = g_config.brightness; + break; + } + case id_effect: + { + *value_data = g_config.effect; + break; + } + case id_effect_speed: + { + *value_data = g_config.effect_speed; + break; + } + case id_color_1: + { + _get_color( &(g_config.color_1), value_data ); + break; + } + case id_color_2: + { + _get_color( &(g_config.color_2), value_data ); + break; + } + case id_caps_lock_indicator_color: + { + _get_color( &(g_config.caps_lock_indicator.color), value_data ); + break; + } + case id_caps_lock_indicator_row_col: + { + //*value_data = g_config.caps_lock_indicator.index; + break; + } + case id_layer_1_indicator_color: + { + _get_color( &(g_config.layer_1_indicator.color), value_data ); + break; + } + case id_layer_1_indicator_row_col: + { + //*value_data = g_config.layer_1_indicator.index; + break; + } + case id_layer_2_indicator_color: + { + _get_color( &(g_config.layer_2_indicator.color), value_data ); + break; + } + case id_layer_2_indicator_row_col: + { + //*value_data = g_config.layer_2_indicator.index; + break; + } + case id_layer_3_indicator_color: + { + _get_color( &(g_config.layer_3_indicator.color), value_data ); + break; + } + case id_layer_3_indicator_row_col: + { + //*value_data = g_config.layer_3_indicator.index; + break; + } + case id_alphas_mods: + { + for ( int i=0; i<5; i++ ) + { + *(value_data+i*2) = g_config.alphas_mods[i] >> 8; + *(value_data+i*2+1) = g_config.alphas_mods[i] & 0xFF; + } + } + } +} + void backlight_config_set_alphas_mods( uint16_t *alphas_mods ) { for ( int i=0; i<5; i++ ) @@ -970,12 +1188,12 @@ void backlight_config_set_alphas_mods( uint16_t *alphas_mods ) void backlight_config_load(void) { - eeprom_read_block( &g_config, EEPROM_BACKLIGHT_CONFIG_ADDR, sizeof(zeal_backlight_config) ); + eeprom_read_block( &g_config, ((void*)BACKLIGHT_CONFIG_EEPROM_ADDR), sizeof(backlight_config) ); } void backlight_config_save(void) { - eeprom_update_block( &g_config, EEPROM_BACKLIGHT_CONFIG_ADDR, sizeof(zeal_backlight_config) ); + eeprom_update_block( &g_config, ((void*)BACKLIGHT_CONFIG_EEPROM_ADDR), sizeof(backlight_config) ); } void backlight_init_drivers(void) @@ -1041,6 +1259,121 @@ void backlight_init_drivers(void) } } +bool process_record_backlight(uint16_t keycode, keyrecord_t *record) +{ + // Record keypresses for backlight effects + if ( record->event.pressed ) + { + backlight_set_key_hit( record->event.key.row, record->event.key.col ); + } + + switch(keycode) + { + case BR_INC: + if (record->event.pressed) + { + backlight_brightness_increase(); + } + return false; + break; + case BR_DEC: + if (record->event.pressed) + { + backlight_brightness_decrease(); + } + return false; + break; + case EF_INC: + if (record->event.pressed) + { + backlight_effect_increase(); + } + return false; + break; + case EF_DEC: + if (record->event.pressed) + { + backlight_effect_decrease(); + } + return false; + break; + case ES_INC: + if (record->event.pressed) + { + backlight_effect_speed_increase(); + } + return false; + break; + case ES_DEC: + if (record->event.pressed) + { + backlight_effect_speed_decrease(); + } + return false; + break; + case H1_INC: + if (record->event.pressed) + { + backlight_color_1_hue_increase(); + } + return false; + break; + case H1_DEC: + if (record->event.pressed) + { + backlight_color_1_hue_decrease(); + } + return false; + break; + case S1_INC: + if (record->event.pressed) + { + backlight_color_1_sat_increase(); + } + return false; + break; + case S1_DEC: + if (record->event.pressed) + { + backlight_color_1_sat_decrease(); + break; + } + return false; + break; + case H2_INC: + if (record->event.pressed) + { + backlight_color_2_hue_increase(); + } + return false; + break; + case H2_DEC: + if (record->event.pressed) + { + backlight_color_2_hue_decrease(); + } + return false; + break; + case S2_INC: + if (record->event.pressed) + { + backlight_color_2_sat_increase(); + } + return false; + break; + case S2_DEC: + if (record->event.pressed) + { + backlight_color_2_sat_decrease(); + break; + } + return false; + break; + } + + return true; +} + // Deals with the messy details of incrementing an integer uint8_t increment( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) { @@ -1140,33 +1473,6 @@ void backlight_color_2_sat_decrease(void) backlight_config_save(); } -void *backlight_get_custom_key_color_eeprom_address( uint8_t led ) -{ - // 3 bytes per color - return EEPROM_BACKLIGHT_KEY_COLOR_ADDR + ( led * 3 ); -} - -void backlight_get_key_color( uint8_t led, HSV *hsv ) -{ - void *address = backlight_get_custom_key_color_eeprom_address( led ); - hsv->h = eeprom_read_byte(address); - hsv->s = eeprom_read_byte(address+1); - hsv->v = eeprom_read_byte(address+2); -} - -void backlight_set_key_color( uint8_t row, uint8_t column, HSV hsv ) -{ - uint8_t led; - map_row_column_to_led( row, column, &led ); - if ( led < 72 ) - { - void *address = backlight_get_custom_key_color_eeprom_address(led); - eeprom_update_byte(address, hsv.h); - eeprom_update_byte(address+1, hsv.s); - eeprom_update_byte(address+2, hsv.v); - } -} - void backlight_test_led( uint8_t index, bool red, bool green, bool blue ) { for ( int i=0; i<72; i++ ) diff --git a/keyboards/zeal60/zeal_backlight.h b/keyboards/zeal60/rgb_backlight.h similarity index 76% rename from keyboards/zeal60/zeal_backlight.h rename to keyboards/zeal60/rgb_backlight.h index c40112a00bec..12e70ac77bef 100644 --- a/keyboards/zeal60/zeal_backlight.h +++ b/keyboards/zeal60/rgb_backlight.h @@ -1,22 +1,21 @@ -#ifndef ZEAL_BACKLIGHT_H -#define ZEAL_BACKLIGHT_H +#ifndef RGB_BACKLIGHT_H +#define RGB_BACKLIGHT_H #if BACKLIGHT_ENABLED #else -#error zeal_backlight.h included when BACKLIGHT_ENABLED == 0 +#error rgb_backlight.h included when BACKLIGHT_ENABLED == 0 #endif // BACKLIGHT_ENABLED #include #include #include "quantum/color.h" -#include "zeal_rpc.h" typedef struct { HSV color; uint8_t index; -} zeal_indicator; +} backlight_config_indicator; typedef struct { @@ -34,17 +33,18 @@ typedef struct uint8_t effect_speed; // 1 byte HSV color_1; // 3 bytes HSV color_2; // 3 bytes - zeal_indicator caps_lock_indicator; // 4 bytes - zeal_indicator layer_1_indicator; // 4 bytes - zeal_indicator layer_2_indicator; // 4 bytes - zeal_indicator layer_3_indicator; // 4 bytes + backlight_config_indicator caps_lock_indicator; // 4 bytes + backlight_config_indicator layer_1_indicator; // 4 bytes + backlight_config_indicator layer_2_indicator; // 4 bytes + backlight_config_indicator layer_3_indicator; // 4 bytes uint16_t alphas_mods[5]; // 10 bytes -} zeal_backlight_config; // = 37 bytes +} backlight_config; // = 37 bytes -void backlight_config_set_values(msg_backlight_config_set_values *values); void backlight_config_set_alphas_mods( uint16_t *value ); void backlight_config_load(void); void backlight_config_save(void); +void backlight_config_set_value( uint8_t *data ); +void backlight_config_get_value( uint8_t *data ); void backlight_init_drivers(void); @@ -61,6 +61,9 @@ void backlight_set_indicator_state(uint8_t state); // If the buffer is dirty, it will update the driver with the buffer. void backlight_update_pwm_buffers(void); +// Handle backlight specific keycodes +bool process_record_backlight(uint16_t keycode, keyrecord_t *record); + void backlight_set_key_hit(uint8_t row, uint8_t col); void backlight_effect_increase(void); @@ -80,14 +83,8 @@ void backlight_color_2_hue_decrease(void); void backlight_color_2_sat_increase(void); void backlight_color_2_sat_decrease(void); - - -void *backlight_get_key_color_eeprom_address(uint8_t led); -void backlight_get_key_color( uint8_t led, HSV *hsv ); -void backlight_set_key_color( uint8_t row, uint8_t column, HSV hsv ); - void backlight_test_led( uint8_t index, bool red, bool green, bool blue ); uint32_t backlight_get_tick(void); void backlight_debug_led(bool state); -#endif //ZEAL_BACKLIGHT_H +#endif //RGB_BACKLIGHT_H diff --git a/keyboards/zeal60/rgb_backlight_api.h b/keyboards/zeal60/rgb_backlight_api.h new file mode 100644 index 000000000000..47f901048cde --- /dev/null +++ b/keyboards/zeal60/rgb_backlight_api.h @@ -0,0 +1,31 @@ + +#ifndef RGB_BACKLIGHT_API_H +#define RGB_BACKLIGHT_API_H + +enum backlight_config_value +{ + id_use_split_backspace = 0x01, + id_use_split_left_shift = 0x02, + id_use_split_right_shift = 0x03, + id_use_7u_spacebar = 0x04, + id_use_iso_enter = 0x05, + id_disable_when_usb_suspended = 0x06, + id_disable_hhkb_blocker_leds = 0x07, + id_disable_after_timeout = 0x08, + id_brightness = 0x09, + id_effect = 0x0A, + id_effect_speed = 0x0B, + id_color_1 = 0x0C, + id_color_2 = 0x0D, + id_caps_lock_indicator_color = 0x0E, + id_caps_lock_indicator_row_col = 0x0F, + id_layer_1_indicator_color = 0x10, + id_layer_1_indicator_row_col = 0x11, + id_layer_2_indicator_color = 0x12, + id_layer_2_indicator_row_col = 0x13, + id_layer_3_indicator_color = 0x14, + id_layer_3_indicator_row_col = 0x15, + id_alphas_mods = 0x16 +}; + +#endif // RGB_BACKLIGHT_API_H diff --git a/keyboards/zeal60/rgb_backlight_keycodes.h b/keyboards/zeal60/rgb_backlight_keycodes.h new file mode 100644 index 000000000000..1785f85990f1 --- /dev/null +++ b/keyboards/zeal60/rgb_backlight_keycodes.h @@ -0,0 +1,23 @@ + +#ifndef RGB_BACKLIGHT_KEYCODES_H +#define RGB_BACKLIGHT_KEYCODES_H + +// This is hardcoded at 0x5F00 so it's well after keycode value SAFE_RANGE +enum backlight_keycodes { + BR_INC = 0x5F00, // backlight brightness increase + BR_DEC, // backlight brightness decrease + EF_INC, // backlight effect increase + EF_DEC, // backlight effect decrease + ES_INC, + ES_DEC, + H1_INC, + H1_DEC, + S1_INC, + S1_DEC, + H2_INC, + H2_DEC, + S2_INC, + S2_DEC +}; + +#endif // RGB_BACKLIGHT_KEYCODES_H diff --git a/keyboards/zeal60/rules.mk b/keyboards/zeal60/rules.mk index 797c0bc7b72b..c74a2062d66e 100644 --- a/keyboards/zeal60/rules.mk +++ b/keyboards/zeal60/rules.mk @@ -1,8 +1,7 @@ # project specific files -SRC = zeal_backlight.c \ - zeal_eeprom.c \ +SRC = rgb_backlight.c \ quantum/color.c \ drivers/issi/is31fl3731.c \ drivers/avr/i2c_master.c diff --git a/keyboards/zeal60/zeal60.c b/keyboards/zeal60/zeal60.c index c9dd03ff6853..ae379c59266c 100644 --- a/keyboards/zeal60/zeal60.c +++ b/keyboards/zeal60/zeal60.c @@ -1,82 +1,98 @@ #include "zeal60.h" +#include "zeal60_api.h" + // Check that no backlight functions are called #if BACKLIGHT_ENABLED -#include "zeal_backlight.h" +#include "rgb_backlight.h" #endif // BACKLIGHT_ENABLED -#include "zeal_eeprom.h" -#include "zeal_rpc.h" #include "raw_hid.h" #include "dynamic_keymap.h" +#include "timer.h" +#include "tmk_core/common/eeprom.h" + +bool eeprom_is_valid(void) +{ + return (eeprom_read_word(((void*)EEPROM_MAGIC_ADDR)) == EEPROM_MAGIC && + eeprom_read_byte(((void*)EEPROM_VERSION_ADDR)) == EEPROM_VERSION); +} + +void eeprom_set_valid(bool valid) +{ + eeprom_update_word(((void*)EEPROM_MAGIC_ADDR), valid ? EEPROM_MAGIC : 0xFFFF); + eeprom_update_byte(((void*)EEPROM_VERSION_ADDR), valid ? EEPROM_VERSION : 0xFF); +} #ifdef RAW_ENABLE void raw_hid_receive( uint8_t *data, uint8_t length ) { - uint8_t command = data[0]; - switch ( command ) + uint8_t *command_id = &(data[0]); + uint8_t *command_data = &(data[1]); + switch ( *command_id ) { - case id_protocol_version: + case id_get_protocol_version: { - msg_protocol_version *msg = (msg_protocol_version*)&data[1]; - msg->version = PROTOCOL_VERSION; + command_data[0] = PROTOCOL_VERSION >> 8; + command_data[1] = PROTOCOL_VERSION & 0xFF; break; } -#if USE_KEYMAPS_IN_EEPROM - case id_keymap_keycode_load: + case id_get_keyboard_value: { - msg_keymap_keycode_load *msg = (msg_keymap_keycode_load*)&data[1]; - msg->keycode = dynamic_keymap_keycode_load( msg->layer, msg->row, msg->column ); + if ( command_data[0] == 0x01 ) + { + uint32_t value = timer_read32(); + command_data[1] = (value >> 24 ) & 0xFF; + command_data[2] = (value >> 16 ) & 0xFF; + command_data[3] = (value >> 8 ) & 0xFF; + command_data[4] = value & 0xFF; + } + else + { + *command_id = id_unhandled; + } break; } - case id_keymap_keycode_save: +#ifdef DYNAMIC_KEYMAP_ENABLE + case id_dynamic_keymap_get_keycode: { - msg_keymap_keycode_save *msg = (msg_keymap_keycode_save*)&data[1]; - dynamic_keymap_keycode_save( msg->layer, msg->row, msg->column, msg->keycode); + uint16_t keycode = dynamic_keymap_get_keycode( command_data[0], command_data[1], command_data[2] ); + command_data[3] = keycode >> 8; + command_data[4] = keycode & 0xFF; break; } - case id_keymap_default_save: + case id_dynamic_keymap_set_keycode: { - dynamic_keymap_default_save(); + dynamic_keymap_set_keycode( command_data[0], command_data[1], command_data[2], ( command_data[3] << 8 ) | command_data[4] ); break; } -#endif // USE_KEYMAPS_IN_EEPROM -#if BACKLIGHT_ENABLED - case id_backlight_config_set_values: + case id_dynamic_keymap_clear_all: { - msg_backlight_config_set_values *msg = (msg_backlight_config_set_values*)&data[1]; - backlight_config_set_values(msg); - backlight_config_save(); + dynamic_keymap_clear_all(); break; } - case id_backlight_config_set_alphas_mods: +#endif // DYNAMIC_KEYMAP_ENABLE +#if BACKLIGHT_ENABLED + case id_backlight_config_set_value: { - msg_backlight_config_set_alphas_mods *msg = (msg_backlight_config_set_alphas_mods*)&data[1]; - backlight_config_set_alphas_mods( msg->alphas_mods ); - backlight_config_save(); + backlight_config_set_value(command_data); break; } - case id_backlight_set_key_color: + case id_backlight_config_get_value: { - msg_backlight_set_key_color *msg = (msg_backlight_set_key_color*)&data[1]; - backlight_set_key_color(msg->row, msg->column, msg->hsv); + backlight_config_get_value(command_data); break; } -#endif // BACKLIGHT_ENABLED - case id_system_get_state: + case id_backlight_config_save: { - msg_system_state *msg = (msg_system_state*)&data[1]; -#if BACKLIGHT_ENABLED - msg->value = backlight_get_tick(); -#else - msg->value = 1; // TODO: need to decouple "uptime" from backlight -#endif // BACKLIGHT_ENABLED + backlight_config_save(); break; } +#endif // BACKLIGHT_ENABLED default: { // Unhandled message. - data[0] = id_unhandled; + *command_id = id_unhandled; break; } } @@ -137,24 +153,13 @@ void matrix_init_kb(void) // save the default values to the EEPROM. Default values // come from construction of the zeal_backlight_config instance. backlight_config_save(); - - // Clear the LED colors stored in EEPROM - for ( int row=0; row < MATRIX_ROWS; row++ ) - { - HSV hsv; - for ( int column=0; column < MATRIX_COLS; column++ ) - { - hsv.h = rand() & 0xFF; - hsv.s = rand() & 0x7F; - hsv.v = 255; - backlight_set_key_color( row, column, hsv ); - } - } #endif // BACKLIGHT_ENABLED +#ifdef DYNAMIC_KEYMAP_ENABLE // This saves "empty" keymaps so it falls back to the keymaps // in the firmware (aka. progmem/flash) - dynamic_keymap_default_save(); + dynamic_keymap_clear_all(); +#endif // Save the magic number last, in case saving was interrupted eeprom_set_valid(true); @@ -182,118 +187,10 @@ void matrix_scan_kb(void) bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - // Record keypresses for backlight effects - if ( record->event.pressed ) - { -#if BACKLIGHT_ENABLED - backlight_set_key_hit( record->event.key.row, record->event.key.col ); -#endif // BACKLIGHT_ENABLED - } + process_record_backlight(keycode, record); switch(keycode) { -#if BACKLIGHT_ENABLED - case BR_INC: - if (record->event.pressed) - { - backlight_brightness_increase(); - } - return false; - break; - case BR_DEC: - if (record->event.pressed) - { - backlight_brightness_decrease(); - } - return false; - break; - case EF_INC: - if (record->event.pressed) - { - backlight_effect_increase(); - } - return false; - break; - case EF_DEC: - if (record->event.pressed) - { - backlight_effect_decrease(); - } - return false; - break; - case ES_INC: - if (record->event.pressed) - { - backlight_effect_speed_increase(); - } - return false; - break; - case ES_DEC: - if (record->event.pressed) - { - backlight_effect_speed_decrease(); - } - return false; - break; - case H1_INC: - if (record->event.pressed) - { - backlight_color_1_hue_increase(); - } - return false; - break; - case H1_DEC: - if (record->event.pressed) - { - backlight_color_1_hue_decrease(); - } - return false; - break; - case S1_INC: - if (record->event.pressed) - { - backlight_color_1_sat_increase(); - } - return false; - break; - case S1_DEC: - if (record->event.pressed) - { - backlight_color_1_sat_decrease(); - break; - } - return false; - break; - case H2_INC: - if (record->event.pressed) - { - backlight_color_2_hue_increase(); - } - return false; - break; - case H2_DEC: - if (record->event.pressed) - { - backlight_color_2_hue_decrease(); - } - return false; - break; - case S2_INC: - if (record->event.pressed) - { - backlight_color_2_sat_increase(); - } - return false; - break; - case S2_DEC: - if (record->event.pressed) - { - backlight_color_2_sat_decrease(); - break; - } - return false; - break; -#endif // BACKLIGHT_ENABLED case FN_MO13: if (record->event.pressed) { diff --git a/keyboards/zeal60/zeal60.h b/keyboards/zeal60/zeal60.h index fd24f24e2cff..4fc845d53f63 100644 --- a/keyboards/zeal60/zeal60.h +++ b/keyboards/zeal60/zeal60.h @@ -2,7 +2,7 @@ #define ZEAL60_H #include "quantum.h" +#include "rgb_backlight_keycodes.h" +#include "zeal60_keycodes.h" -#include "zeal_keycode.h" - -#endif //ZEAL60_H +#endif // ZEAL60_H diff --git a/keyboards/zeal60/zeal60_api.h b/keyboards/zeal60/zeal60_api.h new file mode 100644 index 000000000000..aa5b8d438499 --- /dev/null +++ b/keyboards/zeal60/zeal60_api.h @@ -0,0 +1,21 @@ +#ifndef ZEAL60_API_H +#define ZEAL60_API_H + +#define PROTOCOL_VERSION 0x0007 + +enum zeal60_command_id +{ + id_get_protocol_version = 0x01, // always 0x01 + id_get_keyboard_value, + id_set_keyboard_value, + id_dynamic_keymap_get_keycode, + id_dynamic_keymap_set_keycode, + id_dynamic_keymap_clear_all, + id_backlight_config_set_value, + id_backlight_config_get_value, + id_backlight_config_save, + + id_unhandled = 0xFF, +}; + +#endif // ZEAL60_API_H diff --git a/keyboards/zeal60/zeal_keycode.h b/keyboards/zeal60/zeal60_keycodes.h similarity index 64% rename from keyboards/zeal60/zeal_keycode.h rename to keyboards/zeal60/zeal60_keycodes.h index 96f87696227d..012f422a31ff 100644 --- a/keyboards/zeal60/zeal_keycode.h +++ b/keyboards/zeal60/zeal60_keycodes.h @@ -1,25 +1,13 @@ -#ifndef ZEAL_KEYCODE_H -#define ZEAL_KEYCODE_H +#ifndef ZEAL60_KEYCODE_H +#define ZEAL60_KEYCODE_H // Can't use SAFE_RANGE here, it might change if someone adds // new values to enum quantum_keycodes. -// Need to keep checking 0x5F00 is still in the safe range. +// Need to keep checking 0x5F10 is still in the safe range. +// TODO: merge this into quantum_keycodes +// Backlight keycodes are in range 0x5F00-0x5F0F enum zeal60_keycodes { - BR_INC = 0x5F00, // backlight brightness increase - BR_DEC, // backlight brightness decrease - EF_INC, // backlight effect increase - EF_DEC, // backlight effect decrease - ES_INC, - ES_DEC, - H1_INC, - H1_DEC, - S1_INC, - S1_DEC, - H2_INC, - H2_DEC, - S2_INC, - S2_DEC, - FN_MO13, + FN_MO13 = 0x5F10, FN_MO23 }; diff --git a/keyboards/zeal60/zeal_eeprom.c b/keyboards/zeal60/zeal_eeprom.c deleted file mode 100644 index 61be1f7e9488..000000000000 --- a/keyboards/zeal60/zeal_eeprom.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "zeal_eeprom.h" -#include "tmk_core/common/eeprom.h" - -bool eeprom_is_valid(void) -{ - return (eeprom_read_word(EEPROM_MAGIC_ADDR) == EEPROM_MAGIC && - eeprom_read_byte(EEPROM_VERSION_ADDR) == EEPROM_VERSION); -} - -void eeprom_set_valid(bool valid) -{ - eeprom_update_word(EEPROM_MAGIC_ADDR, valid ? EEPROM_MAGIC : 0xFFFF); - eeprom_update_byte(EEPROM_VERSION_ADDR, valid ? EEPROM_VERSION : 0xFF); -} diff --git a/keyboards/zeal60/zeal_eeprom.h b/keyboards/zeal60/zeal_eeprom.h deleted file mode 100644 index d1fe676c887b..000000000000 --- a/keyboards/zeal60/zeal_eeprom.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef ZEAL_EEPROM_H -#define ZEAL_EEPROM_H - -#include -#include -#include "tmk_core/common/eeprom.h" - -#define EEPROM_MAGIC 0x451F -#define EEPROM_MAGIC_ADDR ((void*)32) - -// Bump this every time we change what we store -// This will automatically reset the EEPROM with defaults -// and avoid loading invalid data from the EEPROM -#define EEPROM_VERSION 0x06 -#define EEPROM_VERSION_ADDR ((void*)34) - -#define EEPROM_BACKLIGHT_CONFIG_ADDR ((void*)35) - -// zeal_backlight_config uses 37 bytes -// 35+37=72 -#define EEPROM_BACKLIGHT_KEY_COLOR_ADDR ((void*)72) - -// key colors use 72*3=216 -// 72+216=288 - -// Reconcile with config.h -//#define EEPROM_KEYMAP_ADDR ((void*)288) -//#define EEPROM_KEYMAP_MAX 4 - -// Each keymap is MATRIX_ROWS*MATRIX_COLS*2 bytes -// For Zeal60 this is 5*14*2=140 bytes -// 4 keymaps = 560 bytes -// 288 + 560 = 848 -// 848 < 1024 :-) - -// For Zeal65 this is 5*15*2=150 bytes -// 4 keymaps = 600 bytes -// 288 + 600 = 888 -// 888 < 1024 :-) - -bool eeprom_is_valid(void); -void eeprom_set_valid(bool valid); - - - - - -#endif // ZEAL_EEPROM_H diff --git a/keyboards/zeal60/zeal_rpc.h b/keyboards/zeal60/zeal_rpc.h deleted file mode 100644 index 39672ff0c4c8..000000000000 --- a/keyboards/zeal60/zeal_rpc.h +++ /dev/null @@ -1,105 +0,0 @@ -#ifndef ZEAL_RPC_H -#define ZEAL_RPC_H - -#include "quantum/color.h" - -#define PROTOCOL_VERSION 0x0006 - -enum -{ - id_protocol_version = 0x01, // always 0x01 - id_keymap_keycode_load, - id_keymap_keycode_save, - id_keymap_default_save, - id_backlight_config_set_values, - id_backlight_config_set_alphas_mods, - id_backlight_set_key_color, - id_system_get_state, - id_system_set_state, - id_unhandled = 0xFF, -}; - -#if defined(__GNUC__) -#define PACKED __attribute__ ((__packed__)) -#else -#define PACKED -#endif - -#if defined(_MSC_VER) -#pragma pack( push, 1 ) -#endif - -typedef struct PACKED -{ - uint16_t version; -} msg_protocol_version; - -typedef struct PACKED -{ - uint8_t layer; - uint8_t row; - uint8_t column; - uint16_t keycode; -} msg_keymap_keycode_load; - -typedef struct PACKED -{ - uint8_t layer; - uint8_t row; - uint8_t column; - uint16_t keycode; -} msg_keymap_keycode_save; - -typedef struct PACKED -{ - bool use_split_backspace:1; - bool use_split_left_shift:1; - bool use_split_right_shift:1; - bool use_7u_spacebar:1; - bool use_iso_enter:1; - bool disable_when_usb_suspended:1; - bool disable_hhkb_blocker_leds:1; - uint8_t disable_after_timeout; - uint8_t brightness; - uint8_t effect; - uint8_t effect_speed; - HSV color_1; - HSV color_2; - HSV caps_lock_indicator_color; - uint8_t caps_lock_indicator_row; - uint8_t caps_lock_indicator_column; - HSV layer_1_indicator_color; - uint8_t layer_1_indicator_row; - uint8_t layer_1_indicator_column; - HSV layer_2_indicator_color; - uint8_t layer_2_indicator_row; - uint8_t layer_2_indicator_column; - HSV layer_3_indicator_color; - uint8_t layer_3_indicator_row; - uint8_t layer_3_indicator_column; - // This is close to the packet size limit of 32 -} msg_backlight_config_set_values; - -typedef struct PACKED -{ - uint16_t alphas_mods[5]; -} msg_backlight_config_set_alphas_mods; - -typedef struct PACKED -{ - uint8_t row; - uint8_t column; - HSV hsv; -} msg_backlight_set_key_color; - -typedef struct PACKED -{ - uint8_t id; - uint32_t value; -} msg_system_state; - -#if defined(_MSC_VER) -#pragma pack( pop ) -#endif - -#endif // ZEAL_RPC_H diff --git a/keyboards/zeal65/config.h b/keyboards/zeal65/config.h index e0a407ef76ae..42dde1e2ca99 100644 --- a/keyboards/zeal65/config.h +++ b/keyboards/zeal65/config.h @@ -93,6 +93,9 @@ along with this program. If not, see . // disable backlight after timeout in minutes, 0 = no timeout #define BACKLIGHT_DISABLE_AFTER_TIMEOUT 0 +// the default effect (RGB test) +#define BACKLIGHT_EFFECT 255 + // These define which keys in the matrix are alphas/mods // Used for backlight effects so colors are different for // alphas vs. mods @@ -104,8 +107,23 @@ along with this program. If not, see . #define BACKLIGHT_ALPHAS_MODS_ROW_3 0b0111000000000001 #define BACKLIGHT_ALPHAS_MODS_ROW_4 0b0111110000000011 -#define DYNAMIC_KEYMAP_BASE_ADDR 288 #define DYNAMIC_KEYMAP_LAYER_COUNT 4 +// EEPROM usage + +// TODO: refactor with new user EEPROM code (coming soon) +#define EEPROM_MAGIC 0x451F +#define EEPROM_MAGIC_ADDR 32 +// Bump this every time we change what we store +// This will automatically reset the EEPROM with defaults +// and avoid loading invalid data from the EEPROM +#define EEPROM_VERSION 0x07 +#define EEPROM_VERSION_ADDR 34 + +// Backlight config starts after EEPROM version +#define BACKLIGHT_CONFIG_EEPROM_ADDR 35 +// Dynamic keymap starts after backlight config (35+37) +#define DYNAMIC_KEYMAP_EEPROM_ADDR 72 + #endif diff --git a/keyboards/zeal65/rules.mk b/keyboards/zeal65/rules.mk index e62c8c2951fd..f672ae2bb9d9 100644 --- a/keyboards/zeal65/rules.mk +++ b/keyboards/zeal65/rules.mk @@ -2,8 +2,7 @@ # project specific files SRC = ../zeal60/zeal60.c \ - ../zeal60/zeal_backlight.c \ - ../zeal60/zeal_eeprom.c \ + ../zeal60/rgb_backlight.c \ quantum/color.c \ drivers/issi/is31fl3731.c \ drivers/avr/i2c_master.c diff --git a/quantum/dynamic_keymap.c b/quantum/dynamic_keymap.c index ee48b0d3638c..9f18612d56cf 100644 --- a/quantum/dynamic_keymap.c +++ b/quantum/dynamic_keymap.c @@ -1,3 +1,19 @@ +/* Copyright 2017 Jason Williams (Wilba) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include "config.h" #include "keymap.h" // to get keymaps[][][] @@ -5,8 +21,8 @@ #ifdef DYNAMIC_KEYMAP_ENABLE -#ifndef DYNAMIC_KEYMAP_BASE_ADDR -#error DYNAMIC_KEYMAP_BASE_ADDR not defined +#ifndef DYNAMIC_KEYMAP_EEPROM_ADDR +#error DYNAMIC_KEYMAP_EEPROM_ADDR not defined #endif #ifndef DYNAMIC_KEYMAP_LAYER_COUNT @@ -18,11 +34,11 @@ void *dynamic_keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t column) { // TODO: optimize this with some left shifts - return ((void*)DYNAMIC_KEYMAP_BASE_ADDR) + ( layer * MATRIX_ROWS * MATRIX_COLS * 2 ) + + return ((void*)DYNAMIC_KEYMAP_EEPROM_ADDR) + ( layer * MATRIX_ROWS * MATRIX_COLS * 2 ) + ( row * MATRIX_COLS * 2 ) + ( column * 2 ); } -uint16_t dynamic_keymap_keycode_load(uint8_t layer, uint8_t row, uint8_t column) +uint16_t dynamic_keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t column) { void *address = dynamic_keymap_key_to_eeprom_address(layer, row, column); // Big endian, so we can read/write EEPROM directly from host if we want @@ -31,7 +47,7 @@ uint16_t dynamic_keymap_keycode_load(uint8_t layer, uint8_t row, uint8_t column) return keycode; } -void dynamic_keymap_keycode_save(uint8_t layer, uint8_t row, uint8_t column, uint16_t keycode) +void dynamic_keymap_set_keycode(uint8_t layer, uint8_t row, uint8_t column, uint16_t keycode) { void *address = dynamic_keymap_key_to_eeprom_address(layer, row, column); // Big endian, so we can read/write EEPROM directly from host if we want @@ -39,7 +55,7 @@ void dynamic_keymap_keycode_save(uint8_t layer, uint8_t row, uint8_t column, uin eeprom_update_byte(address+1, (uint8_t)(keycode & 0xFF)); } -void dynamic_keymap_default_save(void) +void dynamic_keymap_clear_all(void) { // Save "empty" keymaps. for ( int layer = 0; layer < DYNAMIC_KEYMAP_LAYER_COUNT; layer++ ) @@ -48,7 +64,7 @@ void dynamic_keymap_default_save(void) { for ( int column = 0; column < MATRIX_COLS; column++ ) { - dynamic_keymap_keycode_save(layer, row, column, KC_EENULL); + dynamic_keymap_set_keycode(layer, row, column, KC_EENULL); } } } @@ -64,7 +80,7 @@ uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) key.row < MATRIX_ROWS && // possibly redundant key.col < MATRIX_COLS ) // possibly redundant { - uint16_t keycode = dynamic_keymap_keycode_load(layer, key.row, key.col); + uint16_t keycode = dynamic_keymap_get_keycode(layer, key.row, key.col); // If keycode is not "empty", return it, otherwise // drop down to return the one in flash diff --git a/quantum/dynamic_keymap.h b/quantum/dynamic_keymap.h index 10293dd226af..b0133aeb85aa 100644 --- a/quantum/dynamic_keymap.h +++ b/quantum/dynamic_keymap.h @@ -1,3 +1,19 @@ +/* Copyright 2017 Jason Williams (Wilba) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #ifndef DYNAMIC_KEYMAP_H #define DYNAMIC_KEYMAP_H @@ -5,9 +21,9 @@ #include void *dynamic_keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t column); -uint16_t dynamic_keymap_keycode_load(uint8_t layer, uint8_t row, uint8_t column); -void dynamic_keymap_keycode_save(uint8_t layer, uint8_t row, uint8_t column, uint16_t keycode); -void dynamic_keymap_default_save(void); +uint16_t dynamic_keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t column); +void dynamic_keymap_set_keycode(uint8_t layer, uint8_t row, uint8_t column, uint16_t keycode); +void dynamic_keymap_clear_all(void); // This overrides the one in quantum/keymap_common.c // uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key); From fe876a31bdc24a85e93612b2a72d5184418b65e5 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Sun, 9 Sep 2018 00:30:14 +1000 Subject: [PATCH 57/69] Lots of little cleanups --- keyboards/zeal60/config.h | 35 +++--- .../keymaps/backlight_disabled/config.h | 4 +- keyboards/zeal60/keymaps/default/config.h | 24 ++-- keyboards/zeal60/keymaps/hhkb_ansi/config.h | 24 ++-- keyboards/zeal60/keymaps/m60_a/config.h | 26 ++--- keyboards/zeal60/keymaps/m60_a_proto/config.h | 26 ++--- keyboards/zeal60/keymaps/mousekey/config.h | 24 ++-- keyboards/zeal60/keymaps/poker2_ansi/config.h | 24 ++-- keyboards/zeal60/keymaps/poker2_iso/config.h | 24 ++-- keyboards/zeal60/keymaps/ryanmaclean/config.h | 24 ++-- keyboards/zeal60/keymaps/test/config.h | 30 ----- keyboards/zeal60/keymaps/test/keymap.c | 50 --------- keyboards/zeal60/keymaps/tusing/config.h | 24 ++-- keyboards/zeal60/rgb_backlight.c | 106 ++++++++++-------- keyboards/zeal60/rgb_backlight.h | 23 +++- keyboards/zeal60/rgb_backlight_api.h | 20 +++- keyboards/zeal60/rgb_backlight_keycodes.h | 16 ++- keyboards/zeal60/zeal60.c | 49 +++++--- keyboards/zeal60/zeal60.h | 15 +++ keyboards/zeal60/zeal60_api.h | 15 +++ keyboards/zeal60/zeal60_keycodes.h | 17 ++- keyboards/zeal65/config.h | 39 +++---- keyboards/zeal65/keymaps/default/config.h | 20 ++-- keyboards/zeal65/zeal65.c | 19 +++- 24 files changed, 363 insertions(+), 315 deletions(-) delete mode 100644 keyboards/zeal60/keymaps/test/config.h delete mode 100644 keyboards/zeal60/keymaps/test/keymap.c diff --git a/keyboards/zeal60/config.h b/keyboards/zeal60/config.h index 14374a993fb1..b7591fd39c88 100644 --- a/keyboards/zeal60/config.h +++ b/keyboards/zeal60/config.h @@ -75,37 +75,38 @@ along with this program. If not, see . //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION -#define BACKLIGHT_ENABLED 1 +#define RGB_BACKLIGHT_ENABLED 1 -#define BACKLIGHT_KEYCODES_START 0x5F00 +// This conditionally compiles the backlight code for Zeal60 specifics +#define RGB_BACKLIGHT_ZEAL60 // enable/disable LEDs based on layout -#define BACKLIGHT_USE_SPLIT_BACKSPACE 0 -#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 -#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 -#define BACKLIGHT_USE_7U_SPACEBAR 0 -#define BACKLIGHT_USE_ISO_ENTER 0 -#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 +#define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 0 +#define RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 +#define RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 +#define RGB_BACKLIGHT_USE_7U_SPACEBAR 0 +#define RGB_BACKLIGHT_USE_ISO_ENTER 0 +#define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 // disable backlight when USB suspended (PC sleep/hibernate/shutdown) -#define BACKLIGHT_DISABLE_WHEN_USB_SUSPENDED 0 +#define RGB_BACKLIGHT_DISABLE_WHEN_USB_SUSPENDED 0 // disable backlight after timeout in minutes, 0 = no timeout -#define BACKLIGHT_DISABLE_AFTER_TIMEOUT 0 +#define RGB_BACKLIGHT_DISABLE_AFTER_TIMEOUT 0 // the default effect (RGB test) -#define BACKLIGHT_EFFECT 255 +#define RGB_BACKLIGHT_EFFECT 255 // These define which keys in the matrix are alphas/mods // Used for backlight effects so colors are different for // alphas vs. mods // Each value is for a row, bit 0 is column 0 // Alpha=0 Mod=1 -#define BACKLIGHT_ALPHAS_MODS_ROW_0 0b0010000000000001 -#define BACKLIGHT_ALPHAS_MODS_ROW_1 0b0000000000000001 -#define BACKLIGHT_ALPHAS_MODS_ROW_2 0b0001000000000001 -#define BACKLIGHT_ALPHAS_MODS_ROW_3 0b0011000000000001 -#define BACKLIGHT_ALPHAS_MODS_ROW_4 0b0011110000000111 +#define RGB_BACKLIGHT_ALPHAS_MODS_ROW_0 0b0010000000000001 +#define RGB_BACKLIGHT_ALPHAS_MODS_ROW_1 0b0000000000000001 +#define RGB_BACKLIGHT_ALPHAS_MODS_ROW_2 0b0001000000000001 +#define RGB_BACKLIGHT_ALPHAS_MODS_ROW_3 0b0011000000000001 +#define RGB_BACKLIGHT_ALPHAS_MODS_ROW_4 0b0011110000000111 #define DYNAMIC_KEYMAP_LAYER_COUNT 4 @@ -121,7 +122,7 @@ along with this program. If not, see . #define EEPROM_VERSION_ADDR 34 // Backlight config starts after EEPROM version -#define BACKLIGHT_CONFIG_EEPROM_ADDR 35 +#define RGB_BACKLIGHT_CONFIG_EEPROM_ADDR 35 // Dynamic keymap starts after backlight config (35+37) #define DYNAMIC_KEYMAP_EEPROM_ADDR 72 diff --git a/keyboards/zeal60/keymaps/backlight_disabled/config.h b/keyboards/zeal60/keymaps/backlight_disabled/config.h index 1f253459ec63..55e6c97b08db 100644 --- a/keyboards/zeal60/keymaps/backlight_disabled/config.h +++ b/keyboards/zeal60/keymaps/backlight_disabled/config.h @@ -3,7 +3,7 @@ #include "../../config.h" -#undef BACKLIGHT_ENABLED -#define BACKLIGHT_ENABLED 0 +#undef RGB_BACKLIGHT_BACKLIGHT_ENABLED +#define RGB_BACKLIGHT_BACKLIGHT_ENABLED 0 #endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/default/config.h b/keyboards/zeal60/keymaps/default/config.h index 155e53157b58..f0be7ad664a8 100644 --- a/keyboards/zeal60/keymaps/default/config.h +++ b/keyboards/zeal60/keymaps/default/config.h @@ -4,22 +4,22 @@ #include "../../config.h" /* enable/disable LEDs based on layout */ -#undef BACKLIGHT_USE_SPLIT_BACKSPACE -#define BACKLIGHT_USE_SPLIT_BACKSPACE 0 +#undef RGB_BACKLIGHT_USE_SPLIT_BACKSPACE +#define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 0 -#undef BACKLIGHT_USE_SPLIT_LEFT_SHIFT -#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 +#undef RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT +#define RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 -#undef BACKLIGHT_USE_SPLIT_RIGHT_SHIFT -#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 +#undef RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT +#define RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 -#undef BACKLIGHT_USE_7U_SPACEBAR -#define BACKLIGHT_USE_7U_SPACEBAR 0 +#undef RGB_BACKLIGHT_USE_7U_SPACEBAR +#define RGB_BACKLIGHT_USE_7U_SPACEBAR 0 -#undef BACKLIGHT_USE_ISO_ENTER -#define BACKLIGHT_USE_ISO_ENTER 0 +#undef RGB_BACKLIGHT_USE_ISO_ENTER +#define RGB_BACKLIGHT_USE_ISO_ENTER 0 -#undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS -#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 +#undef RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS +#define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 #endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/hhkb_ansi/config.h b/keyboards/zeal60/keymaps/hhkb_ansi/config.h index 3ee536c9341b..30745b59a617 100644 --- a/keyboards/zeal60/keymaps/hhkb_ansi/config.h +++ b/keyboards/zeal60/keymaps/hhkb_ansi/config.h @@ -4,22 +4,22 @@ #include "../../config.h" /* enable/disable LEDs based on layout */ -#undef BACKLIGHT_USE_SPLIT_BACKSPACE -#define BACKLIGHT_USE_SPLIT_BACKSPACE 1 +#undef RGB_BACKLIGHT_USE_SPLIT_BACKSPACE +#define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 1 -#undef BACKLIGHT_USE_SPLIT_LEFT_SHIFT -#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 +#undef RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT +#define RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 -#undef BACKLIGHT_USE_SPLIT_RIGHT_SHIFT -#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 1 +#undef RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT +#define RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 1 -#undef BACKLIGHT_USE_7U_SPACEBAR -#define BACKLIGHT_USE_7U_SPACEBAR 1 +#undef RGB_BACKLIGHT_USE_7U_SPACEBAR +#define RGB_BACKLIGHT_USE_7U_SPACEBAR 1 -#undef BACKLIGHT_USE_ISO_ENTER -#define BACKLIGHT_USE_ISO_ENTER 0 +#undef RGB_BACKLIGHT_USE_ISO_ENTER +#define RGB_BACKLIGHT_USE_ISO_ENTER 0 -#undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS -#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 1 +#undef RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS +#define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 1 #endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/m60_a/config.h b/keyboards/zeal60/keymaps/m60_a/config.h index 8f977a4e4c28..7ba448e29eb9 100644 --- a/keyboards/zeal60/keymaps/m60_a/config.h +++ b/keyboards/zeal60/keymaps/m60_a/config.h @@ -4,25 +4,25 @@ #include "../../config.h" // This conditionally compiles the backlight code for M60-A specifics -#define CONFIG_M60_A +#define RGB_BACKLIGHT_M60_A /* enable/disable LEDs based on layout */ -#undef BACKLIGHT_USE_SPLIT_BACKSPACE -#define BACKLIGHT_USE_SPLIT_BACKSPACE 1 +#undef RGB_BACKLIGHT_USE_SPLIT_BACKSPACE +#define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 1 -#undef BACKLIGHT_USE_SPLIT_LEFT_SHIFT -#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 +#undef RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT +#define RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 -#undef BACKLIGHT_USE_SPLIT_RIGHT_SHIFT -#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 1 +#undef RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT +#define RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 1 -#undef BACKLIGHT_USE_7U_SPACEBAR -#define BACKLIGHT_USE_7U_SPACEBAR 1 +#undef RGB_BACKLIGHT_USE_7U_SPACEBAR +#define RGB_BACKLIGHT_USE_7U_SPACEBAR 1 -#undef BACKLIGHT_USE_ISO_ENTER -#define BACKLIGHT_USE_ISO_ENTER 0 +#undef RGB_BACKLIGHT_USE_ISO_ENTER +#define RGB_BACKLIGHT_USE_ISO_ENTER 0 -#undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS -#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 1 +#undef RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS +#define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 1 #endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/m60_a_proto/config.h b/keyboards/zeal60/keymaps/m60_a_proto/config.h index 5e25fe9ded71..7ea7addc6210 100644 --- a/keyboards/zeal60/keymaps/m60_a_proto/config.h +++ b/keyboards/zeal60/keymaps/m60_a_proto/config.h @@ -8,25 +8,25 @@ #define DIODE_DIRECTION ROW2COL // This conditionally compiles the backlight code for M60-A specifics -#define CONFIG_M60_A +#define RGB_BACKLIGHT_M60_A /* enable/disable LEDs based on layout */ -#undef BACKLIGHT_USE_SPLIT_BACKSPACE -#define BACKLIGHT_USE_SPLIT_BACKSPACE 1 +#undef RGB_BACKLIGHT_USE_SPLIT_BACKSPACE +#define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 1 -#undef BACKLIGHT_USE_SPLIT_LEFT_SHIFT -#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 +#undef RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT +#define RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 -#undef BACKLIGHT_USE_SPLIT_RIGHT_SHIFT -#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 1 +#undef RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT +#define RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 1 -#undef BACKLIGHT_USE_7U_SPACEBAR -#define BACKLIGHT_USE_7U_SPACEBAR 1 +#undef RGB_BACKLIGHT_USE_7U_SPACEBAR +#define RGB_BACKLIGHT_USE_7U_SPACEBAR 1 -#undef BACKLIGHT_USE_ISO_ENTER -#define BACKLIGHT_USE_ISO_ENTER 0 +#undef RGB_BACKLIGHT_USE_ISO_ENTER +#define RGB_BACKLIGHT_USE_ISO_ENTER 0 -#undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS -#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 1 +#undef RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS +#define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 1 #endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/mousekey/config.h b/keyboards/zeal60/keymaps/mousekey/config.h index 155e53157b58..f0be7ad664a8 100644 --- a/keyboards/zeal60/keymaps/mousekey/config.h +++ b/keyboards/zeal60/keymaps/mousekey/config.h @@ -4,22 +4,22 @@ #include "../../config.h" /* enable/disable LEDs based on layout */ -#undef BACKLIGHT_USE_SPLIT_BACKSPACE -#define BACKLIGHT_USE_SPLIT_BACKSPACE 0 +#undef RGB_BACKLIGHT_USE_SPLIT_BACKSPACE +#define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 0 -#undef BACKLIGHT_USE_SPLIT_LEFT_SHIFT -#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 +#undef RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT +#define RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 -#undef BACKLIGHT_USE_SPLIT_RIGHT_SHIFT -#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 +#undef RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT +#define RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 -#undef BACKLIGHT_USE_7U_SPACEBAR -#define BACKLIGHT_USE_7U_SPACEBAR 0 +#undef RGB_BACKLIGHT_USE_7U_SPACEBAR +#define RGB_BACKLIGHT_USE_7U_SPACEBAR 0 -#undef BACKLIGHT_USE_ISO_ENTER -#define BACKLIGHT_USE_ISO_ENTER 0 +#undef RGB_BACKLIGHT_USE_ISO_ENTER +#define RGB_BACKLIGHT_USE_ISO_ENTER 0 -#undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS -#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 +#undef RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS +#define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 #endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/poker2_ansi/config.h b/keyboards/zeal60/keymaps/poker2_ansi/config.h index b6978cda3dae..5ae077749a58 100644 --- a/keyboards/zeal60/keymaps/poker2_ansi/config.h +++ b/keyboards/zeal60/keymaps/poker2_ansi/config.h @@ -5,22 +5,22 @@ /* enable/disable LEDs based on layout */ -#undef BACKLIGHT_USE_SPLIT_BACKSPACE -#define BACKLIGHT_USE_SPLIT_BACKSPACE 0 +#undef RGB_BACKLIGHT_USE_SPLIT_BACKSPACE +#define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 0 -#undef BACKLIGHT_USE_SPLIT_LEFT_SHIFT -#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 +#undef RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT +#define RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 -#undef BACKLIGHT_USE_SPLIT_RIGHT_SHIFT -#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 +#undef RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT +#define RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 -#undef BACKLIGHT_USE_7U_SPACEBAR -#define BACKLIGHT_USE_7U_SPACEBAR 0 +#undef RGB_BACKLIGHT_USE_7U_SPACEBAR +#define RGB_BACKLIGHT_USE_7U_SPACEBAR 0 -#undef BACKLIGHT_USE_ISO_ENTER -#define BACKLIGHT_USE_ISO_ENTER 0 +#undef RGB_BACKLIGHT_USE_ISO_ENTER +#define RGB_BACKLIGHT_USE_ISO_ENTER 0 -#undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS -#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 +#undef RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS +#define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 #endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/poker2_iso/config.h b/keyboards/zeal60/keymaps/poker2_iso/config.h index 2b29669f31c7..a5028ecf8d6f 100644 --- a/keyboards/zeal60/keymaps/poker2_iso/config.h +++ b/keyboards/zeal60/keymaps/poker2_iso/config.h @@ -5,22 +5,22 @@ /* enable/disable LEDs based on layout */ -#undef BACKLIGHT_USE_SPLIT_BACKSPACE -#define BACKLIGHT_USE_SPLIT_BACKSPACE 0 +#undef RGB_BACKLIGHT_USE_SPLIT_BACKSPACE +#define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 0 -#undef BACKLIGHT_USE_SPLIT_LEFT_SHIFT -#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 +#undef RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT +#define RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 -#undef BACKLIGHT_USE_SPLIT_RIGHT_SHIFT -#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 +#undef RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT +#define RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 -#undef BACKLIGHT_USE_7U_SPACEBAR -#define BACKLIGHT_USE_7U_SPACEBAR 0 +#undef RGB_BACKLIGHT_USE_7U_SPACEBAR +#define RGB_BACKLIGHT_USE_7U_SPACEBAR 0 -#undef BACKLIGHT_USE_ISO_ENTER -#define BACKLIGHT_USE_ISO_ENTER 1 +#undef RGB_BACKLIGHT_USE_ISO_ENTER +#define RGB_BACKLIGHT_USE_ISO_ENTER 1 -#undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS -#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 +#undef RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS +#define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 #endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/ryanmaclean/config.h b/keyboards/zeal60/keymaps/ryanmaclean/config.h index 7a0486bcdbc2..d64ef8d942d2 100644 --- a/keyboards/zeal60/keymaps/ryanmaclean/config.h +++ b/keyboards/zeal60/keymaps/ryanmaclean/config.h @@ -4,22 +4,22 @@ #include "../../config.h" /* enable/disable LEDs based on layout */ -#undef BACKLIGHT_USE_SPLIT_BACKSPACE -#define BACKLIGHT_USE_SPLIT_BACKSPACE 1 +#undef RGB_BACKLIGHT_USE_SPLIT_BACKSPACE +#define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 1 -#undef BACKLIGHT_USE_SPLIT_LEFT_SHIFT -#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 +#undef RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT +#define RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 -#undef BACKLIGHT_USE_SPLIT_RIGHT_SHIFT -#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 1 +#undef RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT +#define RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 1 -#undef BACKLIGHT_USE_7U_SPACEBAR -#define BACKLIGHT_USE_7U_SPACEBAR 0 +#undef RGB_BACKLIGHT_USE_7U_SPACEBAR +#define RGB_BACKLIGHT_USE_7U_SPACEBAR 0 -#undef BACKLIGHT_USE_ISO_ENTER -#define BACKLIGHT_USE_ISO_ENTER 0 +#undef RGB_BACKLIGHT_USE_ISO_ENTER +#define RGB_BACKLIGHT_USE_ISO_ENTER 0 -#undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS -#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 +#undef RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS +#define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 #endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/test/config.h b/keyboards/zeal60/keymaps/test/config.h deleted file mode 100644 index c85ca84b60a1..000000000000 --- a/keyboards/zeal60/keymaps/test/config.h +++ /dev/null @@ -1,30 +0,0 @@ -// This is only used for factory test, some features are disabled - -#ifndef CONFIG_USER_H -#define CONFIG_USER_H - -#include "../../config.h" - -#define ZEAL60_TEST -#undef RAW_ENABLE - -/* enable/disable LEDs based on layout */ -#undef BACKLIGHT_USE_SPLIT_BACKSPACE -#define BACKLIGHT_USE_SPLIT_BACKSPACE 0 - -#undef BACKLIGHT_USE_SPLIT_LEFT_SHIFT -#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 - -#undef BACKLIGHT_USE_SPLIT_RIGHT_SHIFT -#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 - -#undef BACKLIGHT_USE_7U_SPACEBAR -#define BACKLIGHT_USE_7U_SPACEBAR 0 - -#undef BACKLIGHT_USE_ISO_ENTER -#define BACKLIGHT_USE_ISO_ENTER 0 - -#undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS -#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 - -#endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/test/keymap.c b/keyboards/zeal60/keymaps/test/keymap.c deleted file mode 100644 index 4d0848f78c43..000000000000 --- a/keyboards/zeal60/keymaps/test/keymap.c +++ /dev/null @@ -1,50 +0,0 @@ -// Test layout for Zeal60 - This is only used for factory test, some features are disabled - -#include "zeal60.h" - -// [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace -// [1,13] is either backslash or ISO Enter -// [2,12] is either ANSI Enter or key left of ISO Enter -// [2,13] is right key of split backspace (e.g. HHKB `~ key) -// [3,1] is right key of split left-shift (e.g ISO key) -// [3,13] is right key of split right-shift (e.g. HHKB Fn key) - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -// Default layer -[0] = { - {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS}, - {KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_NO }, - {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO }, - {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RALT, FN_MO13, FN_MO23, KC_RCTL} -}, - -// Fn1 Layer -[1] = { - {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, - {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS}, - {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, - -// Fn2 Layer -[2] = { - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, - -// Fn3 Layer (zeal60 Configuration) -[3] = { - {KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -} - -}; diff --git a/keyboards/zeal60/keymaps/tusing/config.h b/keyboards/zeal60/keymaps/tusing/config.h index 4ca4ac80f145..5a048ad235fc 100644 --- a/keyboards/zeal60/keymaps/tusing/config.h +++ b/keyboards/zeal60/keymaps/tusing/config.h @@ -4,23 +4,23 @@ #include "../../config.h" /* Enable/disable LEDs based on layout. */ -#undef BACKLIGHT_USE_SPLIT_BACKSPACE -#define BACKLIGHT_USE_SPLIT_BACKSPACE 0 +#undef RGB_BACKLIGHT_USE_SPLIT_BACKSPACE +#define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 0 -#undef BACKLIGHT_USE_SPLIT_LEFT_SHIFT -#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 +#undef RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT +#define RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 -#undef BACKLIGHT_USE_SPLIT_RIGHT_SHIFT -#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 +#undef RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT +#define RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 -#undef BACKLIGHT_USE_7U_SPACEBAR -#define BACKLIGHT_USE_7U_SPACEBAR 0 +#undef RGB_BACKLIGHT_USE_7U_SPACEBAR +#define RGB_BACKLIGHT_USE_7U_SPACEBAR 0 -#undef BACKLIGHT_USE_ISO_ENTER -#define BACKLIGHT_USE_ISO_ENTER 0 +#undef RGB_BACKLIGHT_USE_ISO_ENTER +#define RGB_BACKLIGHT_USE_ISO_ENTER 0 -#undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS -#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 +#undef RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS +#define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 // Set up RGB underglow. #define RGBLIGHT_ANIMATIONS diff --git a/keyboards/zeal60/rgb_backlight.c b/keyboards/zeal60/rgb_backlight.c index 7dbfd80140ed..4bc09e9e7f01 100644 --- a/keyboards/zeal60/rgb_backlight.c +++ b/keyboards/zeal60/rgb_backlight.c @@ -1,5 +1,24 @@ - -#if BACKLIGHT_ENABLED +/* Copyright 2017 Jason Williams (Wilba) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#if RGB_BACKLIGHT_ENABLED + +#if defined (RGB_BACKLIGHT_ZEAL60) || defined (RGB_BACKLIGHT_ZEAL65) || defined (RGB_BACKLIGHT_M60_A) +#else +#error None of the following was defined: RGB_BACKLIGHT_ZEAL60, RGB_BACKLIGHT_ZEAL65, RGB_BACKLIGHT_M60_A +#endif #include "zeal60.h" #include "rgb_backlight.h" @@ -19,16 +38,16 @@ #define BACKLIGHT_EFFECT_MAX 10 backlight_config g_config = { - .use_split_backspace = BACKLIGHT_USE_SPLIT_BACKSPACE, - .use_split_left_shift = BACKLIGHT_USE_SPLIT_LEFT_SHIFT, - .use_split_right_shift = BACKLIGHT_USE_SPLIT_RIGHT_SHIFT, - .use_7u_spacebar = BACKLIGHT_USE_7U_SPACEBAR, - .use_iso_enter = BACKLIGHT_USE_ISO_ENTER, - .disable_hhkb_blocker_leds = BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS, - .disable_when_usb_suspended = BACKLIGHT_DISABLE_WHEN_USB_SUSPENDED, - .disable_after_timeout = BACKLIGHT_DISABLE_AFTER_TIMEOUT, + .use_split_backspace = RGB_BACKLIGHT_USE_SPLIT_BACKSPACE, + .use_split_left_shift = RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT, + .use_split_right_shift = RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT, + .use_7u_spacebar = RGB_BACKLIGHT_USE_7U_SPACEBAR, + .use_iso_enter = RGB_BACKLIGHT_USE_ISO_ENTER, + .disable_hhkb_blocker_leds = RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS, + .disable_when_usb_suspended = RGB_BACKLIGHT_DISABLE_WHEN_USB_SUSPENDED, + .disable_after_timeout = RGB_BACKLIGHT_DISABLE_AFTER_TIMEOUT, .brightness = 255, - .effect = BACKLIGHT_EFFECT, + .effect = RGB_BACKLIGHT_EFFECT, .effect_speed = 0, .color_1 = { .h = 0, .s = 255, .v = 255 }, .color_2 = { .h = 127, .s = 255, .v = 255 }, @@ -37,11 +56,11 @@ backlight_config g_config = { .layer_2_indicator = { .color = { .h = 0, .s = 0, .v = 255 }, .index = 255 }, .layer_3_indicator = { .color = { .h = 0, .s = 0, .v = 255 }, .index = 255 }, .alphas_mods = { - BACKLIGHT_ALPHAS_MODS_ROW_0, - BACKLIGHT_ALPHAS_MODS_ROW_1, - BACKLIGHT_ALPHAS_MODS_ROW_2, - BACKLIGHT_ALPHAS_MODS_ROW_3, - BACKLIGHT_ALPHAS_MODS_ROW_4 } + RGB_BACKLIGHT_ALPHAS_MODS_ROW_0, + RGB_BACKLIGHT_ALPHAS_MODS_ROW_1, + RGB_BACKLIGHT_ALPHAS_MODS_ROW_2, + RGB_BACKLIGHT_ALPHAS_MODS_ROW_3, + RGB_BACKLIGHT_ALPHAS_MODS_ROW_4 } }; bool g_suspend_state = false; @@ -61,9 +80,6 @@ uint32_t g_any_key_hit = 0; #define ISSI_ADDR_1 0x74 #define ISSI_ADDR_2 0x76 - - - const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { /* Refer to IS31 manual for these locations * driver @@ -159,7 +175,7 @@ typedef struct Point { // index in range 0..71 (LA0..LA17, LB0..LB17, LC0..LC17, LD0..LD17) // point values in range x=0..224 y=0..64 // origin is center of top-left key (i.e Esc) -#ifdef CONFIG_ZEAL65 +#if defined (RGB_BACKLIGHT_ZEAL65) const Point g_map_led_to_point[72] PROGMEM = { // LA0..LA17 {120,16}, {104,16}, {88,16}, {72,16}, {56,16}, {40,16}, {24,16}, {4,16}, {4,32}, @@ -188,7 +204,7 @@ const Point g_map_led_to_point_polar[72] PROGMEM = { {0,9}, {0,43}, {0,77}, {0,111}, {0,145}, {255,201}, {224,181}, {230,217}, {235,255}, {189,128}, {200,131}, {210,141}, {218,159}, {201,228}, {201,228}, {206,255}, {213,255}, {218,255} }; -#else +#elif defined (RGB_BACKLIGHT_ZEAL60) || defined (RGB_BACKLIGHT_M60_A) const Point g_map_led_to_point[72] PROGMEM = { // LA0..LA17 {120,16}, {104,16}, {88,16}, {72,16}, {56,16}, {40,16}, {24,16}, {4,16}, {4,32}, @@ -217,13 +233,7 @@ const Point g_map_led_to_point_polar[72] PROGMEM = { {0,27}, {0,64}, {0,101}, {0,137}, {0,174}, {255,233}, {228,201}, {235,255}, {237,255}, {195,128}, {206,136}, {215,152}, {222,175}, {205,234}, {209,255}, {214,255}, {219,255}, {223,255} }; -#endif // ZEAL65_PROTO - - - - - - +#endif // This may seem counter-intuitive, but it's quite flexible. // For each LED, get it's position to decide what color to make it. @@ -246,7 +256,7 @@ void map_led_to_point( uint8_t index, Point *point ) if ( g_config.use_iso_enter ) point->y += 8; // extremely pedantic break; -#ifndef ZEAL65_PROTO +#if defined (RGB_BACKLIGHT_ZEAL60) || defined (RGB_BACKLIGHT_M60_A) case 36+0: // LC0A if ( g_config.use_7u_spacebar ) point->x += 10; @@ -284,7 +294,7 @@ void map_led_to_point_polar( uint8_t index, Point *point ) // -#ifdef CONFIG_ZEAL65 +#if defined (RGB_BACKLIGHT_ZEAL65) // Note: Left spacebar stab is at 4,3 (LC7) // Right spacebar stab is at 4,9 (D14) // @@ -300,7 +310,7 @@ const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { { 36+16, 36+15, 36+5, 36+4, 36+3, 36+2, 36+1, 54+9, 54+10, 54+11, 54+12, 54+6, 54+7, 54+8, 18+15 }, { 36+17, 36+8, 36+7, 255, 255, 255, 255, 36+0, 255, 54+14, 54+15, 54+16, 54+17, 18+17, 18+16 } }; -#else +#elif defined (RGB_BACKLIGHT_ZEAL60) || defined (RGB_BACKLIGHT_M60_A) // Note: Left spacebar stab is at 4,3 (LC6) // Right spacebar stab is at 4,9 (LD13) or 4,10 (LD14) // @@ -742,10 +752,10 @@ void backlight_effect_indicators_set_colors( uint8_t index, HSV hsv ) // do the same for the spacebar stabilizers if ( index == 36+0 ) // LC0 { -#ifdef CONFIG_ZEAL65 +#if defined (RGB_BACKLIGHT_ZEAL65) backlight_set_color( 36+7, rgb.r, rgb.g, rgb.b ); // LC7 backlight_set_color( 54+14, rgb.r, rgb.g, rgb.b ); // LD14 -#else +#elif defined (RGB_BACKLIGHT_ZEAL60) || defined (RGB_BACKLIGHT_M60_A) backlight_set_color( 36+6, rgb.r, rgb.g, rgb.b ); // LC6 backlight_set_color( 54+13, rgb.r, rgb.g, rgb.b ); // LD13 if ( g_config.use_7u_spacebar ) @@ -929,12 +939,15 @@ void backlight_config_set_value( uint8_t *data ) uint8_t *value_data = &(data[1]); switch ( *value_id ) { +#if defined (RGB_BACKLIGHT_ZEAL60) || defined(RGB_BACKLIGHT_ZEAL65) case id_use_split_backspace: { g_config.use_split_backspace = (bool)*value_data; reinitialize = true; break; } +#endif +#if defined (RGB_BACKLIGHT_ZEAL60) case id_use_split_left_shift: { g_config.use_split_left_shift = (bool)*value_data; @@ -959,14 +972,16 @@ void backlight_config_set_value( uint8_t *data ) reinitialize = true; break; } - case id_disable_when_usb_suspended: + case id_disable_hhkb_blocker_leds: { - g_config.disable_when_usb_suspended = (bool)*value_data; + g_config.disable_hhkb_blocker_leds = (bool)*value_data; + reinitialize = true; break; } - case id_disable_hhkb_blocker_leds: +#endif + case id_disable_when_usb_suspended: { - g_config.disable_hhkb_blocker_leds = (bool)*value_data; + g_config.disable_when_usb_suspended = (bool)*value_data; break; } case id_disable_after_timeout: @@ -1188,12 +1203,12 @@ void backlight_config_set_alphas_mods( uint16_t *alphas_mods ) void backlight_config_load(void) { - eeprom_read_block( &g_config, ((void*)BACKLIGHT_CONFIG_EEPROM_ADDR), sizeof(backlight_config) ); + eeprom_read_block( &g_config, ((void*)RGB_BACKLIGHT_CONFIG_EEPROM_ADDR), sizeof(backlight_config) ); } void backlight_config_save(void) { - eeprom_update_block( &g_config, ((void*)BACKLIGHT_CONFIG_EEPROM_ADDR), sizeof(backlight_config) ); + eeprom_update_block( &g_config, ((void*)RGB_BACKLIGHT_CONFIG_EEPROM_ADDR), sizeof(backlight_config) ); } void backlight_init_drivers(void) @@ -1207,14 +1222,13 @@ void backlight_init_drivers(void) { // OR the possible "disabled" cases together, then NOT the result to get the enabled state // LC6 LD13 not present on Zeal65 -#ifdef CONFIG_ZEAL65 +#if defined (RGB_BACKLIGHT_ZEAL65) bool enabled = !( ( index == 18+5 && !g_config.use_split_backspace ) || // LB5 ( index == 36+15 && !g_config.use_split_left_shift ) || // LC15 ( index == 54+8 && !g_config.use_split_right_shift ) || // LD8 ( index == 36+6 ) || // LC6 ( index == 54+13 ) ); // LD13 -#else -#ifdef CONFIG_M60_A +#elif defined (RGB_BACKLIGHT_M60_A) bool enabled = !( // LB6 LB7 LB8 LB15 LB16 LB17 not present on M60-A ( index == 18+6 ) || // LB6 @@ -1228,7 +1242,7 @@ void backlight_init_drivers(void) ( index == 54+17 ) || // LD17 ( index == 36+15 ) || // LC15 ( index == 54+13 ) ); // LD13 -#else // Zeal60 +#elif defined (RGB_BACKLIGHT_ZEAL60) // LB6 LB7 LB8 LB15 LB16 LB17 not present on Zeal60 bool enabled = !( ( index == 18+5 && !g_config.use_split_backspace ) || // LB5 ( index == 36+15 && !g_config.use_split_left_shift ) || // LC15 @@ -1242,7 +1256,6 @@ void backlight_init_drivers(void) ( index == 18+15 ) || // LB15 ( index == 18+16 ) || // LB16 ( index == 18+17 ) ); // LB17 -#endif #endif // This only caches it for later IS31FL3731_set_led_control_register( index, enabled, enabled, enabled ); @@ -1488,11 +1501,6 @@ void backlight_test_led( uint8_t index, bool red, bool green, bool blue ) } } -uint32_t backlight_get_tick(void) -{ - return g_tick; -} - void backlight_debug_led( bool state ) { if (state) diff --git a/keyboards/zeal60/rgb_backlight.h b/keyboards/zeal60/rgb_backlight.h index 12e70ac77bef..7a262a27baf1 100644 --- a/keyboards/zeal60/rgb_backlight.h +++ b/keyboards/zeal60/rgb_backlight.h @@ -1,10 +1,25 @@ +/* Copyright 2017 Jason Williams (Wilba) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifndef RGB_BACKLIGHT_H #define RGB_BACKLIGHT_H -#if BACKLIGHT_ENABLED +#if RGB_BACKLIGHT_ENABLED #else -#error rgb_backlight.h included when BACKLIGHT_ENABLED == 0 -#endif // BACKLIGHT_ENABLED +#error rgb_backlight.h included when RGB_BACKLIGHT_ENABLED == 0 +#endif // RGB_BACKLIGHT_ENABLED #include #include @@ -40,7 +55,6 @@ typedef struct uint16_t alphas_mods[5]; // 10 bytes } backlight_config; // = 37 bytes -void backlight_config_set_alphas_mods( uint16_t *value ); void backlight_config_load(void); void backlight_config_save(void); void backlight_config_set_value( uint8_t *data ); @@ -84,7 +98,6 @@ void backlight_color_2_sat_increase(void); void backlight_color_2_sat_decrease(void); void backlight_test_led( uint8_t index, bool red, bool green, bool blue ); -uint32_t backlight_get_tick(void); void backlight_debug_led(bool state); #endif //RGB_BACKLIGHT_H diff --git a/keyboards/zeal60/rgb_backlight_api.h b/keyboards/zeal60/rgb_backlight_api.h index 47f901048cde..82416e370316 100644 --- a/keyboards/zeal60/rgb_backlight_api.h +++ b/keyboards/zeal60/rgb_backlight_api.h @@ -1,4 +1,18 @@ - +/* Copyright 2017 Jason Williams (Wilba) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifndef RGB_BACKLIGHT_API_H #define RGB_BACKLIGHT_API_H @@ -9,8 +23,8 @@ enum backlight_config_value id_use_split_right_shift = 0x03, id_use_7u_spacebar = 0x04, id_use_iso_enter = 0x05, - id_disable_when_usb_suspended = 0x06, - id_disable_hhkb_blocker_leds = 0x07, + id_disable_hhkb_blocker_leds = 0x06, + id_disable_when_usb_suspended = 0x07, id_disable_after_timeout = 0x08, id_brightness = 0x09, id_effect = 0x0A, diff --git a/keyboards/zeal60/rgb_backlight_keycodes.h b/keyboards/zeal60/rgb_backlight_keycodes.h index 1785f85990f1..6a5e06ab09e1 100644 --- a/keyboards/zeal60/rgb_backlight_keycodes.h +++ b/keyboards/zeal60/rgb_backlight_keycodes.h @@ -1,4 +1,18 @@ - +/* Copyright 2017 Jason Williams (Wilba) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifndef RGB_BACKLIGHT_KEYCODES_H #define RGB_BACKLIGHT_KEYCODES_H diff --git a/keyboards/zeal60/zeal60.c b/keyboards/zeal60/zeal60.c index ae379c59266c..e516c4dbfc6d 100644 --- a/keyboards/zeal60/zeal60.c +++ b/keyboards/zeal60/zeal60.c @@ -1,8 +1,23 @@ +/* Copyright 2017 Jason Williams (Wilba) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "zeal60.h" #include "zeal60_api.h" // Check that no backlight functions are called -#if BACKLIGHT_ENABLED +#if RGB_BACKLIGHT_ENABLED #include "rgb_backlight.h" #endif // BACKLIGHT_ENABLED @@ -72,7 +87,7 @@ void raw_hid_receive( uint8_t *data, uint8_t length ) break; } #endif // DYNAMIC_KEYMAP_ENABLE -#if BACKLIGHT_ENABLED +#if RGB_BACKLIGHT_ENABLED case id_backlight_config_set_value: { backlight_config_set_value(command_data); @@ -88,7 +103,7 @@ void raw_hid_receive( uint8_t *data, uint8_t length ) backlight_config_save(); break; } -#endif // BACKLIGHT_ENABLED +#endif // RGB_BACKLIGHT_ENABLED default: { // Unhandled message. @@ -141,19 +156,19 @@ void matrix_init_kb(void) // OK to load from EEPROM. if (eeprom_is_valid()) { -#if BACKLIGHT_ENABLED +#if RGB_BACKLIGHT_ENABLED backlight_config_load(); -#endif // BACKLIGHT_ENABLED +#endif // RGB_BACKLIGHT_ENABLED // TODO: do something to "turn on" keymaps in EEPROM? } else { -#if BACKLIGHT_ENABLED +#if RGB_BACKLIGHT_ENABLED // If the EEPROM has not been saved before, or is out of date, // save the default values to the EEPROM. Default values // come from construction of the zeal_backlight_config instance. backlight_config_save(); -#endif // BACKLIGHT_ENABLED +#endif // RGB_BACKLIGHT_ENABLED #ifdef DYNAMIC_KEYMAP_ENABLE // This saves "empty" keymaps so it falls back to the keymaps @@ -165,20 +180,20 @@ void matrix_init_kb(void) eeprom_set_valid(true); } -#if BACKLIGHT_ENABLED +#if RGB_BACKLIGHT_ENABLED // Initialize LED drivers for backlight. backlight_init_drivers(); backlight_timer_init(); backlight_timer_enable(); -#endif // BACKLIGHT_ENABLED +#endif // RGB_BACKLIGHT_ENABLED matrix_init_user(); } void matrix_scan_kb(void) { -#if BACKLIGHT_ENABLED +#if RGB_BACKLIGHT_ENABLED // This only updates the LED driver buffers if something has changed. backlight_update_pwm_buffers(); #endif // BACKLIGHT_ENABLED @@ -187,7 +202,9 @@ void matrix_scan_kb(void) bool process_record_kb(uint16_t keycode, keyrecord_t *record) { +#if RGB_BACKLIGHT_ENABLED process_record_backlight(keycode, record); +#endif // BACKLIGHT_ENABLED switch(keycode) { @@ -303,22 +320,22 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) void led_set_kb(uint8_t usb_led) { -#if BACKLIGHT_ENABLED +#if RGB_BACKLIGHT_ENABLED backlight_set_indicator_state(usb_led); -#endif // BACKLIGHT_ENABLED +#endif // RGB_BACKLIGHT_ENABLED } void suspend_power_down_kb(void) { -#if BACKLIGHT_ENABLED +#if RGB_BACKLIGHT_ENABLED backlight_set_suspend_state(true); -#endif // BACKLIGHT_ENABLED +#endif // RGB_BACKLIGHT_ENABLED } void suspend_wakeup_init_kb(void) { -#if BACKLIGHT_ENABLED +#if RGB_BACKLIGHT_ENABLED backlight_set_suspend_state(false); -#endif // BACKLIGHT_ENABLED +#endif // RGB_BACKLIGHT_ENABLED } diff --git a/keyboards/zeal60/zeal60.h b/keyboards/zeal60/zeal60.h index 4fc845d53f63..0bf0599f5b21 100644 --- a/keyboards/zeal60/zeal60.h +++ b/keyboards/zeal60/zeal60.h @@ -1,3 +1,18 @@ +/* Copyright 2017 Jason Williams (Wilba) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifndef ZEAL60_H #define ZEAL60_H diff --git a/keyboards/zeal60/zeal60_api.h b/keyboards/zeal60/zeal60_api.h index aa5b8d438499..c95726edc3c1 100644 --- a/keyboards/zeal60/zeal60_api.h +++ b/keyboards/zeal60/zeal60_api.h @@ -1,3 +1,18 @@ +/* Copyright 2017 Jason Williams (Wilba) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifndef ZEAL60_API_H #define ZEAL60_API_H diff --git a/keyboards/zeal60/zeal60_keycodes.h b/keyboards/zeal60/zeal60_keycodes.h index 012f422a31ff..e37ffb83620a 100644 --- a/keyboards/zeal60/zeal60_keycodes.h +++ b/keyboards/zeal60/zeal60_keycodes.h @@ -1,3 +1,18 @@ +/* Copyright 2017 Jason Williams (Wilba) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifndef ZEAL60_KEYCODE_H #define ZEAL60_KEYCODE_H @@ -27,4 +42,4 @@ enum zeal60_action_functions { #define TG_NKRO MAGIC_TOGGLE_NKRO -#endif // ZEAL_KEYCODE_H +#endif // ZEAL60_KEYCODE_H diff --git a/keyboards/zeal65/config.h b/keyboards/zeal65/config.h index 42dde1e2ca99..3e07b854e5ca 100644 --- a/keyboards/zeal65/config.h +++ b/keyboards/zeal65/config.h @@ -20,9 +20,6 @@ along with this program. If not, see . #include "config_common.h" -// This conditionally compiles the backlight code for Zeal65 specifics -#define CONFIG_ZEAL65 - // USB Device descriptor parameter #define VENDOR_ID 0xFEED #define PRODUCT_ID 0x6065 @@ -78,34 +75,38 @@ along with this program. If not, see . //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION -#define BACKLIGHT_ENABLED 1 +#define RGB_BACKLIGHT_ENABLED 1 + +// This conditionally compiles the backlight code for Zeal65 specifics +#define RGB_BACKLIGHT_ZEAL65 + // enable/disable LEDs based on layout -#define BACKLIGHT_USE_SPLIT_BACKSPACE 0 -#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 -#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 1 -#define BACKLIGHT_USE_7U_SPACEBAR 0 -#define BACKLIGHT_USE_ISO_ENTER 0 -#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 +#define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 0 +#define RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 +#define RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 1 +#define RGB_BACKLIGHT_USE_7U_SPACEBAR 0 +#define RGB_BACKLIGHT_USE_ISO_ENTER 0 +#define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 // disable backlight when USB suspended (PC sleep/hibernate/shutdown) -#define BACKLIGHT_DISABLE_WHEN_USB_SUSPENDED 0 +#define RGB_BACKLIGHT_DISABLE_WHEN_USB_SUSPENDED 0 // disable backlight after timeout in minutes, 0 = no timeout -#define BACKLIGHT_DISABLE_AFTER_TIMEOUT 0 +#define RGB_BACKLIGHT_DISABLE_AFTER_TIMEOUT 0 // the default effect (RGB test) -#define BACKLIGHT_EFFECT 255 +#define RGB_BACKLIGHT_EFFECT 255 // These define which keys in the matrix are alphas/mods // Used for backlight effects so colors are different for // alphas vs. mods // Each value is for a row, bit 0 is column 0 // Alpha=0 Mod=1 -#define BACKLIGHT_ALPHAS_MODS_ROW_0 0b0110000000000001 -#define BACKLIGHT_ALPHAS_MODS_ROW_1 0b0100000000000001 -#define BACKLIGHT_ALPHAS_MODS_ROW_2 0b0101000000000001 -#define BACKLIGHT_ALPHAS_MODS_ROW_3 0b0111000000000001 -#define BACKLIGHT_ALPHAS_MODS_ROW_4 0b0111110000000011 +#define RGB_BACKLIGHT_ALPHAS_MODS_ROW_0 0b0110000000000001 +#define RGB_BACKLIGHT_ALPHAS_MODS_ROW_1 0b0100000000000001 +#define RGB_BACKLIGHT_ALPHAS_MODS_ROW_2 0b0101000000000001 +#define RGB_BACKLIGHT_ALPHAS_MODS_ROW_3 0b0111000000000001 +#define RGB_BACKLIGHT_ALPHAS_MODS_ROW_4 0b0111110000000011 #define DYNAMIC_KEYMAP_LAYER_COUNT 4 @@ -121,7 +122,7 @@ along with this program. If not, see . #define EEPROM_VERSION_ADDR 34 // Backlight config starts after EEPROM version -#define BACKLIGHT_CONFIG_EEPROM_ADDR 35 +#define RGB_BACKLIGHT_CONFIG_EEPROM_ADDR 35 // Dynamic keymap starts after backlight config (35+37) #define DYNAMIC_KEYMAP_EEPROM_ADDR 72 diff --git a/keyboards/zeal65/keymaps/default/config.h b/keyboards/zeal65/keymaps/default/config.h index e9afa84a1370..3b6f0f22e900 100644 --- a/keyboards/zeal65/keymaps/default/config.h +++ b/keyboards/zeal65/keymaps/default/config.h @@ -4,19 +4,19 @@ #include "../../config.h" /* enable/disable LEDs based on layout */ -#undef USE_SPLIT_BACKSPACE -#define USE_SPLIT_BACKSPACE 0 +#undef RGB_BACKLIGHT_USE_SPLIT_BACKSPACE +#define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 0 -#undef USE_SPLIT_LEFT_SHIFT -#define USE_SPLIT_LEFT_SHIFT 0 +#undef RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT +#define RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 -#undef USE_SPLIT_RIGHT_SHIFT -#define USE_SPLIT_RIGHT_SHIFT 0 +#undef RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT +#define RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 -#undef USE_7U_SPACEBAR -#define USE_7U_SPACEBAR 0 +#undef RGB_BACKLIGHT_USE_7U_SPACEBAR +#define RGB_BACKLIGHT_USE_7U_SPACEBAR 0 -#undef USE_ISO_ENTER -#define USE_ISO_ENTER 0 +#undef RGB_BACKLIGHT_USE_ISO_ENTER +#define RGB_BACKLIGHT_USE_ISO_ENTER 0 #endif //CONFIG_USER_H diff --git a/keyboards/zeal65/zeal65.c b/keyboards/zeal65/zeal65.c index 726732326ff1..2d8ba8b53b17 100644 --- a/keyboards/zeal65/zeal65.c +++ b/keyboards/zeal65/zeal65.c @@ -1,5 +1,20 @@ +/* Copyright 2017 Jason Williams (Wilba) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "config.h" -#ifndef CONFIG_ZEAL65 -#error CONFIG_ZEAL65 not defined, you done goofed somehao, brah +#ifndef RGB_BACKLIGHT_ZEAL65 +#error RGB_BACKLIGHT_ZEAL65 not defined, you done goofed somehao, brah #endif From 2f9797c89e175335d69f0e3733297c4ab2a89070 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Sun, 9 Sep 2018 01:00:01 +1000 Subject: [PATCH 58/69] Added readme.md --- keyboards/zeal60/readme.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 keyboards/zeal60/readme.md diff --git a/keyboards/zeal60/readme.md b/keyboards/zeal60/readme.md new file mode 100644 index 000000000000..afaf6219b71b --- /dev/null +++ b/keyboards/zeal60/readme.md @@ -0,0 +1,16 @@ +Zeal60 +==== + +[Zeal60](https://cdn.shopify.com/s/files/1/0490/7329/products/Zeal60.jpg) + +This is a 60% PCB with per-key RGB LEDs and supports ANSI, ISO, winkey/winkeyless bottom row, HHKB-layout (split right shift and backspace). + +Keyboard Maintainer: [Wilba](http://wilba.tech/) and on [github](https://github.com/Wilba6582) +Hardware Supported: Zeal60 PCB Rev 0-3 +Hardware Availability: https://zealpc.net/collections/group-buy-pre-orders/products/zeal60rgb + +Make example for this keyboard (after setting up your build environment): + + make zeal60:default + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. From a82ba763b3731570cef8dd6522f1bd61744723bb Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Sun, 9 Sep 2018 01:05:16 +1000 Subject: [PATCH 59/69] Added readme.md --- keyboards/zeal65/readme.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 keyboards/zeal65/readme.md diff --git a/keyboards/zeal65/readme.md b/keyboards/zeal65/readme.md new file mode 100644 index 000000000000..11c1d6fb6b6f --- /dev/null +++ b/keyboards/zeal65/readme.md @@ -0,0 +1,16 @@ +Zeal65 +==== + +[Zeal65](https://cdn.shopify.com/s/files/1/0490/7329/products/Zeal65_PCB2.jpg) + +This is a 65% PCB with per-key RGB LEDs and supports fixed, 1800-like bottom row and split backspace. It was designed for the Zephyr custom keyboard. + +Keyboard Maintainer: [Wilba](http://wilba.tech/) and on [github](https://github.com/Wilba6582) +Hardware Supported: Zeal65 PCB Rev 1 +Hardware Availability: https://zealpc.net/collections/group-buy-pre-orders/products/zephyr + +Make example for this keyboard (after setting up your build environment): + + make zeal65:default + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. From 524212dfd7a200859f105b17f61aaf881601b1fb Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Sun, 9 Sep 2018 03:03:38 +1000 Subject: [PATCH 60/69] Added LAYOUT_60*() macros, refactored and cleaned up default keymaps --- keyboards/zeal60/info.json | 25 +++++++ .../config.h | 0 .../keymaps/ansi_split_bs_rshift/keymap.c | 39 ++++++++++ .../keymaps/backlight_disabled/config.h | 9 --- .../keymaps/backlight_disabled/keymap.c | 50 ------------- keyboards/zeal60/keymaps/default/keymap.c | 59 +++++++-------- .../keymaps/{hhkb_ansi => hhkb}/config.h | 0 keyboards/zeal60/keymaps/hhkb/keymap.c | 39 ++++++++++ keyboards/zeal60/keymaps/hhkb_ansi/keymap.c | 50 ------------- keyboards/zeal60/keymaps/hhkb_wilba/config.h | 25 ------- keyboards/zeal60/keymaps/hhkb_wilba/keymap.c | 52 -------------- .../keymaps/{poker2_iso => iso}/config.h | 5 +- keyboards/zeal60/keymaps/iso/keymap.c | 39 ++++++++++ keyboards/zeal60/keymaps/m60_a/keymap.c | 61 +++++++--------- keyboards/zeal60/keymaps/m60_a_proto/keymap.c | 61 +++++++--------- keyboards/zeal60/keymaps/mousekey/Makefile | 5 -- keyboards/zeal60/keymaps/mousekey/keymap.c | 50 ------------- keyboards/zeal60/keymaps/poker2_ansi/config.h | 26 ------- keyboards/zeal60/keymaps/poker2_ansi/keymap.c | 50 ------------- keyboards/zeal60/keymaps/poker2_iso/keymap.c | 50 ------------- keyboards/zeal60/keymaps/tusing/config.h | 2 +- keyboards/zeal60/zeal60.h | 72 +++++++++++++++++++ 22 files changed, 291 insertions(+), 478 deletions(-) create mode 100644 keyboards/zeal60/info.json rename keyboards/zeal60/keymaps/{mousekey => ansi_split_bs_rshift}/config.h (100%) create mode 100644 keyboards/zeal60/keymaps/ansi_split_bs_rshift/keymap.c delete mode 100644 keyboards/zeal60/keymaps/backlight_disabled/config.h delete mode 100644 keyboards/zeal60/keymaps/backlight_disabled/keymap.c rename keyboards/zeal60/keymaps/{hhkb_ansi => hhkb}/config.h (100%) create mode 100644 keyboards/zeal60/keymaps/hhkb/keymap.c delete mode 100644 keyboards/zeal60/keymaps/hhkb_ansi/keymap.c delete mode 100644 keyboards/zeal60/keymaps/hhkb_wilba/config.h delete mode 100644 keyboards/zeal60/keymaps/hhkb_wilba/keymap.c rename keyboards/zeal60/keymaps/{poker2_iso => iso}/config.h (89%) create mode 100644 keyboards/zeal60/keymaps/iso/keymap.c delete mode 100644 keyboards/zeal60/keymaps/mousekey/Makefile delete mode 100644 keyboards/zeal60/keymaps/mousekey/keymap.c delete mode 100644 keyboards/zeal60/keymaps/poker2_ansi/config.h delete mode 100644 keyboards/zeal60/keymaps/poker2_ansi/keymap.c delete mode 100644 keyboards/zeal60/keymaps/poker2_iso/keymap.c diff --git a/keyboards/zeal60/info.json b/keyboards/zeal60/info.json new file mode 100644 index 000000000000..70c3d5310765 --- /dev/null +++ b/keyboards/zeal60/info.json @@ -0,0 +1,25 @@ +{ + "keyboard_name": "Zeal60", + "url": "", + "maintainer": "Wilba", + "bootloader": "DFU", + "width": 15, + "height": 5, + "layouts": { + "LAYOUT_all": { + "layout": [{"label":"~", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"|", "x":13.5, "y":1, "w":1.5}, {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"Shift", "x":0, "y":3, "w":1.25}, {"x":1.25, "y":3}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":1.75}, {"x":14, "y":3}, {"label":"Ctrl", "x":0, "y":4, "w":1.25}, {"label":"Win", "x":1.25, "y":4, "w":1.25}, {"label":"Alt", "x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":6.25}, {"label":"Alt", "x":10, "y":4, "w":1.25}, {"label":"Win", "x":11.25, "y":4, "w":1.25}, {"label":"Menu", "x":12.5, "y":4, "w":1.25}, {"label":"Ctrl", "x":13.75, "y":4, "w":1.25}] + } + "LAYOUT_60_ansi": { + "layout": [{"label":"~", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"label":"Backspace", "x":13, "y":0, "w":2}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"|", "x":13.5, "y":1, "w":1.5}, {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"Shift", "x":0, "y":3, "w":2.25}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":2.75}, {"label":"Ctrl", "x":0, "y":4, "w":1.25}, {"label":"Win", "x":1.25, "y":4, "w":1.25}, {"label":"Alt", "x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":6.25}, {"label":"Alt", "x":10, "y":4, "w":1.25}, {"label":"Win", "x":11.25, "y":4, "w":1.25}, {"label":"Menu", "x":12.5, "y":4, "w":1.25}, {"label":"Ctrl", "x":13.75, "y":4, "w":1.25}] + } + "LAYOUT_60_iso": { + "layout": [{"label":"\u00ac", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"\"", "x":2, "y":0}, {"label":"\u00a3", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"label":"Backspace", "x":13, "y":0, "w":2}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"Enter", "x":13.75, "y":1, "w":1.25, "h":2}, {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"@", "x":11.75, "y":2}, {"label":"~", "x":12.75, "y":2}, {"label":"Shift", "x":0, "y":3, "w":1.25}, {"label":"|", "x":1.25, "y":3}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":2.75}, {"label":"Ctrl", "x":0, "y":4, "w":1.25}, {"label":"Win", "x":1.25, "y":4, "w":1.25}, {"label":"Alt", "x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":6.25}, {"label":"AltGr", "x":10, "y":4, "w":1.25}, {"label":"Win", "x":11.25, "y":4, "w":1.25}, {"label":"Menu", "x":12.5, "y":4, "w":1.25}, {"label":"Ctrl", "x":13.75, "y":4, "w":1.25}] + } + "LAYOUT_60_ansi_split_bs_rshift": { + "layout": [{"label":"~", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"|", "x":13.5, "y":1, "w":1.5}, {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"Shift", "x":0, "y":3, "w":2.25}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":1.75}, {"x":14, "y":3}, {"label":"Ctrl", "x":0, "y":4, "w":1.25}, {"label":"Win", "x":1.25, "y":4, "w":1.25}, {"label":"Alt", "x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":6.25}, {"label":"Alt", "x":10, "y":4, "w":1.25}, {"label":"Win", "x":11.25, "y":4, "w":1.25}, {"label":"Menu", "x":12.5, "y":4, "w":1.25}, {"label":"Ctrl", "x":13.75, "y":4, "w":1.25}] + } + "LAYOUT_60_hhkb": { + "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"label":"|", "x":13, "y":0}, {"label":"~", "x":14, "y":0}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"Delete", "x":13.5, "y":1, "w":1.5}, {"label":"Control", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"Shift", "x":0, "y":3, "w":2.25}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":1.75}, {"label":"Fn", "x":14, "y":3}, {"label":"Os", "x":1.5, "y":4}, {"label":"Alt", "x":2.5, "y":4, "w":1.5}, {"x":4, "y":4, "w":7}, {"label":"Alt", "x":11, "y":4, "w":1.5}, {"label":"Os", "x":12.5, "y":4}] + } + } +} \ No newline at end of file diff --git a/keyboards/zeal60/keymaps/mousekey/config.h b/keyboards/zeal60/keymaps/ansi_split_bs_rshift/config.h similarity index 100% rename from keyboards/zeal60/keymaps/mousekey/config.h rename to keyboards/zeal60/keymaps/ansi_split_bs_rshift/config.h diff --git a/keyboards/zeal60/keymaps/ansi_split_bs_rshift/keymap.c b/keyboards/zeal60/keymaps/ansi_split_bs_rshift/keymap.c new file mode 100644 index 000000000000..45bfec08ebe6 --- /dev/null +++ b/keyboards/zeal60/keymaps/ansi_split_bs_rshift/keymap.c @@ -0,0 +1,39 @@ +// ANSI split backspace/right shift layout for Zeal60 + +#include "zeal60.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +// Default layer +[0] = LAYOUT_60_ansi_split_bs_rshift( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_DEL, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, FN_MO13, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, FN_MO23, KC_RCTL), + +// Fn1 Layer +[1] = LAYOUT_60_ansi_split_bs_rshift( + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, + KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_TRNS, + KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_EJCT, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + +// Fn2 Layer +[2] = LAYOUT_60_ansi_split_bs_rshift( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + +// Fn3 Layer (zeal60 Configuration) +[3] = LAYOUT_60_ansi_split_bs_rshift( + KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + +}; diff --git a/keyboards/zeal60/keymaps/backlight_disabled/config.h b/keyboards/zeal60/keymaps/backlight_disabled/config.h deleted file mode 100644 index 55e6c97b08db..000000000000 --- a/keyboards/zeal60/keymaps/backlight_disabled/config.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef CONFIG_USER_H -#define CONFIG_USER_H - -#include "../../config.h" - -#undef RGB_BACKLIGHT_BACKLIGHT_ENABLED -#define RGB_BACKLIGHT_BACKLIGHT_ENABLED 0 - -#endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/backlight_disabled/keymap.c b/keyboards/zeal60/keymaps/backlight_disabled/keymap.c deleted file mode 100644 index b5a887932abc..000000000000 --- a/keyboards/zeal60/keymaps/backlight_disabled/keymap.c +++ /dev/null @@ -1,50 +0,0 @@ -// Default layout for Zeal60 - -#include "zeal60.h" - -// [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace -// [1,13] is either backslash or ISO Enter -// [2,12] is either ANSI Enter or key left of ISO Enter -// [2,13] is right key of split backspace (e.g. HHKB `~ key) -// [3,1] is right key of split left-shift (e.g ISO key) -// [3,13] is right key of split right-shift (e.g. HHKB Fn key) - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -// Default layer -[0] = { - {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS}, - {KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_NO }, - {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO }, - {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RALT, FN_MO13, FN_MO23, KC_RCTL} -}, - -// Fn1 Layer -[1] = { - {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, - {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS}, - {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, - -// Fn2 Layer -[2] = { - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, - -// Fn3 Layer (zeal60 Configuration) -[3] = { - {KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -} - -}; diff --git a/keyboards/zeal60/keymaps/default/keymap.c b/keyboards/zeal60/keymaps/default/keymap.c index b5a887932abc..134359455346 100644 --- a/keyboards/zeal60/keymaps/default/keymap.c +++ b/keyboards/zeal60/keymaps/default/keymap.c @@ -2,49 +2,38 @@ #include "zeal60.h" -// [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace -// [1,13] is either backslash or ISO Enter -// [2,12] is either ANSI Enter or key left of ISO Enter -// [2,13] is right key of split backspace (e.g. HHKB `~ key) -// [3,1] is right key of split left-shift (e.g ISO key) -// [3,13] is right key of split right-shift (e.g. HHKB Fn key) - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Default layer -[0] = { - {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS}, - {KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_NO }, - {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO }, - {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RALT, FN_MO13, FN_MO23, KC_RCTL} -}, +[0] = LAYOUT_60_ansi( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, FN_MO13, FN_MO23, KC_RCTL), // Fn1 Layer -[1] = { - {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, - {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS}, - {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, +[1] = LAYOUT_60_ansi( + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL , + KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS, + KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), // Fn2 Layer -[2] = { - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, +[2] = LAYOUT_60_ansi( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), // Fn3 Layer (zeal60 Configuration) -[3] = { - {KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -} +[3] = LAYOUT_60_ansi( + KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), }; diff --git a/keyboards/zeal60/keymaps/hhkb_ansi/config.h b/keyboards/zeal60/keymaps/hhkb/config.h similarity index 100% rename from keyboards/zeal60/keymaps/hhkb_ansi/config.h rename to keyboards/zeal60/keymaps/hhkb/config.h diff --git a/keyboards/zeal60/keymaps/hhkb/keymap.c b/keyboards/zeal60/keymaps/hhkb/keymap.c new file mode 100644 index 000000000000..8c97cfaf3adb --- /dev/null +++ b/keyboards/zeal60/keymaps/hhkb/keymap.c @@ -0,0 +1,39 @@ +// HHKB layout for Zeal60 + +#include "zeal60.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + // Default layer + [0] = LAYOUT_60_hhkb( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, FN_MO13, + KC_LGUI, KC_LALT, KC_SPC, KC_RALT, FN_MO23), + + // Fn1 Layer + [1] = LAYOUT_60_hhkb( + KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, + KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_TRNS, + KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_EJCT, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + + // Fn2 Layer + [2] = LAYOUT_60_hhkb( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + + // Fn3 Layer (zeal60 Configuration) + [3] = LAYOUT_60_hhkb( + KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + + }; diff --git a/keyboards/zeal60/keymaps/hhkb_ansi/keymap.c b/keyboards/zeal60/keymaps/hhkb_ansi/keymap.c deleted file mode 100644 index 199758c1bbe6..000000000000 --- a/keyboards/zeal60/keymaps/hhkb_ansi/keymap.c +++ /dev/null @@ -1,50 +0,0 @@ -// HHKB layout for Zeal60 - -#include "zeal60.h" - -// [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace -// [1,13] is either backslash or ISO Enter -// [2,12] is either ANSI Enter or key left of ISO Enter -// [2,13] is right key of split backspace (e.g. HHKB `~ key) -// [3,1] is right key of split left-shift (e.g ISO key) -// [3,13] is right key of split right-shift (e.g. HHKB Fn key) - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -// Default layer -[0] = { - {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS}, - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC}, - {KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_GRV }, - {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, FN_MO13}, - {KC_NO, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_NO, KC_RALT, FN_MO23, KC_NO } -}, - -// Fn1 Layer -[1] = { - {KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS }, - {KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_EJCT, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_TRNS, KC_DEL }, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, - -// Fn2 Layer -[2] = { - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, - -// Fn3 Layer (zeal60 Configuration) -[3] = { - {KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -} - -}; diff --git a/keyboards/zeal60/keymaps/hhkb_wilba/config.h b/keyboards/zeal60/keymaps/hhkb_wilba/config.h deleted file mode 100644 index 3ee536c9341b..000000000000 --- a/keyboards/zeal60/keymaps/hhkb_wilba/config.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef CONFIG_USER_H -#define CONFIG_USER_H - -#include "../../config.h" - -/* enable/disable LEDs based on layout */ -#undef BACKLIGHT_USE_SPLIT_BACKSPACE -#define BACKLIGHT_USE_SPLIT_BACKSPACE 1 - -#undef BACKLIGHT_USE_SPLIT_LEFT_SHIFT -#define BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 - -#undef BACKLIGHT_USE_SPLIT_RIGHT_SHIFT -#define BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 1 - -#undef BACKLIGHT_USE_7U_SPACEBAR -#define BACKLIGHT_USE_7U_SPACEBAR 1 - -#undef BACKLIGHT_USE_ISO_ENTER -#define BACKLIGHT_USE_ISO_ENTER 0 - -#undef BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS -#define BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 1 - -#endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/hhkb_wilba/keymap.c b/keyboards/zeal60/keymaps/hhkb_wilba/keymap.c deleted file mode 100644 index b3d41b815ded..000000000000 --- a/keyboards/zeal60/keymaps/hhkb_wilba/keymap.c +++ /dev/null @@ -1,52 +0,0 @@ -// Wilba's HHKB layout for Zeal60 - -#include "zeal60.h" - -// [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace -// [1,13] is either backslash or ISO Enter -// [2,12] is either ANSI Enter or key left of ISO Enter -// [2,13] is right key of split backspace (e.g. HHKB `~ key) -// [3,1] is right key of split left-shift (e.g ISO key) -// [3,13] is right key of split right-shift (e.g. HHKB Fn key) - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -// Default layer -[0] = { - {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS}, - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC}, - {KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_GRV }, - {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, FN_MO13}, - {KC_NO, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_NO, KC_RALT, FN_MO23, KC_NO } -}, - -// Fn1 Layer -[1] = { - {KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS }, - {KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_EJCT, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_TRNS, KC_DEL }, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, - -// Fn2 Layer -[2] = { - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_CALC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, - -// Fn3 Layer (zeal60 Configuration) -[3] = { - {RESET, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -} - -}; - - diff --git a/keyboards/zeal60/keymaps/poker2_iso/config.h b/keyboards/zeal60/keymaps/iso/config.h similarity index 89% rename from keyboards/zeal60/keymaps/poker2_iso/config.h rename to keyboards/zeal60/keymaps/iso/config.h index a5028ecf8d6f..2cf9ec71e203 100644 --- a/keyboards/zeal60/keymaps/poker2_iso/config.h +++ b/keyboards/zeal60/keymaps/iso/config.h @@ -3,13 +3,12 @@ #include "../../config.h" - /* enable/disable LEDs based on layout */ #undef RGB_BACKLIGHT_USE_SPLIT_BACKSPACE #define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 0 #undef RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT -#define RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 +#define RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT 1 #undef RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT #define RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 @@ -23,4 +22,4 @@ #undef RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS #define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 -#endif //CONFIG_USER_H +#endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/iso/keymap.c b/keyboards/zeal60/keymaps/iso/keymap.c new file mode 100644 index 000000000000..75948aa2351f --- /dev/null +++ b/keyboards/zeal60/keymaps/iso/keymap.c @@ -0,0 +1,39 @@ +// ISO layout for Zeal60 + +#include "zeal60.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +// Default layer +[0] = LAYOUT_60_iso( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_ENT, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, FN_MO13, FN_MO23, KC_RCTL), + +// Fn1 Layer +[1] = LAYOUT_60_iso( + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL , + KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS, + KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + +// Fn2 Layer +[2] = LAYOUT_60_iso( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + +// Fn3 Layer (zeal60 Configuration) +[3] = LAYOUT_60_iso( + KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + +}; diff --git a/keyboards/zeal60/keymaps/m60_a/keymap.c b/keyboards/zeal60/keymaps/m60_a/keymap.c index b3d41b815ded..2892237861cd 100644 --- a/keyboards/zeal60/keymaps/m60_a/keymap.c +++ b/keyboards/zeal60/keymaps/m60_a/keymap.c @@ -1,51 +1,40 @@ -// Wilba's HHKB layout for Zeal60 +// M60-A layout for Zeal60 #include "zeal60.h" -// [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace -// [1,13] is either backslash or ISO Enter -// [2,12] is either ANSI Enter or key left of ISO Enter -// [2,13] is right key of split backspace (e.g. HHKB `~ key) -// [3,1] is right key of split left-shift (e.g ISO key) -// [3,13] is right key of split right-shift (e.g. HHKB Fn key) - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Default layer -[0] = { - {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS}, - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC}, - {KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_GRV }, - {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, FN_MO13}, - {KC_NO, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_NO, KC_RALT, FN_MO23, KC_NO } -}, +[0] = LAYOUT_60_hhkb( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_DEL, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, FN_MO13, + KC_LGUI, KC_LALT, KC_SPC, KC_RALT, FN_MO23), // Fn1 Layer -[1] = { - {KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS }, - {KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_EJCT, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_TRNS, KC_DEL }, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, +[1] = LAYOUT_60_hhkb( + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, + KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_TRNS, + KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_EJCT, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), // Fn2 Layer -[2] = { - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_CALC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, +[2] = LAYOUT_60_hhkb( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), // Fn3 Layer (zeal60 Configuration) -[3] = { - {RESET, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -} +[3] = LAYOUT_60_hhkb( + KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), }; diff --git a/keyboards/zeal60/keymaps/m60_a_proto/keymap.c b/keyboards/zeal60/keymaps/m60_a_proto/keymap.c index b3d41b815ded..2892237861cd 100644 --- a/keyboards/zeal60/keymaps/m60_a_proto/keymap.c +++ b/keyboards/zeal60/keymaps/m60_a_proto/keymap.c @@ -1,51 +1,40 @@ -// Wilba's HHKB layout for Zeal60 +// M60-A layout for Zeal60 #include "zeal60.h" -// [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace -// [1,13] is either backslash or ISO Enter -// [2,12] is either ANSI Enter or key left of ISO Enter -// [2,13] is right key of split backspace (e.g. HHKB `~ key) -// [3,1] is right key of split left-shift (e.g ISO key) -// [3,13] is right key of split right-shift (e.g. HHKB Fn key) - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Default layer -[0] = { - {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS}, - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC}, - {KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_GRV }, - {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, FN_MO13}, - {KC_NO, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_NO, KC_RALT, FN_MO23, KC_NO } -}, +[0] = LAYOUT_60_hhkb( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_DEL, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, FN_MO13, + KC_LGUI, KC_LALT, KC_SPC, KC_RALT, FN_MO23), // Fn1 Layer -[1] = { - {KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS }, - {KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_EJCT, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_TRNS, KC_DEL }, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, +[1] = LAYOUT_60_hhkb( + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, + KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_TRNS, + KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_EJCT, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), // Fn2 Layer -[2] = { - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_CALC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, +[2] = LAYOUT_60_hhkb( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), // Fn3 Layer (zeal60 Configuration) -[3] = { - {RESET, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -} +[3] = LAYOUT_60_hhkb( + KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), }; diff --git a/keyboards/zeal60/keymaps/mousekey/Makefile b/keyboards/zeal60/keymaps/mousekey/Makefile deleted file mode 100644 index f6505b063111..000000000000 --- a/keyboards/zeal60/keymaps/mousekey/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -MOUSEKEY_ENABLE = yes - -ifndef QUANTUM_DIR - include ../../../../Makefile -endif \ No newline at end of file diff --git a/keyboards/zeal60/keymaps/mousekey/keymap.c b/keyboards/zeal60/keymaps/mousekey/keymap.c deleted file mode 100644 index b5a887932abc..000000000000 --- a/keyboards/zeal60/keymaps/mousekey/keymap.c +++ /dev/null @@ -1,50 +0,0 @@ -// Default layout for Zeal60 - -#include "zeal60.h" - -// [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace -// [1,13] is either backslash or ISO Enter -// [2,12] is either ANSI Enter or key left of ISO Enter -// [2,13] is right key of split backspace (e.g. HHKB `~ key) -// [3,1] is right key of split left-shift (e.g ISO key) -// [3,13] is right key of split right-shift (e.g. HHKB Fn key) - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -// Default layer -[0] = { - {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS}, - {KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_NO }, - {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO }, - {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RALT, FN_MO13, FN_MO23, KC_RCTL} -}, - -// Fn1 Layer -[1] = { - {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, - {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS}, - {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, - -// Fn2 Layer -[2] = { - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, - -// Fn3 Layer (zeal60 Configuration) -[3] = { - {KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -} - -}; diff --git a/keyboards/zeal60/keymaps/poker2_ansi/config.h b/keyboards/zeal60/keymaps/poker2_ansi/config.h deleted file mode 100644 index 5ae077749a58..000000000000 --- a/keyboards/zeal60/keymaps/poker2_ansi/config.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef CONFIG_USER_H -#define CONFIG_USER_H - -#include "../../config.h" - - -/* enable/disable LEDs based on layout */ -#undef RGB_BACKLIGHT_USE_SPLIT_BACKSPACE -#define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 0 - -#undef RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT -#define RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 - -#undef RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT -#define RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 - -#undef RGB_BACKLIGHT_USE_7U_SPACEBAR -#define RGB_BACKLIGHT_USE_7U_SPACEBAR 0 - -#undef RGB_BACKLIGHT_USE_ISO_ENTER -#define RGB_BACKLIGHT_USE_ISO_ENTER 0 - -#undef RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS -#define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 - -#endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/poker2_ansi/keymap.c b/keyboards/zeal60/keymaps/poker2_ansi/keymap.c deleted file mode 100644 index ee254cbc4641..000000000000 --- a/keyboards/zeal60/keymaps/poker2_ansi/keymap.c +++ /dev/null @@ -1,50 +0,0 @@ -// Poker2 ANSI layout for Zeal60 - -#include "zeal60.h" - -// [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace -// [1,13] is either backslash or ISO Enter -// [2,12] is either ANSI Enter or key left of ISO Enter -// [2,13] is right key of split backspace (e.g. HHKB `~ key) -// [3,1] is right key of split left-shift (e.g ISO key) -// [3,13] is right key of split right-shift (e.g. HHKB Fn key) - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -// Default layer -[0] = { - {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS}, - {KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_NO }, - {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO }, - {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RALT, FN_MO13, FN_MO23, KC_RCTL} -}, - -// Fn1 Layer -[1] = { - {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, - {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS}, - {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, - -// Fn2 Layer -[2] = { - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, - -// Fn3 Layer (zeal60 Configuration) -[3] = { - {KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -} - -}; diff --git a/keyboards/zeal60/keymaps/poker2_iso/keymap.c b/keyboards/zeal60/keymaps/poker2_iso/keymap.c deleted file mode 100644 index 2c21ae7a4a66..000000000000 --- a/keyboards/zeal60/keymaps/poker2_iso/keymap.c +++ /dev/null @@ -1,50 +0,0 @@ -// Poker2 ANSI layout for Zeal60 - -#include "zeal60.h" - -// [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace -// [1,13] is either backslash or ISO Enter -// [2,12] is either ANSI Enter or key left of ISO Enter -// [2,13] is right key of split backspace (e.g. HHKB `~ key) -// [3,1] is right key of split left-shift (e.g ISO key) -// [3,13] is right key of split right-shift (e.g. HHKB Fn key) - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - -// Default layer -[0] = { - {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC}, - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_ENT }, - {KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_NO }, - {KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO }, - {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RALT, FN_MO13, FN_MO23, KC_RCTL} -}, - -// Fn1 Layer -[1] = { - {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL }, - {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS}, - {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, - -// Fn2 Layer -[2] = { - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, - -// Fn3 Layer (zeal60 Configuration) -[3] = { - {KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -} - -}; diff --git a/keyboards/zeal60/keymaps/tusing/config.h b/keyboards/zeal60/keymaps/tusing/config.h index 5a048ad235fc..05d76437ebec 100644 --- a/keyboards/zeal60/keymaps/tusing/config.h +++ b/keyboards/zeal60/keymaps/tusing/config.h @@ -32,7 +32,7 @@ #define RGBLIGHT_VAL_STEP 10 // How much each press of rgb_val changes val // Enable current limiting for RGB underglow. -#define USB_MAX_POWER_CONSUMPTION 900 +//#define USB_MAX_POWER_CONSUMPTION 900 #define RGBSTRIP_CURRENT_LIMIT 800 // Strip current limit in mA. #define RGBSTRIP_MAX_CURRENT_PER_LIGHT 40 // mA per light when at max brightness. diff --git a/keyboards/zeal60/zeal60.h b/keyboards/zeal60/zeal60.h index 0bf0599f5b21..540395e29074 100644 --- a/keyboards/zeal60/zeal60.h +++ b/keyboards/zeal60/zeal60.h @@ -20,4 +20,76 @@ #include "rgb_backlight_keycodes.h" #include "zeal60_keycodes.h" +#define XXX KC_NO + +#define LAYOUT_60_all( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K2D, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ + K40, K41, K42, K47, K4A, K4B, K4C, K4D \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D }, \ + { K40, K41, K42, XXX, XXX, XXX, XXX, K47, XXX, XXX, K4A, K4B, K4C, K4D } \ +} + +#define LAYOUT_60_ansi( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \ + K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, \ + K40, K41, K42, K47, K4A, K4B, K4C, K4D \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, XXX }, \ + { K30, XXX, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, XXX }, \ + { K40, K41, K42, XXX, XXX, XXX, XXX, K47, XXX, XXX, K4A, K4B, K4C, K4D } \ +} + +#define LAYOUT_60_iso( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, \ + K40, K41, K42, K47, K4A, K4B, K4C, K4D \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, XXX }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, XXX }, \ + { K40, K41, K42, XXX, XXX, XXX, XXX, K47, XXX, XXX, K4A, K4B, K4C, K4D } \ +} + +#define LAYOUT_60_ansi_split_bs_rshift( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K2D, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \ + K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ + K40, K41, K42, K47, K4A, K4B, K4C, K4D \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D }, \ + { K30, XXX, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D }, \ + { K40, K41, K42, XXX, XXX, XXX, XXX, K47, XXX, XXX, K4A, K4B, K4C, K4D } \ +} + +#define LAYOUT_60_hhkb( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K2D, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \ + K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ + K41, K42, K47, K4B, K4C \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D }, \ + { K30, XXX, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D }, \ + { XXX, K41, K42, XXX, XXX, XXX, XXX, K47, XXX, XXX, XXX, K4B, K4C, XXX } \ +} + #endif // ZEAL60_H From 6cd58673587f9e08b375bb2ccfd45fb447795e3a Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Sun, 9 Sep 2018 11:40:11 +1000 Subject: [PATCH 61/69] Fix compile error in suspend.c --- tmk_core/common/avr/suspend.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c index 2cbe39dd3447..76c1c6d8d0bc 100644 --- a/tmk_core/common/avr/suspend.c +++ b/tmk_core/common/avr/suspend.c @@ -141,9 +141,6 @@ static void power_down(uint8_t wdto) * * FIXME: needs doc */ - -__attribute__ ((weak)) void suspend_power_down_kb(void) {} - void suspend_power_down(void) { suspend_power_down_kb(); From c78d0dd71bec314d2b4d363667b313702570fd4c Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Sun, 9 Sep 2018 12:38:12 +1000 Subject: [PATCH 62/69] Added Zeal65 LAYOUT macros, info.json --- keyboards/zeal65/info.json | 16 ++++++ keyboards/zeal65/keymaps/default/config.h | 12 ----- keyboards/zeal65/keymaps/default/keymap.c | 63 +++++++++------------- keyboards/zeal65/keymaps/split_bs/config.h | 10 ++++ keyboards/zeal65/keymaps/split_bs/keymap.c | 39 ++++++++++++++ keyboards/zeal65/zeal65.h | 53 ++++++++++++++++++ 6 files changed, 144 insertions(+), 49 deletions(-) create mode 100644 keyboards/zeal65/info.json create mode 100644 keyboards/zeal65/keymaps/split_bs/config.h create mode 100644 keyboards/zeal65/keymaps/split_bs/keymap.c create mode 100644 keyboards/zeal65/zeal65.h diff --git a/keyboards/zeal65/info.json b/keyboards/zeal65/info.json new file mode 100644 index 000000000000..56fd44e43314 --- /dev/null +++ b/keyboards/zeal65/info.json @@ -0,0 +1,16 @@ +{ + "keyboard_name": "Zeal65", + "url": "", + "maintainer": "Wilba", + "bootloader": "DFU", + "width": 16, + "height": 5, + "layouts": { + "LAYOUT_65_split_bs": { + "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"label":"|", "x":13, "y":0}, {"label":"Del", "x":14, "y":0}, {"label":"Home", "x":15, "y":0}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"Backspace", "x":13.5, "y":1, "w":1.5}, {"label":"PgUp", "x":15, "y":1}, {"label":"Control", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"PgDn", "x":15, "y":2}, {"label":"Shift", "x":0, "y":3, "w":2.25}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":1.75}, {"label":"\u2191", "x":14, "y":3}, {"label":"End", "x":15, "y":3}, {"label":"Win", "x":0, "y":4, "w":1.5}, {"label":"Alt", "x":1.5, "y":4, "w":1.5}, {"x":3, "y":4, "w":7}, {"label":"Fn2", "x":10, "y":4, "w":1.5}, {"label":"Fn1", "x":11.5, "y":4, "w":1.5}, {"label":"\u2190", "x":13, "y":4}, {"label":"\u2193", "x":14, "y":4}, {"label":"\u2192", "x":15, "y":4}] + } + "LAYOUT_60_normie": { + "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"label":"Backspace", "x":13, "y":0, "w":2}, {"label":"Home", "x":15, "y":0}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"|", "x":13.5, "y":1, "w":1.5}, {"label":"PgUp", "x":15, "y":1}, {"label":"Control", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"PgDn", "x":15, "y":2}, {"label":"Shift", "x":0, "y":3, "w":2.25}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":1.75}, {"label":"\u2191", "x":14, "y":3}, {"label":"End", "x":15, "y":3}, {"label":"Win", "x":0, "y":4, "w":1.5}, {"label":"Alt", "x":1.5, "y":4, "w":1.5}, {"x":3, "y":4, "w":7}, {"label":"Fn2", "x":10, "y":4, "w":1.5}, {"label":"Fn1", "x":11.5, "y":4, "w":1.5}, {"label":"\u2190", "x":13, "y":4}, {"label":"\u2193", "x":14, "y":4}, {"label":"\u2192", "x":15, "y":4}] + } + } +} \ No newline at end of file diff --git a/keyboards/zeal65/keymaps/default/config.h b/keyboards/zeal65/keymaps/default/config.h index 3b6f0f22e900..38c7798c10e0 100644 --- a/keyboards/zeal65/keymaps/default/config.h +++ b/keyboards/zeal65/keymaps/default/config.h @@ -7,16 +7,4 @@ #undef RGB_BACKLIGHT_USE_SPLIT_BACKSPACE #define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 0 -#undef RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT -#define RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 - -#undef RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT -#define RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 - -#undef RGB_BACKLIGHT_USE_7U_SPACEBAR -#define RGB_BACKLIGHT_USE_7U_SPACEBAR 0 - -#undef RGB_BACKLIGHT_USE_ISO_ENTER -#define RGB_BACKLIGHT_USE_ISO_ENTER 0 - #endif //CONFIG_USER_H diff --git a/keyboards/zeal65/keymaps/default/keymap.c b/keyboards/zeal65/keymaps/default/keymap.c index 3f7606105dfb..571e3b5c53b4 100644 --- a/keyboards/zeal65/keymaps/default/keymap.c +++ b/keyboards/zeal65/keymaps/default/keymap.c @@ -1,50 +1,39 @@ -// Default layout for Zeal60 +// Default layout for Zeal65 -#include "../zeal60/zeal60.h" - -// [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace -// [1,13] is either backslash or ISO Enter -// [2,12] is either ANSI Enter or key left of ISO Enter -// [2,13] is right key of split backspace (e.g. HHKB `~ key) -// [3,1] is right key of split left-shift (e.g ISO key) -// [3,13] is right key of split right-shift (e.g. HHKB Fn key) +#include "zeal65.h" const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Default layer -[0] = { - {KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NO }, - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_NO }, - {KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_NO, KC_NO }, - {KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO, KC_NO }, - {KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_NO, KC_NO, KC_NO, KC_SPC, KC_NO, KC_NO, KC_RALT, FN_MO13, FN_MO23, KC_RCTL, KC_NO } -}, +[0] = LAYOUT_65_normie( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, + KC_LCTL, KC_LALT, KC_SPC, FN_MO23, FN_MO13, KC_LEFT, KC_DOWN, KC_RGHT), // Fn1 Layer -[1] = { - {KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_TRNS}, - {KC_CAPS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_INS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, +[1] = LAYOUT_65_normie( + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), // Fn2 Layer -[2] = { - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, +[2] = LAYOUT_65_normie( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), // Fn3 Layer (zeal60 Configuration) -[3] = { - {KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -} +[3] = LAYOUT_65_normie( + KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), }; diff --git a/keyboards/zeal65/keymaps/split_bs/config.h b/keyboards/zeal65/keymaps/split_bs/config.h new file mode 100644 index 000000000000..b3dea8d198fb --- /dev/null +++ b/keyboards/zeal65/keymaps/split_bs/config.h @@ -0,0 +1,10 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +/* enable/disable LEDs based on layout */ +#undef RGB_BACKLIGHT_USE_SPLIT_BACKSPACE +#define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 1 + +#endif //CONFIG_USER_H diff --git a/keyboards/zeal65/keymaps/split_bs/keymap.c b/keyboards/zeal65/keymaps/split_bs/keymap.c new file mode 100644 index 000000000000..af58b4958aa5 --- /dev/null +++ b/keyboards/zeal65/keymaps/split_bs/keymap.c @@ -0,0 +1,39 @@ +// Split-backspace layout for Zeal65 + +#include "zeal65.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +// Default layer +[0] = LAYOUT_65_split_bs( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_DEL, KC_HOME, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, KC_PGUP, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, + KC_LGUI, KC_LALT, KC_SPC, FN_MO23, FN_MO13, KC_LEFT, KC_DOWN, KC_RGHT), + +// Fn1 Layer +[1] = LAYOUT_65_split_bs( + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, KC_TRNS, + KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + +// Fn2 Layer +[2] = LAYOUT_65_split_bs( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + +// Fn3 Layer (zeal60 Configuration) +[3] = LAYOUT_65_split_bs( + KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + +}; diff --git a/keyboards/zeal65/zeal65.h b/keyboards/zeal65/zeal65.h new file mode 100644 index 000000000000..9cc3741aec95 --- /dev/null +++ b/keyboards/zeal65/zeal65.h @@ -0,0 +1,53 @@ +/* Copyright 2017 Jason Williams (Wilba) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef ZEAL65_H +#define ZEAL65_H + +#include "quantum.h" +#include "../zeal60/rgb_backlight_keycodes.h" +#include "../zeal60/zeal60_keycodes.h" + +#define XXX KC_NO + +#define LAYOUT_65_split_bs( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K2D, K0E, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2E, \ + K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \ + K40, K41, K47, K4A, K4B, K4C, K4D, K4E \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E }, \ + { K30, XXX, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \ + { K40, K41, XXX, XXX, XXX, XXX, XXX, K47, XXX, XXX, K4A, K4B, K4C, K4D, K4E } \ +} + +#define LAYOUT_65_normie( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2E, \ + K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \ + K40, K41, K47, K4A, K4B, K4C, K4D, K4E \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, XXX, K2E }, \ + { K30, XXX, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \ + { K40, K41, XXX, XXX, XXX, XXX, XXX, K47, XXX, XXX, K4A, K4B, K4C, K4D, K4E } \ +} + +#endif // ZEAL65_H From 85e67756796f19444124cb0434d929550fdcb03e Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Sun, 9 Sep 2018 13:42:36 +1000 Subject: [PATCH 63/69] Added rama/m60_a, deleted zeal60/keymaps/m60_a --- keyboards/rama/m60_a/config.h | 131 ++++++++++++++++++ keyboards/rama/m60_a/info.json | 13 ++ .../m60_a/keymaps/default}/keymap.c | 4 +- keyboards/rama/m60_a/keymaps/proto/config.h | 10 ++ .../m60_a/keymaps/proto}/keymap.c | 0 keyboards/rama/m60_a/m60_a.c | 20 +++ keyboards/rama/m60_a/m60_a.h | 39 ++++++ keyboards/rama/m60_a/readme.md | 15 ++ keyboards/rama/m60_a/rules.mk | 85 ++++++++++++ keyboards/zeal60/config.h | 32 ++--- keyboards/zeal60/keymaps/hhkb/keymap.c | 58 ++++---- keyboards/zeal60/keymaps/m60_a/config.h | 28 ---- keyboards/zeal60/keymaps/m60_a_proto/config.h | 32 ----- keyboards/zeal65/config.h | 32 ++--- 14 files changed, 374 insertions(+), 125 deletions(-) create mode 100644 keyboards/rama/m60_a/config.h create mode 100644 keyboards/rama/m60_a/info.json rename keyboards/{zeal60/keymaps/m60_a_proto => rama/m60_a/keymaps/default}/keymap.c (98%) create mode 100644 keyboards/rama/m60_a/keymaps/proto/config.h rename keyboards/{zeal60/keymaps/m60_a => rama/m60_a/keymaps/proto}/keymap.c (100%) create mode 100644 keyboards/rama/m60_a/m60_a.c create mode 100644 keyboards/rama/m60_a/m60_a.h create mode 100644 keyboards/rama/m60_a/readme.md create mode 100644 keyboards/rama/m60_a/rules.mk delete mode 100644 keyboards/zeal60/keymaps/m60_a/config.h delete mode 100644 keyboards/zeal60/keymaps/m60_a_proto/config.h diff --git a/keyboards/rama/m60_a/config.h b/keyboards/rama/m60_a/config.h new file mode 100644 index 000000000000..e329db8e093c --- /dev/null +++ b/keyboards/rama/m60_a/config.h @@ -0,0 +1,131 @@ +/* Copyright 2017 Jason Williams (Wilba) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +// USB Device descriptor parameter +#define VENDOR_ID 0xFEED // This is same as Zeal60 for now +#define PRODUCT_ID 0x6060 // This is same as Zeal60 for now +#define DEVICE_VER 0x0001 +#define MANUFACTURER RAMA.WORKS +#define PRODUCT RAMA M60-A +#define DESCRIPTION RAMA M60-A Keyboard + + + +// key matrix size +#define MATRIX_ROWS 5 +#define MATRIX_COLS 14 + +// Zeal60 PCB default pin-out +#define MATRIX_ROW_PINS { F0, F1, F4, F6, F7 } +#define MATRIX_COL_PINS { F5, D5, B1, B2, B3, D3, D2, C7, C6, B6, B5, B4, D7, D6 } +#define UNUSED_PINS + +// IS31FL3731 driver +#define DRIVER_COUNT 2 +#define DRIVER_LED_TOTAL 72 + +// COL2ROW or ROW2COL +#define DIODE_DIRECTION COL2ROW + +// Set 0 if debouncing isn't needed +#define DEBOUNCING_DELAY 5 + +// Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap +#define LOCKING_SUPPORT_ENABLE +// Locking resynchronize hack +#define LOCKING_RESYNC_ENABLE + +// key combination for command +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +// disable debug print +//#define NO_DEBUG + +// disable print +//#define NO_PRINT + +// disable action features +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +#define RGB_BACKLIGHT_ENABLED 1 + +// This conditionally compiles the backlight code for M60-A specifics +#define RGB_BACKLIGHT_M60_A + +// enable/disable LEDs based on layout +// they aren't really used if RGB_BACKLIGHT_M60_A defined +#define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 1 +#define RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 +#define RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 1 +#define RGB_BACKLIGHT_USE_7U_SPACEBAR 1 +#define RGB_BACKLIGHT_USE_ISO_ENTER 0 +#define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 1 + +// disable backlight when USB suspended (PC sleep/hibernate/shutdown) +#define RGB_BACKLIGHT_DISABLE_WHEN_USB_SUSPENDED 0 + +// disable backlight after timeout in minutes, 0 = no timeout +#define RGB_BACKLIGHT_DISABLE_AFTER_TIMEOUT 0 + +// the default effect (RGB test) +#define RGB_BACKLIGHT_EFFECT 255 + +// These define which keys in the matrix are alphas/mods +// Used for backlight effects so colors are different for +// alphas vs. mods +// Each value is for a row, bit 0 is column 0 +// Alpha=0 Mod=1 +#define RGB_BACKLIGHT_ALPHAS_MODS_ROW_0 0b0000000000000001 +#define RGB_BACKLIGHT_ALPHAS_MODS_ROW_1 0b0010000000000001 +#define RGB_BACKLIGHT_ALPHAS_MODS_ROW_2 0b0011000000000001 +#define RGB_BACKLIGHT_ALPHAS_MODS_ROW_3 0b0011000000000001 +#define RGB_BACKLIGHT_ALPHAS_MODS_ROW_4 0b0011100000000111 + +#define DYNAMIC_KEYMAP_LAYER_COUNT 4 + +// EEPROM usage + +// TODO: refactor with new user EEPROM code (coming soon) +#define EEPROM_MAGIC 0x451F +#define EEPROM_MAGIC_ADDR 32 +// Bump this every time we change what we store +// This will automatically reset the EEPROM with defaults +// and avoid loading invalid data from the EEPROM +#define EEPROM_VERSION 0x07 +#define EEPROM_VERSION_ADDR 34 + +// Backlight config starts after EEPROM version +#define RGB_BACKLIGHT_CONFIG_EEPROM_ADDR 35 +// Dynamic keymap starts after backlight config (35+37) +#define DYNAMIC_KEYMAP_EEPROM_ADDR 72 + + +#endif diff --git a/keyboards/rama/m60_a/info.json b/keyboards/rama/m60_a/info.json new file mode 100644 index 000000000000..577becd21969 --- /dev/null +++ b/keyboards/rama/m60_a/info.json @@ -0,0 +1,13 @@ +{ + "keyboard_name": "M60-A", + "url": "", + "maintainer": "Wilba", + "bootloader": "DFU", + "width": 15, + "height": 5, + "layouts": { + "LAYOUT_60_hhkb": { + "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"label":"|", "x":13, "y":0}, {"label":"~", "x":14, "y":0}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"Delete", "x":13.5, "y":1, "w":1.5}, {"label":"Control", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"Shift", "x":0, "y":3, "w":2.25}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":1.75}, {"label":"Fn", "x":14, "y":3}, {"label":"Os", "x":1.5, "y":4}, {"label":"Alt", "x":2.5, "y":4, "w":1.5}, {"x":4, "y":4, "w":7}, {"label":"Alt", "x":11, "y":4, "w":1.5}, {"label":"Os", "x":12.5, "y":4}] + } + } +} \ No newline at end of file diff --git a/keyboards/zeal60/keymaps/m60_a_proto/keymap.c b/keyboards/rama/m60_a/keymaps/default/keymap.c similarity index 98% rename from keyboards/zeal60/keymaps/m60_a_proto/keymap.c rename to keyboards/rama/m60_a/keymaps/default/keymap.c index 2892237861cd..0ed75c19802b 100644 --- a/keyboards/zeal60/keymaps/m60_a_proto/keymap.c +++ b/keyboards/rama/m60_a/keymaps/default/keymap.c @@ -1,6 +1,6 @@ -// M60-A layout for Zeal60 +// M60-A layout -#include "zeal60.h" +#include "m60_a.h" const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/rama/m60_a/keymaps/proto/config.h b/keyboards/rama/m60_a/keymaps/proto/config.h new file mode 100644 index 000000000000..dee4908460f7 --- /dev/null +++ b/keyboards/rama/m60_a/keymaps/proto/config.h @@ -0,0 +1,10 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +// This fixes the diodes mounted reversed (fab fail) on M60-A prototype +#undef DIODE_DIRECTION +#define DIODE_DIRECTION ROW2COL + +#endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/m60_a/keymap.c b/keyboards/rama/m60_a/keymaps/proto/keymap.c similarity index 100% rename from keyboards/zeal60/keymaps/m60_a/keymap.c rename to keyboards/rama/m60_a/keymaps/proto/keymap.c diff --git a/keyboards/rama/m60_a/m60_a.c b/keyboards/rama/m60_a/m60_a.c new file mode 100644 index 000000000000..2968e9707439 --- /dev/null +++ b/keyboards/rama/m60_a/m60_a.c @@ -0,0 +1,20 @@ +/* Copyright 2017 Jason Williams (Wilba) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "config.h" + +#ifndef RGB_BACKLIGHT_M60_A +#error RGB_BACKLIGHT_M60_A not defined, you done goofed somehao, brah +#endif diff --git a/keyboards/rama/m60_a/m60_a.h b/keyboards/rama/m60_a/m60_a.h new file mode 100644 index 000000000000..7107242cc351 --- /dev/null +++ b/keyboards/rama/m60_a/m60_a.h @@ -0,0 +1,39 @@ +/* Copyright 2017 Jason Williams (Wilba) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef M60_A_H +#define M60_A_H + +#include "quantum.h" +#include "../../zeal60/rgb_backlight_keycodes.h" +#include "../../zeal60/zeal60_keycodes.h" + +#define XXX KC_NO + +#define LAYOUT_60_hhkb( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K2D, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \ + K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ + K41, K42, K47, K4B, K4C \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D }, \ + { K30, XXX, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D }, \ + { XXX, K41, K42, XXX, XXX, XXX, XXX, K47, XXX, XXX, XXX, K4B, K4C, XXX } \ +} + +#endif // M60_A_H diff --git a/keyboards/rama/m60_a/readme.md b/keyboards/rama/m60_a/readme.md new file mode 100644 index 000000000000..f7fa162445ea --- /dev/null +++ b/keyboards/rama/m60_a/readme.md @@ -0,0 +1,15 @@ +# RAMA M60-A + +![RAMA M60-A](https://static1.squarespace.com/static/563c788ae4b099120ae219e2/t/5aafa6a20e2e7254480b21bf/1535873164793/RAMA-M60-A-03.688.jpg?format=1500w) + +The M60-A represents the benchmark and equilibrium between function and design for us at Rama Works. The gently exaggerated design of the frame is not understated, but rather provocative. Inspiration and evolution from previous models are evident in the beautifully articulated design and the well defined aesthetic, the fingerprint of our ‘Industrial Modern’ designs. The M60-A offers a unique contender in the traditional 60% form factor. [More info at RAMA WORKS](https://rama.works/m60-a/) + +Keyboard Maintainer: [Wilba6582](https://github.com/Wilba6582) +Hardware Supported: RAMA M60-A PCB +Hardware Availability: [RAMA WORKS Store](https://ramaworks.store/) + +Make example for this keyboard (after setting up your build environment): + + make rama/m60_a:default + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. \ No newline at end of file diff --git a/keyboards/rama/m60_a/rules.mk b/keyboards/rama/m60_a/rules.mk new file mode 100644 index 000000000000..f672ae2bb9d9 --- /dev/null +++ b/keyboards/rama/m60_a/rules.mk @@ -0,0 +1,85 @@ + + +# project specific files +SRC = ../zeal60/zeal60.c \ + ../zeal60/rgb_backlight.c \ + quantum/color.c \ + drivers/issi/is31fl3731.c \ + drivers/avr/i2c_master.c + +# MCU name +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + +# Do not put the microcontroller into power saving mode +# when we get USB suspend event. We want it to keep updating +# backlight effects. +OPT_DEFS += -DNO_SUSPEND_POWER_DOWN + +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE ?= no # Mouse keys(+4700) +EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) +CONSOLE_ENABLE ?= no # Console for debug(+400) +COMMAND_ENABLE ?= no # Commands for debug and configuration +NKRO_ENABLE ?= yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE ?= no # MIDI controls +AUDIO_ENABLE ?= no # Audio output on port C6 +UNICODE_ENABLE ?= no # Unicode +BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend + +RAW_ENABLE = yes +DYNAMIC_KEYMAP_ENABLE = yes +CIE1931_CURVE = yes + diff --git a/keyboards/zeal60/config.h b/keyboards/zeal60/config.h index b7591fd39c88..19f4cb704989 100644 --- a/keyboards/zeal60/config.h +++ b/keyboards/zeal60/config.h @@ -1,20 +1,18 @@ -/* -Copyright 2012 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - +/* Copyright 2017 Jason Williams (Wilba) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifndef CONFIG_H #define CONFIG_H diff --git a/keyboards/zeal60/keymaps/hhkb/keymap.c b/keyboards/zeal60/keymaps/hhkb/keymap.c index 8c97cfaf3adb..863988247270 100644 --- a/keyboards/zeal60/keymaps/hhkb/keymap.c +++ b/keyboards/zeal60/keymaps/hhkb/keymap.c @@ -4,36 +4,36 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - // Default layer - [0] = LAYOUT_60_hhkb( - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, - KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, FN_MO13, - KC_LGUI, KC_LALT, KC_SPC, KC_RALT, FN_MO23), +// Default layer +[0] = LAYOUT_60_hhkb( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, FN_MO13, + KC_LGUI, KC_LALT, KC_SPC, KC_RALT, FN_MO23), - // Fn1 Layer - [1] = LAYOUT_60_hhkb( - KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, - KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_TRNS, - KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_EJCT, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), +// Fn1 Layer +[1] = LAYOUT_60_hhkb( + KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, + KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_TRNS, + KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_EJCT, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), - // Fn2 Layer - [2] = LAYOUT_60_hhkb( - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), +// Fn2 Layer +[2] = LAYOUT_60_hhkb( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), - // Fn3 Layer (zeal60 Configuration) - [3] = LAYOUT_60_hhkb( - KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), +// Fn3 Layer (zeal60 Configuration) +[3] = LAYOUT_60_hhkb( + KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BR_DEC, BR_INC, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, ES_DEC, ES_INC, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), - }; +}; diff --git a/keyboards/zeal60/keymaps/m60_a/config.h b/keyboards/zeal60/keymaps/m60_a/config.h deleted file mode 100644 index 7ba448e29eb9..000000000000 --- a/keyboards/zeal60/keymaps/m60_a/config.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef CONFIG_USER_H -#define CONFIG_USER_H - -#include "../../config.h" - -// This conditionally compiles the backlight code for M60-A specifics -#define RGB_BACKLIGHT_M60_A - -/* enable/disable LEDs based on layout */ -#undef RGB_BACKLIGHT_USE_SPLIT_BACKSPACE -#define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 1 - -#undef RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT -#define RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 - -#undef RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT -#define RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 1 - -#undef RGB_BACKLIGHT_USE_7U_SPACEBAR -#define RGB_BACKLIGHT_USE_7U_SPACEBAR 1 - -#undef RGB_BACKLIGHT_USE_ISO_ENTER -#define RGB_BACKLIGHT_USE_ISO_ENTER 0 - -#undef RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS -#define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 1 - -#endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/m60_a_proto/config.h b/keyboards/zeal60/keymaps/m60_a_proto/config.h deleted file mode 100644 index 7ea7addc6210..000000000000 --- a/keyboards/zeal60/keymaps/m60_a_proto/config.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef CONFIG_USER_H -#define CONFIG_USER_H - -#include "../../config.h" - -// This fixes the diodes mounted reversed (fab fail) on M60-A prototype -#undef DIODE_DIRECTION -#define DIODE_DIRECTION ROW2COL - -// This conditionally compiles the backlight code for M60-A specifics -#define RGB_BACKLIGHT_M60_A - -/* enable/disable LEDs based on layout */ -#undef RGB_BACKLIGHT_USE_SPLIT_BACKSPACE -#define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 1 - -#undef RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT -#define RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 - -#undef RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT -#define RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 1 - -#undef RGB_BACKLIGHT_USE_7U_SPACEBAR -#define RGB_BACKLIGHT_USE_7U_SPACEBAR 1 - -#undef RGB_BACKLIGHT_USE_ISO_ENTER -#define RGB_BACKLIGHT_USE_ISO_ENTER 0 - -#undef RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS -#define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 1 - -#endif //CONFIG_USER_H diff --git a/keyboards/zeal65/config.h b/keyboards/zeal65/config.h index 3e07b854e5ca..0ef5ecc18130 100644 --- a/keyboards/zeal65/config.h +++ b/keyboards/zeal65/config.h @@ -1,20 +1,18 @@ -/* -Copyright 2012 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - +/* Copyright 2017 Jason Williams (Wilba) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifndef CONFIG_H #define CONFIG_H From d8dea596da7fcf01cd99542539da0568312d644e Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Sun, 9 Sep 2018 13:55:28 +1000 Subject: [PATCH 64/69] Fixed rama/m60_a/keymaps/proto --- keyboards/rama/m60_a/keymaps/proto/keymap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/rama/m60_a/keymaps/proto/keymap.c b/keyboards/rama/m60_a/keymaps/proto/keymap.c index 2892237861cd..0ed75c19802b 100644 --- a/keyboards/rama/m60_a/keymaps/proto/keymap.c +++ b/keyboards/rama/m60_a/keymaps/proto/keymap.c @@ -1,6 +1,6 @@ -// M60-A layout for Zeal60 +// M60-A layout -#include "zeal60.h" +#include "m60_a.h" const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { From 3426b29cda73fd95970525bf2ae67db8365a1f93 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Sun, 9 Sep 2018 17:53:48 +1000 Subject: [PATCH 65/69] Fixed compilation error for suspend.c --- tmk_core/common/avr/suspend.c | 37 ++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c index 76c1c6d8d0bc..b5a304af7b5f 100644 --- a/tmk_core/common/avr/suspend.c +++ b/tmk_core/common/avr/suspend.c @@ -55,6 +55,24 @@ void suspend_idle(uint8_t time) sleep_disable(); } + +// TODO: This needs some cleanup + +/** \brief Run keyboard level Power down + * + * FIXME: needs doc + */ +__attribute__ ((weak)) +void suspend_power_down_user (void) { } +/** \brief Run keyboard level Power down + * + * FIXME: needs doc + */ +__attribute__ ((weak)) +void suspend_power_down_kb(void) { + suspend_power_down_user(); +} + #ifndef NO_SUSPEND_POWER_DOWN /** \brief Power down MCU with watchdog timer * @@ -72,21 +90,6 @@ void suspend_idle(uint8_t time) */ static uint8_t wdt_timeout = 0; -/** \brief Run keyboard level Power down - * - * FIXME: needs doc - */ -__attribute__ ((weak)) -void suspend_power_down_user (void) { } -/** \brief Run keyboard level Power down - * - * FIXME: needs doc - */ -__attribute__ ((weak)) -void suspend_power_down_kb(void) { - suspend_power_down_user(); -} - /** \brief Power down * * FIXME: needs doc @@ -184,8 +187,6 @@ void suspend_wakeup_init_kb(void) { */ void suspend_wakeup_init(void) { - suspend_wakeup_init_kb(); - // clear keyboard state clear_keyboard(); #ifdef BACKLIGHT_ENABLE @@ -198,7 +199,7 @@ void suspend_wakeup_init(void) rgblight_timer_enable(); #endif #endif - suspend_wakeup_init_kb(); + suspend_wakeup_init_kb(); } #ifndef NO_SUSPEND_POWER_DOWN From ebe55af784668090d3ced0e4784a0d2f21c71a4e Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Mon, 10 Sep 2018 01:34:44 +1000 Subject: [PATCH 66/69] Requested changes for PR --- keyboards/rama/m60_a/keymaps/default/keymap.c | 3 +-- keyboards/rama/m60_a/keymaps/proto/keymap.c | 3 +-- keyboards/rama/m60_a/readme.md | 4 ++-- keyboards/rama/m60_a/rules.mk | 24 +++++++++---------- keyboards/zeal60/Makefile | 3 --- keyboards/zeal60/info.json | 8 +++---- .../keymaps/ansi_split_bs_rshift/keymap.c | 3 +-- keyboards/zeal60/keymaps/default/keymap.c | 3 +-- keyboards/zeal60/keymaps/hhkb/keymap.c | 3 +-- keyboards/zeal60/keymaps/iso/keymap.c | 3 +-- keyboards/zeal60/keymaps/ryanmaclean/keymap.c | 3 +-- keyboards/zeal60/keymaps/tusing/Makefile | 4 ---- keyboards/zeal60/keymaps/tusing/keymap.c | 3 +-- keyboards/zeal60/readme.md | 6 ++--- keyboards/zeal60/rules.mk | 22 ++++++++--------- keyboards/zeal65/Makefile | 3 --- keyboards/zeal65/info.json | 4 ++-- keyboards/zeal65/keymaps/default/keymap.c | 3 +-- keyboards/zeal65/keymaps/split_bs/keymap.c | 3 +-- keyboards/zeal65/readme.md | 6 ++--- keyboards/zeal65/rules.mk | 24 +++++++++---------- 21 files changed, 59 insertions(+), 79 deletions(-) delete mode 100644 keyboards/zeal60/Makefile delete mode 100644 keyboards/zeal65/Makefile diff --git a/keyboards/rama/m60_a/keymaps/default/keymap.c b/keyboards/rama/m60_a/keymaps/default/keymap.c index 0ed75c19802b..7b6d9b756c01 100644 --- a/keyboards/rama/m60_a/keymaps/default/keymap.c +++ b/keyboards/rama/m60_a/keymaps/default/keymap.c @@ -1,6 +1,5 @@ // M60-A layout - -#include "m60_a.h" +#include QMK_KEYBOARD_H const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/rama/m60_a/keymaps/proto/keymap.c b/keyboards/rama/m60_a/keymaps/proto/keymap.c index 0ed75c19802b..7b6d9b756c01 100644 --- a/keyboards/rama/m60_a/keymaps/proto/keymap.c +++ b/keyboards/rama/m60_a/keymaps/proto/keymap.c @@ -1,6 +1,5 @@ // M60-A layout - -#include "m60_a.h" +#include QMK_KEYBOARD_H const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/rama/m60_a/readme.md b/keyboards/rama/m60_a/readme.md index f7fa162445ea..fe54f0163a17 100644 --- a/keyboards/rama/m60_a/readme.md +++ b/keyboards/rama/m60_a/readme.md @@ -2,7 +2,7 @@ ![RAMA M60-A](https://static1.squarespace.com/static/563c788ae4b099120ae219e2/t/5aafa6a20e2e7254480b21bf/1535873164793/RAMA-M60-A-03.688.jpg?format=1500w) -The M60-A represents the benchmark and equilibrium between function and design for us at Rama Works. The gently exaggerated design of the frame is not understated, but rather provocative. Inspiration and evolution from previous models are evident in the beautifully articulated design and the well defined aesthetic, the fingerprint of our ‘Industrial Modern’ designs. The M60-A offers a unique contender in the traditional 60% form factor. [More info at RAMA WORKS](https://rama.works/m60-a/) +The M60-A represents the benchmark and equilibrium between function and design for us at Rama Works. The gently exaggerated design of the frame is not understated, but rather provocative. Inspiration and evolution from previous models are evident in the beautifully articulated design and the well defined aesthetic, the fingerprint of our 'Industrial Modern' designs. The M60-A offers a unique contender in the traditional 60% form factor. [More info at RAMA WORKS](https://rama.works/m60-a/) Keyboard Maintainer: [Wilba6582](https://github.com/Wilba6582) Hardware Supported: RAMA M60-A PCB @@ -12,4 +12,4 @@ Make example for this keyboard (after setting up your build environment): make rama/m60_a:default -See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. \ No newline at end of file +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). \ No newline at end of file diff --git a/keyboards/rama/m60_a/rules.mk b/keyboards/rama/m60_a/rules.mk index f672ae2bb9d9..476eed317736 100644 --- a/keyboards/rama/m60_a/rules.mk +++ b/keyboards/rama/m60_a/rules.mk @@ -63,21 +63,21 @@ OPT_DEFS += -DNO_SUSPEND_POWER_DOWN # change to "no" to disable the options, or define them in the Makefile in # the appropriate keymap folder that will get included automatically # -BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE ?= no # Mouse keys(+4700) -EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) -CONSOLE_ENABLE ?= no # Console for debug(+400) -COMMAND_ENABLE ?= no # Commands for debug and configuration -NKRO_ENABLE ?= yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -MIDI_ENABLE ?= no # MIDI controls -AUDIO_ENABLE ?= no # Audio output on port C6 -UNICODE_ENABLE ?= no # Unicode -BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID -RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend RAW_ENABLE = yes DYNAMIC_KEYMAP_ENABLE = yes diff --git a/keyboards/zeal60/Makefile b/keyboards/zeal60/Makefile deleted file mode 100644 index 4e2a6f00fd8e..000000000000 --- a/keyboards/zeal60/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -ifndef MAKEFILE_INCLUDED - include ../../Makefile -endif \ No newline at end of file diff --git a/keyboards/zeal60/info.json b/keyboards/zeal60/info.json index 70c3d5310765..c4234e49a458 100644 --- a/keyboards/zeal60/info.json +++ b/keyboards/zeal60/info.json @@ -8,16 +8,16 @@ "layouts": { "LAYOUT_all": { "layout": [{"label":"~", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"|", "x":13.5, "y":1, "w":1.5}, {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"Shift", "x":0, "y":3, "w":1.25}, {"x":1.25, "y":3}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":1.75}, {"x":14, "y":3}, {"label":"Ctrl", "x":0, "y":4, "w":1.25}, {"label":"Win", "x":1.25, "y":4, "w":1.25}, {"label":"Alt", "x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":6.25}, {"label":"Alt", "x":10, "y":4, "w":1.25}, {"label":"Win", "x":11.25, "y":4, "w":1.25}, {"label":"Menu", "x":12.5, "y":4, "w":1.25}, {"label":"Ctrl", "x":13.75, "y":4, "w":1.25}] - } + }, "LAYOUT_60_ansi": { "layout": [{"label":"~", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"label":"Backspace", "x":13, "y":0, "w":2}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"|", "x":13.5, "y":1, "w":1.5}, {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"Shift", "x":0, "y":3, "w":2.25}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":2.75}, {"label":"Ctrl", "x":0, "y":4, "w":1.25}, {"label":"Win", "x":1.25, "y":4, "w":1.25}, {"label":"Alt", "x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":6.25}, {"label":"Alt", "x":10, "y":4, "w":1.25}, {"label":"Win", "x":11.25, "y":4, "w":1.25}, {"label":"Menu", "x":12.5, "y":4, "w":1.25}, {"label":"Ctrl", "x":13.75, "y":4, "w":1.25}] - } + }, "LAYOUT_60_iso": { "layout": [{"label":"\u00ac", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"\"", "x":2, "y":0}, {"label":"\u00a3", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"label":"Backspace", "x":13, "y":0, "w":2}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"Enter", "x":13.75, "y":1, "w":1.25, "h":2}, {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"@", "x":11.75, "y":2}, {"label":"~", "x":12.75, "y":2}, {"label":"Shift", "x":0, "y":3, "w":1.25}, {"label":"|", "x":1.25, "y":3}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":2.75}, {"label":"Ctrl", "x":0, "y":4, "w":1.25}, {"label":"Win", "x":1.25, "y":4, "w":1.25}, {"label":"Alt", "x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":6.25}, {"label":"AltGr", "x":10, "y":4, "w":1.25}, {"label":"Win", "x":11.25, "y":4, "w":1.25}, {"label":"Menu", "x":12.5, "y":4, "w":1.25}, {"label":"Ctrl", "x":13.75, "y":4, "w":1.25}] - } + }, "LAYOUT_60_ansi_split_bs_rshift": { "layout": [{"label":"~", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"|", "x":13.5, "y":1, "w":1.5}, {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"Shift", "x":0, "y":3, "w":2.25}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":1.75}, {"x":14, "y":3}, {"label":"Ctrl", "x":0, "y":4, "w":1.25}, {"label":"Win", "x":1.25, "y":4, "w":1.25}, {"label":"Alt", "x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":6.25}, {"label":"Alt", "x":10, "y":4, "w":1.25}, {"label":"Win", "x":11.25, "y":4, "w":1.25}, {"label":"Menu", "x":12.5, "y":4, "w":1.25}, {"label":"Ctrl", "x":13.75, "y":4, "w":1.25}] - } + }, "LAYOUT_60_hhkb": { "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"label":"|", "x":13, "y":0}, {"label":"~", "x":14, "y":0}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"Delete", "x":13.5, "y":1, "w":1.5}, {"label":"Control", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"Shift", "x":0, "y":3, "w":2.25}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":1.75}, {"label":"Fn", "x":14, "y":3}, {"label":"Os", "x":1.5, "y":4}, {"label":"Alt", "x":2.5, "y":4, "w":1.5}, {"x":4, "y":4, "w":7}, {"label":"Alt", "x":11, "y":4, "w":1.5}, {"label":"Os", "x":12.5, "y":4}] } diff --git a/keyboards/zeal60/keymaps/ansi_split_bs_rshift/keymap.c b/keyboards/zeal60/keymaps/ansi_split_bs_rshift/keymap.c index 45bfec08ebe6..edb4f256b536 100644 --- a/keyboards/zeal60/keymaps/ansi_split_bs_rshift/keymap.c +++ b/keyboards/zeal60/keymaps/ansi_split_bs_rshift/keymap.c @@ -1,6 +1,5 @@ // ANSI split backspace/right shift layout for Zeal60 - -#include "zeal60.h" +#include QMK_KEYBOARD_H const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/zeal60/keymaps/default/keymap.c b/keyboards/zeal60/keymaps/default/keymap.c index 134359455346..3a13cf4d5ade 100644 --- a/keyboards/zeal60/keymaps/default/keymap.c +++ b/keyboards/zeal60/keymaps/default/keymap.c @@ -1,6 +1,5 @@ // Default layout for Zeal60 - -#include "zeal60.h" +#include QMK_KEYBOARD_H const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/zeal60/keymaps/hhkb/keymap.c b/keyboards/zeal60/keymaps/hhkb/keymap.c index 863988247270..5cedc6e5ecf5 100644 --- a/keyboards/zeal60/keymaps/hhkb/keymap.c +++ b/keyboards/zeal60/keymaps/hhkb/keymap.c @@ -1,6 +1,5 @@ // HHKB layout for Zeal60 - -#include "zeal60.h" +#include QMK_KEYBOARD_H const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/zeal60/keymaps/iso/keymap.c b/keyboards/zeal60/keymaps/iso/keymap.c index 75948aa2351f..55120f05e5ce 100644 --- a/keyboards/zeal60/keymaps/iso/keymap.c +++ b/keyboards/zeal60/keymaps/iso/keymap.c @@ -1,6 +1,5 @@ // ISO layout for Zeal60 - -#include "zeal60.h" +#include QMK_KEYBOARD_H const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/zeal60/keymaps/ryanmaclean/keymap.c b/keyboards/zeal60/keymaps/ryanmaclean/keymap.c index 5d2d901ca849..2e342b497c83 100644 --- a/keyboards/zeal60/keymaps/ryanmaclean/keymap.c +++ b/keyboards/zeal60/keymaps/ryanmaclean/keymap.c @@ -2,8 +2,7 @@ // Note that LGUI and RGUI are swapped with LALT and RALT respectively, for use with Macs // Also note that Control has replaced Caps Lock, and that pressing left or right shift once // will output left parenthese and right parenthese respectively. - -#include "zeal60.h" +#include QMK_KEYBOARD_H // [0,13] is either left key of split backspace (e.g. HHKB \| key) or 2U backspace // [1,13] is either backslash or ISO Enter diff --git a/keyboards/zeal60/keymaps/tusing/Makefile b/keyboards/zeal60/keymaps/tusing/Makefile index 9b0e3654e798..762905da03f9 100644 --- a/keyboards/zeal60/keymaps/tusing/Makefile +++ b/keyboards/zeal60/keymaps/tusing/Makefile @@ -4,7 +4,3 @@ # RGBLIGHT_ENABLE = yes AUDIO_ENABLE = no # Underglow cannot be used with audio. - -ifndef QUANTUM_DIR - include ../../../../Makefile -endif \ No newline at end of file diff --git a/keyboards/zeal60/keymaps/tusing/keymap.c b/keyboards/zeal60/keymaps/tusing/keymap.c index 1c8bf4fddde8..41d2effd4686 100644 --- a/keyboards/zeal60/keymaps/tusing/keymap.c +++ b/keyboards/zeal60/keymaps/tusing/keymap.c @@ -1,6 +1,5 @@ // Default layout for Zeal60 -#include "zeal60.h" -#include "action_layer.h" +#include QMK_KEYBOARD_H // For readability. #define _______ KC_TRNS diff --git a/keyboards/zeal60/readme.md b/keyboards/zeal60/readme.md index afaf6219b71b..d8c6dbd011fb 100644 --- a/keyboards/zeal60/readme.md +++ b/keyboards/zeal60/readme.md @@ -5,12 +5,12 @@ Zeal60 This is a 60% PCB with per-key RGB LEDs and supports ANSI, ISO, winkey/winkeyless bottom row, HHKB-layout (split right shift and backspace). -Keyboard Maintainer: [Wilba](http://wilba.tech/) and on [github](https://github.com/Wilba6582) -Hardware Supported: Zeal60 PCB Rev 0-3 +Keyboard Maintainer: [Wilba](http://wilba.tech/) and on [github](https://github.com/Wilba6582) +Hardware Supported: Zeal60 PCB Rev 0-3 Hardware Availability: https://zealpc.net/collections/group-buy-pre-orders/products/zeal60rgb Make example for this keyboard (after setting up your build environment): make zeal60:default -See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/zeal60/rules.mk b/keyboards/zeal60/rules.mk index c74a2062d66e..ecb0b3f710c5 100644 --- a/keyboards/zeal60/rules.mk +++ b/keyboards/zeal60/rules.mk @@ -62,18 +62,18 @@ OPT_DEFS += -DNO_SUSPEND_POWER_DOWN # change to "no" to disable the options, or define them in the Makefile in # the appropriate keymap folder that will get included automatically # -BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE ?= no # Mouse keys(+4700) -EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) -CONSOLE_ENABLE ?= no # Console for debug(+400) -COMMAND_ENABLE ?= no # Commands for debug and configuration -NKRO_ENABLE ?= yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -MIDI_ENABLE ?= no # MIDI controls -AUDIO_ENABLE ?= no # Audio output on port C6 -UNICODE_ENABLE ?= no # Unicode -BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID -RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend diff --git a/keyboards/zeal65/Makefile b/keyboards/zeal65/Makefile deleted file mode 100644 index 4e2a6f00fd8e..000000000000 --- a/keyboards/zeal65/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -ifndef MAKEFILE_INCLUDED - include ../../Makefile -endif \ No newline at end of file diff --git a/keyboards/zeal65/info.json b/keyboards/zeal65/info.json index 56fd44e43314..94a090689e5d 100644 --- a/keyboards/zeal65/info.json +++ b/keyboards/zeal65/info.json @@ -8,8 +8,8 @@ "layouts": { "LAYOUT_65_split_bs": { "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"label":"|", "x":13, "y":0}, {"label":"Del", "x":14, "y":0}, {"label":"Home", "x":15, "y":0}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"Backspace", "x":13.5, "y":1, "w":1.5}, {"label":"PgUp", "x":15, "y":1}, {"label":"Control", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"PgDn", "x":15, "y":2}, {"label":"Shift", "x":0, "y":3, "w":2.25}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":1.75}, {"label":"\u2191", "x":14, "y":3}, {"label":"End", "x":15, "y":3}, {"label":"Win", "x":0, "y":4, "w":1.5}, {"label":"Alt", "x":1.5, "y":4, "w":1.5}, {"x":3, "y":4, "w":7}, {"label":"Fn2", "x":10, "y":4, "w":1.5}, {"label":"Fn1", "x":11.5, "y":4, "w":1.5}, {"label":"\u2190", "x":13, "y":4}, {"label":"\u2193", "x":14, "y":4}, {"label":"\u2192", "x":15, "y":4}] - } - "LAYOUT_60_normie": { + }, + "LAYOUT_65_normie": { "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"label":"Backspace", "x":13, "y":0, "w":2}, {"label":"Home", "x":15, "y":0}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"|", "x":13.5, "y":1, "w":1.5}, {"label":"PgUp", "x":15, "y":1}, {"label":"Control", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"PgDn", "x":15, "y":2}, {"label":"Shift", "x":0, "y":3, "w":2.25}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":1.75}, {"label":"\u2191", "x":14, "y":3}, {"label":"End", "x":15, "y":3}, {"label":"Win", "x":0, "y":4, "w":1.5}, {"label":"Alt", "x":1.5, "y":4, "w":1.5}, {"x":3, "y":4, "w":7}, {"label":"Fn2", "x":10, "y":4, "w":1.5}, {"label":"Fn1", "x":11.5, "y":4, "w":1.5}, {"label":"\u2190", "x":13, "y":4}, {"label":"\u2193", "x":14, "y":4}, {"label":"\u2192", "x":15, "y":4}] } } diff --git a/keyboards/zeal65/keymaps/default/keymap.c b/keyboards/zeal65/keymaps/default/keymap.c index 571e3b5c53b4..dd1a715d0a4e 100644 --- a/keyboards/zeal65/keymaps/default/keymap.c +++ b/keyboards/zeal65/keymaps/default/keymap.c @@ -1,6 +1,5 @@ // Default layout for Zeal65 - -#include "zeal65.h" +#include QMK_KEYBOARD_H const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/zeal65/keymaps/split_bs/keymap.c b/keyboards/zeal65/keymaps/split_bs/keymap.c index af58b4958aa5..96b04c358d36 100644 --- a/keyboards/zeal65/keymaps/split_bs/keymap.c +++ b/keyboards/zeal65/keymaps/split_bs/keymap.c @@ -1,6 +1,5 @@ // Split-backspace layout for Zeal65 - -#include "zeal65.h" +#include QMK_KEYBOARD_H const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { diff --git a/keyboards/zeal65/readme.md b/keyboards/zeal65/readme.md index 11c1d6fb6b6f..2fc3839ba21b 100644 --- a/keyboards/zeal65/readme.md +++ b/keyboards/zeal65/readme.md @@ -6,11 +6,11 @@ Zeal65 This is a 65% PCB with per-key RGB LEDs and supports fixed, 1800-like bottom row and split backspace. It was designed for the Zephyr custom keyboard. Keyboard Maintainer: [Wilba](http://wilba.tech/) and on [github](https://github.com/Wilba6582) -Hardware Supported: Zeal65 PCB Rev 1 -Hardware Availability: https://zealpc.net/collections/group-buy-pre-orders/products/zephyr +Hardware Supported: Zeal65 PCB Rev 1 +Hardware Availability: https://zealpc.net/collections/group-buy-pre-orders/products/zephyr Make example for this keyboard (after setting up your build environment): make zeal65:default -See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/zeal65/rules.mk b/keyboards/zeal65/rules.mk index f672ae2bb9d9..476eed317736 100644 --- a/keyboards/zeal65/rules.mk +++ b/keyboards/zeal65/rules.mk @@ -63,21 +63,21 @@ OPT_DEFS += -DNO_SUSPEND_POWER_DOWN # change to "no" to disable the options, or define them in the Makefile in # the appropriate keymap folder that will get included automatically # -BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE ?= no # Mouse keys(+4700) -EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) -CONSOLE_ENABLE ?= no # Console for debug(+400) -COMMAND_ENABLE ?= no # Commands for debug and configuration -NKRO_ENABLE ?= yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -MIDI_ENABLE ?= no # MIDI controls -AUDIO_ENABLE ?= no # Audio output on port C6 -UNICODE_ENABLE ?= no # Unicode -BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID -RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend RAW_ENABLE = yes DYNAMIC_KEYMAP_ENABLE = yes From 5f29769f68bb5aedd07a31440c83d6665ecb21d7 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Mon, 10 Sep 2018 01:50:37 +1000 Subject: [PATCH 67/69] Fixed readme.md images --- keyboards/zeal60/readme.md | 2 +- keyboards/zeal65/readme.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/zeal60/readme.md b/keyboards/zeal60/readme.md index d8c6dbd011fb..e23f294a156f 100644 --- a/keyboards/zeal60/readme.md +++ b/keyboards/zeal60/readme.md @@ -1,7 +1,7 @@ Zeal60 ==== -[Zeal60](https://cdn.shopify.com/s/files/1/0490/7329/products/Zeal60.jpg) +![Zeal60](https://cdn.shopify.com/s/files/1/0490/7329/products/Zeal60.jpg) This is a 60% PCB with per-key RGB LEDs and supports ANSI, ISO, winkey/winkeyless bottom row, HHKB-layout (split right shift and backspace). diff --git a/keyboards/zeal65/readme.md b/keyboards/zeal65/readme.md index 2fc3839ba21b..7e6835ea045a 100644 --- a/keyboards/zeal65/readme.md +++ b/keyboards/zeal65/readme.md @@ -1,7 +1,7 @@ Zeal65 ==== -[Zeal65](https://cdn.shopify.com/s/files/1/0490/7329/products/Zeal65_PCB2.jpg) +![Zeal65](https://cdn.shopify.com/s/files/1/0490/7329/products/Zeal65_PCB2.jpg) This is a 65% PCB with per-key RGB LEDs and supports fixed, 1800-like bottom row and split backspace. It was designed for the Zephyr custom keyboard. From 0693f360dd24d644b8e8c985525d81b534dbffa3 Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Mon, 10 Sep 2018 01:52:20 +1000 Subject: [PATCH 68/69] Another readme.md fix --- keyboards/zeal65/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/zeal65/readme.md b/keyboards/zeal65/readme.md index 7e6835ea045a..8f43dc24356c 100644 --- a/keyboards/zeal65/readme.md +++ b/keyboards/zeal65/readme.md @@ -5,7 +5,7 @@ Zeal65 This is a 65% PCB with per-key RGB LEDs and supports fixed, 1800-like bottom row and split backspace. It was designed for the Zephyr custom keyboard. -Keyboard Maintainer: [Wilba](http://wilba.tech/) and on [github](https://github.com/Wilba6582) +Keyboard Maintainer: [Wilba](http://wilba.tech/) and on [github](https://github.com/Wilba6582) Hardware Supported: Zeal65 PCB Rev 1 Hardware Availability: https://zealpc.net/collections/group-buy-pre-orders/products/zephyr From 08959a4ee4b084ac828f2de36c01bebf5290bbca Mon Sep 17 00:00:00 2001 From: Wilba6582 Date: Mon, 10 Sep 2018 22:46:07 +1000 Subject: [PATCH 69/69] Added drashna's requested changes --- keyboards/rama/m60_a/config.h | 5 +-- keyboards/rama/m60_a/keymaps/proto/config.h | 7 +---- keyboards/rama/m60_a/m60_a.c | 2 -- keyboards/rama/m60_a/m60_a.h | 4 +-- keyboards/rama/m60_a/rules.mk | 10 ++---- keyboards/zeal60/config.h | 5 +-- .../keymaps/ansi_split_bs_rshift/config.h | 6 +--- keyboards/zeal60/keymaps/default/config.h | 7 +---- keyboards/zeal60/keymaps/hhkb/config.h | 7 +---- keyboards/zeal60/keymaps/iso/config.h | 7 +---- keyboards/zeal60/keymaps/ryanmaclean/config.h | 6 +--- keyboards/zeal60/keymaps/tusing/config.h | 6 +--- keyboards/zeal60/readme.md | 31 +++++++++++++++++++ keyboards/zeal60/rgb_backlight.c | 1 - keyboards/zeal60/rgb_backlight.h | 4 +-- keyboards/zeal60/rgb_backlight_api.h | 5 +-- keyboards/zeal60/rgb_backlight_keycodes.h | 5 +-- keyboards/zeal60/rules.mk | 10 ++---- keyboards/zeal60/zeal60.h | 4 +-- keyboards/zeal60/zeal60_api.h | 5 +-- keyboards/zeal60/zeal60_keycodes.h | 5 +-- keyboards/zeal65/config.h | 5 +-- keyboards/zeal65/keymaps/default/config.h | 7 +---- keyboards/zeal65/keymaps/split_bs/config.h | 7 +---- keyboards/zeal65/rules.mk | 10 ++---- keyboards/zeal65/zeal65.c | 2 -- keyboards/zeal65/zeal65.h | 5 +-- 27 files changed, 57 insertions(+), 121 deletions(-) diff --git a/keyboards/rama/m60_a/config.h b/keyboards/rama/m60_a/config.h index e329db8e093c..45e7d8896386 100644 --- a/keyboards/rama/m60_a/config.h +++ b/keyboards/rama/m60_a/config.h @@ -13,8 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef CONFIG_H -#define CONFIG_H +#pragma once #include "config_common.h" @@ -127,5 +126,3 @@ // Dynamic keymap starts after backlight config (35+37) #define DYNAMIC_KEYMAP_EEPROM_ADDR 72 - -#endif diff --git a/keyboards/rama/m60_a/keymaps/proto/config.h b/keyboards/rama/m60_a/keymaps/proto/config.h index dee4908460f7..54a185ff19b7 100644 --- a/keyboards/rama/m60_a/keymaps/proto/config.h +++ b/keyboards/rama/m60_a/keymaps/proto/config.h @@ -1,10 +1,5 @@ -#ifndef CONFIG_USER_H -#define CONFIG_USER_H - -#include "../../config.h" +#pragma once // This fixes the diodes mounted reversed (fab fail) on M60-A prototype #undef DIODE_DIRECTION #define DIODE_DIRECTION ROW2COL - -#endif //CONFIG_USER_H diff --git a/keyboards/rama/m60_a/m60_a.c b/keyboards/rama/m60_a/m60_a.c index 2968e9707439..80a98460d822 100644 --- a/keyboards/rama/m60_a/m60_a.c +++ b/keyboards/rama/m60_a/m60_a.c @@ -13,8 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include "config.h" - #ifndef RGB_BACKLIGHT_M60_A #error RGB_BACKLIGHT_M60_A not defined, you done goofed somehao, brah #endif diff --git a/keyboards/rama/m60_a/m60_a.h b/keyboards/rama/m60_a/m60_a.h index 7107242cc351..3caab6ac0f00 100644 --- a/keyboards/rama/m60_a/m60_a.h +++ b/keyboards/rama/m60_a/m60_a.h @@ -13,8 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef M60_A_H -#define M60_A_H +#pragma once #include "quantum.h" #include "../../zeal60/rgb_backlight_keycodes.h" @@ -36,4 +35,3 @@ { XXX, K41, K42, XXX, XXX, XXX, XXX, K47, XXX, XXX, XXX, K4B, K4C, XXX } \ } -#endif // M60_A_H diff --git a/keyboards/rama/m60_a/rules.mk b/keyboards/rama/m60_a/rules.mk index 476eed317736..02617cf1c76e 100644 --- a/keyboards/rama/m60_a/rules.mk +++ b/keyboards/rama/m60_a/rules.mk @@ -45,14 +45,8 @@ F_USB = $(F_CPU) # Interrupt driven control endpoint task(+60) OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT - -# Boot Section Size in *bytes* -# Teensy halfKay 512 -# Teensy++ halfKay 1024 -# Atmel DFU loader 4096 -# LUFA bootloader 4096 -# USBaspLoader 2048 -OPT_DEFS += -DBOOTLOADER_SIZE=4096 +# Boot Section +BOOTLOADER = atmel-dfu # Do not put the microcontroller into power saving mode # when we get USB suspend event. We want it to keep updating diff --git a/keyboards/zeal60/config.h b/keyboards/zeal60/config.h index 19f4cb704989..baa4978a8349 100644 --- a/keyboards/zeal60/config.h +++ b/keyboards/zeal60/config.h @@ -13,8 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef CONFIG_H -#define CONFIG_H +#pragma once #include "config_common.h" @@ -124,5 +123,3 @@ // Dynamic keymap starts after backlight config (35+37) #define DYNAMIC_KEYMAP_EEPROM_ADDR 72 - -#endif diff --git a/keyboards/zeal60/keymaps/ansi_split_bs_rshift/config.h b/keyboards/zeal60/keymaps/ansi_split_bs_rshift/config.h index f0be7ad664a8..011cf5c5a567 100644 --- a/keyboards/zeal60/keymaps/ansi_split_bs_rshift/config.h +++ b/keyboards/zeal60/keymaps/ansi_split_bs_rshift/config.h @@ -1,7 +1,4 @@ -#ifndef CONFIG_USER_H -#define CONFIG_USER_H - -#include "../../config.h" +#pragma once /* enable/disable LEDs based on layout */ #undef RGB_BACKLIGHT_USE_SPLIT_BACKSPACE @@ -22,4 +19,3 @@ #undef RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS #define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 -#endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/default/config.h b/keyboards/zeal60/keymaps/default/config.h index f0be7ad664a8..f8478a3df270 100644 --- a/keyboards/zeal60/keymaps/default/config.h +++ b/keyboards/zeal60/keymaps/default/config.h @@ -1,7 +1,4 @@ -#ifndef CONFIG_USER_H -#define CONFIG_USER_H - -#include "../../config.h" +#pragma once /* enable/disable LEDs based on layout */ #undef RGB_BACKLIGHT_USE_SPLIT_BACKSPACE @@ -21,5 +18,3 @@ #undef RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS #define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 - -#endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/hhkb/config.h b/keyboards/zeal60/keymaps/hhkb/config.h index 30745b59a617..25f74d3d28fe 100644 --- a/keyboards/zeal60/keymaps/hhkb/config.h +++ b/keyboards/zeal60/keymaps/hhkb/config.h @@ -1,7 +1,4 @@ -#ifndef CONFIG_USER_H -#define CONFIG_USER_H - -#include "../../config.h" +#pragma once /* enable/disable LEDs based on layout */ #undef RGB_BACKLIGHT_USE_SPLIT_BACKSPACE @@ -21,5 +18,3 @@ #undef RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS #define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 1 - -#endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/iso/config.h b/keyboards/zeal60/keymaps/iso/config.h index 2cf9ec71e203..c96ef1f05782 100644 --- a/keyboards/zeal60/keymaps/iso/config.h +++ b/keyboards/zeal60/keymaps/iso/config.h @@ -1,7 +1,4 @@ -#ifndef CONFIG_USER_H -#define CONFIG_USER_H - -#include "../../config.h" +#pragma once /* enable/disable LEDs based on layout */ #undef RGB_BACKLIGHT_USE_SPLIT_BACKSPACE @@ -21,5 +18,3 @@ #undef RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS #define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 - -#endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/ryanmaclean/config.h b/keyboards/zeal60/keymaps/ryanmaclean/config.h index d64ef8d942d2..f1531eb34523 100644 --- a/keyboards/zeal60/keymaps/ryanmaclean/config.h +++ b/keyboards/zeal60/keymaps/ryanmaclean/config.h @@ -1,7 +1,4 @@ -#ifndef CONFIG_USER_H -#define CONFIG_USER_H - -#include "../../config.h" +#pragma once /* enable/disable LEDs based on layout */ #undef RGB_BACKLIGHT_USE_SPLIT_BACKSPACE @@ -22,4 +19,3 @@ #undef RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS #define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 -#endif //CONFIG_USER_H diff --git a/keyboards/zeal60/keymaps/tusing/config.h b/keyboards/zeal60/keymaps/tusing/config.h index 461ed7ab6360..93f260946cfb 100644 --- a/keyboards/zeal60/keymaps/tusing/config.h +++ b/keyboards/zeal60/keymaps/tusing/config.h @@ -1,7 +1,4 @@ -#ifndef CONFIG_USER_H -#define CONFIG_USER_H - -#include "../../config.h" +#pragma once /* Enable/disable LEDs based on layout. */ #undef RGB_BACKLIGHT_USE_SPLIT_BACKSPACE @@ -41,4 +38,3 @@ // Prevent modifiers on layer 1 from persisting after we let go #define PREVENT_STUCK_MODIFIERS -#endif diff --git a/keyboards/zeal60/readme.md b/keyboards/zeal60/readme.md index e23f294a156f..9eca28f83eae 100644 --- a/keyboards/zeal60/readme.md +++ b/keyboards/zeal60/readme.md @@ -14,3 +14,34 @@ Make example for this keyboard (after setting up your build environment): make zeal60:default See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). + + +RGB Backlight Configuration +==== + +A keymap (in the keymaps directory) can optionally configure which RGB backlight LEDs are used, depending on the needs of the layout, by adding a config.h file in the keymap's directory. +The following #define symbols will enable/disable a feature using 1 or 0. + + RGB_BACKLIGHT_USE_SPLIT_BACKSPACE + +Split backspace is being used, enables the right LED of the split backspace (the top-right corner) + + RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT + +Split left shift is being used (i.e. ISO layout), enables the right LED of the split left shift (the ISO key) + + RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT + +Split right shift is being used (i.e. HHKB style layouts), enables the right LED of the split right shift (the Fn key) + + RGB_BACKLIGHT_USE_7U_SPACEBAR + +A 7U spacebar is being used, controls the LEDs under the right stabilizer (of 7U spacebar) and right Alt (if 6.25U spacebar). + + RGB_BACKLIGHT_USE_ISO_ENTER + +An ISO Enter is being used. Only used to tweak the location of the LED being used under ANSI Enter/backslash + + RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS + +Disables the LEDs under HHKB corner blockers, useful for transparent cases. diff --git a/keyboards/zeal60/rgb_backlight.c b/keyboards/zeal60/rgb_backlight.c index 4bc09e9e7f01..9f62a8d38187 100644 --- a/keyboards/zeal60/rgb_backlight.c +++ b/keyboards/zeal60/rgb_backlight.c @@ -29,7 +29,6 @@ #include #include #include "progmem.h" -#include "config.h" #include "quantum/color.h" #include "drivers/avr/i2c_master.h" diff --git a/keyboards/zeal60/rgb_backlight.h b/keyboards/zeal60/rgb_backlight.h index 7a262a27baf1..60f2ace51af0 100644 --- a/keyboards/zeal60/rgb_backlight.h +++ b/keyboards/zeal60/rgb_backlight.h @@ -13,8 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef RGB_BACKLIGHT_H -#define RGB_BACKLIGHT_H +#pragma once #if RGB_BACKLIGHT_ENABLED #else @@ -100,4 +99,3 @@ void backlight_color_2_sat_decrease(void); void backlight_test_led( uint8_t index, bool red, bool green, bool blue ); void backlight_debug_led(bool state); -#endif //RGB_BACKLIGHT_H diff --git a/keyboards/zeal60/rgb_backlight_api.h b/keyboards/zeal60/rgb_backlight_api.h index 82416e370316..01827e849fc3 100644 --- a/keyboards/zeal60/rgb_backlight_api.h +++ b/keyboards/zeal60/rgb_backlight_api.h @@ -13,8 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef RGB_BACKLIGHT_API_H -#define RGB_BACKLIGHT_API_H +#pragma once enum backlight_config_value { @@ -41,5 +40,3 @@ enum backlight_config_value id_layer_3_indicator_row_col = 0x15, id_alphas_mods = 0x16 }; - -#endif // RGB_BACKLIGHT_API_H diff --git a/keyboards/zeal60/rgb_backlight_keycodes.h b/keyboards/zeal60/rgb_backlight_keycodes.h index 6a5e06ab09e1..ba7f03f89d4e 100644 --- a/keyboards/zeal60/rgb_backlight_keycodes.h +++ b/keyboards/zeal60/rgb_backlight_keycodes.h @@ -13,8 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef RGB_BACKLIGHT_KEYCODES_H -#define RGB_BACKLIGHT_KEYCODES_H +#pragma once // This is hardcoded at 0x5F00 so it's well after keycode value SAFE_RANGE enum backlight_keycodes { @@ -33,5 +32,3 @@ enum backlight_keycodes { S2_INC, S2_DEC }; - -#endif // RGB_BACKLIGHT_KEYCODES_H diff --git a/keyboards/zeal60/rules.mk b/keyboards/zeal60/rules.mk index ecb0b3f710c5..c4686f9852bd 100644 --- a/keyboards/zeal60/rules.mk +++ b/keyboards/zeal60/rules.mk @@ -44,14 +44,8 @@ F_USB = $(F_CPU) # Interrupt driven control endpoint task(+60) OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT - -# Boot Section Size in *bytes* -# Teensy halfKay 512 -# Teensy++ halfKay 1024 -# Atmel DFU loader 4096 -# LUFA bootloader 4096 -# USBaspLoader 2048 -OPT_DEFS += -DBOOTLOADER_SIZE=4096 +# Boot Section +BOOTLOADER = atmel-dfu # Do not put the microcontroller into power saving mode # when we get USB suspend event. We want it to keep updating diff --git a/keyboards/zeal60/zeal60.h b/keyboards/zeal60/zeal60.h index 540395e29074..ef9de7989e5d 100644 --- a/keyboards/zeal60/zeal60.h +++ b/keyboards/zeal60/zeal60.h @@ -13,8 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef ZEAL60_H -#define ZEAL60_H +#pragma once #include "quantum.h" #include "rgb_backlight_keycodes.h" @@ -92,4 +91,3 @@ { XXX, K41, K42, XXX, XXX, XXX, XXX, K47, XXX, XXX, XXX, K4B, K4C, XXX } \ } -#endif // ZEAL60_H diff --git a/keyboards/zeal60/zeal60_api.h b/keyboards/zeal60/zeal60_api.h index c95726edc3c1..baa8ac09f8ae 100644 --- a/keyboards/zeal60/zeal60_api.h +++ b/keyboards/zeal60/zeal60_api.h @@ -13,8 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef ZEAL60_API_H -#define ZEAL60_API_H +#pragma once #define PROTOCOL_VERSION 0x0007 @@ -32,5 +31,3 @@ enum zeal60_command_id id_unhandled = 0xFF, }; - -#endif // ZEAL60_API_H diff --git a/keyboards/zeal60/zeal60_keycodes.h b/keyboards/zeal60/zeal60_keycodes.h index e37ffb83620a..9511801eb26d 100644 --- a/keyboards/zeal60/zeal60_keycodes.h +++ b/keyboards/zeal60/zeal60_keycodes.h @@ -13,8 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef ZEAL60_KEYCODE_H -#define ZEAL60_KEYCODE_H +#pragma once // Can't use SAFE_RANGE here, it might change if someone adds // new values to enum quantum_keycodes. @@ -41,5 +40,3 @@ enum zeal60_action_functions { #define FN_TT23 F((0x0F00|TRIPLE_TAP_2_3)) #define TG_NKRO MAGIC_TOGGLE_NKRO - -#endif // ZEAL60_KEYCODE_H diff --git a/keyboards/zeal65/config.h b/keyboards/zeal65/config.h index 0ef5ecc18130..2dbf6123783c 100644 --- a/keyboards/zeal65/config.h +++ b/keyboards/zeal65/config.h @@ -13,8 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef CONFIG_H -#define CONFIG_H +#pragma once #include "config_common.h" @@ -124,5 +123,3 @@ // Dynamic keymap starts after backlight config (35+37) #define DYNAMIC_KEYMAP_EEPROM_ADDR 72 - -#endif diff --git a/keyboards/zeal65/keymaps/default/config.h b/keyboards/zeal65/keymaps/default/config.h index 38c7798c10e0..f579dfaa7b34 100644 --- a/keyboards/zeal65/keymaps/default/config.h +++ b/keyboards/zeal65/keymaps/default/config.h @@ -1,10 +1,5 @@ -#ifndef CONFIG_USER_H -#define CONFIG_USER_H - -#include "../../config.h" +#pragma once /* enable/disable LEDs based on layout */ #undef RGB_BACKLIGHT_USE_SPLIT_BACKSPACE #define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 0 - -#endif //CONFIG_USER_H diff --git a/keyboards/zeal65/keymaps/split_bs/config.h b/keyboards/zeal65/keymaps/split_bs/config.h index b3dea8d198fb..018be8d7cc34 100644 --- a/keyboards/zeal65/keymaps/split_bs/config.h +++ b/keyboards/zeal65/keymaps/split_bs/config.h @@ -1,10 +1,5 @@ -#ifndef CONFIG_USER_H -#define CONFIG_USER_H - -#include "../../config.h" +#pragma once /* enable/disable LEDs based on layout */ #undef RGB_BACKLIGHT_USE_SPLIT_BACKSPACE #define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 1 - -#endif //CONFIG_USER_H diff --git a/keyboards/zeal65/rules.mk b/keyboards/zeal65/rules.mk index 476eed317736..02617cf1c76e 100644 --- a/keyboards/zeal65/rules.mk +++ b/keyboards/zeal65/rules.mk @@ -45,14 +45,8 @@ F_USB = $(F_CPU) # Interrupt driven control endpoint task(+60) OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT - -# Boot Section Size in *bytes* -# Teensy halfKay 512 -# Teensy++ halfKay 1024 -# Atmel DFU loader 4096 -# LUFA bootloader 4096 -# USBaspLoader 2048 -OPT_DEFS += -DBOOTLOADER_SIZE=4096 +# Boot Section +BOOTLOADER = atmel-dfu # Do not put the microcontroller into power saving mode # when we get USB suspend event. We want it to keep updating diff --git a/keyboards/zeal65/zeal65.c b/keyboards/zeal65/zeal65.c index 2d8ba8b53b17..540c93080a1a 100644 --- a/keyboards/zeal65/zeal65.c +++ b/keyboards/zeal65/zeal65.c @@ -13,8 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include "config.h" - #ifndef RGB_BACKLIGHT_ZEAL65 #error RGB_BACKLIGHT_ZEAL65 not defined, you done goofed somehao, brah #endif diff --git a/keyboards/zeal65/zeal65.h b/keyboards/zeal65/zeal65.h index 9cc3741aec95..3ee4f49e5965 100644 --- a/keyboards/zeal65/zeal65.h +++ b/keyboards/zeal65/zeal65.h @@ -13,8 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef ZEAL65_H -#define ZEAL65_H +#pragma once #include "quantum.h" #include "../zeal60/rgb_backlight_keycodes.h" @@ -49,5 +48,3 @@ { K30, XXX, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \ { K40, K41, XXX, XXX, XXX, XXX, XXX, K47, XXX, XXX, K4A, K4B, K4C, K4D, K4E } \ } - -#endif // ZEAL65_H