[Keyboard] Add the Octopad (#9946)

* Create Alter folder

* Revert "Create Alter folder"

This reverts commit 361103b821dbb22957b66cdedb0d11f996def71c.

* Add octopad folder

* Added a new keyboard, the Octopad

* Edited files based on requested changes

* Moved encoder code in keyboard level

* Updated the readme

* Corrected the rows and columns of encoders on config.h

* Changed the Vendor ID to D812 since the first one was already taken

* Added support for ast1109MLTRQ speakers

* Increased number of layers to 8 on VIA keymap

* Edited files based on comments

* Edited rules.mk as per comment

* Edited readme.md as per comment
master
NightlyBoards 2020-12-30 08:58:14 +08:00 committed by GitHub
parent 8ee03f6a6b
commit ac433b218d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 406 additions and 0 deletions

View File

@ -0,0 +1,85 @@
/*
Copyright 2020 Neil Brian Ramirez
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
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xD812
#define PRODUCT_ID 0x0004
#define DEVICE_VER 0x0001
#define MANUFACTURER Neil Brian Ramirez
#define PRODUCT Octopad
/* key matrix size */
#define MATRIX_ROWS 3
#define MATRIX_COLS 5
/*
* 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 { B2, B3, NO_PIN }
#define MATRIX_COL_PINS { F1, F0, D0, D1, B1 }
#define UNUSED_PINS
/* COL2ROW, ROW2COL*/
#define DIODE_DIRECTION COL2ROW
#define RGB_DI_PIN F7
#ifdef RGB_DI_PIN
#define RGBLED_NUM 8
#define RGBLIGHT_ANIMATIONS
#endif
/* Encoders */
#define ENCODERS 2
#define ENCODERS_PAD_A { C7, F4 }
#define ENCODERS_PAD_B { C6, F5 }
#define ENCODERS_CW_KEY { { 3, 2 },{ 1, 2 } }
#define ENCODERS_CCW_KEY { { 2, 2 },{ 0, 2 } }
/* Audio */
#define B5_AUDIO
#define AUDIO_CLICKY
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5
/* define if matrix has ghost (lacks anti-ghosting diodes) */
//#define MATRIX_HAS_GHOST
/* 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

View File

@ -0,0 +1,51 @@
/* Copyright 2020 Neil Brian Ramirez
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "encoder_action.h"
#ifdef ENCODERS
static uint8_t encoder_state[ENCODERS] = {0};
static keypos_t encoder_cw[ENCODERS] = ENCODERS_CW_KEY;
static keypos_t encoder_ccw[ENCODERS] = ENCODERS_CCW_KEY;
#endif
void encoder_action_unregister(void) {
#ifdef ENCODERS
for (int index = 0; index < ENCODERS; ++index) {
if (encoder_state[index]) {
keyevent_t encoder_event = (keyevent_t) {
.key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
.pressed = false,
.time = (timer_read() | 1)
};
encoder_state[index] = 0;
action_exec(encoder_event);
}
}
#endif
}
void encoder_action_register(uint8_t index, bool clockwise) {
#ifdef ENCODERS
keyevent_t encoder_event = (keyevent_t) {
.key = clockwise ? encoder_cw[index] : encoder_ccw[index],
.pressed = true,
.time = (timer_read() | 1)
};
encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
action_exec(encoder_event);
#endif
}

View File

@ -0,0 +1,21 @@
/* Copyright 2020 Neil Brian Ramirez
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "quantum.h"
void encoder_action_unregister(void);
void encoder_action_register(uint8_t index, bool clockwise);

View File

@ -0,0 +1,29 @@
{
"keyboard_name": "Octopad",
"url": "",
"maintainer": "Neil Brian Ramirez",
"width": 6.5,
"height": 3.25,
"layouts": {
"LAYOUT": {
"layout": [
{"x":0, "y":0},
{"x":1, "y":0},
{"x":2, "y":0},
{"x":3.5, "y":0},
{"x":4.5, "y":0},
{"x":5.5, "y":0},
{"x":1.25, "y":1.25},
{"x":2.25, "y":1.25},
{"x":3.25, "y":1.25},
{"x":4.25, "y":1.25},
{"x":1.25, "y":2.25},
{"x":2.25, "y":2.25},
{"x":3.25, "y":2.25},
{"x":4.25, "y":2.25}
]
}
}
}

View File

@ -0,0 +1,32 @@
/* Copyright 2020 Neil Brian Ramirez
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Base */
/* ENC1_CCW, ENC1_P, ENC1_CW, ENC2_CCW, ENC2_P, ENC2_CW,
MACRO1, MACRO2, MACRO3, MACRO4,
MACRO5, MACRO6, MACRO7, MACRO8
*/
[0] = LAYOUT(
KC_VOLD, KC_ESC, KC_VOLU, KC_BRID, RESET, KC_BRIU,
KC_Q, KC_W, KC_E, KC_R,
KC_A, KC_S, KC_D, KC_F
),
};

View File

@ -0,0 +1 @@
#define DYNAMIC_KEYMAP_LAYER_COUNT 8

View File

@ -0,0 +1,73 @@
/* Copyright 2020 Neil Brian Ramirez
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Base */
/* ENC1_CCW, ENC1_P, ENC1_CW, ENC2_CCW, ENC2_P, ENC2_CW,
MACRO1, MACRO2, MACRO3, MACRO4,
MACRO5, MACRO6, MACRO7, MACRO8
*/
[0] = LAYOUT(
KC_VOLD, KC_ESC, KC_VOLU, KC_BRID, RESET, KC_BRIU,
KC_Q, KC_W, KC_E, KC_R,
KC_A, KC_S, KC_D, KC_F
),
[1] = LAYOUT(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
[2] = LAYOUT(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
[3] = LAYOUT(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
[4] = LAYOUT(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
[5] = LAYOUT(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
[6] = LAYOUT(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
[7] = LAYOUT(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
};

View File

@ -0,0 +1,2 @@
VIA_ENABLE = yes
LTO_ENABLE = yes

View File

@ -0,0 +1,27 @@
/* Copyright 2020 Neil Brian Ramirez
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "octopad.h"
void matrix_scan_kb(void) {
encoder_action_unregister();
matrix_scan_user();
}
void encoder_update_kb(uint8_t index, bool clockwise) {
encoder_action_register(index, clockwise);
// encoder_update_user(index, clockwise);
};

View File

@ -0,0 +1,39 @@
/* Copyright 2020 Neil Brian Ramirez
*
* 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
#include "quantum.h"
#include "encoder_action.h"
/* 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( \
E00A, K04, E00B, E01A, K14, E01B, \
K00, K01, K02, K03, \
K10, K11, K12, K13 \
\
) { \
{ K00, K01, K02, K03, K04 }, \
{ K10, K11, K12, K13, K14 }, \
{ E00A, E00B, E01A, E01B, KC_NO } \
}

View File

@ -0,0 +1,20 @@
# Nightly Boards Octopad
![octopad](https://i.imgur.com/MkSzzGBl.jpg)
An 8 key macropad with 2 rotary encoders
* Keyboard Maintainer: [Neil Brian Ramirez](https://github.com/NightlyBoards)
* Hardware Supported: atmega32u4
Make example for this keyboard (after setting up your build environment):
make nightly_boards/octopad:default
Flashing example for this keyboard:
make nightly_boards/octopad:default:flash
You can enter bootloader mode by pressing the physical reset button at the back of the pcb or by holding the upper left key (among the 8 keys) while plugging the usb cable.
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

@ -0,0 +1,26 @@
# MCU name
MCU = atmega32u4
# Bootloader selection
BOOTLOADER = atmel-dfu
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # 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
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
BLUETOOTH_ENABLE = no # Enable Bluetooth
AUDIO_ENABLE = yes # Audio output
ENCODER_ENABLE = yes # Enable Rotary Encoders
# Added encoder Action
SRC += encoder_action.c