1
0
Fork 0

Woodpad refactor (#11651)

This commit is contained in:
Ryan 2021-01-23 03:48:27 +11:00 committed by GitHub
parent a7d79f4c00
commit 188c0bacb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 215 additions and 304 deletions

View file

@ -1,5 +1,5 @@
/*
Copyright 2017
Copyright 2017 WoodKeys
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
@ -15,17 +15,16 @@ 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
#pragma once
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6069
#define DEVICE_VER 0x0001
#define MANUFACTURER WoodKeys.click
#define PRODUCT woodpad
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6069
#define DEVICE_VER 0x0001
#define MANUFACTURER WoodKeys.click
#define PRODUCT Woodpad
/* key matrix size */
#define MATRIX_ROWS 5
@ -40,17 +39,45 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
*
*/
*/
#define MATRIX_ROW_PINS { D1, D0, D4, C6, D7 }
#define MATRIX_COL_PINS { B1, B3, B2, B6 }
#define UNUSED_PINS
/* COL2ROW, ROW2COL*/
/* COL2ROW, ROW2COL */
#define DIODE_DIRECTION COL2ROW
// #define BACKLIGHT_PIN B7
// #define BACKLIGHT_BREATHING
// #define BACKLIGHT_LEVELS 3
//#define BACKLIGHT_PIN B7
//#define BACKLIGHT_BREATHING
//#define BACKLIGHT_LEVELS 3
//#define RGB_DI_PIN E2
//#ifdef RGB_DI_PIN
//# define RGBLED_NUM 16
//# define RGBLIGHT_HUE_STEP 8
//# define RGBLIGHT_SAT_STEP 8
//# define RGBLIGHT_VAL_STEP 8
//# define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
//# define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
/*== all animations enable ==*/
//# define RGBLIGHT_ANIMATIONS
/*== or choose animations ==*/
//# define RGBLIGHT_EFFECT_BREATHING
//# define RGBLIGHT_EFFECT_RAINBOW_MOOD
//# define RGBLIGHT_EFFECT_RAINBOW_SWIRL
//# define RGBLIGHT_EFFECT_SNAKE
//# define RGBLIGHT_EFFECT_KNIGHT
//# define RGBLIGHT_EFFECT_CHRISTMAS
//# define RGBLIGHT_EFFECT_STATIC_GRADIENT
//# define RGBLIGHT_EFFECT_RGB_TEST
//# define RGBLIGHT_EFFECT_ALTERNATING
/*== customize breathing effect ==*/
/*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/
//# define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64
/*==== use exp() and sin() ====*/
//# define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7
//# define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255
//#endif
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5
@ -58,13 +85,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* 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
/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
* This is useful for the Windows task manager shortcut (ctrl+shift+esc).
*/
//#define GRAVE_ESC_CTRL_OVERRIDE
/*
* Force NKRO
*
@ -86,54 +116,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//#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.
*
*/
/* 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.
@ -149,30 +131,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION
/*
* MIDI options
*/
/* disable these deprecated features by default */
#define NO_ACTION_MACRO
#define NO_ACTION_FUNCTION
/* Prevent use of disabled MIDI features in the keymap */
//#define MIDI_ENABLE_STRICT 1
/* enable basic MIDI features:
- MIDI notes can be sent when in Music mode is on
*/
//#define MIDI_BASIC
/* enable advanced MIDI features:
- MIDI notes can be added to the keymap
- Octave shift and transpose
- Virtual sustain, portamento, and modulation wheel
- etc.
*/
//#define MIDI_ADVANCED
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 1
#endif
/* Bootmagic Lite key configuration */
//#define BOOTMAGIC_LITE_ROW 0
//#define BOOTMAGIC_LITE_COLUMN 0

View file

@ -0,0 +1,37 @@
{
"keyboard_name": "Woodpad",
"url": "",
"maintainer": "qmk",
"width": 4,
"height": 5,
"layouts": {
"LAYOUT_ortho_5x4": {
"layout": [
{"x": 0, "y": 0},
{"x": 1, "y": 0},
{"x": 2, "y": 0},
{"x": 3, "y": 0},
{"x": 0, "y": 1},
{"x": 1, "y": 1},
{"x": 2, "y": 1},
{"x": 3, "y": 1},
{"x": 0, "y": 2},
{"x": 1, "y": 2},
{"x": 2, "y": 2},
{"x": 3, "y": 2},
{"x": 0, "y": 3},
{"x": 1, "y": 3},
{"x": 2, "y": 3},
{"x": 3, "y": 3},
{"x": 0, "y": 4},
{"x": 1, "y": 4},
{"x": 2, "y": 4},
{"x": 3, "y": 4}
]
}
}
}

View file

@ -1,19 +0,0 @@
/* Copyright 2017 REPLACE_WITH_YOUR_NAME
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
// place overrides here

View file

@ -1,4 +1,4 @@
/* Copyright 2017 REPLACE_WITH_YOUR_NAME
/* Copyright 2017 WoodKeys
*
* 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
@ -13,115 +13,88 @@
* 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
// 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 _NUMLOCK 0
#define _NAV 1
#define _ALT 2
#define _ADJUST 3
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_NUMLOCK] = KEYMAP( /* Base */
KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,\
KC_P7, KC_P8, KC_P9, KC_PPLS, \
KC_P4, KC_P5, KC_P6, KC_PEQL, \
KC_P1, KC_P2, KC_P3, KC_COMM, \
KC_LALT, KC_P0, KC_PDOT, KC_PENT \
),
[_NAV] = KEYMAP( /* Base */
_______, _______, _______, _______,\
KC_HOME, KC_UP, KC_PGUP, _______, \
KC_LEFT, XXXXXXX, KC_RIGHT, _______, \
KC_END, KC_DOWN, KC_PGDN, _______, \
_______, KC_INS, KC_DEL, _______ \
),
[_ALT] = KEYMAP( /* Base */
_______, KC_MUTE, KC_VOLD, KC_VOLU,\
_______, _______, _______, _______, \
_______, _______, _______, _______, \
_______, _______, _______, _______, \
_______, _______, _______, _______ \
),
[_ADJUST] = KEYMAP( /* Base */
_______, KC_A, _______, RESET,\
_______, _______, _______, _______, \
_______, _______, _______, _______, \
_______, _______, _______, _______, \
_______, _______, _______, _______ \
),
enum layer_names {
_NUMLOCK,
_NAV,
_ALT,
_ADJUST
};
void numlock_led_on(void) {
PORTF |= (1<<7);
}
void numlock_led_off(void) {
PORTF &= ~(1<<7);
}
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_NUMLOCK] = LAYOUT_ortho_5x4( /* Base */
KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
KC_P7, KC_P8, KC_P9, KC_PPLS,
KC_P4, KC_P5, KC_P6, KC_PEQL,
KC_P1, KC_P2, KC_P3, KC_COMM,
KC_LALT, KC_P0, KC_PDOT, KC_PENT
),
[_NAV] = LAYOUT_ortho_5x4( /* Base */
_______, _______, _______, _______,
KC_HOME, KC_UP, KC_PGUP, _______,
KC_LEFT, XXXXXXX, KC_RGHT, _______,
KC_END, KC_DOWN, KC_PGDN, _______,
_______, KC_INS, KC_DEL, _______
),
[_ALT] = LAYOUT_ortho_5x4( /* Base */
_______, KC_MUTE, KC_VOLD, KC_VOLU,
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______, _______
),
[_ADJUST] = LAYOUT_ortho_5x4( /* Base */
_______, KC_A, _______, RESET,
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______, _______
)
};
static bool numlock_down = false;
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_NLCK:
if (record->event.pressed) {
numlock_down = true;
if (IS_LAYER_ON(_ALT)) {
layer_on(_ADJUST);
}
} else{
if(!IS_LAYER_ON(_ADJUST)) {
if (!IS_LAYER_ON(_NAV)){
numlock_led_off();
layer_on(_NAV);
} else {
numlock_led_on();
layer_off(_NAV);
}
} else {
layer_off(_ADJUST);
}
numlock_down = false;
}
return false;
break;
case KC_LALT:
if (record->event.pressed) {
if (numlock_down) {
layer_on(_ADJUST);
} else {
layer_on(_ALT);
}
} else {
if(IS_LAYER_ON(_ADJUST)) {
layer_off(_ADJUST);
} else {
layer_off(_ALT);
}
}
// Allow normal processing of ALT?
return false;
break;
}
return true;
}
void matrix_init_user(void) {
// set Numlock LED to output and low
DDRF |= (1<<7);
PORTF &= ~(1<<7);
}
void matrix_scan_user(void) {
}
void led_set_user(uint8_t usb_led) {
switch (keycode) {
case KC_NLCK:
if (record->event.pressed) {
numlock_down = true;
if (IS_LAYER_ON(_ALT)) {
layer_on(_ADJUST);
}
} else {
if(!IS_LAYER_ON(_ADJUST)) {
if (!IS_LAYER_ON(_NAV)) {
numlock_led_off();
layer_on(_NAV);
} else {
numlock_led_on();
layer_off(_NAV);
}
} else {
layer_off(_ADJUST);
}
numlock_down = false;
}
return false;
case KC_LALT:
if (record->event.pressed) {
if (numlock_down) {
layer_on(_ADJUST);
} else {
layer_on(_ALT);
}
} else {
if(IS_LAYER_ON(_ADJUST)) {
layer_off(_ADJUST);
} else {
layer_off(_ALT);
}
}
// Allow normal processing of ALT
return false;
}
return true;
}

View file

@ -1 +1 @@
# The default keymap for woodpad
# The default keymap for Woodpad

View file

@ -1,17 +1,2 @@
# QMK 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 support (+2400 to 4200, depending on config)
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.
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
CONSOLE_ENABLE = no
NKRO_ENABLE = yes

View file

@ -1,28 +1,17 @@
woodpad keyboard firmware
======================
# Woodpad
## Quantum MK Firmware
![Woodpad](https://woodkeys.click/wp-content/uploads/2017/08/ma2.jpg)
For the full Quantum feature list, see [the parent readme](/).
* Keyboard Maintainer: QMK Community
* Hardware Supported: Woodpad PCB
* Hardware Availability: [WoodKeys](https://woodkeys.click/product/woodpad/)
## Building
Make example for this keyboard (after setting up your build environment):
Download or clone the whole firmware and navigate to the keyboards/woodpad 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.
make handwired/woodpad:default
Depending on which keymap you would like to use, you will have to compile slightly differently.
Flashing example for this keyboard:
### Default
make handwired/woodpad:default:flash
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|<name>]
```
Keymaps follow the format **__\<name\>.c__** and are stored in the `keymaps` folder.
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).

View file

@ -2,31 +2,23 @@
MCU = atmega32u4
# Bootloader selection
# Teensy halfkay
# Pro Micro caterina
# Atmel DFU atmel-dfu
# LUFA DFU lufa-dfu
# QMK DFU qmk-dfu
# ATmega32A bootloadHID
# ATmega328P USBasp
BOOTLOADER = caterina
# 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)
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = yes # Console for debug
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 support (+2400 to 4200, depending on config)
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
RGBLIGHT_ENABLE = no
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
BLUETOOTH_ENABLE = no # Enable Bluetooth
AUDIO_ENABLE = no # Audio output
LAYOUTS = ortho_5x4

View file

@ -1,4 +1,4 @@
/* Copyright 2017 REPLACE_WITH_YOUR_NAME
/* Copyright 2017 WoodKeys
*
* 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
@ -13,31 +13,18 @@
* 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 "woodpad.h"
void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
matrix_init_user();
void keyboard_pre_init_kb(void) {
setPinOutput(F7);
keyboard_pre_init_user();
}
void matrix_scan_kb(void) {
// put your looping keyboard code here
// runs every cycle (a lot)
matrix_scan_user();
inline void numlock_led_on(void) {
writePinHigh(F7);
}
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);
inline void numlock_led_off(void) {
writePinLow(F7);
}

View file

@ -1,4 +1,4 @@
/* Copyright 2017 REPLACE_WITH_YOUR_NAME
/* Copyright 2017 WoodKeys
*
* 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
@ -13,28 +13,32 @@
* 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 WOODPAD_H
#define WOODPAD_H
#pragma once
#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 arguments
// The second converts the arguments into a two-dimensional array
#define KEYMAP( \
extern void numlock_led_on(void);
extern void numlock_led_off(void);
/* This is a shortcut to help you visually see your layout.
*
* The first section contains all of the arguments representing the physical
* layout of the board and position of the keys.
*
* The second converts the arguments into a two-dimensional array which
* represents the switch matrix.
*/
#define LAYOUT_ortho_5x4( \
k00, k01, k02, k03, \
k10, k11, k12, k13, \
k20, k21, k22, k23, \
k30, k31, k32, k33, \
k40, k41, k42, k43 \
) \
{ \
) { \
{ k00, k01, k02, k03 }, \
{ k10, k11, k12, k13 }, \
{ k20, k21, k22, k23 }, \
{ k30, k31, k32, k33 }, \
{ k40, k41, k42, k43 }, \
{ k40, k41, k42, k43 } \
}
#endif