diff options
Diffstat (limited to 'keyboards/cluepad')
-rw-r--r-- | keyboards/cluepad/Makefile | 3 | ||||
-rw-r--r-- | keyboards/cluepad/cluepad.c | 60 | ||||
-rw-r--r-- | keyboards/cluepad/cluepad.h | 36 | ||||
-rw-r--r-- | keyboards/cluepad/config.h | 100 | ||||
-rw-r--r-- | keyboards/cluepad/keymaps/default/keymap.c | 65 | ||||
-rw-r--r-- | keyboards/cluepad/readme.md | 4 | ||||
-rw-r--r-- | keyboards/cluepad/rules.mk | 65 |
7 files changed, 333 insertions, 0 deletions
diff --git a/keyboards/cluepad/Makefile b/keyboards/cluepad/Makefile new file mode 100644 index 0000000000..4e2a6f00fd --- /dev/null +++ b/keyboards/cluepad/Makefile @@ -0,0 +1,3 @@ +ifndef MAKEFILE_INCLUDED + include ../../Makefile +endif
\ No newline at end of file diff --git a/keyboards/cluepad/cluepad.c b/keyboards/cluepad/cluepad.c new file mode 100644 index 0000000000..1867b617fd --- /dev/null +++ b/keyboards/cluepad/cluepad.c @@ -0,0 +1,60 @@ +#include "cluepad.h" + +int pwm_level; + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + matrix_init_user(); + + // JTAG disable for PORT F. write JTD bit twice within four cycles. + MCUCR |= (1<<JTD); + MCUCR |= (1<<JTD); +}; + +void led_set_kb(uint8_t usb_led) +{ + print("led_set\n"); +} + +void backlight_init_ports(void) +{ + // Set C7 to output + DDRC |= (1<<7); + + // Initialize the timer + TC4H = 0x03; + OCR4C = 0xFF; + TCCR4A = 0b10000010; + TCCR4B = 0b00000001; +} + +void backlight_set(uint8_t level) +{ + // Determine the PWM level + switch (level) + { + case 0: + // 33% + pwm_level = 0x54; + break; + case 1: + // 66% + pwm_level = 0xA8; + break; + case 2: + // 100% + pwm_level = 0xFF; + break; + case 3: + // 0% + pwm_level = 0x00; + break; + default: + xprintf("Unknown level: %d\n", level); + } + + // Write the PWM level to the timer + TC4H = pwm_level >> 8; + OCR4A = 0xFF & pwm_level; +} diff --git a/keyboards/cluepad/cluepad.h b/keyboards/cluepad/cluepad.h new file mode 100644 index 0000000000..5e4a5999e2 --- /dev/null +++ b/keyboards/cluepad/cluepad.h @@ -0,0 +1,36 @@ +#ifndef CLUEPAD_H +#define CLUEPAD_H + +#include "quantum.h" + + +/* Cluepad matrix layout + * .-------------------. + * |NLCK| /| *| -| + * |-------------------| + * | 7| 8| 9| | + * |--------------| | + * | 4| 5| 6| +| + * |-------------------| + * | 1| 2| 3| | + * |--------------| | + * | 0| .| Ent| + * '-------------------' + */ +// The first section contains all of the arguments +// The second converts the arguments into a two-dimensional array +#define KEYMAP( \ + k00, k01, k02, k03, \ + k10, k11, k12, k13, \ + k20, k21, k22, \ + k30, k31, k32, k33, \ + k40, k42 \ +) { \ + { k00, k01, k02, k03, }, \ + { k10, k11, k12, k13, }, \ + { k20, k21, k22, KC_NO, }, \ + { k30, k31, k32, k33, }, \ + { k40, KC_NO, k42, KC_NO } \ +} + +#endif diff --git a/keyboards/cluepad/config.h b/keyboards/cluepad/config.h new file mode 100644 index 0000000000..bae05fade3 --- /dev/null +++ b/keyboards/cluepad/config.h @@ -0,0 +1,100 @@ +/* +Copyright 2012 Jun Wako <wakojun@gmail.com> + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xC1ED +#define PRODUCT_ID 0x2312 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Clueboard +#define PRODUCT Cluepad with RGB Underlighting +#define DESCRIPTION QMK keyboard firmware for Cluepad + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 4 + +// ROWS: Top to bottom, COLS: Left to right +/* Row pin configuration +* row: 0 1 2 3 4 +* pin: +*/ +#define MATRIX_ROW_PINS { B0, D3, D5, D4, D6 } +/* Column pin configuration + * col: 0 1 2 3 + * pin: F4 E6 B1 D2 + */ +#define MATRIX_COL_PINS { F4, E6, B1, D2 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 5 + +/* Number of backlighting levels */ +#define BACKLIGHT_LEVELS 3 + +/* 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 + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* Underlight configuration + */ +#define RGB_DI_PIN F6 +#define RGBLIGHT_TIMER +#define RGBLED_NUM 4 // Number of LEDs +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SAT_STEP 17 +#define RGBLIGHT_VAL_STEP 17 + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* Debug forcibly enabled */ +#define ALWAYS_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/cluepad/keymaps/default/keymap.c b/keyboards/cluepad/keymaps/default/keymap.c new file mode 100644 index 0000000000..66827fe48b --- /dev/null +++ b/keyboards/cluepad/keymaps/default/keymap.c @@ -0,0 +1,65 @@ +#include "cluepad.h" + +#include "backlight.h" + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _BL 0 +#define _FL 1 +#define _RS 2 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Keymap _BL: (Base Layer) Default Layer + * .-------------------. + * |NL F| /| *| -| + * |-------------------| + * | 7| 8| 9| | + * |--------------| | + * | 4| 5| 6| +| + * |-------------------| + * | 1| 2| 3| | + * |--------------| | + * | 0| .| Ent| + * '-------------------' + */ +[_BL] = KEYMAP( + LT(_FL, KC_NLCK), KC_PSLS, KC_PAST, KC_PMNS, \ + KC_P7, KC_P8, KC_P9, KC_PPLS, \ + KC_P4, KC_P5, KC_P6, \ + KC_P1, KC_P2, KC_P3, KC_PENT, \ + KC_P0, KC_PDOT), + + /* Keymap _FL: Function Layer + * .-------------------. + * |NL F| | | Fn0| + * |-------------------| + * | | Fn4| | | + * |--------------| | + * | Fn3|BL_S| Fn2| Fn6| + * |-------------------| + * | | Fn5| | | + * |--------------| | + * | Fn1| | Fn7| + * '-------------------' + */ +[_FL] = KEYMAP( + LT(_FL, KC_NLCK), KC_TRNS, KC_TRNS, RGB_TOG, \ + KC_TRNS, RGB_SAI, KC_TRNS, RGB_VAI, \ + RGB_HUD, BL_STEP, RGB_HUI, \ + KC_TRNS, RGB_SAD, KC_TRNS, RGB_VAD, \ + RGB_MOD, KC_TRNS) +}; + +/*enum function_id { +};*/ + +const uint16_t PROGMEM fn_actions[] = { +}; + +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { + switch (id) { + } +} + diff --git a/keyboards/cluepad/readme.md b/keyboards/cluepad/readme.md new file mode 100644 index 0000000000..8450340f27 --- /dev/null +++ b/keyboards/cluepad/readme.md @@ -0,0 +1,4 @@ +Cluepad number pad firmware +====================== + +TODO: to be updated. diff --git a/keyboards/cluepad/rules.mk b/keyboards/cluepad/rules.mk new file mode 100644 index 0000000000..19b16b95a9 --- /dev/null +++ b/keyboards/cluepad/rules.mk @@ -0,0 +1,65 @@ + +# 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=4096 + + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE ?= yes # 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 +NKRO_ENABLE ?= yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE ?= yes # Enable numpad's backlight functionality +RGBLIGHT_ENABLE ?= yes +# MIDI_ENABLE ?= YES # MIDI controls +# UNICODE_ENABLE ?= YES # Unicode +# BLUETOOTH_ENABLE ?= yes # Enable Bluetooth with the Adafruit EZ-Key HID
\ No newline at end of file |