Add initial support for the Makey Makey Classic (#16658)

This commit is contained in:
jpe230 2022-04-19 05:53:09 -05:00 committed by GitHub
parent bdd1f318c3
commit 1acb37db7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 308 additions and 0 deletions

View File

@ -0,0 +1,36 @@
/* Copyright 2022 Jose Pablo Ramirez <jp.ramangulo@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/>.
*/
#pragma once
#include "config_common.h"
/* key matrix size */
#define MATRIX_ROWS 3
#define MATRIX_COLS 6
/* Keyboard Matrix Assignments */
#define DIRECT_PINS { \
{ D6, B4, C7, B1, E6, D7 }, \
{ C6, D4, D0, D1, D2, D2 }, \
{ F0, F1, F5, F5, F6, F7 } \
}
/* LEDs Pins */
#define LED_PINS 5
#define LED_PINS_HW {B5, B6, B7, B3, B2}
#define DEBOUNCE 10

View File

@ -0,0 +1,35 @@
{
"keyboard_name": "Makey Makey Classic",
"manufacturer": "JoyLabs",
"url": "https://makeymakey.com/products/makey-makey-kit",
"maintainer": "Jpe230",
"usb": {
"vid": "0xE230",
"pid": "0x2B74",
"device_version": "0.0.1"
},
"layouts": {
"LAYOUT": {
"layout": [
{"x":0, "y":0},
{"x":1, "y":0},
{"x":2, "y":0},
{"x":3, "y":0},
{"x":4, "y":0},
{"x":5, "y":0},
{"x":0, "y":1},
{"x":1, "y":1},
{"x":2, "y":1},
{"x":3, "y":1},
{"x":4, "y":1},
{"x":5, "y":1},
{"x":0, "y":2},
{"x":1, "y":2},
{"x":2, "y":2},
{"x":3, "y":2},
{"x":4, "y":2},
{"x":5, "y":2}
]
}
}
}

View File

@ -0,0 +1,42 @@
/* Copyright 2022 Jose Pablo Ramirez <jp.ramangulo@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/>.
*/
#include QMK_KEYBOARD_H
// clang-format off
/*
* ,-----------------------------------------------------.
* | |
* | (UP) |
* MSU | ^ .-""-. .-""-. | W
* MSD | | / \ / \ | A
* MSL | (LEFT)<== O ==> (RIGHT) ; ; ; ; | S
* MSR | | \ / \ / | D
* MB1 | v '-..-' '-..-' | F
* MB2 | (DOWN) (SPACE) (RGHT CLK) | G
* | |
* \-----------------------------------------------------/
*/
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(
KC_UP, KC_DOWN, KC_LEFT, KC_RGHT, KC_SPC, KC_BTN1,
KC_W, KC_A, KC_S, KC_D, KC_F, KC_G,
KC_MS_U, KC_MS_D, KC_MS_L, KC_MS_R, KC_BTN1, KC_BTN2
)
};
// clang-format on

View File

@ -0,0 +1,126 @@
/* Copyright 2022 Jose Pablo Ramirez <jp.ramangulo@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/>.
*/
#include "makeymakey.h"
static pin_t pins[MATRIX_ROWS][MATRIX_COLS] = DIRECT_PINS;
static pin_t led_pins[LED_PINS] = LED_PINS_HW;
static bool led_state[MATRIX_COLS] = {0};
static uint8_t led_cycle_counter = 0;
void keyboard_post_init_kb(void) {
for(uint8_t row = 0; row < MATRIX_ROWS; row++)
{
for(uint8_t col = 0; col < MATRIX_COLS; col++)
{
writePinLow(pins[row][col]); //Disable internal pull-up resistors
}
}
keyboard_post_init_user();
}
void cycle_leds(void) {
for(uint8_t i = 0; i < 3; i++) {
setPinInput(led_pins[i]);
writePinLow(led_pins[i]);
}
led_cycle_counter++;
led_cycle_counter %= 6;
switch (led_cycle_counter) {
case 0:
if (led_state[0]) { // Up Arrow
setPinInput(led_pins[0]);
writePinLow(led_pins[0]);
setPinOutput(led_pins[1]);
writePinHigh(led_pins[1]);
setPinOutput(led_pins[2]);
writePinLow(led_pins[2]);
}
break;
case 1:
if (led_state[1]) { // Down Arrow
setPinOutput(led_pins[0]);
writePinHigh(led_pins[0]);
setPinOutput(led_pins[1]);
writePinLow(led_pins[1]);
setPinInput(led_pins[2]);
writePinLow(led_pins[2]);
}
break;
case 2:
if (led_state[2]) { // Left Arrow
setPinOutput(led_pins[0]);
writePinLow(led_pins[0]);
setPinOutput(led_pins[1]);
writePinHigh(led_pins[1]);
setPinInput(led_pins[2]);
writePinLow(led_pins[2]);
}
break;
case 3:
if (led_state[3]) { // Right Arrow
setPinInput(led_pins[0]);
writePinLow(led_pins[0]);
setPinOutput(led_pins[1]);
writePinLow(led_pins[1]);
setPinOutput(led_pins[2]);
writePinHigh(led_pins[2]);
}
break;
case 4:
if (led_state[4]) { // Space
setPinOutput(led_pins[0]);
writePinLow(led_pins[0]);
setPinInput(led_pins[1]);
writePinLow(led_pins[1]);
setPinOutput(led_pins[2]);
writePinHigh(led_pins[2]);
}
break;
case 5:
if (led_state[5]) { // Right Click
setPinOutput(led_pins[0]);
writePinHigh(led_pins[0]);
setPinInput(led_pins[1]);
writePinLow(led_pins[1]);
setPinOutput(led_pins[2]);
writePinLow(led_pins[2]);
}
break;
default:
break;
}
}
void matrix_scan_kb() {
cycle_leds();
matrix_scan_user();
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
uint8_t row = record->event.key.row;
uint8_t col = record->event.key.col;
if(row == 0 && col >= 0 && col < MATRIX_COLS) {
led_state[col] = record->event.pressed;
}
return process_record_user(keycode, record);
}

View File

@ -0,0 +1,32 @@
/* Copyright 2022 Jose Pablo Ramirez <jp.ramangulo@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/>.
*/
#pragma once
#include "quantum.h"
// clang-format off
#define LAYOUT( \
K00, K01, K02, K03, K04, K05, \
K10, K11, K12, K13, K14, K15, \
K20, K21, K22, K23, K24, K25 \
) \
{ \
{ K00, K01, K02, K03, K04, K05 }, \
{ K10, K11, K12, K13, K14, K15 }, \
{ K20, K21, K22, K23, K24, K25 } \
}
// clang-format on

View File

@ -0,0 +1,19 @@
# Makey Makey Classic
![makeymakey](https://cdn.shopify.com/s/files/1/0162/8612/products/Makey_Carlos_1024x1024_crop_center.png)
The original Makey Makey Classic. There are six inputs on the front of the board, which can be attached to via alligator clipping, soldering to the pads, or any other method you can think of. There are another 12 inputs on the back, six for keyboard keys and six for mouse motion, which you can access with jumpers via the female headers.
* Keyboard Maintainer: [Pablo Ramirez](https://github.com/Jpe230)
* Hardware Supported: Makey Makey Classic (atmega32u4)
* Hardware Availability: [Makey Makey official store] https://makeymakey.com/products/makey-makey-kit
Make example for this keyboard (after setting up your build environment):
make makeymakey:default
Flashing example for this keyboard:
make makeymakey:default:flash
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,18 @@
# MCU name
MCU = atmega32u4
# Bootloader selection
BOOTLOADER = caterina
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = no # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = yes # Enable N-Key Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output