From 28bd394eb775b5f3180ada278d69f3ddadd28ec1 Mon Sep 17 00:00:00 2001 From: fishsoupisgood Date: Thu, 1 Oct 2020 16:50:32 +0100 Subject: tmdk_32a --- keyboards/ymdk/ymd09_32a/README.md | 15 +++++ keyboards/ymdk/ymd09_32a/config.h | 44 ++++++++++++++ keyboards/ymdk/ymd09_32a/info.json | 23 ++++++++ keyboards/ymdk/ymd09_32a/keymaps/default/keymap.c | 13 ++++ keyboards/ymdk/ymd09_32a/keymaps/jmm/keymap.c | 13 ++++ keyboards/ymdk/ymd09_32a/keymaps/via/keymap.c | 20 +++++++ keyboards/ymdk/ymd09_32a/keymaps/via/rules.mk | 1 + keyboards/ymdk/ymd09_32a/rules.mk | 23 ++++++++ keyboards/ymdk/ymd09_32a/ymd09_32a.c | 72 +++++++++++++++++++++++ keyboards/ymdk/ymd09_32a/ymd09_32a.h | 43 ++++++++++++++ 10 files changed, 267 insertions(+) create mode 100644 keyboards/ymdk/ymd09_32a/README.md create mode 100644 keyboards/ymdk/ymd09_32a/config.h create mode 100644 keyboards/ymdk/ymd09_32a/info.json create mode 100644 keyboards/ymdk/ymd09_32a/keymaps/default/keymap.c create mode 100644 keyboards/ymdk/ymd09_32a/keymaps/jmm/keymap.c create mode 100644 keyboards/ymdk/ymd09_32a/keymaps/via/keymap.c create mode 100644 keyboards/ymdk/ymd09_32a/keymaps/via/rules.mk create mode 100644 keyboards/ymdk/ymd09_32a/rules.mk create mode 100644 keyboards/ymdk/ymd09_32a/ymd09_32a.c create mode 100644 keyboards/ymdk/ymd09_32a/ymd09_32a.h diff --git a/keyboards/ymdk/ymd09_32a/README.md b/keyboards/ymdk/ymd09_32a/README.md new file mode 100644 index 000000000..dce883c1f --- /dev/null +++ b/keyboards/ymdk/ymd09_32a/README.md @@ -0,0 +1,15 @@ +# YMD09 + +![YMD09](https://ae01.alicdn.com/kf/HTB1x6BATYvpK1RjSZPiq6zmwXXai/9-Key-QMK-Hotswap-YMDK-RGB-Support-Macro-Function-Type-C-MX-Switches-Mechanical-Keyboard-Numpad.jpg) + +A 9-key macropad by [YMDK](https://ymdk.aliexpress.com/store/429151) with per-key RGB lighting. + +* Keyboard Maintainer: [Patrick Fruh](https://github.com/kaeltis) +* Hardware Supported: YMD09 +* Hardware Availability: [AliExpress](https://www.aliexpress.com/i/4000510880374.html) + +Make example for this keyboard (after setting up your build environment): + + make ymdk/ymd09:default + +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). diff --git a/keyboards/ymdk/ymd09_32a/config.h b/keyboards/ymdk/ymd09_32a/config.h new file mode 100644 index 000000000..4bf0d5be4 --- /dev/null +++ b/keyboards/ymdk/ymd09_32a/config.h @@ -0,0 +1,44 @@ +/* +Copyright 2019 Ethan Durrant (emdarcher) + +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 . +*/ + +#pragma once + +#define VENDOR_ID 0x20A0 +#define PRODUCT_ID 0x422D +#define DEVICE_VER 0x0104 +#define MANUFACTURER YMDK +#define PRODUCT YMD09_32A +#define DESCRIPTION 9-Key Macropad + +/* matrix size */ +#define MATRIX_ROWS 3 +#define MATRIX_COLS 3 + +#define MATRIX_ROW_PINS { A0, A1, A2 } +#define MATRIX_COL_PINS { B0, B1, B2 } +#define UNUSED_PINS + +#define DIODE_DIRECTION ROW2COL + +#define BACKLIGHT_PIN D4 +#define BACKLIGHT_LEVELS 6 + +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 9 +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 diff --git a/keyboards/ymdk/ymd09_32a/info.json b/keyboards/ymdk/ymd09_32a/info.json new file mode 100644 index 000000000..f7c7034a6 --- /dev/null +++ b/keyboards/ymdk/ymd09_32a/info.json @@ -0,0 +1,23 @@ +{ + "keyboard_name": "YMD09_32A", + "url": "https://www.aliexpress.com/item/4000510880374.html", + "maintainer": "jmm", + "width": 3, + "height": 3, + "layouts": { + "LAYOUT": { + "key_count": 9, + "layout": [ + {"label": "7", "x": 0, "y": 0}, + {"label": "8", "x": 1, "y": 0}, + {"label": "9", "x": 2, "y": 0}, + {"label": "4", "x": 0, "y": 1}, + {"label": "5", "x": 1, "y": 1}, + {"label": "6", "x": 2, "y": 1}, + {"label": "1", "x": 0, "y": 2}, + {"label": "2", "x": 1, "y": 2}, + {"label": "3", "x": 2, "y": 2} + ] + } + } +} diff --git a/keyboards/ymdk/ymd09_32a/keymaps/default/keymap.c b/keyboards/ymdk/ymd09_32a/keymaps/default/keymap.c new file mode 100644 index 000000000..330e41db6 --- /dev/null +++ b/keyboards/ymdk/ymd09_32a/keymaps/default/keymap.c @@ -0,0 +1,13 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [0] = LAYOUT(KC_KP_7, KC_KP_8, KC_KP_9, + KC_KP_4, LT(1, KC_KP_5), KC_KP_6, + KC_KP_1, KC_KP_2, KC_KP_3), + + [1] = LAYOUT(RGB_RMOD, RGB_VAI, RGB_MOD, + RGB_HUI, KC_TRNS, RGB_SAI, + RGB_HUD, RGB_VAD, RGB_SAD), + +}; diff --git a/keyboards/ymdk/ymd09_32a/keymaps/jmm/keymap.c b/keyboards/ymdk/ymd09_32a/keymaps/jmm/keymap.c new file mode 100644 index 000000000..982fd95f1 --- /dev/null +++ b/keyboards/ymdk/ymd09_32a/keymaps/jmm/keymap.c @@ -0,0 +1,13 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [0] = LAYOUT(KC_A, KC_B, KC_C, + KC_D, LT(1,KC_E), KC_F, + KC_G, KC_H, KC_U ), + + [1] = LAYOUT(RGB_RMOD, RGB_VAI, RGB_MOD, + RGB_HUI, KC_TRNS, RGB_SAI, + RGB_HUD, RGB_VAD, RGB_SAD), + +}; diff --git a/keyboards/ymdk/ymd09_32a/keymaps/via/keymap.c b/keyboards/ymdk/ymd09_32a/keymaps/via/keymap.c new file mode 100644 index 000000000..e84b587a3 --- /dev/null +++ b/keyboards/ymdk/ymd09_32a/keymaps/via/keymap.c @@ -0,0 +1,20 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [0] = LAYOUT(KC_KP_7, KC_KP_8, KC_KP_9, + KC_KP_4, LT(1, KC_KP_5), KC_KP_6, + KC_KP_1, KC_KP_2, KC_KP_3), + + [1] = LAYOUT(RGB_RMOD, RGB_VAI, RGB_MOD, + RGB_HUI, RESET, RGB_SAI, + RGB_HUD, RGB_VAD, RGB_SAD), + + [2] = LAYOUT(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), +}; diff --git a/keyboards/ymdk/ymd09_32a/keymaps/via/rules.mk b/keyboards/ymdk/ymd09_32a/keymaps/via/rules.mk new file mode 100644 index 000000000..1e5b99807 --- /dev/null +++ b/keyboards/ymdk/ymd09_32a/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/ymdk/ymd09_32a/rules.mk b/keyboards/ymdk/ymd09_32a/rules.mk new file mode 100644 index 000000000..57b0c1c1b --- /dev/null +++ b/keyboards/ymdk/ymd09_32a/rules.mk @@ -0,0 +1,23 @@ +# MCU name +MCU = atmega32a + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# ATmega32A bootloadHID +# ATmega328P USBasp +BOOTLOADER = bootloadHID + +# build options +BOOTMAGIC_ENABLE = no +MOUSEKEY_ENABLE = yes +EXTRAKEY_ENABLE = yes +CONSOLE_ENABLE = no +COMMAND_ENABLE = yes +BACKLIGHT_ENABLE = yes +RGBLIGHT_ENABLE = yes +WS2812_DRIVER = i2c +ENABLE_RAW = yes diff --git a/keyboards/ymdk/ymd09_32a/ymd09_32a.c b/keyboards/ymdk/ymd09_32a/ymd09_32a.c new file mode 100644 index 000000000..e600ddd3a --- /dev/null +++ b/keyboards/ymdk/ymd09_32a/ymd09_32a.c @@ -0,0 +1,72 @@ +/* + * Copyright 2019 Ethan Durrant (emdarcher) + * + * 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 "ymd09_32a.h" + + +void raw_hid_receive( uint8_t *data, uint8_t length ) +{ + uint8_t *command_id = &(data[0]); + uint8_t *command_data = &(data[1]); + + switch ( *command_id ) + { + case RAW_COMMAND_GET_PROTOCOL_VERSION: //0x01(id) 0x00(payload_length) + { + *command_id =RAW_COMMAND_GET_PROTOCOL_VERSION; + command_data[0]=0x01; + command_data[1]=PROTOCOL_VERSION; + break; + } + case RAW_COMMAND_CHANGE_COLOR: // 0x05 0x03 0xRR 0xGG 0xBB + { + *command_id=RAW_COMMAND_CHANGE_COLOR; + if(command_data[0] != 3 ) + { + command_data[0]=0x01; + command_data[1]=FAILED; + } + else + { + rgblight_sethsv(command_data[1], command_data[2], command_data[3]); + command_data[0]=0x04; + command_data[4]=SUCCESS; + } + break; + } + default: //0xff ... + { + *command_id=RAW_COMMAND_UNDEFINED; + command_data[0]=0x01; + command_data[1]=FAILED; + break; + } + } + raw_hid_send(data,length); +} + +void keyboard_pre_init_kb(void) { + led_init_ports(); + keyboard_pre_init_user(); +} + +void led_init_ports(void) { + setPinOutput(D1); +} + +bool led_update_kb(led_t led_state) { + return true; +} diff --git a/keyboards/ymdk/ymd09_32a/ymd09_32a.h b/keyboards/ymdk/ymd09_32a/ymd09_32a.h new file mode 100644 index 000000000..878df0226 --- /dev/null +++ b/keyboards/ymdk/ymd09_32a/ymd09_32a.h @@ -0,0 +1,43 @@ +/* +Copyright 2019 Ethan Durrant (emdarcher) + +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 . +*/ + +#pragma once + +#include "quantum.h" +#include "raw_hid.h" + +enum RAW_COMMAND_ID +{ + RAW_COMMAND_GET_PROTOCOL_VERSION=0x01, + RAW_COMMAND_CHANGE_COLOR=0x05, + RAW_COMMAND_UNDEFINED=0xff, +}; + +#define PROTOCOL_VERSION 0x02 +#define SUCCESS 0x01 +#define FAILED 0xff + + +#define LAYOUT( \ + K00, K01, K02, \ + K10, K11, K12, \ + K20, K21, K22 \ +) { \ + { K00, K01, K02 }, \ + { K10, K11, K12 }, \ + { K20, K21, K22 } \ +} -- cgit v1.2.3