diff options
author | peepeetee <43021794+peepeetee@users.noreply.github.com> | 2022-02-06 13:16:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-05 21:16:21 -0800 |
commit | 38e085df87820941bcfcdce3b3bc16e46855f557 (patch) | |
tree | cf0d99e0b6a4f3780d35e079d555e31b7a6d002d /keyboards/k_type | |
parent | 10fa737ab879fea7cdb03b393d1efbcb28a4a12f (diff) |
move input club keyboards into vendor folder (#15788)
Diffstat (limited to 'keyboards/k_type')
-rw-r--r-- | keyboards/k_type/chconf.h | 29 | ||||
-rw-r--r-- | keyboards/k_type/config.h | 186 | ||||
-rw-r--r-- | keyboards/k_type/halconf.h | 27 | ||||
-rw-r--r-- | keyboards/k_type/i2c_master.c | 150 | ||||
-rw-r--r-- | keyboards/k_type/i2c_master.h | 127 | ||||
-rw-r--r-- | keyboards/k_type/info.json | 108 | ||||
-rw-r--r-- | keyboards/k_type/is31fl3733-dual.c | 236 | ||||
-rw-r--r-- | keyboards/k_type/is31fl3733-dual.h | 252 | ||||
-rw-r--r-- | keyboards/k_type/k_type-rgbdriver.c | 57 | ||||
-rw-r--r-- | keyboards/k_type/k_type.c | 235 | ||||
-rw-r--r-- | keyboards/k_type/k_type.h | 42 | ||||
-rw-r--r-- | keyboards/k_type/keymaps/andrew-fahmy/config.h | 52 | ||||
-rw-r--r-- | keyboards/k_type/keymaps/andrew-fahmy/keymap.c | 60 | ||||
-rw-r--r-- | keyboards/k_type/keymaps/andrew-fahmy/rules.mk | 1 | ||||
-rw-r--r-- | keyboards/k_type/keymaps/belak/keymap.c | 27 | ||||
-rw-r--r-- | keyboards/k_type/keymaps/default/keymap.c | 22 | ||||
-rw-r--r-- | keyboards/k_type/keymaps/default/rules.mk | 1 | ||||
-rw-r--r-- | keyboards/k_type/mcuconf.h | 57 | ||||
-rw-r--r-- | keyboards/k_type/readme.md | 17 | ||||
-rw-r--r-- | keyboards/k_type/rules.mk | 38 |
20 files changed, 0 insertions, 1724 deletions
diff --git a/keyboards/k_type/chconf.h b/keyboards/k_type/chconf.h deleted file mode 100644 index ae0cce51ed..0000000000 --- a/keyboards/k_type/chconf.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright 2020 QMK - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/* - * This file was auto-generated by: - * `qmk chibios-confmigrate -i keyboards/k_type/chconf.h -r platforms/chibios/common/configs/chconf.h` - */ - -#pragma once - -#define CH_CFG_ST_TIMEDELTA 0 - -#define CH_CFG_TIME_QUANTUM 20 - -#include_next <chconf.h> - diff --git a/keyboards/k_type/config.h b/keyboards/k_type/config.h deleted file mode 100644 index de73e06a98..0000000000 --- a/keyboards/k_type/config.h +++ /dev/null @@ -1,186 +0,0 @@ -/* -Copyright 2015 Jun Wako <wakojun@gmail.com> - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#pragma once - -/* USB Device descriptor parameter */ -#define VENDOR_ID 0x1C11 -#define PRODUCT_ID 0xB04D -#define DEVICE_VER 0x0001 -#define MANUFACTURER Input:Club -#define PRODUCT K-Type (QMK) - -/* key matrix size */ -#define MATRIX_ROWS 10 -#define MATRIX_COLS 10 - -/* - * 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 { D5, D6, D7, C1, C2, C3, C4, C5, C6, C7 } -#define MATRIX_COL_PINS { B2, B3, B18, B19, C0, C8, C9, D0, D1, D4 } -#define UNUSED_PINS - -/* COL2ROW, ROW2COL */ -#define DIODE_DIRECTION COL2ROW - -/* 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 - -/* 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 - -/* If defined, GRAVE_ESC will always act as ESC when CTRL is held. - * This is useful for the Windows task manager shortcut (ctrl+shift+esc). - */ -//#define GRAVE_ESC_CTRL_OVERRIDE - -/* - * 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 - -/* disable these deprecated features by default */ -#define NO_ACTION_MACRO -#define NO_ACTION_FUNCTION - -/* Bootmagic Lite key configuration */ -//#define BOOTMAGIC_LITE_ROW 0 -//#define BOOTMAGIC_LITE_COLUMN 0 - - -#ifdef RGB_MATRIX_ENABLE -//#include "gpio.h" -// RGB Matrix Animation modes. Explicitly enabled -// For full list of effects, see: -// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects -# define ENABLE_RGB_MATRIX_ALPHAS_MODS -# define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN -# define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT -# define ENABLE_RGB_MATRIX_BREATHING -# define ENABLE_RGB_MATRIX_BAND_SAT -# define ENABLE_RGB_MATRIX_BAND_VAL -# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT -# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL -# define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT -# define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL -# define ENABLE_RGB_MATRIX_CYCLE_ALL -# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT -# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN -# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON -# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN -# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL -# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL -# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL -# define ENABLE_RGB_MATRIX_DUAL_BEACON -# define ENABLE_RGB_MATRIX_RAINBOW_BEACON -# define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS -# define ENABLE_RGB_MATRIX_RAINDROPS -# define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS -# define ENABLE_RGB_MATRIX_HUE_BREATHING -# define ENABLE_RGB_MATRIX_HUE_PENDULUM -# define ENABLE_RGB_MATRIX_HUE_WAVE -# define ENABLE_RGB_MATRIX_PIXEL_RAIN -# define ENABLE_RGB_MATRIX_PIXEL_FLOW -# define ENABLE_RGB_MATRIX_PIXEL_FRACTAL -// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined -# define ENABLE_RGB_MATRIX_TYPING_HEATMAP -# define ENABLE_RGB_MATRIX_DIGITAL_RAIN -// enabled only if RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is defined -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS -# define ENABLE_RGB_MATRIX_SPLASH -# define ENABLE_RGB_MATRIX_MULTISPLASH -# define ENABLE_RGB_MATRIX_SOLID_SPLASH -# define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH - -# define RGB_MATRIX_KEYPRESSES -# define RGB_MATRIX_FRAMEBUFFER_EFFECTS - - -// i2c_master defines -# define I2C_COUNT 2 -# define I2C1_CLOCK_SPEED 400000 - -# define I2C1_SCL_PIN B0 // A2 on pinout = B0 -# define I2C1_SDA_PIN B1 // A2 on pinout = B1 -# define I2C1_SCL_PAL_MODE PAL_MODE_ALTERNATIVE_2 -# define I2C1_SDA_PAL_MODE PAL_MODE_ALTERNATIVE_2 - -# define USE_I2C2 -# define I2C2_SCL_PIN C10 // A2 on pinout = C10 -# define I2C2_SDA_PIN C11 // A2 on pinout = C11 -# define I2C2_SCL_PAL_MODE PAL_MODE_ALTERNATIVE_2 -# define I2C2_SDA_PAL_MODE PAL_MODE_ALTERNATIVE_2 - -# define DRIVER_ADDR_1 0b1010000 -# define DRIVER_ADDR_2 0b1010000 -# define DRIVER_COUNT 2 -# define DRIVER_1_LED_TOTAL 64 -# define DRIVER_2_LED_TOTAL 55 -# define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) -#endif diff --git a/keyboards/k_type/halconf.h b/keyboards/k_type/halconf.h deleted file mode 100644 index c615d9656f..0000000000 --- a/keyboards/k_type/halconf.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright 2020 QMK - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/* - * This file was auto-generated by: - * `qmk chibios-confmigrate -i keyboards/k_type/halconf.h -r platforms/chibios/common/configs/halconf.h` - */ - -#pragma once - -#define HAL_USE_I2C TRUE - -#include_next <halconf.h> - diff --git a/keyboards/k_type/i2c_master.c b/keyboards/k_type/i2c_master.c deleted file mode 100644 index af34d55ef6..0000000000 --- a/keyboards/k_type/i2c_master.c +++ /dev/null @@ -1,150 +0,0 @@ -/* Copyright 2018 Jack Humbert - * Copyright 2018 Yiancar - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/* This library is only valid for STM32 processors. - * This library follows the convention of the AVR i2c_master library. - * As a result addresses are expected to be already shifted (addr << 1). - * I2CD1 is the default driver which corresponds to pins B6 and B7. This - * can be changed. - * Please ensure that HAL_USE_I2C is TRUE in the halconf.h file and that - * STM32_I2C_USE_I2C1 is TRUE in the mcuconf.h file. Pins B6 and B7 are used - * but using any other I2C pins should be trivial. - */ - -#ifdef RGB_MATRIX_ENABLE - - -#include "quantum.h" -#include "i2c_master.h" -#include <string.h> -#include <hal.h> - -static uint8_t i2c_address; - -I2CDriver *drivers[I2C_COUNT]; - -static const I2CConfig i2cconfig = { -#if defined(USE_I2CV1_CONTRIB) - I2C1_CLOCK_SPEED, -#elif defined(USE_I2CV1) - I2C1_OPMODE, - I2C1_CLOCK_SPEED, - I2C1_DUTY_CYCLE, -#else - // This configures the I2C clock to 400khz assuming a 72Mhz clock - // For more info : https://www.st.com/en/embedded-software/stsw-stm32126.html - STM32_TIMINGR_PRESC(I2C1_TIMINGR_PRESC) | STM32_TIMINGR_SCLDEL(I2C1_TIMINGR_SCLDEL) | STM32_TIMINGR_SDADEL(I2C1_TIMINGR_SDADEL) | STM32_TIMINGR_SCLH(I2C1_TIMINGR_SCLH) | STM32_TIMINGR_SCLL(I2C1_TIMINGR_SCLL), 0, 0 -#endif -}; - -static i2c_status_t chibios_to_qmk(const msg_t* status) { - switch (*status) { - case I2C_NO_ERROR: - return I2C_STATUS_SUCCESS; - case I2C_TIMEOUT: - return I2C_STATUS_TIMEOUT; - // I2C_BUS_ERROR, I2C_ARBITRATION_LOST, I2C_ACK_FAILURE, I2C_OVERRUN, I2C_PEC_ERROR, I2C_SMB_ALERT - default: - return I2C_STATUS_ERROR; - } -} - -__attribute__((weak)) void i2c_init(I2CDriver *driver, ioline_t scl_pin, ioline_t sda_pin) { - static uint8_t index = 0; - if (index < I2C_COUNT) { - - // Try releasing special pins for a short time - palSetLineMode(scl_pin, PAL_MODE_INPUT); - palSetLineMode(sda_pin, PAL_MODE_INPUT); - - chThdSleepMilliseconds(10); - -#if defined(USE_GPIOV1) - palSetLineMode(scl_pin, I2C1_SCL_PAL_MODE); - palSetLineMode(sda_pin, I2C1_SDA_PAL_MODE); -#else - palSetLineMode(scl_pin, PAL_MODE_ALTERNATE(I2C1_SCL_PAL_MODE) | PAL_OUTPUT_TYPE_OPENDRAIN); - palSetLineMode(sda_pin, PAL_MODE_ALTERNATE(I2C1_SDA_PAL_MODE) | PAL_OUTPUT_TYPE_OPENDRAIN); -#endif - - drivers[index++] = driver; - } -} - -i2c_status_t i2c_start(uint8_t index, uint8_t address) { - if(index >= I2C_COUNT) { - return I2C_STATUS_ERROR; - } - i2c_address = address; - i2cStart(drivers[index], &i2cconfig); - return I2C_STATUS_SUCCESS; -} - -i2c_status_t i2c_transmit(uint8_t index, uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout) { - if(index >= I2C_COUNT) { - return I2C_STATUS_ERROR; - } - i2c_address = address; - i2cStart(drivers[index], &i2cconfig); - msg_t status = i2cMasterTransmitTimeout(drivers[index], (i2c_address >> 1), data, length, 0, 0, TIME_MS2I(timeout)); - return chibios_to_qmk(&status); -} - -i2c_status_t i2c_receive(uint8_t index, uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout) { - if(index >= I2C_COUNT) { - return I2C_STATUS_ERROR; - } - i2c_address = address; - i2cStart(drivers[index], &i2cconfig); - msg_t status = i2cMasterReceiveTimeout(drivers[index], (i2c_address >> 1), data, length, TIME_MS2I(timeout)); - return chibios_to_qmk(&status); -} - -i2c_status_t i2c_writeReg(uint8_t index, uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout) { - if(index >= I2C_COUNT) { - return I2C_STATUS_ERROR; - } - i2c_address = devaddr; - i2cStart(drivers[index], &i2cconfig); - - uint8_t complete_packet[length + 1]; - for (uint8_t i = 0; i < length; i++) { - complete_packet[i + 1] = data[i]; - } - complete_packet[0] = regaddr; - - msg_t status = i2cMasterTransmitTimeout(drivers[index], (i2c_address >> 1), complete_packet, length + 1, 0, 0, TIME_MS2I(timeout)); - return chibios_to_qmk(&status); -} - -i2c_status_t i2c_readReg(uint8_t index, uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout) { - if(index >= I2C_COUNT) { - return I2C_STATUS_ERROR; - } - i2c_address = devaddr; - i2cStart(drivers[index], &i2cconfig); - msg_t status = i2cMasterTransmitTimeout(drivers[index], (i2c_address >> 1), ®addr, 1, data, length, TIME_MS2I(timeout)); - return chibios_to_qmk(&status); -} - -void i2c_stop(uint8_t index) { - if(index < I2C_COUNT) { - i2cStop(drivers[index]); - } -} - -#endif diff --git a/keyboards/k_type/i2c_master.h b/keyboards/k_type/i2c_master.h deleted file mode 100644 index d4e9d6878f..0000000000 --- a/keyboards/k_type/i2c_master.h +++ /dev/null @@ -1,127 +0,0 @@ -/* Copyright 2018 Jack Humbert - * Copyright 2018 Yiancar - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/* This library follows the convention of the AVR i2c_master library. - * As a result addresses are expected to be already shifted (addr << 1). - * I2CD1 is the default driver which corresponds to pins B6 and B7. This - * can be changed. - * Please ensure that HAL_USE_I2C is TRUE in the halconf.h file and that - * STM32_I2C_USE_I2C1 is TRUE in the mcuconf.h file. - */ -#pragma once - -#include <ch.h> -#include <hal.h> - -#ifndef I2C_COUNT -# define I2C_COUNT 1 -#endif - -#ifdef I2C1_BANK -# define I2C1_SCL_BANK I2C1_BANK -# define I2C1_SDA_BANK I2C1_BANK -#endif - -#ifndef I2C1_SCL_BANK -# define I2C1_SCL_BANK GPIOB -#endif - -#ifndef I2C1_SDA_BANK -# define I2C1_SDA_BANK GPIOB -#endif - - -#ifdef USE_I2C2 -# ifdef I2C2_BANK -# define I2C2_SCL_BANK I2C2_BANK -# define I2C2_SDA_BANK I2C2_BANK -# endif -# ifndef I2C2_SCL_BANK -# define I2C2_SCL_BANK GPIOC -# endif -# ifndef I2C2_SDA_BANK -# define I2C2_SDA_BANK GPIOC -# endif -#endif - -#ifndef I2C1_SCL_PIN -# define I2C1_SCL_PIN 6 -#endif -#ifndef I2C1_SDA_PIN -# define I2C1_SDA_PIN 7 -#endif - -#ifdef USE_I2CV1 -# ifndef I2C1_OPMODE -# define I2C1_OPMODE OPMODE_I2C -# endif -# ifndef I2C1_CLOCK_SPEED -# define I2C1_CLOCK_SPEED 100000 /* 400000 */ -# endif -# ifndef I2C1_DUTY_CYCLE -# define I2C1_DUTY_CYCLE STD_DUTY_CYCLE /* FAST_DUTY_CYCLE_2 */ -# endif -#else -// The default timing values below configures the I2C clock to 400khz assuming a 72Mhz clock -// For more info : https://www.st.com/en/embedded-software/stsw-stm32126.html -# ifndef I2C1_TIMINGR_PRESC -# define I2C1_TIMINGR_PRESC 0U -# endif -# ifndef I2C1_TIMINGR_SCLDEL -# define I2C1_TIMINGR_SCLDEL 7U -# endif -# ifndef I2C1_TIMINGR_SDADEL -# define I2C1_TIMINGR_SDADEL 0U -# endif -# ifndef I2C1_TIMINGR_SCLH -# define I2C1_TIMINGR_SCLH 38U -# endif -# ifndef I2C1_TIMINGR_SCLL -# define I2C1_TIMINGR_SCLL 129U -# endif -#endif - -#ifdef USE_GPIOV1 -# ifndef I2C1_SCL_PAL_MODE -# define I2C1_SCL_PAL_MODE PAL_MODE_STM32_ALTERNATE_OPENDRAIN -# endif -# ifndef I2C1_SDA_PAL_MODE -# define I2C1_SDA_PAL_MODE PAL_MODE_STM32_ALTERNATE_OPENDRAIN -# endif -#else -// The default PAL alternate modes are used to signal that the pins are used for I2C -# ifndef I2C1_SCL_PAL_MODE -# define I2C1_SCL_PAL_MODE 4 -# endif -# ifndef I2C1_SDA_PAL_MODE -# define I2C1_SDA_PAL_MODE 4 -# endif -#endif - -typedef int16_t i2c_status_t; - -#define I2C_STATUS_SUCCESS (0) -#define I2C_STATUS_ERROR (-1) -#define I2C_STATUS_TIMEOUT (-2) - -void i2c_init(I2CDriver *driver, ioline_t scl_pin, ioline_t sda_pin); -i2c_status_t i2c_start(uint8_t index, uint8_t address); -i2c_status_t i2c_transmit(uint8_t index, uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout); -i2c_status_t i2c_receive(uint8_t index, uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout); -i2c_status_t i2c_writeReg(uint8_t index, uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout); -i2c_status_t i2c_readReg(uint8_t index, uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout); -void i2c_stop(uint8_t index); diff --git a/keyboards/k_type/info.json b/keyboards/k_type/info.json deleted file mode 100644 index cf0c9253bd..0000000000 --- a/keyboards/k_type/info.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "keyboard_name": "K-Type", - "url": "", - "maintainer": "qmk", - "layouts": { - "LAYOUT_tkl_ansi": { - "layout": [ - {"x": 0, "y": 0}, - {"x": 2, "y": 0}, - {"x": 3, "y": 0}, - {"x": 4, "y": 0}, - {"x": 5, "y": 0}, - {"x": 6.5, "y": 0}, - {"x": 7.5, "y": 0}, - {"x": 8.5, "y": 0}, - {"x": 9.5, "y": 0}, - {"x": 11, "y": 0}, - {"x": 12, "y": 0}, - {"x": 13, "y": 0}, - {"x": 14, "y": 0}, - - {"x": 15.25, "y": 0}, - {"x": 16.25, "y": 0}, - {"x": 17.25, "y": 0}, - - {"x": 0, "y": 1.5}, - {"x": 1, "y": 1.5}, - {"x": 2, "y": 1.5}, - {"x": 3, "y": 1.5}, - {"x": 4, "y": 1.5}, - {"x": 5, "y": 1.5}, - {"x": 6, "y": 1.5}, - {"x": 7, "y": 1.5}, - {"x": 8, "y": 1.5}, - {"x": 9, "y": 1.5}, - {"x": 10, "y": 1.5}, - {"x": 11, "y": 1.5}, - {"x": 12, "y": 1.5}, - {"x": 13, "y": 1.5, "w": 2}, - - {"x": 15.25, "y": 1.5}, - {"x": 16.25, "y": 1.5}, - {"x": 17.25, "y": 1.5}, - - {"x": 0, "y": 2.5, "w": 1.5}, - {"x": 1.5, "y": 2.5}, - {"x": 2.5, "y": 2.5}, - {"x": 3.5, "y": 2.5}, - {"x": 4.5, "y": 2.5}, - {"x": 5.5, "y": 2.5}, - {"x": 6.5, "y": 2.5}, - {"x": 7.5, "y": 2.5}, - {"x": 8.5, "y": 2.5}, - {"x": 9.5, "y": 2.5}, - {"x": 10.5, "y": 2.5}, - {"x": 11.5, "y": 2.5}, - {"x": 12.5, "y": 2.5}, - {"x": 13.5, "y": 2.5, "w": 1.5}, - - {"x": 15.25, "y": 2.5}, - {"x": 16.25, "y": 2.5}, - {"x": 17.25, "y": 2.5}, - - {"x": 0, "y": 3.5, "w": 1.75}, - {"x": 1.75, "y": 3.5}, - {"x": 2.75, "y": 3.5}, - {"x": 3.75, "y": 3.5}, - {"x": 4.75, "y": 3.5}, - {"x": 5.75, "y": 3.5}, - {"x": 6.75, "y": 3.5}, - {"x": 7.75, "y": 3.5}, - {"x": 8.75, "y": 3.5}, - {"x": 9.75, "y": 3.5}, - {"x": 10.75, "y": 3.5}, - {"x": 11.75, "y": 3.5}, - {"x": 12.75, "y": 3.5, "w": 2.25}, - - {"x": 0, "y": 4.5, "w": 2.25}, - {"x": 2.25, "y": 4.5}, - {"x": 3.25, "y": 4.5}, - {"x": 4.25, "y": 4.5}, - {"x": 5.25, "y": 4.5}, - {"x": 6.25, "y": 4.5}, - {"x": 7.25, "y": 4.5}, - {"x": 8.25, "y": 4.5}, - {"x": 9.25, "y": 4.5}, - {"x": 10.25, "y": 4.5}, - {"x": 11.25, "y": 4.5}, - {"x": 12.25, "y": 4.5, "w": 2.75}, - - {"x": 16.25, "y": 4.5}, - - {"x": 0, "y": 5.5, "w": 1.25}, - {"x": 1.25, "y": 5.5, "w": 1.25}, - {"x": 2.5, "y": 5.5, "w": 1.25}, - {"x": 3.75, "y": 5.5, "w": 6.25}, - {"x": 10, "y": 5.5, "w": 1.25}, - {"x": 11.25, "y": 5.5, "w": 1.25}, - {"x": 12.5, "y": 5.5, "w": 1.25}, - {"x": 13.75, "y": 5.5, "w": 1.25}, - - {"x": 15.25, "y": 5.5}, - {"x": 16.25, "y": 5.5}, - {"x": 17.25, "y": 5.5} - ] - } - } -} diff --git a/keyboards/k_type/is31fl3733-dual.c b/keyboards/k_type/is31fl3733-dual.c deleted file mode 100644 index e76479b01a..0000000000 --- a/keyboards/k_type/is31fl3733-dual.c +++ /dev/null @@ -1,236 +0,0 @@ -/* Copyright 2017 Jason Williams - * Copyright 2018 Jack Humbert - * Copyright 2018 Yiancar - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifdef RGB_MATRIX_ENABLE - -#include "is31fl3733-dual.h" -#include "i2c_master.h" -#include "wait.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) -// The address will vary depending on your wiring: -// 00 <-> GND -// 01 <-> SCL -// 10 <-> SDA -// 11 <-> VCC -// ADDR1 represents A1:A0 of the 7-bit address. -// ADDR2 represents A3:A2 of the 7-bit address. -// The result is: 0b101(ADDR2)(ADDR1) -#define ISSI_ADDR_DEFAULT 0x50 - -#define ISSI_COMMANDREGISTER 0xFD -#define ISSI_COMMANDREGISTER_WRITELOCK 0xFE -#define ISSI_INTERRUPTMASKREGISTER 0xF0 -#define ISSI_INTERRUPTSTATUSREGISTER 0xF1 - -#define ISSI_PAGE_LEDCONTROL 0x00 // PG0 -#define ISSI_PAGE_PWM 0x01 // PG1 -#define ISSI_PAGE_AUTOBREATH 0x02 // PG2 -#define ISSI_PAGE_FUNCTION 0x03 // PG3 - -#define ISSI_REG_CONFIGURATION 0x00 // PG3 -#define ISSI_REG_GLOBALCURRENT 0x01 // PG3 -#define ISSI_REG_RESET 0x11 // PG3 -#define ISSI_REG_SWPULLUP 0x0F // PG3 -#define ISSI_REG_CSPULLUP 0x10 // PG3 - -#ifndef ISSI_TIMEOUT -# define ISSI_TIMEOUT 5000 -#endif - -#ifndef ISSI_PERSISTENCE -# define ISSI_PERSISTENCE 0 -#endif - -// Transfer buffer for TWITransmitData() -uint8_t g_twi_transfer_buffer[20]; - -// These buffers match the IS31FL3733 PWM registers. -// The control buffers match the PG0 LED On/Off registers. -// 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 IS31FL3733_write_pwm_buffer() but it's -// probably not worth the extra complexity. -uint8_t g_pwm_buffer[DRIVER_COUNT][192]; -bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false}; - -uint8_t g_led_control_registers[DRIVER_COUNT][24] = {{0}, {0}}; -bool g_led_control_registers_update_required[DRIVER_COUNT] = {false}; - -bool IS31FL3733_write_register(uint8_t index, uint8_t addr, uint8_t reg, uint8_t data) { - // If the transaction fails function returns false. - g_twi_transfer_buffer[0] = reg; - g_twi_transfer_buffer[1] = data; - -#if ISSI_PERSISTENCE > 0 - for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) { - if (i2c_transmit(index, addr << 1, g_twi_transfer_buffer, 2, TIME_US2I(ISSI_TIMEOUT)) != 0) { - return false; - } - } -#else - if (i2c_transmit(index, addr << 1, g_twi_transfer_buffer, 2, TIME_US2I(ISSI_TIMEOUT)) != 0) { - return false; - } -#endif - return true; -} - -bool IS31FL3733_write_pwm_buffer(uint8_t index, uint8_t addr, uint8_t *pwm_buffer) { - // Assumes PG1 is already selected. - // If any of the transactions fails function returns false. - // Transmit PWM registers in 12 transfers of 16 bytes. - // g_twi_transfer_buffer[] is 20 bytes - - // Iterate over the pwm_buffer contents at 16 byte intervals. - for (int i = 0; i < 192; i += 16) { - g_twi_transfer_buffer[0] = i; - // Copy the data from i to i+15. - // Device will auto-increment register for data after the first byte - // Thus this sets registers 0x00-0x0F, 0x10-0x1F, etc. in one transfer. - for (int j = 0; j < 16; j++) { - g_twi_transfer_buffer[1 + j] = pwm_buffer[i + j]; - } - -#if ISSI_PERSISTENCE > 0 - for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) { - if (i2c_transmit(index, addr << 1, g_twi_transfer_buffer, 17, TIME_US2I(ISSI_TIMEOUT)) != 0) { - return false; - } - } -#else - if (i2c_transmit(index, addr << 1, g_twi_transfer_buffer, 17, TIME_US2I(ISSI_TIMEOUT)) != 0) { - return false; - } -#endif - } - return true; -} - -void IS31FL3733_init(uint8_t bus, uint8_t addr, uint8_t sync) { - // In order to avoid the LEDs being driven with garbage data - // in the LED driver's PWM registers, shutdown is enabled last. - // Set up the mode and other settings, clear the PWM registers, - // then disable software shutdown. - // Sync is passed so set it according to the datasheet. - - // Unlock the command register. - IS31FL3733_write_register(bus, addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); - // Select PG0 - IS31FL3733_write_register(bus, addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL); - // Turn off all LEDs. - for (int i = 0x00; i <= 0x17; i++) { - IS31FL3733_write_register(bus, addr, i, 0x00); - } - // Unlock the command register. - IS31FL3733_write_register(bus, addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); - // Select PG1 - IS31FL3733_write_register(bus, addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM); - // Set PWM on all LEDs to 0 - // No need to setup Breath registers to PWM as that is the default. - for (int i = 0x00; i <= 0xBF; i++) { - IS31FL3733_write_register(bus, addr, i, 0x00); - } - // Unlock the command register. - IS31FL3733_write_register(bus, addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5); - // Select PG3 - IS31FL3733_write_register(bus, addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION); - // Set global current to maximum. - IS31FL3733_write_register(bus, addr, ISSI_REG_GLOBALCURRENT, 0xFF); - // Disable software shutdown. - IS31FL3733_write_register(bus, addr, ISSI_REG_CONFIGURATION, (sync << 6) | 0x01); - // Wait 10ms to ensure the device has woken up. - wait_ms(10); -} - -void IS31FL3733_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]; - - g_pwm_buffer[led.driver][led.r] = red; - g_pwm_buffer[led.driver][led.g] = green; - g_pwm_buffer[led.driver][led.b] = blue; - g_pwm_buffer_update_required[led.driver] = true; - } -} - -void IS31FL3733_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { - for (int i = 0; i < DRIVER_LED_TOTAL; i++) { - IS31FL3733_set_color(i, red, green, blue); - } -} - -void IS31FL3733_set_led_control_register(uint8_t index, bool red, bool green, bool blue) { - is31_led led = g_is31_leds[index]; - - uint8_t control_register_r = led.r / 8; - uint8_t control_register_g = led.g / 8; - uint8_t control_register_b = led.b / 8; - uint8_t bit_r = led.r % 8; - uint8_t bit_g = led.g % 8; - uint8_t bit_b = led.b % 8; - - if (red) { - g_led_control_registers[led.driver][control_register_r] |= (1 << bit_r); - } else { - g_led_control_registers[led.driver][control_register_r] &= ~(1 << bit_r); - } - if (green) { - g_led_control_registers[led.driver][control_register_g] |= (1 << bit_g); - } else { - g_led_control_registers[led.driver][control_register_g] &= ~(1 << bit_g); - } - if (blue) { - g_led_control_registers[led.driver][control_register_b] |= (1 << bit_b); - } else { - g_led_control_registers[led.driver][control_register_b] &= ~(1 << bit_b); - } - - g_led_control_registers_update_required[led.driver] = true; -} - -void IS31FL3733_update_pwm_buffers(uint8_t addr, uint8_t index) { - if (g_pwm_buffer_update_required[index]) { - // Firstly we need to unlock the command register and select PG1. - IS31FL3733_write_register(index, addr, ISSI_COMMANDREGISTER_WRI |