diff options
author | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2019-02-18 08:35:34 -0800 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2019-02-18 08:35:34 -0800 |
commit | f0edc993b7beb15cc9c0443677801daddcae710b (patch) | |
tree | 0d0ee27fca9ea4384a905cdc26878aaa796ee18d /keyboards/winkeyless/bface | |
parent | 593d08d6aec38aca6f38db4a17f3d8cdcd13bf28 (diff) |
[Keyboard] Winkeyless Directory (#5163)
* introduce wkl directory and readme
* move bface into winkeyless directory and edit readme for new make instructions
* move bmini into the winkeyless directory and edit readme
* move bmini ex into winkeyless directory
* edit readme some more
* add newbs guide to readmes
* fix path to bface
* temporarily turn off community layout support until we refactor this taking out all the custom ps2avrgb stuff
Diffstat (limited to 'keyboards/winkeyless/bface')
-rw-r--r-- | keyboards/winkeyless/bface/README.md | 44 | ||||
-rw-r--r-- | keyboards/winkeyless/bface/backlight_ps2avrGB.c | 94 | ||||
-rw-r--r-- | keyboards/winkeyless/bface/backlight_ps2avrGB.h | 35 | ||||
-rw-r--r-- | keyboards/winkeyless/bface/bface.c | 46 | ||||
-rw-r--r-- | keyboards/winkeyless/bface/bface.h | 44 | ||||
-rw-r--r-- | keyboards/winkeyless/bface/config.h | 46 | ||||
-rw-r--r-- | keyboards/winkeyless/bface/i2c.c | 104 | ||||
-rw-r--r-- | keyboards/winkeyless/bface/i2c.h | 25 | ||||
-rw-r--r-- | keyboards/winkeyless/bface/info.json | 12 | ||||
-rw-r--r-- | keyboards/winkeyless/bface/keymaps/default/keymap.c | 43 | ||||
-rw-r--r-- | keyboards/winkeyless/bface/keymaps/kpeatt/keymap.c | 79 | ||||
-rw-r--r-- | keyboards/winkeyless/bface/keymaps/kpeatt/readme.md | 10 | ||||
-rw-r--r-- | keyboards/winkeyless/bface/matrix.c | 113 | ||||
-rwxr-xr-x | keyboards/winkeyless/bface/program | 105 | ||||
-rw-r--r-- | keyboards/winkeyless/bface/rules.mk | 48 | ||||
-rw-r--r-- | keyboards/winkeyless/bface/usbconfig.h | 396 |
16 files changed, 1244 insertions, 0 deletions
diff --git a/keyboards/winkeyless/bface/README.md b/keyboards/winkeyless/bface/README.md new file mode 100644 index 0000000000..f1789b04cf --- /dev/null +++ b/keyboards/winkeyless/bface/README.md @@ -0,0 +1,44 @@ +# B.face + +A 60% keyboard with RGB that runs ps2avrgb natively. Please note that the B.face and B.fake have different switch matrices. Firmware on one, will not work on the other. + +Keyboard Maintainer: QMK Community +Hardware Supported: B.face PCB +Hardware Availability: [Winkeyless](https://winkeyless.kr/product/b-face-x2-pcb/) + +Make example for this keyboard (after setting up your build environment): + + make winkeyless/bface:default + +Flashing + +ps2avr(GB) boards use an atmega32a microcontroller and a different bootloader. It is not flashable using the regular QMK methods. + +Windows: +1. Download [HIDBootFlash](http://vusb.wikidot.com/project:hidbootflash). +2. Place your keyboard into reset. +3. Press the `Find Device` button and ensure that your keyboard is found. +4. Press the `Open .hex File` button and locate the `.hex` file you created. +5. Press the `Flash Device` button and wait for the process to complete. + +macOS: +1. Install homebrew by typing the following: + ``` + /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" + ``` +2. Install `crosspack-avr`. + ``` + brew cask install crosspack-avr + ``` +3. Install the following packages: + ``` + brew install python + brew install pyusb + brew install --HEAD`https://raw.githubusercontent.com/robertgzr/homebrew-tap/master/bootloadhid.rb + ``` + +4. Place your keyboard into reset. +5. Flash the board by typing `bootloadHID -r` followed by the path to your `.hex` 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). diff --git a/keyboards/winkeyless/bface/backlight_ps2avrGB.c b/keyboards/winkeyless/bface/backlight_ps2avrGB.c new file mode 100644 index 0000000000..c0f6428407 --- /dev/null +++ b/keyboards/winkeyless/bface/backlight_ps2avrGB.c @@ -0,0 +1,94 @@ +/* Copyright 2017 Sebastian Kaim + * + * 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 BACKLIGHT_ENABLE + +#include "backlight_ps2avrGB.h" +#define sbi(reg,bit) reg |= (_BV(bit)) +#define cbi(reg,bit) reg &= (~_BV(bit)) +#define PWM10 WGM10 +#define PWM11 WGM11 +#define COM1x1 COM1B1 +#define OCR1x OCR1B + +void backlight_init_ports(void) +{ +#if BACKLIGHT_ON_STATE == 0 + backlight_off(); +#else + backlight_on(); +#endif + + // setup pwm + // this bitmagic is sourced from the original firmware + /*TCCR1B = ((TCCR1B & ~0x07) | 0x03); + TCNT1H = 0; + TCNT1L = 0; + sbi(TIMSK, TOIE1); + OCR1BH = 0; + OCR1BL = 0; + cbi(TCCR1A,PWM11); + sbi(TCCR1A,PWM10); + sbi(TCCR1A,COM1B1); + cbi(TCCR1A,COM1B0);*/ + ICR1 = 0xFFFF; + + TCCR1A = _BV(COM1x1) | _BV(WGM11); // = 0b00001010; + TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001; + + backlight_init(); +} + +void backlight_set(uint8_t level) +{ + if( level == 0 ) { + backlight_off(); + } + else { + backlight_on(); + /*uint8_t pwm = get_pwm_for_brightness(level); + set_backlight_pwm(pwm); + TCCR1A |= _BV(COM1x1); + OCR1x = (level >= 2) ? 0xFFFF : 0x00FF;*/ + } +} + +#define PWM_MAX 0xFF +uint8_t get_pwm_for_brightness(uint8_t level) +{ + // we need to cast up here to allow multiplication with 0xFF. We could also use floats, but this is probably a lot faster. + uint16_t brightness = (uint16_t)level * (uint16_t)PWM_MAX / (uint16_t)BACKLIGHT_LEVELS; + return (uint8_t)brightness; +} + +void backlight_on(void) +{ + //_SFR_IO8(0x12) |= _BV(0x4); + LED_PIN |= BACKLIGHT_PORT_NUM; +} + +void backlight_off(void) +{ + //_SFR_IO8(0x12) &= ~_BV(0x4); + LED_PIN &= ~BACKLIGHT_PORT_NUM; +} + +void set_backlight_pwm(uint8_t level) { + // this does not work (yet) + //OCR1B = level; +} + +#endif // BACKLIGHT_ENABLE diff --git a/keyboards/winkeyless/bface/backlight_ps2avrGB.h b/keyboards/winkeyless/bface/backlight_ps2avrGB.h new file mode 100644 index 0000000000..d5ca903993 --- /dev/null +++ b/keyboards/winkeyless/bface/backlight_ps2avrGB.h @@ -0,0 +1,35 @@ +/* Copyright 2017 Sebastian Kaim + * + * 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/>. + */ + + +#if defined(__AVR__) +#include <avr/pgmspace.h> +#include <avr/io.h> +#include <avr/interrupt.h> +#endif +#include <stddef.h> +#include <stdlib.h> +#include "backlight.h" + +#ifndef PS2AVRGB_BACKLIGHT_H +#define PS2AVRGB_BACKLIGHT_H + +uint8_t get_pwm_for_brightness(uint8_t level); +void set_backlight_pwm(uint8_t level); +void backlight_on(void); +void backlight_off(void); + +#endif diff --git a/keyboards/winkeyless/bface/bface.c b/keyboards/winkeyless/bface/bface.c new file mode 100644 index 0000000000..8422a4a40b --- /dev/null +++ b/keyboards/winkeyless/bface/bface.c @@ -0,0 +1,46 @@ +/* +Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com> +Copyright 2018 Sebastian Kaim <sebb@sebb767.de> + +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/>. +*/ + +#include "bface.h" +#include "rgblight.h" + +#include <avr/pgmspace.h> + +#include "action_layer.h" +#include "i2c.h" +#include "quantum.h" + +extern rgblight_config_t rgblight_config; + +void rgblight_set(void) { + if (!rgblight_config.enable) { + for (uint8_t i = 0; i < RGBLED_NUM; i++) { + led[i].r = 0; + led[i].g = 0; + led[i].b = 0; + } + } + + i2c_init(); + i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM); +} + +__attribute__ ((weak)) +void matrix_scan_user(void) { + rgblight_task(); +} diff --git a/keyboards/winkeyless/bface/bface.h b/keyboards/winkeyless/bface/bface.h new file mode 100644 index 0000000000..62d62f6953 --- /dev/null +++ b/keyboards/winkeyless/bface/bface.h @@ -0,0 +1,44 @@ +/* +Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com> +Copyright 2017 Sebastian Kaim <sebb@sebb767.de> + +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/>. +*/ + +#ifndef KEYMAP_COMMON_H +#define KEYMAP_COMMON_H + +#include "quantum_keycodes.h" +#include "keycode.h" +#include "action.h" + +#define LAYOUT_60_ansi( \ + K04, K14, K24, K34, K44, K54, K16, KB6, KB7, K17, KA4, KB4, KC4, KE4, \ + K03, K13, K23, K33, K43, K53, K26, KC6, KC7, K27, KA3, KB3, KC3, KD3, \ + K02, K12, K22, K32, K42, K52, K36, KD6, KD7, K37, KA2, KB2, KD2, \ + K01, K11, K21, K31, K41, K51, K46, KE6, KE7, K47, KA1, KB1, \ + K00, K10, K20, K56, K57, KA0, KB0, KC0 \ +){ \ + { K00, K10, K20, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KA0, KB0, KC0, KC_NO, KC_NO }, \ + { K01, K11, K21, K31, K41, K51, KC_NO, KC_NO, KC_NO, KC_NO, KA1, KB1, KC_NO, KC_NO, KC_NO }, \ + { K02, K12, K22, K32, K42, K52, KC_NO, KC_NO, KC_NO, KC_NO, KA2, KB2, KC_NO, KD2, KC_NO }, \ + { K03, K13, K23, K33, K43, K53, KC_NO, KC_NO, KC_NO, KC_NO, KA3, KB3, KC3, KD3, KC_NO }, \ + { K04, K14, K24, K34, K44, K54, KC_NO, KC_NO, KC_NO, KC_NO, KA4, KB4, KC4, KC_NO, KE4 }, \ + { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { KC_NO, K16, K26, K36, K46, K56, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KB6, KC6, KD6, KE6 }, \ + { KC_NO, K17, K27, K37, K47, K57, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KB7, KC7, KD7, KE7 } \ +} + + +#endif diff --git a/keyboards/winkeyless/bface/config.h b/keyboards/winkeyless/bface/config.h new file mode 100644 index 0000000000..11ac373c02 --- /dev/null +++ b/keyboards/winkeyless/bface/config.h @@ -0,0 +1,46 @@ +/* +Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com> +Copyright 2017 Sebastian Kaim <sebastian.kaim@sebb767.de> + +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/>. +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#define VENDOR_ID 0x20A0 +#define PRODUCT_ID 0x422D +// You can edit those at usbconfig.h about line 250. These values will +// unforunatly be ignored so far +#define MANUFACTURER winkeyless.kr +#define PRODUCT b.face + +/* matrix size */ +#define MATRIX_ROWS 8 +#define MATRIX_COLS 15 + +#define RGBLED_NUM 16 +#define RGBLIGHT_ANIMATIONS + +#define NO_UART 1 +#define BOOTLOADHID_BOOTLOADER 1 + +#ifdef BACKLIGHT_ENABLE + // the backlight PWM does not work (yet). Therefore, we only have two backlight levels (on/off) + #define BACKLIGHT_LEVELS 1 + #define LED_PIN PORTD + #define BACKLIGHT_PORT_NUM (1 << 4) +#endif + +#endif diff --git a/keyboards/winkeyless/bface/i2c.c b/keyboards/winkeyless/bface/i2c.c new file mode 100644 index 0000000000..c27f3e3d17 --- /dev/null +++ b/keyboards/winkeyless/bface/i2c.c @@ -0,0 +1,104 @@ +/* +Copyright 2016 Luiz Ribeiro <luizribeiro@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/>. +*/ + +#include <avr/io.h> +#include <util/twi.h> + +#include "i2c.h" + +void i2c_set_bitrate(uint16_t bitrate_khz) { + uint8_t bitrate_div = ((F_CPU / 1000l) / bitrate_khz); + if (bitrate_div >= 16) { + bitrate_div = (bitrate_div - 16) / 2; + } + TWBR = bitrate_div; +} + +void i2c_init(void) { + // set pull-up resistors on I2C bus pins + PORTC |= 0b11; + + i2c_set_bitrate(400); + + // enable TWI (two-wire interface) + TWCR |= (1 << TWEN); + + // enable TWI interrupt and slave address ACK + TWCR |= (1 << TWIE); + TWCR |= (1 << TWEA); +} + +uint8_t i2c_start(uint8_t address) { + // reset TWI control register + TWCR = 0; + + // begin transmission and wait for it to end + TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN); + while (!(TWCR & (1<<TWINT))); + + // check if the start condition was successfully transmitted + if ((TWSR & 0xF8) != TW_START) { + return 1; + } + + // transmit address and wait + TWDR = address; + TWCR = (1<<TWINT) | (1<<TWEN); + while (!(TWCR & (1<<TWINT))); + + // check if the device has acknowledged the READ / WRITE mode + uint8_t twst = TW_STATUS & 0xF8; + if ((twst != TW_MT_SLA_ACK) && (twst != TW_MR_SLA_ACK)) { + return 1; + } + + return 0; +} + +void i2c_stop(void) { + TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO); +} + +uint8_t i2c_write(uint8_t data) { + TWDR = data; + + // transmit data and wait + TWCR = (1<<TWINT) | (1<<TWEN); + while (!(TWCR & (1<<TWINT))); + + if ((TWSR & 0xF8) != TW_MT_DATA_ACK) { + return 1; + } + + return 0; +} + +uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length) { + if (i2c_start(address)) { + return 1; + } + + for (uint16_t i = 0; i < length; i++) { + if (i2c_write(data[i])) { + return 1; + } + } + + i2c_stop(); + + return 0; +} diff --git a/keyboards/winkeyless/bface/i2c.h b/keyboards/winkeyless/bface/i2c.h new file mode 100644 index 0000000000..27c9d3d050 --- /dev/null +++ b/keyboards/winkeyless/bface/i2c.h @@ -0,0 +1,25 @@ +/* +Copyright 2016 Luiz Ribeiro <luizribeiro@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/>. +*/ + +#ifndef __I2C_H__ +#define __I2C_H__ + +void i2c_init(void); +void i2c_set_bitrate(uint16_t bitrate_khz); +uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length); + +#endif diff --git a/keyboards/winkeyless/bface/info.json b/keyboards/winkeyless/bface/info.json new file mode 100644 index 0000000000..f5ecf173d3 --- /dev/null +++ b/keyboards/winkeyless/bface/info.json @@ -0,0 +1,12 @@ +{ + "keyboard_name": "b.face", + "url": "", + "maintainer": "qmk", + "width": 15, + "height": 5, + "layouts": { + "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}] + } + } +} diff --git a/keyboards/winkeyless/bface/keymaps/default/keymap.c b/keyboards/winkeyless/bface/keymaps/default/keymap.c new file mode 100644 index 0000000000..a3e9bc9577 --- /dev/null +++ b/keyboards/winkeyless/bface/keymaps/default/keymap.c @@ -0,0 +1,43 @@ +/* +Copyright 2017 Sebastian Kaim <sebastian.kaim@sebb767.de> + +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/>. +*/ + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [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_F1, 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_LALT,KC_LGUI, KC_SPC, KC_RALT,KC_RGUI,MO(1), KC_RCTL + ), + [1] = LAYOUT_60_ansi( + KC_TRNS,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_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,BL_INC, BL_DEC, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS,RGB_MOD,KC_TRNS,BL_ON, BL_OFF, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS + ), + /* You can copy this layer as base for a new fn layer * / + [n] = 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 + ), // */ +}; diff --git a/keyboards/winkeyless/bface/keymaps/kpeatt/keymap.c b/keyboards/winkeyless/bface/keymaps/kpeatt/keymap.c new file mode 100644 index 0000000000..84de7872f4 --- /dev/null +++ b/keyboards/winkeyless/bface/keymaps/kpeatt/keymap.c @@ -0,0 +1,79 @@ +/* +Copyright 2017 Kyle Peatt <kpeatt@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/>. +*/ + +#include QMK_KEYBOARD_H + +#define ______ KC_TRNS + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Qwerty + * ,-----------------------------------------------------------------------------------------. + * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | Bkspc | + * |-----------------------------------------------------------------------------------------+ + * | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | + * |-----------------------------------------------------------------------------------------+ + * | Caps/FN | A | S | D | F | G | H | J | K | L | ; | ' | Enter | + * |-----------------------------------------------------------------------------------------+ + * | Shift | Z | X | C | V | B | N | M | , | . | / | RShift | + * |-----------------------------------------------------------------------------------------+ + * | Ctrl | GUI | Alt | Space | Alt | GUI | Ctrl | Fn | + * `-----------------------------------------------------------------------------------------' + */ + + [0] = LAYOUT_60_ansi( + KC_GESC, 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, + LT(1, 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,KC_RGUI, KC_RCTL, MO(1) + ), + + /* FN Layer + * ,-----------------------------------------------------------------------------------------. + * | `~ | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | | + * |-----------------------------------------------------------------------------------------+ + * | | | Up | | | | | | | |RGBMOD| Val+| Val- |RBGTOG| + * |-----------------------------------------------------------------------------------------+ + * | | Left| Down|Right| | | | | Sat+| Sat-| Hue+| Hue-| | + * |-----------------------------------------------------------------------------------------+ + * | | | | | | | | | | | | | | | + * |-----------------------------------------------------------------------------------------+ + * | | | | | | | | | | + * `-----------------------------------------------------------------------------------------' + */ + + [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_UP,______,______,______,______,______,______,______,RGB_MOD,RGB_VAI,RGB_VAD,RGB_TOG, + ______,KC_LEFT,KC_DOWN,KC_RGHT,______, ______, ______,______,RGB_SAI,RGB_SAD,RGB_HUI,RGB_HUD,______, + ______,______,______,______,______, ______, ______,______,______,______,______, ______, + ______,______,______, ______, ______,______,______,______ + ), + /* You can copy this layer as base for a new fn layer * / + [n] = LAYOUT_60_ansi( + ______,______,______,______,______,______,______,______,______,______,______,______,______,______, + ______,______,______,______,______,______,______,______,______,______,______,______,______,______, + ______,______,______,______,______,______,______,______,______,______,______,______,______, + ______,______,______,______,______,______,______,______,______,______,______, ______, + ______,______,______, ______, ______,______,______,______ + ), // */ +}; + +const uint16_t PROGMEM fn_actions[] = { + [0] = ACTION_LAYER_MOMENTARY(1), +}; diff --git a/keyboards/winkeyless/bface/keymaps/kpeatt/readme.md b/keyboards/winkeyless/bface/keymaps/kpeatt/readme.md new file mode 100644 index 0000000000..a7eef1e5fc --- /dev/null +++ b/keyboards/winkeyless/bface/keymaps/kpeatt/readme.md @@ -0,0 +1,10 @@ +kpeatt's bface layout +====================== + +## Keyboard Notes +- This is for a clone bface PCB that is no longer for sale as far as I can tell. [Used to be sold on KBDFans](https://www.aliexpress.com/item/bface-60-RGB-underground-copy-pcb-from-china-gh60-pcb-Customize-keyboard-PCB/32731084597.html). +- To put in reset mode hold `left ctrl` while inserting the USB cable +- Use flashing instructions in the main `bface` directory + +### Build +To build this keymap, run `make bface:kpeatt` from the qmk_firmware directory. diff --git a/keyboards/winkeyless/bface/matrix.c b/keyboards/winkeyless/bface/matrix.c new file mode 100644 index 0000000000..b3761a63ca --- /dev/null +++ b/keyboards/winkeyless/bface/matrix.c @@ -0,0 +1,113 @@ +/* +Copyright 2017 Luiz Ribeiro <luizribeiro@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/>. +*/ + +#include <avr/io.h> +#include <util/delay.h> + +#include "matrix.h" + +#ifndef DEBOUNCE +# define DEBOUNCE 5 +#endif + +static uint8_t debouncing = DEBOUNCE; + +static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + +void matrix_init(void) { + // all outputs for rows high + DDRB = 0xFF; + PORTB = 0xFF; + // all inputs for columns + DDRA = 0x00; + DDRC &= ~(0x111111<<2); + DDRD &= ~(1<<PIND7); + // all columns are pulled-up + PORTA = 0xFF; + PORTC |= (0b111111<<2); + PORTD |= (1<<PIND7); + + // initialize matrix state: all keys off + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + matrix[row] = 0x00; + matrix_debouncing[row] = 0x00; + } + + // activate backlight + //PORTD |= (1 << 4); + //_SFR_IO8(0x09) |= (1 << 4); //_BV(0x94 & 0xF); + // + // this is the code that *should* be executed in quantum.c + _SFR_IO8(0x12) |= _BV(0x4); +} + +void matrix_set_row_status(uint8_t row) { + DDRB = (1 << row); + PORTB = ~(1 << row); +} + +uint8_t bit_reverse(uint8_t x) { + x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa); + x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc); + x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0); + return x; +} + +uint8_t matrix_scan(void) { + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + matrix_set_row_status(row); + _delay_us(5); + + matrix_row_t cols = ( + // cols 0..7, PORTA 0 -> 7 + (~PINA) & 0xFF + ) | ( + // cols 8..13, PORTC 7 -> 0 + bit_reverse((~PINC) & 0xFF) << 8 + ) | ( + // col 14, PORTD 7 + ((~PIND) & (1 << PIND7)) << 7 + ); + + if (matrix_debouncing[row] != cols) { + matrix_debouncing[row] = cols; + debouncing = DEBOUNCE; + } + } + + if (debouncing) { + if (--debouncing) { + _delay_ms(1); + } else { + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + matrix[i] = matrix_debouncing[i]; + } + } + } + + matrix_scan_user(); + + return 1; +} + +inline matrix_row_t matrix_get_row(uint8_t row) { + return matrix[row]; +} + +void matrix_print(void) { +} diff --git a/keyboards/winkeyless/bface/program b/keyboards/winkeyless/bface/program new file mode 100755 index 0000000000..298e645477 --- /dev/null +++ b/keyboards/winkeyless/bface/program @@ -0,0 +1,105 @@ +#!/usr/bin/env python +# Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>, Sebastian Kaim <sebb@sebb767.de> +# +# 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/>. + +from __future__ import print_function + +import os +import sys +import time +import usb + + +def checkForKeyboardInNormalMode(): + """Returns a device if a ps2avrGB device in normal made (that is in keyboard mode) or None if it is not found.""" + return usb.core.find(idVendor=0x20A0, idProduct=0x422D) + +def checkForKeyboardInBootloaderMode(): + """Returns True if a ps2avrGB device in bootloader (flashable) mode is found and False otherwise.""" + return (usb.core.find(idVendor=0x16c0, idProduct=0x05df) is not None) + +def flashKeyboard(firmware_file): + """Calls bootloadHID to flash the given file to the device.""" + print('Flashing firmware to device ...') + if os.system('bootloadHID -r "%s"' % firmware_file) == 0: + print('\nDone!') + else: + print('\nbootloadHID returned an error.') + +def printDeviceInfo(dev): + """Prints all infos for a given USB device""" + print('Device Information:') + print(' idVendor: %d (0x%04x)' % (dev.idVendor, dev.idVendor)) + p |