From da5cb5fd6f91c2f7aebbcebbf211252c51d9b4a5 Mon Sep 17 00:00:00 2001 From: peepeetee <43021794+peepeetee@users.noreply.github.com> Date: Tue, 1 Feb 2022 12:44:28 +0800 Subject: [Keyboard] move woodkeys.click keyboards to /woodkeys (#16113) --- keyboards/meira/TWIlib.c | 300 ------------------- keyboards/meira/TWIlib.h | 71 ----- keyboards/meira/config.h | 45 --- keyboards/meira/featherble/config.h | 97 ------ keyboards/meira/featherble/featherble.c | 17 -- keyboards/meira/featherble/featherble.h | 19 -- keyboards/meira/featherble/rules.mk | 5 - keyboards/meira/info.json | 65 ---- keyboards/meira/issi.c | 286 ------------------ keyboards/meira/issi.h | 39 --- keyboards/meira/keymaps/cole/config.h | 31 -- keyboards/meira/keymaps/cole/keymap.c | 225 -------------- keyboards/meira/keymaps/cole/readme.md | 1 - keyboards/meira/keymaps/cole/rules.mk | 2 - keyboards/meira/keymaps/default/config.h | 31 -- keyboards/meira/keymaps/default/keymap.c | 299 ------------------- keyboards/meira/keymaps/default/readme.md | 1 - keyboards/meira/keymaps/grahampheath/config.h | 35 --- keyboards/meira/keymaps/grahampheath/keymap.c | 398 ------------------------- keyboards/meira/keymaps/grahampheath/readme.md | 55 ---- keyboards/meira/keymaps/grahampheath/rules.mk | 5 - keyboards/meira/keymaps/takmiya/config.h | 24 -- keyboards/meira/keymaps/takmiya/keymap.c | 234 --------------- keyboards/meira/keymaps/takmiya/readme.md | 1 - keyboards/meira/lighting.c | 97 ------ keyboards/meira/lighting.h | 6 - keyboards/meira/matrix.c | 270 ----------------- keyboards/meira/meira.c | 97 ------ keyboards/meira/meira.h | 37 --- keyboards/meira/promicro/config.h | 88 ------ keyboards/meira/promicro/promicro.c | 17 -- keyboards/meira/promicro/promicro.h | 19 -- keyboards/meira/promicro/rules.mk | 3 - keyboards/meira/readme.md | 28 -- keyboards/meira/rules.mk | 34 --- 35 files changed, 2982 deletions(-) delete mode 100755 keyboards/meira/TWIlib.c delete mode 100755 keyboards/meira/TWIlib.h delete mode 100644 keyboards/meira/config.h delete mode 100644 keyboards/meira/featherble/config.h delete mode 100644 keyboards/meira/featherble/featherble.c delete mode 100644 keyboards/meira/featherble/featherble.h delete mode 100644 keyboards/meira/featherble/rules.mk delete mode 100644 keyboards/meira/info.json delete mode 100755 keyboards/meira/issi.c delete mode 100755 keyboards/meira/issi.h delete mode 100644 keyboards/meira/keymaps/cole/config.h delete mode 100644 keyboards/meira/keymaps/cole/keymap.c delete mode 100644 keyboards/meira/keymaps/cole/readme.md delete mode 100644 keyboards/meira/keymaps/cole/rules.mk delete mode 100644 keyboards/meira/keymaps/default/config.h delete mode 100644 keyboards/meira/keymaps/default/keymap.c delete mode 100644 keyboards/meira/keymaps/default/readme.md delete mode 100644 keyboards/meira/keymaps/grahampheath/config.h delete mode 100644 keyboards/meira/keymaps/grahampheath/keymap.c delete mode 100644 keyboards/meira/keymaps/grahampheath/readme.md delete mode 100644 keyboards/meira/keymaps/grahampheath/rules.mk delete mode 100644 keyboards/meira/keymaps/takmiya/config.h delete mode 100644 keyboards/meira/keymaps/takmiya/keymap.c delete mode 100644 keyboards/meira/keymaps/takmiya/readme.md delete mode 100755 keyboards/meira/lighting.c delete mode 100755 keyboards/meira/lighting.h delete mode 100644 keyboards/meira/matrix.c delete mode 100644 keyboards/meira/meira.c delete mode 100644 keyboards/meira/meira.h delete mode 100644 keyboards/meira/promicro/config.h delete mode 100644 keyboards/meira/promicro/promicro.c delete mode 100644 keyboards/meira/promicro/promicro.h delete mode 100644 keyboards/meira/promicro/rules.mk delete mode 100644 keyboards/meira/readme.md delete mode 100644 keyboards/meira/rules.mk (limited to 'keyboards/meira') diff --git a/keyboards/meira/TWIlib.c b/keyboards/meira/TWIlib.c deleted file mode 100755 index 8f5658fcdb..0000000000 --- a/keyboards/meira/TWIlib.c +++ /dev/null @@ -1,300 +0,0 @@ -/* - * TWIlib.c - * - * Created: 6/01/2014 10:41:33 PM - * Author: Chris Herring - */ - -#include -#include -#include "TWIlib.h" -#include -#include "print.h" - -// Global transmit buffer -volatile uint8_t *TWITransmitBuffer; -// 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) - -TWIInfoStruct TWIInfo; - -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) ) - { - -// xprintf("i2c ready\n"); - return 1; - } - else - { - if(TWIInfo.mode == Initializing){ - switch(TWIInfo.errorCode){ - case TWI_SUCCESS: - break; - case TWI_NO_RELEVANT_INFO: - - break; - case TWI_LOST_ARBIT: - case TWI_MT_DATA_NACK: - // Some kind of I2C error, reset and re-init - xprintf("I2C init error: %d\n", TWIInfo.errorCode); - TWCR = (1 << TWINT)|(1 << TWSTO); - TWIInit(); - break; - default: - xprintf("Other i2c init error: %d\n", TWIInfo.errorCode); - } - } - return 0; - } -} - - -void TWITransmitData(void *const TXdata, uint8_t dataLen, uint8_t repStart, uint8_t blocking) -{ - // Wait until ready - while (!isTWIReady()) {_delay_us(1);} - // Reset the I2C stuff - TWCR = (1 << TWINT)|(1 << TWSTO); - TWIInit(); - // Set repeated start mode - TWIInfo.repStart = repStart; - // Copy transmit info to global variables - TWITransmitBuffer = (uint8_t *)TXdata; - 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(); - } - if(blocking){ - // Wait until ready - while (!isTWIReady()){_delay_us(1);} - } -} - - -// 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, 0); - } - 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/meira/TWIlib.h b/keyboards/meira/TWIlib.h deleted file mode 100755 index 8ba261c6e5..0000000000 --- a/keyboards/meira/TWIlib.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * TWIlib.h - * - * Created: 6/01/2014 10:38:42 PM - * Author: Chris Herring - */ - - -#ifndef TWILIB_H_ -#define TWILIB_H_ -// TWI bit rate -#define TWI_FREQ 400000 -// Get TWI status -#define TWI_STATUS (TWSR & 0xF8) -// Transmit buffer length -#define TXMAXBUFLEN 20 -// Receive buffer length -#define RXMAXBUFLEN 20 - -typedef enum { - Ready, - Initializing, - RepeatedStartSent, - MasterTransmitter, - MasterReceiver, - SlaceTransmitter, - SlaveReciever - } TWIMode; - - typedef struct TWIInfoStruct{ - TWIMode mode; - uint8_t errorCode; - uint8_t repStart; - }TWIInfoStruct; - -extern 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<. -*/ - -#pragma once - -#include "config_common.h" - -/* USB Device descriptor parameter */ -#define VENDOR_ID 0xFEED -#define PRODUCT_ID 0x6061 -#define DEVICE_VER 0x0001 -#define MANUFACTURER WoodKeys.click -#define PRODUCT Meira - -/* key matrix size */ -#define MATRIX_ROWS 4 -#define MATRIX_COLS 12 - -/* COL2ROW, ROW2COL*/ -//#define DIODE_DIRECTION - -#ifdef BACKLIGHT_ENABLE -#define BACKLIGHT_LEVELS 10 -#define BACKLIGHT_PWM_MAP {2, 4, 8, 16, 40, 55, 70, 128, 200, 255} -#endif - -#ifdef RGBLIGHT_ENABLE -#define RGB_DI_PIN D3 - -#define RGBLED_NUM 15 // Number of LEDs -#endif diff --git a/keyboards/meira/featherble/config.h b/keyboards/meira/featherble/config.h deleted file mode 100644 index 94bef3b330..0000000000 --- a/keyboards/meira/featherble/config.h +++ /dev/null @@ -1,97 +0,0 @@ -/* -Copyright 2017 Cole Markham, WoodKeys.click - -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 . -*/ - -#pragma once - -#include "config_common.h" - -/* - * Keyboard Matrix Assignments - * - * Change this to how you wired your keyboard - * COLS: AVR pins used for columns, left to right - * ROWS: AVR pins used for rows, top to bottom - * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) - * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) - * -*/ -#define MATRIX_ROW_PINS { F7, F6, F5, F4 } -// Column pins to demux in LSB order -#define MATRIX_COL_PINS { C7, B7, B6, C6, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN, NO_PIN } -#define MATRIX_COL_PINS_SCANNED { C7, B7, B6, C6 } -#define LED_EN_PIN D2 -#define UNUSED_PINS - -#define QMK_SPEAKER B5 -#define AUDIO_PIN B5 -#define AUDIO_VOICES - -// #define BACKLIGHT_PIN B7 -// #define BACKLIGHT_BREATHING -//#define BACKLIGHT_LEVELS 3 - -/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ -#define DEBOUNCE 5 - -/* define if matrix has ghost (lacks anti-ghosting diodes) */ -//#define MATRIX_HAS_GHOST - -/* number of backlight levels */ - -/* 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 - -/* - * Force NKRO - * - * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved - * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the - * makefile for this to work.) - * - * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) - * until the next keyboard reset. - * - * NKRO may prevent your keystrokes from being detected in the BIOS, but it is - * fully operational during normal computer usage. - * - * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) - * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by - * bootmagic, NKRO mode will always be enabled until it is toggled again during a - * power-up. - * - */ -//#define FORCE_NKRO - -/* - * 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 diff --git a/keyboards/meira/featherble/featherble.c b/keyboards/meira/featherble/featherble.c deleted file mode 100644 index 63ade21904..0000000000 --- a/keyboards/meira/featherble/featherble.c +++ /dev/null @@ -1,17 +0,0 @@ -/* Copyright 2017 Cole Markham, WoodKeys.click - * - * 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 "meira.h" diff --git a/keyboards/meira/featherble/featherble.h b/keyboards/meira/featherble/featherble.h deleted file mode 100644 index eab7c639b9..0000000000 --- a/keyboards/meira/featherble/featherble.h +++ /dev/null @@ -1,19 +0,0 @@ -/* Copyright 2017 Cole Markham, WoodKeys.click - * - * 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 . - */ - -#pragma once - -#include "meira.h" diff --git a/keyboards/meira/featherble/rules.mk b/keyboards/meira/featherble/rules.mk deleted file mode 100644 index 01f1af1ae8..0000000000 --- a/keyboards/meira/featherble/rules.mk +++ /dev/null @@ -1,5 +0,0 @@ -# Processor frequency -F_CPU = 8000000 - -BLUETOOTH_ENABLE = yes -BLUETOOTH_DRIVER = BluefruitLE diff --git a/keyboards/meira/info.json b/keyboards/meira/info.json deleted file mode 100644 index de9ce42f8e..0000000000 --- a/keyboards/meira/info.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "keyboard_name": "Meira", - "url": "", - "maintainer": "colemarkham", - "layout_aliases": { - "LAYOUT": "LAYOUT_ortho_4x12" - }, - "layouts": { - "LAYOUT_ortho_4x12": { - "layout": [ - {"x":0, "y":0}, - {"x":1, "y":0}, - {"x":2, "y":0}, - {"x":3, "y":0}, - {"x":4, "y":0}, - {"x":5, "y":0}, - {"x":6, "y":0}, - {"x":7, "y":0}, - {"x":8, "y":0}, - {"x":9, "y":0}, - {"x":10, "y":0}, - {"x":11, "y":0}, - - {"x":0, "y":1}, - {"x":1, "y":1}, - {"x":2, "y":1}, - {"x":3, "y":1}, - {"x":4, "y":1}, - {"x":5, "y":1}, - {"x":6, "y":1}, - {"x":7, "y":1}, - {"x":8, "y":1}, - {"x":9, "y":1}, - {"x":10, "y":1}, - {"x":11, "y":1}, - - {"x":0, "y":2}, - {"x":1, "y":2}, - {"x":2, "y":2}, - {"x":3, "y":2}, - {"x":4, "y":2}, - {"x":5, "y":2}, - {"x":6, "y":2}, - {"x":7, "y":2}, - {"x":8, "y":2}, - {"x":9, "y":2}, - {"x":10, "y":2}, - {"x":11, "y":2}, - - {"x":0, "y":3}, - {"x":1, "y":3}, - {"x":2, "y":3}, - {"x":3, "y":3}, - {"x":4, "y":3}, - {"x":5, "y":3}, - {"x":6, "y":3}, - {"x":7, "y":3}, - {"x":8, "y":3}, - {"x":9, "y":3}, - {"x":10, "y":3}, - {"x":11, "y":3} - ] - } - } -} diff --git a/keyboards/meira/issi.c b/keyboards/meira/issi.c deleted file mode 100755 index 600a465ba3..0000000000 --- a/keyboards/meira/issi.c +++ /dev/null @@ -1,286 +0,0 @@ -#ifdef ISSI_ENABLE - -#include -#include -#include -#include -#include -#include -#include "issi.h" -#include "print.h" -#include "TWIlib.h" - -#define ISSI_ADDR_DEFAULT 0xE8 - -#define ISSI_REG_CONFIG 0x00 -#define ISSI_REG_CONFIG_PICTUREMODE 0x00 -#define ISSI_REG_CONFIG_AUTOPLAYMODE 0x08 - -#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' -uint8_t control[8][9] = { - {0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0}, -}; -ISSIDeviceStruct *issi_devices[4] = {0, 0, 0, 0}; - -#ifndef cbi -#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) -#endif - -#ifndef sbi -#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) -#endif - -#define I2C_WRITE 0 -#define F_SCL 400000UL // SCL frequency -#define Prescaler 1 -#define TWBR_val ((((F_CPU / F_SCL) / Prescaler) - 16 ) / 2) - -uint8_t i2c_start(uint8_t address) -{ - // reset TWI control register - TWCR = 0; - // transmit START condition - TWCR = (1<> 1; -// uint8_t control_reg = (y << 1) | (matrix & 0x01); -// uint8_t pwm_reg = 0; -// switch(matrix & 0x01){ -// case 0: -// pwm_reg = 0x24; -// break; -// case 1: -// pwm_reg = 0x2C; -// break; -// } -// pwm_reg += (y << 4) + x; -// xprintf(" device: %02X\n", device); -// xprintf(" control: %02X %02X\n", control_reg, control[matrix][y]); -// xprintf(" pwm: %02X %02X\n", pwm_reg, pwm); -// writeRegister8(device, 0, control_reg, control[matrix][y]); -// writeRegister8(device, 0, control_reg + 0x12, control[matrix][y]); -// writeRegister8(device, 0, pwm_reg, pwm); -// } - -void activateLED(uint8_t matrix, uint8_t cx, uint8_t cy, uint8_t pwm) -{ - uint8_t device_addr = (matrix & 0x06) >> 1; - ISSIDeviceStruct *device = issi_devices[device_addr]; - if(device == 0){ - return; - } - // xprintf("activeLED: %02X %02X %02X %02X\n", matrix, cy, cx, pwm); - uint8_t x = cx - 1; // funciton takes 1 based counts, but we need 0... - uint8_t y = cy - 1; // creating them once for less confusion - uint8_t control_reg = (y << 1) | (matrix & 0x01); - if(pwm == 0){ - cbi(device->led_ctrl[control_reg], x); - cbi(device->led_blink_ctrl[control_reg], x); - }else{ - sbi(device->led_ctrl[control_reg], x); - sbi(device->led_blink_ctrl[control_reg], x); - } - uint8_t pwm_reg = 0; - switch(matrix & 0x01){ - case 0: - pwm_reg = 0x00; - break; - case 1: - pwm_reg = 0x08; - break; - } - pwm_reg += (y << 4) + x; - // xprintf(" device_addr: %02X\n", device_addr); - // xprintf(" control: %02X %02X\n", control_reg, control[matrix][y]); - // xprintf(" pwm: %02X %02X\n", pwm_reg, pwm); - // writeRegister8(device_addr, 0, control_reg, control[matrix][y]); - device->led_pwm[pwm_reg] = pwm; - device->led_dirty = 1; - - // writeRegister8(device_addr, 0, control_reg + 0x12, control[matrix][y]); - // writeRegister8(device_addr, 0, pwm_reg, pwm); -} - -void update_issi(uint8_t device_addr, uint8_t blocking) -{ - // This seems to take about 6ms - ISSIDeviceStruct *device = issi_devices[device_addr]; - if(device != 0){ - if(device->fn_dirty){ - device->fn_dirty = 0; - setFrame(device_addr, ISSI_BANK_FUNCTIONREG); - TWITransmitData(&device->fn_device_addr, sizeof(device->fn_registers) + 2, 0, 1); - } - if(device->led_dirty){ - device->led_dirty = 0; - setFrame(device_addr, 0); - TWITransmitData(&device->led_device_addr, 0xB6, 0, blocking); - } - } -} - -void issi_init(void) -{ - // Set LED_EN/SDB high to enable the chip - xprintf("Enabing SDB on pin: %d\n", LED_EN_PIN); - _SFR_IO8((LED_EN_PIN >> 4) + 1) &= ~_BV(LED_EN_PIN & 0xF); // IN - _SFR_IO8((LED_EN_PIN >> 4) + 2) |= _BV(LED_EN_PIN & 0xF); // HI - TWIInit(); - for(uint8_t device_addr = 0; device_addr < 4; device_addr++){ - xprintf("ISSI Init device: %d\n", device_addr); - // If this device has been previously allocated, free it - if(issi_devices[device_addr] != 0){ - free(issi_devices[device_addr]); - } - // Try to shutdown the device, if this fails skip this device - writeRegister8(device_addr, ISSI_BANK_FUNCTIONREG, ISSI_REG_SHUTDOWN, 0x00); - while (!isTWIReady()){_delay_us(1);} - if(TWIInfo.errorCode != 0xFF){ - xprintf("ISSI init failed %d %02X %02X\n", device_addr, TWIInfo.mode, TWIInfo.errorCode); - continue; - } - // Allocate the device structure - calloc zeros it for us - ISSIDeviceStruct *device = (ISSIDeviceStruct *)calloc(sizeof(ISSIDeviceStruct) * 2, 1); - issi_devices[device_addr] = device; - device->fn_device_addr = ISSI_ADDR_DEFAULT | device_addr << 1; - device->fn_register_addr = 0; - device->led_device_addr = ISSI_ADDR_DEFAULT | device_addr << 1; - device->led_register_addr = 0; - // set dirty bits so that all of the buffered data is written out - device->fn_dirty = 1; - device->led_dirty = 1; - update_issi(device_addr, 1); - // Set the function register to picture mode - // device->fn_reg[ISSI_REG_CONFIG] = ISSI_REG_CONFIG_PICTUREMODE; - writeRegister8(device_addr, ISSI_BANK_FUNCTIONREG, ISSI_REG_SHUTDOWN, 0x01); - } - - // Shutdown and set all registers to 0 - // writeRegister8(device_addr, ISSI_BANK_FUNCTIONREG, ISSI_REG_SHUTDOWN, 0x00); - // for(uint8_t bank = 0; bank <= 7; bank++){ - // for (uint8_t reg = 0x00; reg <= 0xB3; reg++) { - // writeRegister8(device_addr, bank, reg, 0x00); - // } - // } - // for (uint8_t reg = 0; reg <= 0x0C; reg++) { - // writeRegister8(device_addr, ISSI_BANK_FUNCTIONREG, reg, 0x00); - // } - // writeRegister8(device_addr, ISSI_BANK_FUNCTIONREG, ISSI_REG_CONFIG, ISSI_REG_CONFIG_PICTUREMODE); - // writeRegister8(device_addr, ISSI_BANK_FUNCTIONREG, ISSI_REG_SHUTDOWN, 0x01); - // picture mode - // writeRegister8(ISSI_BANK_FUNCTIONREG, 0x01, 0x01); - - //Enable blink - // writeRegister8(ISSI_BANK_FUNCTIONREG, 0x05, 0x48B); - - //Enable Breath - -} - -#endif diff --git a/keyboards/meira/issi.h b/keyboards/meira/issi.h deleted file mode 100755 index 74379ddbc8..0000000000 --- a/keyboards/meira/issi.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#ifdef ISSI_ENABLE - -typedef struct ISSIDeviceStruct{ - uint8_t fn_dirty; // function registers need to be resent - uint8_t fn_device_addr; - uint8_t fn_register_addr; - uint8_t fn_registers[13]; - uint8_t led_dirty; // LED data has changed and needs to be resent - uint8_t led_device_addr; - uint8_t led_register_addr; - uint8_t led_ctrl[18]; - uint8_t led_blink_ctrl[18]; - uint8_t led_pwm[144]; -}ISSIDeviceStruct; - -extern ISSIDeviceStruct *issi_devices[]; - -// Low level commands- 'device' is the 2-bit i2c id. -void issi_init(void); -void set_shutdown(uint8_t device, uint8_t shutdown); -void writeRegister8(uint8_t device, uint8_t frame, uint8_t reg, uint8_t data); - -// Higher level, no device is given, but it is calculated from 'matrix' -// Each device has 2 blocks, max of 4 devices: -// Device | Block = Matrix -// 0 A 0 -// 0 B 1 -// 1 A 2 -// 1 B 3 -// 2 A 4 -// 2 B 5 -// 3 A 6 -// 3 B 7 -void activateLED(uint8_t matrix, uint8_t cx, uint8_t cy, uint8_t pwm); -void update_issi(uint8_t device_addr, uint8_t blocking); - -#endif diff --git a/keyboards/meira/keymaps/cole/config.h b/keyboards/meira/keymaps/cole/config.h deleted file mode 100644 index 90c490e836..0000000000 --- a/keyboards/meira/keymaps/cole/config.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright 2017 Cole Markham, WoodKeys.click - * - * 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_USER_H -#define CONFIG_USER_H - -#include "../../config.h" - -// place overrides here -#define MUSIC_MASK (keycode != KC_NO) -#ifdef AUDIO_ENABLE - #define STARTUP_SONG SONG(IMPERIAL_MARCH) - // Disable music mode to keep the firmware size down - #define NO_MUSIC_MODE - -#endif - -#endif diff --git a/keyboards/meira/keymaps/cole/keymap.c b/keyboards/meira/keymaps/cole/keymap.c deleted file mode 100644 index 94806c5da2..0000000000 --- a/keyboards/meira/keymaps/cole/keymap.c +++ /dev/null @@ -1,225 +0,0 @@ -/* Copyright 2017 Cole Markham - * - * 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 "meira.h" -#include "lighting.h" - -#ifdef RGBLIGHT_ENABLE -//Following line allows macro to read current RGB settings -extern rgblight_config_t rgblight_config; -#endif - -#define _QWERTY 0 -#define _COLEMAK 1 -#define _DVORAK 2 -#define _LOWER 3 -#define _RAISE 4 -#define _ADJUST 16 - - -#ifndef BLUETOOTH_ENABLE -#define OUT_BT KC_TRNS -#endif - -enum custom_keycodes { - QWERTY = SAFE_RANGE, - LOWER, - RAISE, - ADJUST, -}; - -// define variables for reactive RGB -bool TOG_STATUS = false; -int RGB_current_mode; - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* Qwerty - * ,-----------------------------------------------------------------------------------. - * | Esc | Q | W | E | R | T | Y | U | I | O | P | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Tab | A | S | D | F | G | H | J | K | L | ; | ' | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * |Adjust| Ctrl | Ctrl | Alt |Lower | Cmd |Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ - [_QWERTY] = LAYOUT( \ - KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ - KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, \ - ADJUST, KC_LCTL, KC_LALT, KC_LALT, LOWER, KC_LGUI, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ - ), - - /* Lower - * ,-----------------------------------------------------------------------------------. - * | | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | ~ | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | | \ | | | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | Next | Vol- | Vol+ | Play | - * `-----------------------------------------------------------------------------------' - */ - [_LOWER] = LAYOUT( \ - _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \ - KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ - _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, KC_QUOT, \ - _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END \ - ), - - /* Raise - * ,-----------------------------------------------------------------------------------. - * | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | ` | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | Home | PgUp | PgDn | End | - * `-----------------------------------------------------------------------------------' - */ - [_RAISE] = LAYOUT( \ - _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \ - KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ - _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END \ - ), - - /* Adjust (Lower + Raise) - * ,-----------------------------------------------------------------------------------. - * | | Reset| | | | | | | | | | Del | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | | | | | | | | | | | | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | | | | | - * `-----------------------------------------------------------------------------------' - */ - [_ADJUST] = LAYOUT( \ - RESET, _______, _______, KC_MRWD, KC_MPLY, KC_MFFD, KC_PSCR, _______, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, \ - BL_STEP, RGB_MOD, _______, AU_ON, AU_OFF, _______, _______, _______, _______, _______, _______, _______, \ - BL_TOGG, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, KC_PSCR, _______, _______, _______, _______, _______, _______, _______, OUT_AUTO, OUT_USB, OUT_BT \ - ) -}; - -// Setting ADJUST layer RGB back to default -void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { - if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { -#ifdef RGBLIGHT_ENABLE - rgblight_mode(RGB_current_mode); -#endif - layer_on(layer3); - } else { - layer_off(layer3); - } -} - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case LOWER: - if (record->event.pressed) { - //not sure how to have keyboard check mode and set it to a variable, so my work around - //uses another variable that would be set to true after the first time a reactive key is pressed. - if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false - } else { - TOG_STATUS = !TOG_STATUS; -#ifdef RGBLIGHT_ENABLE - rgblight_mode(16); -#endif - } - layer_on(_LOWER); - update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); - } else { -#ifdef RGBLIGHT_ENABLE - rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change -#endif - TOG_STATUS = false; - layer_off(_LOWER); - update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); - } - return false; - break; - case RAISE: - if (record->event.pressed) { - //not sure how to have keyboard check mode and set it to a variable, so my work around - //uses another variable that would be set to true after the first time a reactive key is pressed. - if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false - } else { - TOG_STATUS = !TOG_STATUS; -#ifdef RGBLIGHT_ENABLE - rgblight_mode(15); -#endif - } - layer_on(_RAISE); - update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); - } else { -#ifdef RGBLIGHT_ENABLE - rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change -#endif - layer_off(_RAISE); - TOG_STATUS = false; - update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); - } - return false; - break; - case ADJUST: - // FIXME add RGB feedback - if (record->event.pressed) { - layer_on(_ADJUST); - } else { - layer_off(_ADJUST); - } - return false; - break; - case BL_TOGG: -#ifdef BACKLIGHT_ENABLE - if (record->event.pressed) { - print("Enabling backlight\n"); - backlight_init_ports(); - } -#endif - return false; - break; - case BL_STEP: - if (record->event.pressed) { -#ifdef BACKLIGHT_ENABLE - backlight_step(); -#endif - - } - return false; - break; - //led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released -#ifdef RGBLIGHT_ENABLE - case RGB_MOD: - if (record->event.pressed) { - rgblight_mode(RGB_current_mode); - rgblight_step(); - RGB_current_mode = rgblight_config.mode; - } - return false; - break; -#endif - } - return true; -} - -void led_set_user(uint8_t usb_led) { - -} diff --git a/keyboards/meira/keymaps/cole/readme.md b/keyboards/meira/keymaps/cole/readme.md deleted file mode 100644 index be84048813..0000000000 --- a/keyboards/meira/keymaps/cole/readme.md +++ /dev/null @@ -1 +0,0 @@ -# The default keymap for meira diff --git a/keyboards/meira/keymaps/cole/rules.mk b/keyboards/meira/keymaps/cole/rules.mk deleted file mode 100644 index 8f8d53e57a..0000000000 --- a/keyboards/meira/keymaps/cole/rules.mk +++ /dev/null @@ -1,2 +0,0 @@ -AUDIO_ENABLE = yes # Audio output on port C6 -EXTRAFLAGS+=-flto # -4-7k \ No newline at end of file diff --git a/keyboards/meira/keymaps/default/config.h b/keyboards/meira/keymaps/default/config.h deleted file mode 100644 index e3776d2eff..0000000000 --- a/keyboards/meira/keymaps/default/config.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright 2017 Cole Markham, WoodKeys.click - * - * 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 . - */ - -#pragma once - -// place overrides here - -// place overrides here -#define MUSIC_MASK (keycode != KC_NO) -#ifdef AUDIO_ENABLE - #define STARTUP_SONG SONG(PLANCK_SOUND) - // #define STARTUP_SONG SONG(NO_SOUND) - - #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ - SONG(COLEMAK_SOUND), \ - SONG(DVORAK_SOUND) \ - } -#endif diff --git a/keyboards/meira/keymaps/default/keymap.c b/keyboards/meira/keymaps/default/keymap.c deleted file mode 100644 index dacf848cf1..0000000000 --- a/keyboards/meira/keymaps/default/keymap.c +++ /dev/null @@ -1,299 +0,0 @@ -/* Copyright 2017 Cole Markham - * - * 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 QMK_KEYBOARD_H -#include "lighting.h" - -#ifdef RGBLIGHT_ENABLE -// Following line allows macro to read current RGB settings -extern rgblight_config_t rgblight_config; -#endif - -enum layer_names { - _QWERTY, - _COLEMAK, - _DVORAK, - _LOWER, - _RAISE, - _ADJUST -}; - -enum custom_keycodes { - QWERTY = SAFE_RANGE, - COLEMAK, - DVORAK, - LOWER, - RAISE, - ADJUST -}; - -#ifdef AUDIO_ENABLE - -float tone_my_startup[][2] = SONG(ODE_TO_JOY); -float tone_my_goodbye[][2] = SONG(ROCK_A_BYE_BABY); - -float tone_qwerty[][2] = SONG(QWERTY_SOUND); -float tone_dvorak[][2] = SONG(DVORAK_SOUND); -float tone_colemak[][2] = SONG(COLEMAK_SOUND); - -#endif /* AUDIO_ENABLE */ - -// define variables for reactive RGB -bool TOG_STATUS = false; -int RGB_current_mode; - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* Qwerty - * ,-----------------------------------------------------------------------------------. - * | Esc | Q | W | E | R | T | Y | U | I | O | P | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Tab | A | S | D | F | G | H | J | K | L | ; | ' | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * |Adjust| Ctrl | Alt | Alt |Lower | Cmd |Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ - [_QWERTY] = LAYOUT( - KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, - KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, - ADJUST, KC_LCTL, KC_LALT, KC_LALT, LOWER, KC_LGUI, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT - ), - - /* Colemak - * ,-----------------------------------------------------------------------------------. - * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Esc | A | R | S | T | D | H | N | E | I | O | " | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ - [_COLEMAK] = LAYOUT( - KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, - KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, - ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT - ), - - /* Dvorak - * ,-----------------------------------------------------------------------------------. - * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Esc | A | O | E | U | I | D | H | T | N | S | / | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ - [_DVORAK] = LAYOUT( - KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, - KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, - KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT, - ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT - ), - - /* Lower - * ,-----------------------------------------------------------------------------------. - * | | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | ~ | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | | \ | | | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | | Next | Vol- | Vol+ | Play | - * `-----------------------------------------------------------------------------------' - */ - [_LOWER] = LAYOUT( - _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, - KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, - _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), _______, _______, KC_QUOT, - _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END - ), - - /* Raise - * ,-----------------------------------------------------------------------------------. - * | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | ` | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | | Home | PgUp | PgDn | End | - * `-----------------------------------------------------------------------------------' - */ - [_RAISE] = LAYOUT( - _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, - KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, - _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END - ), - - /* Adjust (Lower + Raise) - * ,-----------------------------------------------------------------------------------. - * | | Reset| | | | | | | | | | Del | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | | | | | | | | | | | | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | | | | | | - * `-----------------------------------------------------------------------------------' - */ - [_ADJUST] = LAYOUT( - BL_TOGG, RESET, _______, KC_MRWD, KC_MPLY, KC_MFFD, KC_PSCR, _______, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, - BL_STEP, RGB_MOD, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, KC_PSCR, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ - ) -}; - -// Setting ADJUST layer RGB back to default -void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { - if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { -#ifdef RGBLIGHT_ENABLE - rgblight_mode(RGB_current_mode); -#endif - layer_on(layer3); - } else { - layer_off(layer3); - } -} - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case QWERTY: - if (record->event.pressed) { -#ifdef AUDIO_ENABLE - PLAY_SONG(tone_qwerty); -#endif - // persistent_default_layer_set(1UL<<_QWERTY); - } - return false; - break; - case COLEMAK: - if (record->event.pressed) { -#ifdef AUDIO_ENABLE - PLAY_SONG(tone_colemak); -#endif - // persistent_default_layer_set(1UL<<_COLEMAK); - } - return false; - break; - case DVORAK: - if (record->event.pressed) { -#ifdef AUDIO_ENABLE - PLAY_SONG(tone_dvorak); -#endif - // persistent_default_layer_set(1UL<<_DVORAK); - } - return false; - break; - case LOWER: - if (record->event.pressed) { - // not sure how to have keyboard check mode and set it to a variable, so my work around - // uses another variable that would be set to true after the first time a reactive key is pressed. - if (TOG_STATUS) { // TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false - } else { - TOG_STATUS = !TOG_STATUS; -#ifdef RGBLIGHT_ENABLE - rgblight_mode(16); -#endif - } - layer_on(_LOWER); - update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); - } else { -#ifdef RGBLIGHT_ENABLE - rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change -#endif - TOG_STATUS = false; - layer_off(_LOWER); - update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); - } - return false; - break; - case RAISE: - if (record->event.pressed) { - // not sure how to have keyboard check mode and set it to a variable, so my work around - // uses another variable that would be set to true after the first time a reactive key is pressed. - if (TOG_STATUS) { // TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false - } else { - TOG_STATUS = !TOG_STATUS; -#ifdef RGBLIGHT_ENABLE - rgblight_mode(15); -#endif - } - layer_on(_RAISE); - update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); - } else { -#ifdef RGBLIGHT_ENABLE - rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change -#endif - layer_off(_RAISE); - TOG_STATUS = false; - update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); - } - return false; - break; - case ADJUST: - // FIXME add RGB feedback - if (record->event.pressed) { - layer_on(_ADJUST); - } else { - layer_off(_ADJUST); - } - return false; - break; - case BL_TOGG: -#ifdef BACKLIGHT_ENABLE - if (record->event.pressed) { - print("Enabling backlight\n"); - backlight_init_ports(); - } -#endif - return false; - break; - case BL_STEP: - if (record->event.pressed) { - print("Stepping backlight\n"); -#ifdef BACKLIGHT_ENABLE - print("Really stepping backlight\n"); - backlight_step(); -#endif - } - return false; - break; - // led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released -#ifdef RGBLIGHT_ENABLE - case RGB_MOD: - if (record->event.pressed) { - rgblight_mode(RGB_current_mode); - rgblight_step(); - RGB_current_mode = rgblight_con