From 3766f902a02da7e9355685c733f70bcff9fe5a12 Mon Sep 17 00:00:00 2001 From: Gabriel Young Date: Sat, 18 Mar 2017 15:38:03 -0700 Subject: boilerplate project created with new_project.sh --- keyboards/frosty_flake/Makefile | 3 + keyboards/frosty_flake/config.h | 162 +++++++++++++++++++++++ keyboards/frosty_flake/frosty_flake.c | 28 ++++ keyboards/frosty_flake/frosty_flake.h | 19 +++ keyboards/frosty_flake/keymaps/default/Makefile | 21 +++ keyboards/frosty_flake/keymaps/default/config.h | 8 ++ keyboards/frosty_flake/keymaps/default/keymap.c | 44 ++++++ keyboards/frosty_flake/keymaps/default/readme.md | 1 + keyboards/frosty_flake/readme.md | 28 ++++ keyboards/frosty_flake/rules.mk | 68 ++++++++++ 10 files changed, 382 insertions(+) create mode 100644 keyboards/frosty_flake/Makefile create mode 100644 keyboards/frosty_flake/config.h create mode 100644 keyboards/frosty_flake/frosty_flake.c create mode 100644 keyboards/frosty_flake/frosty_flake.h create mode 100644 keyboards/frosty_flake/keymaps/default/Makefile create mode 100644 keyboards/frosty_flake/keymaps/default/config.h create mode 100644 keyboards/frosty_flake/keymaps/default/keymap.c create mode 100644 keyboards/frosty_flake/keymaps/default/readme.md create mode 100644 keyboards/frosty_flake/readme.md create mode 100644 keyboards/frosty_flake/rules.mk (limited to 'keyboards/frosty_flake') diff --git a/keyboards/frosty_flake/Makefile b/keyboards/frosty_flake/Makefile new file mode 100644 index 0000000000..57b2ef62e5 --- /dev/null +++ b/keyboards/frosty_flake/Makefile @@ -0,0 +1,3 @@ +ifndef MAKEFILE_INCLUDED + include ../../Makefile +endif diff --git a/keyboards/frosty_flake/config.h b/keyboards/frosty_flake/config.h new file mode 100644 index 0000000000..9390feb949 --- /dev/null +++ b/keyboards/frosty_flake/config.h @@ -0,0 +1,162 @@ +/* +Copyright 2012 Jun Wako + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6060 +#define DEVICE_VER 0x0001 +#define MANUFACTURER You +#define PRODUCT frosty_flake +#define DESCRIPTION A custom keyboard + +/* key matrix size */ +#define MATRIX_ROWS 2 +#define MATRIX_COLS 3 + +/* + * 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 { D0, D5 } +#define MATRIX_COL_PINS { F1, F0, B0 } +#define UNUSED_PINS + +/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */ +#define DIODE_DIRECTION COL2ROW + +// #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 DEBOUNCING_DELAY 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 + +/* + * Magic Key Options + * + * Magic keys are hotkey commands that allow control over firmware functions of + * the keyboard. They are best used in combination with the HID Listen program, + * found here: https://www.pjrc.com/teensy/hid_listen.html + * + * The options below allow the magic key functionality to be changed. This is + * useful if your keyboard/keypad is missing keys and you want magic key support. + * + */ + +/* key combination for magic key command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* control how magic key switches layers */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false + +/* override magic key keymap */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM +//#define MAGIC_KEY_HELP1 H +//#define MAGIC_KEY_HELP2 SLASH +//#define MAGIC_KEY_DEBUG D +//#define MAGIC_KEY_DEBUG_MATRIX X +//#define MAGIC_KEY_DEBUG_KBD K +//#define MAGIC_KEY_DEBUG_MOUSE M +//#define MAGIC_KEY_VERSION V +//#define MAGIC_KEY_STATUS S +//#define MAGIC_KEY_CONSOLE C +//#define MAGIC_KEY_LAYER0_ALT1 ESC +//#define MAGIC_KEY_LAYER0_ALT2 GRAVE +//#define MAGIC_KEY_LAYER0 0 +//#define MAGIC_KEY_LAYER1 1 +//#define MAGIC_KEY_LAYER2 2 +//#define MAGIC_KEY_LAYER3 3 +//#define MAGIC_KEY_LAYER4 4 +//#define MAGIC_KEY_LAYER5 5 +//#define MAGIC_KEY_LAYER6 6 +//#define MAGIC_KEY_LAYER7 7 +//#define MAGIC_KEY_LAYER8 8 +//#define MAGIC_KEY_LAYER9 9 +//#define MAGIC_KEY_BOOTLOADER PAUSE +//#define MAGIC_KEY_LOCK CAPS +//#define MAGIC_KEY_EEPROM E +//#define MAGIC_KEY_NKRO N +//#define MAGIC_KEY_SLEEP_LED Z + +/* + * 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 + +#endif diff --git a/keyboards/frosty_flake/frosty_flake.c b/keyboards/frosty_flake/frosty_flake.c new file mode 100644 index 0000000000..22979a4515 --- /dev/null +++ b/keyboards/frosty_flake/frosty_flake.c @@ -0,0 +1,28 @@ +#include "frosty_flake.h" + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + + matrix_init_user(); +} + +void matrix_scan_kb(void) { + // put your looping keyboard code here + // runs every cycle (a lot) + + matrix_scan_user(); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + // put your per-action keyboard code here + // runs for every action, just before processing by the firmware + + return process_record_user(keycode, record); +} + +void led_set_kb(uint8_t usb_led) { + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + + led_set_user(usb_led); +} diff --git a/keyboards/frosty_flake/frosty_flake.h b/keyboards/frosty_flake/frosty_flake.h new file mode 100644 index 0000000000..90ea25ed99 --- /dev/null +++ b/keyboards/frosty_flake/frosty_flake.h @@ -0,0 +1,19 @@ +#ifndef FROSTY_FLAKE_H +#define FROSTY_FLAKE_H + +#include "quantum.h" + +// This a shortcut to help you visually see your layout. +// The following is an example using the Planck MIT layout +// The first section contains all of the arguements +// The second converts the arguments into a two-dimensional array +#define KEYMAP( \ + k00, k01, k02, \ + k10, k11 \ +) \ +{ \ + { k00, k01, k02 }, \ + { k10, KC_NO, k11 }, \ +} + +#endif diff --git a/keyboards/frosty_flake/keymaps/default/Makefile b/keyboards/frosty_flake/keymaps/default/Makefile new file mode 100644 index 0000000000..9d3df5964f --- /dev/null +++ b/keyboards/frosty_flake/keymaps/default/Makefile @@ -0,0 +1,21 @@ +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/frosty_flake/keymaps/default/config.h b/keyboards/frosty_flake/keymaps/default/config.h new file mode 100644 index 0000000000..8893d122e0 --- /dev/null +++ b/keyboards/frosty_flake/keymaps/default/config.h @@ -0,0 +1,8 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +// place overrides here + +#endif diff --git a/keyboards/frosty_flake/keymaps/default/keymap.c b/keyboards/frosty_flake/keymaps/default/keymap.c new file mode 100644 index 0000000000..1c9e33b649 --- /dev/null +++ b/keyboards/frosty_flake/keymaps/default/keymap.c @@ -0,0 +1,44 @@ +#include "frosty_flake.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = KEYMAP( /* Base */ + KC_A, KC_1, KC_H, \ + KC_TAB, KC_SPC \ +), +}; + +const uint16_t PROGMEM fn_actions[] = { + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; + + +void matrix_init_user(void) { + +} + +void matrix_scan_user(void) { + +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} + +void led_set_user(uint8_t usb_led) { + +} diff --git a/keyboards/frosty_flake/keymaps/default/readme.md b/keyboards/frosty_flake/keymaps/default/readme.md new file mode 100644 index 0000000000..11bf4825ff --- /dev/null +++ b/keyboards/frosty_flake/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for frosty_flake diff --git a/keyboards/frosty_flake/readme.md b/keyboards/frosty_flake/readme.md new file mode 100644 index 0000000000..a329650619 --- /dev/null +++ b/keyboards/frosty_flake/readme.md @@ -0,0 +1,28 @@ +frosty_flake keyboard firmware +====================== + +## Quantum MK Firmware + +For the full Quantum feature list, see [the parent readme](/). + +## Building + +Download or clone the whole firmware and navigate to the keyboards/frosty_flake folder. Once your dev env is setup, you'll be able to type `make` to generate your .hex - you can then use the Teensy Loader to program your .hex file. + +Depending on which keymap you would like to use, you will have to compile slightly differently. + +### Default + +To build with the default keymap, simply run `make default`. + +### Other Keymaps + +Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create a folder with the name of your keymap in the keymaps folder, and see keymap documentation (you can find in top readme.md) and existant keymap files. + +To build the firmware binary hex file with a keymap just do `make` with a keymap like this: + +``` +$ make [default|jack|] +``` + +Keymaps follow the format **__\.c__** and are stored in the `keymaps` folder. diff --git a/keyboards/frosty_flake/rules.mk b/keyboards/frosty_flake/rules.mk new file mode 100644 index 0000000000..bad3387bf4 --- /dev/null +++ b/keyboards/frosty_flake/rules.mk @@ -0,0 +1,68 @@ +# MCU name +#MCU = at90usb1287 +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=512 + + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700) +EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) +CONSOLE_ENABLE ?= yes # Console for debug(+400) +COMMAND_ENABLE ?= yes # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE ?= no # USB Nkey Rollover +BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality on B7 by default +MIDI_ENABLE ?= no # MIDI controls +UNICODE_ENABLE ?= no # Unicode +BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE ?= no # Audio output on port C6 +FAUXCLICKY_ENABLE ?= no # Use buzzer to emulate clicky switches -- cgit v1.2.3 From 19fd20261b895a6848c8b15fd7365d5b87b7fd72 Mon Sep 17 00:00:00 2001 From: Gabriel Young Date: Sat, 18 Mar 2017 16:19:10 -0700 Subject: sketch out frosty flake matrix using custom matrix.c based on kitten paw --- keyboards/frosty_flake/config.h | 24 +++--- keyboards/frosty_flake/matrix.c | 167 ++++++++++++++++++++++++++++++++++++++++ keyboards/frosty_flake/rules.mk | 7 +- 3 files changed, 187 insertions(+), 11 deletions(-) create mode 100644 keyboards/frosty_flake/matrix.c (limited to 'keyboards/frosty_flake') diff --git a/keyboards/frosty_flake/config.h b/keyboards/frosty_flake/config.h index 9390feb949..2575a52b18 100644 --- a/keyboards/frosty_flake/config.h +++ b/keyboards/frosty_flake/config.h @@ -24,13 +24,19 @@ along with this program. If not, see . #define VENDOR_ID 0xFEED #define PRODUCT_ID 0x6060 #define DEVICE_VER 0x0001 -#define MANUFACTURER You +#define MANUFACTURER Bathroom Epiphanies #define PRODUCT frosty_flake -#define DESCRIPTION A custom keyboard +#define DESCRIPTION Frosty Flake controller for the CM Storm Quick Fire Rapid + +/* + * Frosty Flake Rev. 20140521 made by Bathroom Ephiphanies + * Schematic is available at https://deskthority.net/w/images/a/a4/Frosty_Flake_Schematics.pdf + * + */ /* key matrix size */ -#define MATRIX_ROWS 2 -#define MATRIX_COLS 3 +#define MATRIX_ROWS 8 // Row0 to Row7 in the schematic +#define MATRIX_COLS 18 // ColA to ColR in the schematic /* * Keyboard Matrix Assignments @@ -42,13 +48,13 @@ along with this program. If not, see . * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) * */ -#define MATRIX_ROW_PINS { D0, D5 } -#define MATRIX_COL_PINS { F1, F0, B0 } -#define UNUSED_PINS +//#define MATRIX_ROW_PINS { D5, D4, D6, D2, D1, D0 } +//#define MATRIX_COL_PINS << n/a >> +//#define UNUSED_PINS { B0, C4, D3 } /* COL2ROW, ROW2COL, or CUSTOM_MATRIX */ -#define DIODE_DIRECTION COL2ROW - +//#define DIODE_DIRECTION << n/a >> + // #define BACKLIGHT_PIN B7 // #define BACKLIGHT_BREATHING // #define BACKLIGHT_LEVELS 3 diff --git a/keyboards/frosty_flake/matrix.c b/keyboards/frosty_flake/matrix.c new file mode 100644 index 0000000000..21b0d90885 --- /dev/null +++ b/keyboards/frosty_flake/matrix.c @@ -0,0 +1,167 @@ +//TODO(gabe): customize for frosty flake + +/* + Copyright 2014 Ralf Schmitt + + 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 +#include +#include +#include +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.h" + +#ifndef DEBOUNCING_DELAY +# define DEBOUNCING_DELAY 5 +#endif +static uint8_t debouncing = DEBOUNCING_DELAY; + +static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + +static uint8_t read_rows(void); +static void select_col(uint8_t col); + +inline uint8_t matrix_rows(void) { + return MATRIX_ROWS; +} + +inline uint8_t matrix_cols(void) { + return MATRIX_COLS; +} + +/* Column pin configuration + * + * col: 0 1 2 3 4 5 6 7 + * pin: PC7 PD5 PD3 PD1 PC2 PD6 PD4 PD2 + * + * Rrr pin configuration + * + * These rrrs uses one 74HC154 4 to 16 bit demultiplexer (low + * active), together with 2 rrrs driven directly from the micro + * controller, to control the 18 rrrs. The rrrs are driven from + * pins B6,5,4,3,2,1,0. + */ +void matrix_init(void) { + DDRC &= ~0b10000100; // Row input pins + DDRD &= ~0b01111110; + PORTC |= 0b10000100; + PORTD |= 0b01111110; + + DDRB |= 0b01111111; // Column output pins + + for (uint8_t i=0; i < MATRIX_ROWS; i++) { + matrix[i] = 0; + matrix_debouncing[i] = 0; + } + matrix_init_quantum(); +} + +uint8_t matrix_scan(void) { + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + select_col(col); + _delay_us(3); + uint8_t rows = read_rows(); + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1< Date: Sun, 19 Mar 2017 15:59:21 -0700 Subject: successfully read data from the matrix --- keyboards/frosty_flake/config.h | 7 +- keyboards/frosty_flake/keymaps/default/Makefile | 4 +- keyboards/frosty_flake/keymaps/default/keymap.c | 7 +- keyboards/frosty_flake/matrix.c | 150 +++++++++++++----------- 4 files changed, 93 insertions(+), 75 deletions(-) (limited to 'keyboards/frosty_flake') diff --git a/keyboards/frosty_flake/config.h b/keyboards/frosty_flake/config.h index 2575a52b18..507e6a6b69 100644 --- a/keyboards/frosty_flake/config.h +++ b/keyboards/frosty_flake/config.h @@ -30,13 +30,14 @@ along with this program. If not, see . /* * Frosty Flake Rev. 20140521 made by Bathroom Ephiphanies - * Schematic is available at https://deskthority.net/w/images/a/a4/Frosty_Flake_Schematics.pdf + * Ported from the Bathroom Epiphanies TMK Firmware: + * https://github.com/BathroomEpiphanies/epiphanies_tmk_keyboard/tree/master/be_controllers * */ /* key matrix size */ -#define MATRIX_ROWS 8 // Row0 to Row7 in the schematic -#define MATRIX_COLS 18 // ColA to ColR in the schematic +#define MATRIX_ROWS 18 +#define MATRIX_COLS 8 /* * Keyboard Matrix Assignments diff --git a/keyboards/frosty_flake/keymaps/default/Makefile b/keyboards/frosty_flake/keymaps/default/Makefile index 9d3df5964f..0887666802 100644 --- a/keyboards/frosty_flake/keymaps/default/Makefile +++ b/keyboards/frosty_flake/keymaps/default/Makefile @@ -3,9 +3,9 @@ # the appropriate keymap folder that will get included automatically # BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = no # Console for debug(+400) +CONSOLE_ENABLE = yes # Console for debug(+400) COMMAND_ENABLE = yes # Commands for debug and configuration NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality diff --git a/keyboards/frosty_flake/keymaps/default/keymap.c b/keyboards/frosty_flake/keymaps/default/keymap.c index 1c9e33b649..e553555668 100644 --- a/keyboards/frosty_flake/keymaps/default/keymap.c +++ b/keyboards/frosty_flake/keymaps/default/keymap.c @@ -28,11 +28,12 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) void matrix_init_user(void) { - + debug_enable = true; } void matrix_scan_user(void) { - + if (matrix_is_modified()) + matrix_print(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { @@ -41,4 +42,4 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { void led_set_user(uint8_t usb_led) { -} +} \ No newline at end of file diff --git a/keyboards/frosty_flake/matrix.c b/keyboards/frosty_flake/matrix.c index 21b0d90885..70456ada32 100644 --- a/keyboards/frosty_flake/matrix.c +++ b/keyboards/frosty_flake/matrix.c @@ -1,5 +1,3 @@ -//TODO(gabe): customize for frosty flake - /* Copyright 2014 Ralf Schmitt @@ -26,16 +24,71 @@ #include "util.h" #include "matrix.h" +#ifndef CONFIG_SPECIFIC_H +#define CONFIG_SPECIFIC_H + +#define CONFIG_LED_IO \ + DDRB |= (1<<7); \ + DDRC |= (1<<5) | (1<<6); + +#define USB_LED_CAPS_LOCK_ON PORTC &= ~(1<<5) +#define USB_LED_CAPS_LOCK_OFF PORTC |= (1<<5) +#define USB_LED_NUM_LOCK_ON PORTB &= ~(1<<7) +#define USB_LED_NUM_LOCK_OFF PORTB |= (1<<7) +#define USB_LED_SCROLL_LOCK_ON PORTC &= ~(1<<6) +#define USB_LED_SCROLL_LOCK_OFF PORTC |= (1<<6) + +#define CONFIG_MATRIX_IO \ + /* Column output pins */ \ + DDRD |= 0b01111011; \ + /* Row input pins */ \ + DDRC &= ~0b10000000; \ + DDRB &= ~0b01111111; \ + PORTC |= 0b10000000; \ + PORTB |= 0b01111111; + +#define MATRIX_ROW_SCAN \ + (PINC&(1<<7) ? 0 : ((matrix_row_t)1<<0)) | \ + (PINB&(1<<5) ? 0 : ((matrix_row_t)1<<1)) | \ + (PINB&(1<<4) ? 0 : ((matrix_row_t)1<<2)) | \ + (PINB&(1<<6) ? 0 : ((matrix_row_t)1<<3)) | \ + (PINB&(1<<1) ? 0 : ((matrix_row_t)1<<4)) | \ + (PINB&(1<<2) ? 0 : ((matrix_row_t)1<<5)) | \ + (PINB&(1<<3) ? 0 : ((matrix_row_t)1<<6)) | \ + (PINB&(1<<0) ? 0 : ((matrix_row_t)1<<7)) + +#define MATRIX_ROW_SELECT \ + case 0: PORTD = (PORTD & ~0b01111011) | 0b00011011; break; \ + case 1: PORTD = (PORTD & ~0b01111011) | 0b01000011; break; \ + case 2: PORTD = (PORTD & ~0b01111011) | 0b01101010; break; \ + case 3: PORTD = (PORTD & ~0b01111011) | 0b01111001; break; \ + case 4: PORTD = (PORTD & ~0b01111011) | 0b01100010; break; \ + case 5: PORTD = (PORTD & ~0b01111011) | 0b01110001; break; \ + case 6: PORTD = (PORTD & ~0b01111011) | 0b01100001; break; \ + case 7: PORTD = (PORTD & ~0b01111011) | 0b01110000; break; \ + case 8: PORTD = (PORTD & ~0b01111011) | 0b01100000; break; \ + case 9: PORTD = (PORTD & ~0b01111011) | 0b01101000; break; \ + case 10: PORTD = (PORTD & ~0b01111011) | 0b00101011; break; \ + case 11: PORTD = (PORTD & ~0b01111011) | 0b00110011; break; \ + case 12: PORTD = (PORTD & ~0b01111011) | 0b00100011; break; \ + case 13: PORTD = (PORTD & ~0b01111011) | 0b01111000; break; \ + case 14: PORTD = (PORTD & ~0b01111011) | 0b00010011; break; \ + case 15: PORTD = (PORTD & ~0b01111011) | 0b01101001; break; \ + case 16: PORTD = (PORTD & ~0b01111011) | 0b00001011; break; \ + case 17: PORTD = (PORTD & ~0b01111011) | 0b00111011; break; + +#endif + #ifndef DEBOUNCING_DELAY -# define DEBOUNCING_DELAY 5 +# define DEBOUNCING_DELAY 0 #endif static uint8_t debouncing = DEBOUNCING_DELAY; static matrix_row_t matrix[MATRIX_ROWS]; static matrix_row_t matrix_debouncing[MATRIX_ROWS]; -static uint8_t read_rows(void); -static void select_col(uint8_t col); +static matrix_row_t scan_row(void); +static void select_row(uint8_t row); inline uint8_t matrix_rows(void) { return MATRIX_ROWS; @@ -45,58 +98,40 @@ inline uint8_t matrix_cols(void) { return MATRIX_COLS; } -/* Column pin configuration - * - * col: 0 1 2 3 4 5 6 7 - * pin: PC7 PD5 PD3 PD1 PC2 PD6 PD4 PD2 - * - * Rrr pin configuration - * - * These rrrs uses one 74HC154 4 to 16 bit demultiplexer (low - * active), together with 2 rrrs driven directly from the micro - * controller, to control the 18 rrrs. The rrrs are driven from - * pins B6,5,4,3,2,1,0. - */ void matrix_init(void) { - DDRC &= ~0b10000100; // Row input pins - DDRD &= ~0b01111110; - PORTC |= 0b10000100; - PORTD |= 0b01111110; - - DDRB |= 0b01111111; // Column output pins + CONFIG_MATRIX_IO; for (uint8_t i=0; i < MATRIX_ROWS; i++) { matrix[i] = 0; matrix_debouncing[i] = 0; } + matrix_init_quantum(); } uint8_t matrix_scan(void) { - for (uint8_t col = 0; col < MATRIX_COLS; col++) { - select_col(col); + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + select_row(row); _delay_us(3); - uint8_t rows = read_rows(); - for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + matrix_row_t row_scan = scan_row(); + for (uint8_t col = 0; col < MATRIX_COLS; col++) { bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1< Date: Sun, 19 Mar 2017 19:55:55 -0700 Subject: start to define keymap; annoying because rows and columns are swapped from schematic --- keyboards/frosty_flake/frosty_flake.h | 74 +++++++++++++++++++++++++ keyboards/frosty_flake/keymaps/default/keymap.c | 11 ++-- keyboards/frosty_flake/matrix.c | 4 +- 3 files changed, 84 insertions(+), 5 deletions(-) (limited to 'keyboards/frosty_flake') diff --git a/keyboards/frosty_flake/frosty_flake.h b/keyboards/frosty_flake/frosty_flake.h index 90ea25ed99..767efcbd81 100644 --- a/keyboards/frosty_flake/frosty_flake.h +++ b/keyboards/frosty_flake/frosty_flake.h @@ -7,6 +7,7 @@ // The following is an example using the Planck MIT layout // The first section contains all of the arguements // The second converts the arguments into a two-dimensional array +#if 0 #define KEYMAP( \ k00, k01, k02, \ k10, k11 \ @@ -15,5 +16,78 @@ { k00, k01, k02 }, \ { k10, KC_NO, k11 }, \ } +#endif + +/* + Matrix col/row mapping + + ,----. ,-------------------. ,-------------------. ,-------------------. ,--------------. + | J6 | | I4 | H4 | H2 | H6 | | A7 | E6 | D2 | D4 | | B4 | B7 | B6 | B0 | | C7 | C5 | A5 | + `----' `-------------------' `-------------------' `-------------------' `--------------' + ,-------------------------------------------------------------------------. ,--------------. ,-------------------. + | J4 | J7 | I7 | H7 | G7 | G4 | F4 | F7 | E7 | D7 | R7 | R4 | E4 | B2 | | L4 | O4 | Q4 | | K1 | L1 | Q1 | Q0 | + |-------------------------------------------------------------------------| |--------------| |-------------------| + | J2 | J5 | I5 | H5 | G5 | G2 | F2 | F5 | E5 | D5 | R5 | R2 | E2 | B3 | | K4 | O7 | Q7 | | K5 | L5 | Q5 | O5 | + |-------------------------------------------------------------------------| '--------------' |-------------- | + | O5 | J3 | I3 | H3 | G3 | G6 | F6 | F3 | E3 | D3 | R3 | R6 | B1 | | K2 | L2 | Q2 | | + |-------------------------------------------------------------------------| ,----. |-------------------| + | N2 | J1 | I1 | H1 | G1 | G0 | F0 | F1 | E1 | D1 | R0 | N3 | | O6 | | K3 | L3 | Q3 | O3 | + |-------------------------------------------------------------------------| ,--------------. |-------------- | + | A4 | P2 | C6 | K6 | C0 | M3 | D0 | A1 | | O0 | K0 | L0 | | L6 | Q6 | | + `-------------------------------------------------------------------------' `--------------' `-------------------' +*/ + +#define KEYMAP( \ + KJ6, KI4, KH4, KH2, KH6, KA7, KE6, KD2, KD4, KB4, KB7, KB6, KB0, KC7, KC5, KA5, \ + KJ4, KJ7, KI7, KH7, KG7, KG4, KF4, KF7, KE7, KD7, KR7, KR4, KE4, KB2, KL4, KO4, KQ4, KK1, KL1, KQ1, KQ0, \ + KJ2, KJ5, KI5, KH5, KG5, KG2, KF2, KF5, KE5, KD5, KR5, KR2, KE2, KB3, KK4, KO7, KQ7, KK5, KL5, KQ5, KO5, \ + KI2, KJ3, KI3, KH3, KG3, KG6, KF6, KF3, KE3, KD3, KR3, KR6, KB1, KK2, KL2, KQ2, \ + KN2, KI6, KJ1, KI1, KH1, KG1, KG0, KF0, KF1, KE1, KD1, KR0, KN3, KO6, KK3, KL3, KQ3, KO3, \ + KA4, KP2, KC6, KK6, KC0, KM3, KD0, KA1, KO0, KK0, KL0, KL6, KQ6 \ +) \ +{ \ +/* 0 1 2 3 4 5 6 7 */ \ +/* A */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ +/* B */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ +/* C */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ +/* D */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ +/* E */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ +/* F */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ +/* G */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ +/* H */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ +/* I */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ +/* J */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KJ6, KC_NO }, \ +/* K */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ +/* L */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ +/* M */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ +/* N */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ +/* O */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ +/* P */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ +/* Q */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ +/* R */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO } \ +} + +#if 0 +#define KEYMAP( \ + KJ6, KI4, KH4, KH2, KH6, KA7, KE6, KD2, KD4, KB4, KB7, KB6, KB0, KC7, KC5, KA5, \ + KJ4, KJ7, KI7, KH7, KG7, KG4, KF4, KF7, KE7, KD7, KR7, KR4, KE4, KB2, KL4, KO4, KQ4, KK1, KL1, KQ1, KQ0, \ + KJ2, KJ5, KI5, KH5, KG5, KG2, KF2, KF5, KE5, KD5, KR5, KR2, KE2, KB3, KK4, KO7, KQ7, KK5, KL5, KQ5, KO5, \ + KI2, KJ3, KI3, KH3, KG3, KG6, KF6, KF3, KE3, KD3, KR3, KR6, KB1, KK2, KL2, KQ2, \ + KN2, KI6, KJ1, KI1, KH1, KG1, KG0, KF0, KF1, KE1, KD1, KR0, KN3, KO6, KK3, KL3, KQ3, KO3, \ + KA4, KP2, KC6, KK6, KC0, KM3, KD0, KA1, KO0, KK0, KL0, KL6, KQ6 \ +) \ +{ \ +/* Columns and rows need to be swapped in the below definition */ \ +/* A B C D E F G H I J K L M N O P Q R */ \ +/* 0 */ { KC_NO, KB0, KC0, KD0, KC_NO, KF0, KG0, KC_NO, KC_NO, KC_NO, KK0, KL0, KC_NO, KC_NO, KO0, KC_NO, KQ0, KR0 }, \ +/* 1 */ { KA1, KB1, KC_NO, KD1, KE1, KF1, KG1, KH1, KI1, KJ1, KK1, KL1, KC_NO, KC_NO, KC_NO, KC_NO, KQ1, KC_NO }, \ +/* 2 */ { KC_NO, KB2, KC_NO, KD2, KE2, KF2, KG2, KH2, KI2, KJ2, KK2, KL2, KC_NO, KN2, KC_NO, KP2, KQ2, KR2 }, \ +/* 3 */ { KC_NO, KB3, KC_NO, KD3, KE3, KF3, KG3, KH3, KI3, KJ3, KK3, KL3, KM3, KN3, KO3, KC_NO, KQ3, KR3 }, \ +/* 4 */ { KA4, KB4, KC_NO, KD4, KE4, KF4, KG4, KH4, KI4, KJ4, KK4, KL4, KC_NO, KC_NO, KO4, KC_NO, KQ4, KR4 }, \ +/* 5 */ { KA5, KC_NO, KC5, KD5, KE5, KF5, KG5, KH5, KI5, KJ5, KK5, KL5, KC_NO, KC_NO, KO5, KC_NO, KQ5, KR5 }, \ +/* 6 */ { KC_NO, KB6, KC6, KC_NO, KE6, KF6, KG6, KH6, KI6, KJ6, KK6, KL6, KC_NO, KC_NO, KO6, KC_NO, KQ6, KR6 }, \ +/* 7 */ { KA7, KB7, KC7, KD7, KE7, KF7, KG7, KH7, KI7, KJ7, KC_NO, KC_NO, KC_NO, KC_NO, KO7, KC_NO, KQ7, KR7 } \ +} +#endif #endif diff --git a/keyboards/frosty_flake/keymaps/default/keymap.c b/keyboards/frosty_flake/keymaps/default/keymap.c index e553555668..90711732fa 100644 --- a/keyboards/frosty_flake/keymaps/default/keymap.c +++ b/keyboards/frosty_flake/keymaps/default/keymap.c @@ -1,10 +1,13 @@ #include "frosty_flake.h" const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[0] = KEYMAP( /* Base */ - KC_A, KC_1, KC_H, \ - KC_TAB, KC_SPC \ -), +[0] = KEYMAP(\ + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR,KC_SLCK,KC_PAUS, \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0,KC_MINS, KC_EQL,KC_BSPC, KC_INS,KC_HOME,KC_PGUP, KC_NLCK,KC_PSLS,KC_PAST,KC_PMNS, \ + 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_DEL, KC_END,KC_PGDN, KC_P7, KC_P8, KC_P9,KC_PPLS, \ + 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_P4, KC_P5, KC_P6, \ + KC_LSFT,KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,KC_COMM, KC_DOT,KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3,KC_PENT, \ + KC_LCTL,KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI, KC_APP,KC_RCTL, KC_LEFT,KC_DOWN,KC_RGHT, KC_P0,KC_PDOT) }; const uint16_t PROGMEM fn_actions[] = { diff --git a/keyboards/frosty_flake/matrix.c b/keyboards/frosty_flake/matrix.c index 70456ada32..07b9f6dd68 100644 --- a/keyboards/frosty_flake/matrix.c +++ b/keyboards/frosty_flake/matrix.c @@ -151,11 +151,13 @@ inline matrix_row_t matrix_get_row(uint8_t row) { return matrix[row]; } +static const char ROW_NAMES[] = "ABCDEFGHIJKLMNOPQR"; + void matrix_print(void) { print("\nr/c 01234567\n"); for (uint8_t row = 0; row < MATRIX_ROWS; row++) { matrix_row_t row_scan = matrix_get_row(row); - xprintf("%02X: ", row); + xprintf("%c: ", ROW_NAMES[row]); for (uint8_t col = 0; col < MATRIX_COLS; col++) { bool curr_bit = row_scan & (1< Date: Sun, 19 Mar 2017 20:33:41 -0700 Subject: Swap rows and columns to match the schematic --- keyboards/frosty_flake/config.h | 4 +- keyboards/frosty_flake/frosty_flake.h | 43 ------- keyboards/frosty_flake/keymaps/default/keymap.c | 3 +- keyboards/frosty_flake/matrix.c | 154 +++++++++--------------- 4 files changed, 62 insertions(+), 142 deletions(-) (limited to 'keyboards/frosty_flake') diff --git a/keyboards/frosty_flake/config.h b/keyboards/frosty_flake/config.h index 507e6a6b69..f03cecb3e6 100644 --- a/keyboards/frosty_flake/config.h +++ b/keyboards/frosty_flake/config.h @@ -36,8 +36,8 @@ along with this program. If not, see . */ /* key matrix size */ -#define MATRIX_ROWS 18 -#define MATRIX_COLS 8 +#define MATRIX_ROWS 8 +#define MATRIX_COLS 18 /* * Keyboard Matrix Assignments diff --git a/keyboards/frosty_flake/frosty_flake.h b/keyboards/frosty_flake/frosty_flake.h index 767efcbd81..3b52df6baa 100644 --- a/keyboards/frosty_flake/frosty_flake.h +++ b/keyboards/frosty_flake/frosty_flake.h @@ -7,16 +7,6 @@ // The following is an example using the Planck MIT layout // The first section contains all of the arguements // The second converts the arguments into a two-dimensional array -#if 0 -#define KEYMAP( \ - k00, k01, k02, \ - k10, k11 \ -) \ -{ \ - { k00, k01, k02 }, \ - { k10, KC_NO, k11 }, \ -} -#endif /* Matrix col/row mapping @@ -36,38 +26,6 @@ | A4 | P2 | C6 | K6 | C0 | M3 | D0 | A1 | | O0 | K0 | L0 | | L6 | Q6 | | `-------------------------------------------------------------------------' `--------------' `-------------------' */ - -#define KEYMAP( \ - KJ6, KI4, KH4, KH2, KH6, KA7, KE6, KD2, KD4, KB4, KB7, KB6, KB0, KC7, KC5, KA5, \ - KJ4, KJ7, KI7, KH7, KG7, KG4, KF4, KF7, KE7, KD7, KR7, KR4, KE4, KB2, KL4, KO4, KQ4, KK1, KL1, KQ1, KQ0, \ - KJ2, KJ5, KI5, KH5, KG5, KG2, KF2, KF5, KE5, KD5, KR5, KR2, KE2, KB3, KK4, KO7, KQ7, KK5, KL5, KQ5, KO5, \ - KI2, KJ3, KI3, KH3, KG3, KG6, KF6, KF3, KE3, KD3, KR3, KR6, KB1, KK2, KL2, KQ2, \ - KN2, KI6, KJ1, KI1, KH1, KG1, KG0, KF0, KF1, KE1, KD1, KR0, KN3, KO6, KK3, KL3, KQ3, KO3, \ - KA4, KP2, KC6, KK6, KC0, KM3, KD0, KA1, KO0, KK0, KL0, KL6, KQ6 \ -) \ -{ \ -/* 0 1 2 3 4 5 6 7 */ \ -/* A */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ -/* B */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ -/* C */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ -/* D */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ -/* E */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ -/* F */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ -/* G */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ -/* H */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ -/* I */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ -/* J */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KJ6, KC_NO }, \ -/* K */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ -/* L */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ -/* M */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ -/* N */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ -/* O */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ -/* P */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ -/* Q */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ -/* R */ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO } \ -} - -#if 0 #define KEYMAP( \ KJ6, KI4, KH4, KH2, KH6, KA7, KE6, KD2, KD4, KB4, KB7, KB6, KB0, KC7, KC5, KA5, \ KJ4, KJ7, KI7, KH7, KG7, KG4, KF4, KF7, KE7, KD7, KR7, KR4, KE4, KB2, KL4, KO4, KQ4, KK1, KL1, KQ1, KQ0, \ @@ -88,6 +46,5 @@ /* 6 */ { KC_NO, KB6, KC6, KC_NO, KE6, KF6, KG6, KH6, KI6, KJ6, KK6, KL6, KC_NO, KC_NO, KO6, KC_NO, KQ6, KR6 }, \ /* 7 */ { KA7, KB7, KC7, KD7, KE7, KF7, KG7, KH7, KI7, KJ7, KC_NO, KC_NO, KC_NO, KC_NO, KO7, KC_NO, KQ7, KR7 } \ } -#endif #endif diff --git a/keyboards/frosty_flake/keymaps/default/keymap.c b/keyboards/frosty_flake/keymaps/default/keymap.c index 90711732fa..4383f7a8d7 100644 --- a/keyboards/frosty_flake/keymaps/default/keymap.c +++ b/keyboards/frosty_flake/keymaps/default/keymap.c @@ -35,8 +35,7 @@ void matrix_init_user(void) { } void matrix_scan_user(void) { - if (matrix_is_modified()) - matrix_print(); + matrix_print(); } bool process_record_user(uint16_t keycode, keyrecord_t *record) { diff --git a/keyboards/frosty_flake/matrix.c b/keyboards/frosty_flake/matrix.c index 07b9f6dd68..f289f506ad 100644 --- a/keyboards/frosty_flake/matrix.c +++ b/keyboards/frosty_flake/matrix.c @@ -1,5 +1,5 @@ /* - Copyright 2014 Ralf Schmitt + Copyright 2017 Gabriel Young 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 @@ -24,9 +24,6 @@ #include "util.h" #include "matrix.h" -#ifndef CONFIG_SPECIFIC_H -#define CONFIG_SPECIFIC_H - #define CONFIG_LED_IO \ DDRB |= (1<<7); \ DDRC |= (1<<5) | (1<<6); @@ -38,85 +35,40 @@ #define USB_LED_SCROLL_LOCK_ON PORTC &= ~(1<<6) #define USB_LED_SCROLL_LOCK_OFF PORTC |= (1<<6) -#define CONFIG_MATRIX_IO \ - /* Column output pins */ \ - DDRD |= 0b01111011; \ - /* Row input pins */ \ - DDRC &= ~0b10000000; \ - DDRB &= ~0b01111111; \ - PORTC |= 0b10000000; \ - PORTB |= 0b01111111; - -#define MATRIX_ROW_SCAN \ - (PINC&(1<<7) ? 0 : ((matrix_row_t)1<<0)) | \ - (PINB&(1<<5) ? 0 : ((matrix_row_t)1<<1)) | \ - (PINB&(1<<4) ? 0 : ((matrix_row_t)1<<2)) | \ - (PINB&(1<<6) ? 0 : ((matrix_row_t)1<<3)) | \ - (PINB&(1<<1) ? 0 : ((matrix_row_t)1<<4)) | \ - (PINB&(1<<2) ? 0 : ((matrix_row_t)1<<5)) | \ - (PINB&(1<<3) ? 0 : ((matrix_row_t)1<<6)) | \ - (PINB&(1<<0) ? 0 : ((matrix_row_t)1<<7)) - -#define MATRIX_ROW_SELECT \ - case 0: PORTD = (PORTD & ~0b01111011) | 0b00011011; break; \ - case 1: PORTD = (PORTD & ~0b01111011) | 0b01000011; break; \ - case 2: PORTD = (PORTD & ~0b01111011) | 0b01101010; break; \ - case 3: PORTD = (PORTD & ~0b01111011) | 0b01111001; break; \ - case 4: PORTD = (PORTD & ~0b01111011) | 0b01100010; break; \ - case 5: PORTD = (PORTD & ~0b01111011) | 0b01110001; break; \ - case 6: PORTD = (PORTD & ~0b01111011) | 0b01100001; break; \ - case 7: PORTD = (PORTD & ~0b01111011) | 0b01110000; break; \ - case 8: PORTD = (PORTD & ~0b01111011) | 0b01100000; break; \ - case 9: PORTD = (PORTD & ~0b01111011) | 0b01101000; break; \ - case 10: PORTD = (PORTD & ~0b01111011) | 0b00101011; break; \ - case 11: PORTD = (PORTD & ~0b01111011) | 0b00110011; break; \ - case 12: PORTD = (PORTD & ~0b01111011) | 0b00100011; break; \ - case 13: PORTD = (PORTD & ~0b01111011) | 0b01111000; break; \ - case 14: PORTD = (PORTD & ~0b01111011) | 0b00010011; break; \ - case 15: PORTD = (PORTD & ~0b01111011) | 0b01101001; break; \ - case 16: PORTD = (PORTD & ~0b01111011) | 0b00001011; break; \ - case 17: PORTD = (PORTD & ~0b01111011) | 0b00111011; break; - -#endif - #ifndef DEBOUNCING_DELAY -# define DEBOUNCING_DELAY 0 +# define DEBOUNCING_DELAY 5 #endif static uint8_t debouncing = DEBOUNCING_DELAY; static matrix_row_t matrix[MATRIX_ROWS]; static matrix_row_t matrix_debouncing[MATRIX_ROWS]; -static matrix_row_t scan_row(void); -static void select_row(uint8_t row); - -inline uint8_t matrix_rows(void) { - return MATRIX_ROWS; -} - -inline uint8_t matrix_cols(void) { - return MATRIX_COLS; -} +static matrix_row_t scan_col(void); +static void select_col(uint8_t row); void matrix_init(void) { - CONFIG_MATRIX_IO; - - for (uint8_t i=0; i < MATRIX_ROWS; i++) { - matrix[i] = 0; - matrix_debouncing[i] = 0; - } - - matrix_init_quantum(); + /* Row output pins */ + DDRD |= 0b01111011; + /* Column input pins */ + DDRC &= ~0b10000000; + DDRB &= ~0b01111111; + PORTC |= 0b10000000; + PORTB |= 0b01111111; + + for (uint8_t i=0; i < MATRIX_ROWS; i++) + matrix[i] = matrix_debouncing[i] = 0; + + matrix_init_quantum(); } uint8_t matrix_scan(void) { - for (uint8_t row = 0; row < MATRIX_ROWS; row++) { - select_row(row); + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + select_col(col); _delay_us(3); - matrix_row_t row_scan = scan_row(); - for (uint8_t col = 0; col < MATRIX_COLS; col++) { + matrix_row_t col_scan = scan_col(); + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1< Date: Sun, 19 Mar 2017 20:45:10 -0700 Subject: support LEDs --- keyboards/frosty_flake/frosty_flake.c | 40 ++++++++++++++++++------- keyboards/frosty_flake/matrix.c | 55 ++++++++++++++--------------------- 2 files changed, 51 insertions(+), 44 deletions(-) (limited to 'keyboards/frosty_flake') diff --git a/keyboards/frosty_flake/frosty_flake.c b/keyboards/frosty_flake/frosty_flake.c index 22979a4515..ed17361840 100644 --- a/keyboards/frosty_flake/frosty_flake.c +++ b/keyboards/frosty_flake/frosty_flake.c @@ -1,28 +1,46 @@ #include "frosty_flake.h" void matrix_init_kb(void) { - // put your keyboard start-up code here - // runs once when the firmware starts up + // put your keyboard start-up code here + // runs once when the firmware starts up - matrix_init_user(); + matrix_init_user(); } void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) + // put your looping keyboard code here + // runs every cycle (a lot) - matrix_scan_user(); + matrix_scan_user(); } bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - // put your per-action keyboard code here - // runs for every action, just before processing by the firmware + // put your per-action keyboard code here + // runs for every action, just before processing by the firmware - return process_record_user(keycode, record); + return process_record_user(keycode, record); } void led_set_kb(uint8_t usb_led) { - // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + DDRB |= (1<<7); + DDRC |= (1<<5) | (1<<6); - led_set_user(usb_led); + print_dec(usb_led); + + if (usb_led & (1< Date: Sun, 19 Mar 2017 20:46:56 -0700 Subject: fix whitespace --- keyboards/frosty_flake/matrix.c | 99 ++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 51 deletions(-) (limited to 'keyboards/frosty_flake') diff --git a/keyboards/frosty_flake/matrix.c b/keyboards/frosty_flake/matrix.c index 5d711a660f..05dffdb643 100644 --- a/keyboards/frosty_flake/matrix.c +++ b/keyboards/frosty_flake/matrix.c @@ -32,8 +32,41 @@ static uint8_t debouncing = DEBOUNCING_DELAY; static matrix_row_t matrix[MATRIX_ROWS]; static matrix_row_t matrix_debouncing[MATRIX_ROWS]; -static matrix_row_t scan_col(void); -static void select_col(uint8_t row); +static matrix_row_t scan_col(void) { + return ( + (PINC&(1<<7) ? 0 : ((matrix_row_t)1<<0)) | + (PINB&(1<<5) ? 0 : ((matrix_row_t)1<<1)) | + (PINB&(1<<4) ? 0 : ((matrix_row_t)1<<2)) | + (PINB&(1<<6) ? 0 : ((matrix_row_t)1<<3)) | + (PINB&(1<<1) ? 0 : ((matrix_row_t)1<<4)) | + (PINB&(1<<2) ? 0 : ((matrix_row_t)1<<5)) | + (PINB&(1<<3) ? 0 : ((matrix_row_t)1<<6)) | + (PINB&(1<<0) ? 0 : ((matrix_row_t)1<<7)) + ); +} + +static void select_col(uint8_t col) { + switch (col) { + case 0: PORTD = (PORTD & ~0b01111011) | 0b00011011; break; + case 1: PORTD = (PORTD & ~0b01111011) | 0b01000011; break; + case 2: PORTD = (PORTD & ~0b01111011) | 0b01101010; break; + case 3: PORTD = (PORTD & ~0b01111011) | 0b01111001; break; + case 4: PORTD = (PORTD & ~0b01111011) | 0b01100010; break; + case 5: PORTD = (PORTD & ~0b01111011) | 0b01110001; break; + case 6: PORTD = (PORTD & ~0b01111011) | 0b01100001; break; + case 7: PORTD = (PORTD & ~0b01111011) | 0b01110000; break; + case 8: PORTD = (PORTD & ~0b01111011) | 0b01100000; break; + case 9: PORTD = (PORTD & ~0b01111011) | 0b01101000; break; + case 10: PORTD = (PORTD & ~0b01111011) | 0b00101011; break; + case 11: PORTD = (PORTD & ~0b01111011) | 0b00110011; break; + case 12: PORTD = (PORTD & ~0b01111011) | 0b00100011; break; + case 13: PORTD = (PORTD & ~0b01111011) | 0b01111000; break; + case 14: PORTD = (PORTD & ~0b01111011) | 0b00010011; break; + case 15: PORTD = (PORTD & ~0b01111011) | 0b01101001; break; + case 16: PORTD = (PORTD & ~0b01111011) | 0b00001011; break; + case 17: PORTD = (PORTD & ~0b01111011) | 0b00111011; break; + } +} void matrix_init(void) { /* Row output pins */ @@ -82,57 +115,21 @@ inline matrix_row_t matrix_get_row(uint8_t row) { } void matrix_print(void) { - print("\nr\\c ABCDEFGHIJKLMNOPQR\n"); - for (uint8_t row = 0; row < MATRIX_ROWS; row++) { - matrix_row_t matrix_row = matrix_get_row(row); - xprintf("%02X: ", row); - for (uint8_t col = 0; col < MATRIX_COLS; col++) { - bool curr_bit = matrix_row & (1< Date: Sun, 19 Mar 2017 20:56:45 -0700 Subject: update docs --- keyboards/frosty_flake/readme.md | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'keyboards/frosty_flake') diff --git a/keyboards/frosty_flake/readme.md b/keyboards/frosty_flake/readme.md index a329650619..ef0e7492bf 100644 --- a/keyboards/frosty_flake/readme.md +++ b/keyboards/frosty_flake/readme.md @@ -1,6 +1,10 @@ frosty_flake keyboard firmware ====================== +This is the firmware for Rev. 20140521 of the Frosty Flake controller by [Bathroom Epiphanies](http://bathroomepiphanies.com/controllers/). + +The code was adapted from the [BathroomEpiphanies TMK Firmware](https://github.com/BathroomEpiphanies/epiphanies_tmk_keyboard/tree/master/be_controllers), but has been cleaned up to match the [schematic](https://deskthority.net/wiki/File:Frosty_Flake_Schematics.pdf) and gone through some minor refactoring for QMK. + ## Quantum MK Firmware For the full Quantum feature list, see [the parent readme](/). -- cgit v1.2.3 From a3a304db9ae09c3c5532c43e553cc24d3f9b29a2 Mon Sep 17 00:00:00 2001 From: Gabriel Young Date: Sun, 19 Mar 2017 21:11:17 -0700 Subject: clean up docs and provide defaults for keymap --- keyboards/frosty_flake/frosty_flake.c | 17 +++++++++++ keyboards/frosty_flake/keymaps/default/Makefile | 4 +-- keyboards/frosty_flake/keymaps/default/keymap.c | 38 +------------------------ keyboards/frosty_flake/readme.md | 2 +- 4 files changed, 21 insertions(+), 40 deletions(-) (limited to 'keyboards/frosty_flake') diff --git a/keyboards/frosty_flake/frosty_flake.c b/keyboards/frosty_flake/frosty_flake.c index ed17361840..1cd4760389 100644 --- a/keyboards/frosty_flake/frosty_flake.c +++ b/keyboards/frosty_flake/frosty_flake.c @@ -44,3 +44,20 @@ void led_set_kb(uint8_t usb_led) { led_set_user(usb_led); } + +__attribute__ ((weak)) +void matrix_init_user(void) { +} + +__attribute__ ((weak)) +void matrix_scan_user(void) { +} + +__attribute__ ((weak)) +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} + +__attribute__ ((weak)) +void led_set_user(uint8_t usb_led) { +} \ No newline at end of file diff --git a/keyboards/frosty_flake/keymaps/default/Makefile b/keyboards/frosty_flake/keymaps/default/Makefile index 0887666802..9d3df5964f 100644 --- a/keyboards/frosty_flake/keymaps/default/Makefile +++ b/keyboards/frosty_flake/keymaps/default/Makefile @@ -3,9 +3,9 @@ # the appropriate keymap folder that will get included automatically # BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE = no # Mouse keys(+4700) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = yes # Console for debug(+400) +CONSOLE_ENABLE = no # Console for debug(+400) COMMAND_ENABLE = yes # Commands for debug and configuration NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality diff --git a/keyboards/frosty_flake/keymaps/default/keymap.c b/keyboards/frosty_flake/keymaps/default/keymap.c index 4383f7a8d7..4dc7ed655f 100644 --- a/keyboards/frosty_flake/keymaps/default/keymap.c +++ b/keyboards/frosty_flake/keymaps/default/keymap.c @@ -8,40 +8,4 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 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_P4, KC_P5, KC_P6, \ KC_LSFT,KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,KC_COMM, KC_DOT,KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3,KC_PENT, \ KC_LCTL,KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI, KC_APP,KC_RCTL, KC_LEFT,KC_DOWN,KC_RGHT, KC_P0,KC_PDOT) -}; - -const uint16_t PROGMEM fn_actions[] = { - -}; - -const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) -{ - // MACRODOWN only works in this function - switch(id) { - case 0: - if (record->event.pressed) { - register_code(KC_RSFT); - } else { - unregister_code(KC_RSFT); - } - break; - } - return MACRO_NONE; -}; - - -void matrix_init_user(void) { - debug_enable = true; -} - -void matrix_scan_user(void) { - matrix_print(); -} - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - return true; -} - -void led_set_user(uint8_t usb_led) { - -} \ No newline at end of file +}; \ No newline at end of file diff --git a/keyboards/frosty_flake/readme.md b/keyboards/frosty_flake/readme.md index ef0e7492bf..ff440e33b6 100644 --- a/keyboards/frosty_flake/readme.md +++ b/keyboards/frosty_flake/readme.md @@ -1,7 +1,7 @@ frosty_flake keyboard firmware ====================== -This is the firmware for Rev. 20140521 of the Frosty Flake controller by [Bathroom Epiphanies](http://bathroomepiphanies.com/controllers/). +This is the firmware for Rev. 20140521 of the Frosty Flake controller by [Bathroom Epiphanies](http://bathroomepiphanies.com/controllers/), a replacement controller for the [Cooler Master Quick Fire Rapid](http://www.coolermaster.com/peripheral/keyboards/quickfirerapid/). The code was adapted from the [BathroomEpiphanies TMK Firmware](https://github.com/BathroomEpiphanies/epiphanies_tmk_keyboard/tree/master/be_controllers), but has been cleaned up to match the [schematic](https://deskthority.net/wiki/File:Frosty_Flake_Schematics.pdf) and gone through some minor refactoring for QMK. -- cgit v1.2.3 From b37f510f323b532360f38afb6f0bb29bc61eaab3 Mon Sep 17 00:00:00 2001 From: Gabriel Young Date: Sun, 19 Mar 2017 21:18:15 -0700 Subject: clean up config --- keyboards/frosty_flake/config.h | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) (limited to 'keyboards/frosty_flake') diff --git a/keyboards/frosty_flake/config.h b/keyboards/frosty_flake/config.h index f03cecb3e6..2c73f10743 100644 --- a/keyboards/frosty_flake/config.h +++ b/keyboards/frosty_flake/config.h @@ -36,39 +36,17 @@ along with this program. If not, see . */ /* key matrix size */ -#define MATRIX_ROWS 8 -#define MATRIX_COLS 18 +#define MATRIX_ROWS 8 // Row0 - Row7 in the schematic +#define MATRIX_COLS 18 // ColA - ColR in the schematic /* * 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, D4, D6, D2, D1, D0 } -//#define MATRIX_COL_PINS << n/a >> -//#define UNUSED_PINS { B0, C4, D3 } - -/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */ -//#define DIODE_DIRECTION << n/a >> - -// #define BACKLIGHT_PIN B7 -// #define BACKLIGHT_BREATHING -// #define BACKLIGHT_LEVELS 3 - + */ +#define UNUSED_PINS { B0, C4, D3 } /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ #define DEBOUNCING_DELAY 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 */ -- cgit v1.2.3