diff --git a/keyboards/frosty_flake/Makefile b/keyboards/frosty_flake/Makefile new file mode 100644 index 000000000..57b2ef62e --- /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 000000000..2c73f1074 --- /dev/null +++ b/keyboards/frosty_flake/config.h @@ -0,0 +1,147 @@ +/* +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 Bathroom Epiphanies +#define PRODUCT frosty_flake +#define DESCRIPTION Frosty Flake controller for the CM Storm Quick Fire Rapid + +/* + * Frosty Flake Rev. 20140521 made by Bathroom Ephiphanies + * 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 - Row7 in the schematic +#define MATRIX_COLS 18 // ColA - ColR in the schematic + +/* + * Keyboard Matrix Assignments + */ +#define UNUSED_PINS { B0, C4, D3 } + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCING_DELAY 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* + * 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 000000000..1cd476038 --- /dev/null +++ b/keyboards/frosty_flake/frosty_flake.c @@ -0,0 +1,63 @@ +#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) { + DDRB |= (1<<7); + DDRC |= (1<<5) | (1<<6); + + print_dec(usb_led); + + if (usb_led & (1< + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#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 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 */ + 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 col = 0; col < MATRIX_COLS; col++) { + select_col(col); + _delay_us(3); + 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<] +``` + +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 000000000..dd2f4b6ee --- /dev/null +++ b/keyboards/frosty_flake/rules.mk @@ -0,0 +1,71 @@ +# MCU name +#MCU = at90usb1287 +MCU = atmega32u2 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# 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 + +CUSTOM_MATRIX = yes +SRC += matrix.c \ No newline at end of file