From d35999340720a56c6368d56a497e30c87386102e Mon Sep 17 00:00:00 2001 From: mechlovin <57231893+mechlovin@users.noreply.github.com> Date: Mon, 6 Jul 2020 09:43:54 +0700 Subject: [PATCH 1/8] add --- keyboards/mechlovin/delphine/config.h | 71 +++++++++++++++++++ keyboards/mechlovin/delphine/delphine.c | 50 +++++++++++++ keyboards/mechlovin/delphine/delphine.h | 38 ++++++++++ keyboards/mechlovin/delphine/info.json | 39 ++++++++++ .../delphine/keymaps/default/keymap.c | 28 ++++++++ .../delphine/keymaps/default/readme.md | 1 + .../mechlovin/delphine/keymaps/via/keymap.c | 52 ++++++++++++++ .../mechlovin/delphine/keymaps/via/readme.md | 1 + .../mechlovin/delphine/keymaps/via/rules.mk | 1 + keyboards/mechlovin/delphine/readme.md | 15 ++++ keyboards/mechlovin/delphine/rev1/config.h | 5 ++ keyboards/mechlovin/delphine/rev1/rules.mk | 39 ++++++++++ keyboards/mechlovin/delphine/rules.mk | 1 + 13 files changed, 341 insertions(+) create mode 100644 keyboards/mechlovin/delphine/config.h create mode 100644 keyboards/mechlovin/delphine/delphine.c create mode 100644 keyboards/mechlovin/delphine/delphine.h create mode 100644 keyboards/mechlovin/delphine/info.json create mode 100644 keyboards/mechlovin/delphine/keymaps/default/keymap.c create mode 100644 keyboards/mechlovin/delphine/keymaps/default/readme.md create mode 100644 keyboards/mechlovin/delphine/keymaps/via/keymap.c create mode 100644 keyboards/mechlovin/delphine/keymaps/via/readme.md create mode 100644 keyboards/mechlovin/delphine/keymaps/via/rules.mk create mode 100644 keyboards/mechlovin/delphine/readme.md create mode 100644 keyboards/mechlovin/delphine/rev1/config.h create mode 100644 keyboards/mechlovin/delphine/rev1/rules.mk create mode 100644 keyboards/mechlovin/delphine/rules.mk diff --git a/keyboards/mechlovin/delphine/config.h b/keyboards/mechlovin/delphine/config.h new file mode 100644 index 000000000000..d4d09625a01e --- /dev/null +++ b/keyboards/mechlovin/delphine/config.h @@ -0,0 +1,71 @@ +/* +Copyright 2020 Team Mechlovin' + +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 "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x4D4C +#define MANUFACTURER Mechlovin +#define PRODUCT Mechlovin Delphine +#define DESCRIPTION Mechlovin Delphine + +/* key matrix size */ +#define MATRIX_ROWS 6 +#define MATRIX_COLS 4 + +/* + * 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 { F0, F1, F4, F5, F6, D3 } +#define MATRIX_COL_PINS { F7, D7, D6, D2 } + +#define DIODE_DIRECTION COL2ROW + +#define BACKLIGHT_PIN B6 +// #define BACKLIGHT_BREATHING +#define BACKLIGHT_LEVELS 3 + +#define RGB_DI_PIN E2 +#ifdef RGB_DI_PIN + #define RGBLED_NUM 13 + #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 +#endif \ No newline at end of file diff --git a/keyboards/mechlovin/delphine/delphine.c b/keyboards/mechlovin/delphine/delphine.c new file mode 100644 index 000000000000..d370d33dede8 --- /dev/null +++ b/keyboards/mechlovin/delphine/delphine.c @@ -0,0 +1,50 @@ +/* Copyright 2020 Team Mechlovin' + * + * 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 "delphine.h" + +// Optional override functions below. +// You can leave any or all of these undefined. +// These are only required if you want to perform custom actions. + +/* +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + + matrix_init_user(); +} + +void matrix_scan_kb(void) { + // put your looping keyboard code here + // runs every cycle (a lot) + + matrix_scan_user(); +} + +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); +} + +bool led_update_kb(led_t led_state) { + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + + return led_update_user(led_state); +} +*/ diff --git a/keyboards/mechlovin/delphine/delphine.h b/keyboards/mechlovin/delphine/delphine.h new file mode 100644 index 000000000000..4cb2e2d3019a --- /dev/null +++ b/keyboards/mechlovin/delphine/delphine.h @@ -0,0 +1,38 @@ +/* Copyright 2020 Team Mechlovin' + * + * 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" + +#define LAYOUT_all( \ + K00, K01, K02, K03, \ + K10, K11, K12, K13, \ + K20, K21, K22, K23, \ + K30, K31, K32, K33, \ + K40, K41, K42, K43, \ + K50, K51, K52, K53 \ +) { \ + { K00, K01, K02, K03 }, \ + { K10, K11, K12, K13 }, \ + { K20, K21, K22, K23 }, \ + { K30, K31, K32, K33 }, \ + { K40, K41, K42, K43 }, \ + { K50, K51, K52, K53 }, \ +} + +// generated by KBFirmware JSON to QMK Parser +// https://noroadsleft.github.io/kbf_qmk_converter/ diff --git a/keyboards/mechlovin/delphine/info.json b/keyboards/mechlovin/delphine/info.json new file mode 100644 index 000000000000..ad289b5e0c84 --- /dev/null +++ b/keyboards/mechlovin/delphine/info.json @@ -0,0 +1,39 @@ +{ + "keyboard_name": "Delphine", + "url": "", + "maintainer": "Team Mechlovin'", + "width": 4, + "height": 6.25, + "layouts": { + "LAYOUT_all": { + "key_count": 24, + "layout": [ + {"label":"K00 (F0,F7)", "x":0, "y":0}, + {"label":"K01 (F0,D7)", "x":1, "y":0}, + {"label":"K02 (F0,D6)", "x":2, "y":0}, + {"label":"K03 (F0,D2)", "x":3, "y":0}, + {"label":"K10 (F1,F7)", "x":0, "y":1.25}, + {"label":"K11 (F1,D7)", "x":1, "y":1.25}, + {"label":"K12 (F1,D6)", "x":2, "y":1.25}, + {"label":"K13 (F1,D2)", "x":3, "y":1.25}, + {"label":"K20 (F4,F7)", "x":0, "y":2.25}, + {"label":"K21 (F4,D7)", "x":1, "y":2.25}, + {"label":"K22 (F4,D6)", "x":2, "y":2.25}, + {"label":"K23 (F4,D2)", "x":3, "y":2.25}, + {"label":"K30 (F5,F7)", "x":0, "y":3.25}, + {"label":"K31 (F5,D7)", "x":1, "y":3.25}, + {"label":"K32 (F5,D6)", "x":2, "y":3.25}, + {"label":"K33 (F5,D2)", "x":3, "y":3.25}, + {"label":"K40 (F6,F7)", "x":0, "y":4.25}, + {"label":"K41 (F6,D7)", "x":1, "y":4.25}, + {"label":"K42 (F6,D6)", "x":2, "y":4.25}, + {"label":"K43 (F6,D2)", "x":3, "y":4.25}, + {"label":"K50 (D3,F7)", "x":0, "y":5.25}, + {"label":"K51 (D3,D7)", "x":1, "y":5.25}, + {"label":"K52 (D3,D6)", "x":2, "y":5.25}, + {"label":"K53 (D3,D2)", "x":3, "y":5.25} + ] + } + } + ,"meta": "https://noroadsleft.github.io/kbf_qmk_converter/" +} diff --git a/keyboards/mechlovin/delphine/keymaps/default/keymap.c b/keyboards/mechlovin/delphine/keymaps/default/keymap.c new file mode 100644 index 000000000000..72ba94359c39 --- /dev/null +++ b/keyboards/mechlovin/delphine/keymaps/default/keymap.c @@ -0,0 +1,28 @@ +/* Copyright 2020 Team Mechlovin' + * + * 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 QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_all( + KC_ESC, BL_STEP, RGB_TOG, RGB_MOD, + 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_PENT, + KC_P0, KC_P0, KC_PDOT, KC_BSPC + ), + +}; \ No newline at end of file diff --git a/keyboards/mechlovin/delphine/keymaps/default/readme.md b/keyboards/mechlovin/delphine/keymaps/default/readme.md new file mode 100644 index 000000000000..67504a70dd4b --- /dev/null +++ b/keyboards/mechlovin/delphine/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for delphine diff --git a/keyboards/mechlovin/delphine/keymaps/via/keymap.c b/keyboards/mechlovin/delphine/keymaps/via/keymap.c new file mode 100644 index 000000000000..3c4c291ddd64 --- /dev/null +++ b/keyboards/mechlovin/delphine/keymaps/via/keymap.c @@ -0,0 +1,52 @@ +/* Copyright 2020 Team Mechlovin' + * + * 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 QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_all( + KC_ESC, BL_STEP, RGB_TOG, RGB_MOD, + 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_PENT, + KC_P0, KC_P0, KC_PDOT, KC_BSPC + ), + [1] = LAYOUT_all( + 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, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + [2] = LAYOUT_all( + 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, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + [3] = LAYOUT_all( + 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, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + +}; \ No newline at end of file diff --git a/keyboards/mechlovin/delphine/keymaps/via/readme.md b/keyboards/mechlovin/delphine/keymaps/via/readme.md new file mode 100644 index 000000000000..b97ae1f26272 --- /dev/null +++ b/keyboards/mechlovin/delphine/keymaps/via/readme.md @@ -0,0 +1 @@ +# The via keymap for delphine diff --git a/keyboards/mechlovin/delphine/keymaps/via/rules.mk b/keyboards/mechlovin/delphine/keymaps/via/rules.mk new file mode 100644 index 000000000000..036bd6d1c3ec --- /dev/null +++ b/keyboards/mechlovin/delphine/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes \ No newline at end of file diff --git a/keyboards/mechlovin/delphine/readme.md b/keyboards/mechlovin/delphine/readme.md new file mode 100644 index 000000000000..e2be948e6fb0 --- /dev/null +++ b/keyboards/mechlovin/delphine/readme.md @@ -0,0 +1,15 @@ +# delphine + +![delphine](imgur.com image replace me!) + +A short description of the keyboard/project + +* Keyboard Maintainer: [Team Mechlovin'](https://github.com/yourusername) +* Hardware Supported: The PCBs, controllers supported +* Hardware Availability: Links to where you can find this hardware + +Make example for this keyboard (after setting up your build environment): + + make delphine: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/mechlovin/delphine/rev1/config.h b/keyboards/mechlovin/delphine/rev1/config.h new file mode 100644 index 000000000000..856e1bc2815f --- /dev/null +++ b/keyboards/mechlovin/delphine/rev1/config.h @@ -0,0 +1,5 @@ + +#pragma once + +#define PRODUCT_ID 0xDEF1 +#define DEVICE_VER 0x0001 diff --git a/keyboards/mechlovin/delphine/rev1/rules.mk b/keyboards/mechlovin/delphine/rev1/rules.mk new file mode 100644 index 000000000000..bab2313766fb --- /dev/null +++ b/keyboards/mechlovin/delphine/rev1/rules.mk @@ -0,0 +1,39 @@ + # MCU name + MCU = atmega32u4 + F_CPU = 8000000 + ARCH = AVR8 + F_USB = $(F_CPU) + + # Bootloader selection + # Teensy halfkay + # Pro Micro caterina + # Atmel DFU atmel-dfu + # LUFA DFU lufa-dfu + # QMK DFU qmk-dfu + # ATmega32A bootloadHID + # ATmega328P USBasp + 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 = yes # USB Nkey Rollover + BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality + RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow + MIDI_ENABLE = no # MIDI support + 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 + HD44780_ENABLE = no # Enable support for HD44780 based LCDs + + # generated by KBFirmware JSON to QMK Parser + # https://noroadsleft.github.io/kbf_qmk_converter/ diff --git a/keyboards/mechlovin/delphine/rules.mk b/keyboards/mechlovin/delphine/rules.mk new file mode 100644 index 000000000000..e2203da6ad3a --- /dev/null +++ b/keyboards/mechlovin/delphine/rules.mk @@ -0,0 +1 @@ +DEFAULT_FOLDER = mechlovin/delphine/rev1 From af4abecdaa8a350200f88e606208c786269f417f Mon Sep 17 00:00:00 2001 From: mechlovin <57231893+mechlovin@users.noreply.github.com> Date: Mon, 6 Jul 2020 13:33:47 +0700 Subject: [PATCH 2/8] ADD --- keyboards/mechlovin/delphine/config.h | 28 +-- .../mechlovin/delphine/mono_led/config.h | 34 ++++ .../mechlovin/delphine/mono_led/rules.mk | 2 + keyboards/mechlovin/delphine/rev1/config.h | 5 - keyboards/mechlovin/delphine/rev1/rules.mk | 39 ----- keyboards/mechlovin/delphine/rgb_led/config.h | 47 +++++ .../mechlovin/delphine/rgb_led/readme.md | 15 ++ .../mechlovin/delphine/rgb_led/rgb_led.c | 162 ++++++++++++++++++ .../mechlovin/delphine/rgb_led/rgb_led.h | 19 ++ .../delphine/rgb_led/rgb_matrix_drivers.c | 94 ++++++++++ keyboards/mechlovin/delphine/rgb_led/rules.mk | 7 + keyboards/mechlovin/delphine/rules.mk | 37 +++- 12 files changed, 417 insertions(+), 72 deletions(-) create mode 100644 keyboards/mechlovin/delphine/mono_led/config.h create mode 100644 keyboards/mechlovin/delphine/mono_led/rules.mk delete mode 100644 keyboards/mechlovin/delphine/rev1/config.h delete mode 100644 keyboards/mechlovin/delphine/rev1/rules.mk create mode 100644 keyboards/mechlovin/delphine/rgb_led/config.h create mode 100644 keyboards/mechlovin/delphine/rgb_led/readme.md create mode 100644 keyboards/mechlovin/delphine/rgb_led/rgb_led.c create mode 100644 keyboards/mechlovin/delphine/rgb_led/rgb_led.h create mode 100644 keyboards/mechlovin/delphine/rgb_led/rgb_matrix_drivers.c create mode 100644 keyboards/mechlovin/delphine/rgb_led/rules.mk diff --git a/keyboards/mechlovin/delphine/config.h b/keyboards/mechlovin/delphine/config.h index d4d09625a01e..66b4f0d51d26 100644 --- a/keyboards/mechlovin/delphine/config.h +++ b/keyboards/mechlovin/delphine/config.h @@ -42,30 +42,4 @@ along with this program. If not, see . #define MATRIX_ROW_PINS { F0, F1, F4, F5, F6, D3 } #define MATRIX_COL_PINS { F7, D7, D6, D2 } -#define DIODE_DIRECTION COL2ROW - -#define BACKLIGHT_PIN B6 -// #define BACKLIGHT_BREATHING -#define BACKLIGHT_LEVELS 3 - -#define RGB_DI_PIN E2 -#ifdef RGB_DI_PIN - #define RGBLED_NUM 13 - #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 -#endif \ No newline at end of file +#define DIODE_DIRECTION COL2ROW \ No newline at end of file diff --git a/keyboards/mechlovin/delphine/mono_led/config.h b/keyboards/mechlovin/delphine/mono_led/config.h new file mode 100644 index 000000000000..ead627937c84 --- /dev/null +++ b/keyboards/mechlovin/delphine/mono_led/config.h @@ -0,0 +1,34 @@ + +#pragma once + +#define PRODUCT_ID 0xDEF1 +#define DEVICE_VER 0x0001 + + +#ifdef BACKLIGHT_ENABLE +#define BACKLIGHT_PIN B6 +// #define BACKLIGHT_BREATHING +#define BACKLIGHT_LEVELS 3 +#endif + +#ifdef RGBLIGHT_ENABLE +#define RGB_DI_PIN E2 +#define RGBLED_NUM 13 +#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 +#endif \ No newline at end of file diff --git a/keyboards/mechlovin/delphine/mono_led/rules.mk b/keyboards/mechlovin/delphine/mono_led/rules.mk new file mode 100644 index 000000000000..ed572b0bbfcd --- /dev/null +++ b/keyboards/mechlovin/delphine/mono_led/rules.mk @@ -0,0 +1,2 @@ +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow \ No newline at end of file diff --git a/keyboards/mechlovin/delphine/rev1/config.h b/keyboards/mechlovin/delphine/rev1/config.h deleted file mode 100644 index 856e1bc2815f..000000000000 --- a/keyboards/mechlovin/delphine/rev1/config.h +++ /dev/null @@ -1,5 +0,0 @@ - -#pragma once - -#define PRODUCT_ID 0xDEF1 -#define DEVICE_VER 0x0001 diff --git a/keyboards/mechlovin/delphine/rev1/rules.mk b/keyboards/mechlovin/delphine/rev1/rules.mk deleted file mode 100644 index bab2313766fb..000000000000 --- a/keyboards/mechlovin/delphine/rev1/rules.mk +++ /dev/null @@ -1,39 +0,0 @@ - # MCU name - MCU = atmega32u4 - F_CPU = 8000000 - ARCH = AVR8 - F_USB = $(F_CPU) - - # Bootloader selection - # Teensy halfkay - # Pro Micro caterina - # Atmel DFU atmel-dfu - # LUFA DFU lufa-dfu - # QMK DFU qmk-dfu - # ATmega32A bootloadHID - # ATmega328P USBasp - 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 = yes # USB Nkey Rollover - BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality - RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow - MIDI_ENABLE = no # MIDI support - 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 - HD44780_ENABLE = no # Enable support for HD44780 based LCDs - - # generated by KBFirmware JSON to QMK Parser - # https://noroadsleft.github.io/kbf_qmk_converter/ diff --git a/keyboards/mechlovin/delphine/rgb_led/config.h b/keyboards/mechlovin/delphine/rgb_led/config.h new file mode 100644 index 000000000000..4d5c853d0c10 --- /dev/null +++ b/keyboards/mechlovin/delphine/rgb_led/config.h @@ -0,0 +1,47 @@ +#pragma once + +#define PRODUCT_ID 0xDEF2 +#define DEVICE_VER 0x0001 + +#ifdef RGBLIGHT_ENABLE +#define RGB_DI_PIN E2 +#define RGBLED_NUM 13 +#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 +#endif + +//rgb matrix setting// This is a 7-bit address, that gets left-shifted and bit 0 +// set to 0 for write, 1 for read (as per I2C protocol) +// The address will vary depending on your wiring: +// 0b1110100 AD <-> GND +// 0b1110111 AD <-> VCC +// 0b1110101 AD <-> SCL +// 0b1110110 AD <-> SDA +#define DRIVER_ADDR_1 0b1110110 +#define DRIVER_ADDR_2 0b1110100 +#define DRIVER_COUNT 1 +#define DRIVER_1_LED_TOTAL 25 +#define DRIVER_2_LED_TOTAL 0 +#define DRIVER_LED_TOTAL 25 +#define RGB_MATRIX_KEYPRESSES // reacts to keypresses +#define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses) +#define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects +#define RGB_DISABLE_WHEN_USB_SUSPENDED false // turn off effects when suspended +#define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness) +#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 255 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255 +#define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_PINWHEEL // Sets the default mode, if none has been set diff --git a/keyboards/mechlovin/delphine/rgb_led/readme.md b/keyboards/mechlovin/delphine/rgb_led/readme.md new file mode 100644 index 000000000000..4d1a3fd0ffc5 --- /dev/null +++ b/keyboards/mechlovin/delphine/rgb_led/readme.md @@ -0,0 +1,15 @@ +# rgb_led + +![rgb_led](imgur.com image replace me!) + +A short description of the keyboard/project + +* Keyboard Maintainer: [Team Mechlovin'](https://github.com/yourusername) +* Hardware Supported: The PCBs, controllers supported +* Hardware Availability: Links to where you can find this hardware + +Make example for this keyboard (after setting up your build environment): + + make rgb_led: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/mechlovin/delphine/rgb_led/rgb_led.c b/keyboards/mechlovin/delphine/rgb_led/rgb_led.c new file mode 100644 index 000000000000..58a6a33ea862 --- /dev/null +++ b/keyboards/mechlovin/delphine/rgb_led/rgb_led.c @@ -0,0 +1,162 @@ +/* Copyright 2020 Team Mechlovin' + * + * 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 "rgb_led.h" + + +#ifdef RGB_MATRIX_ENABLE +const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +// left CA + {0, C5_2, C6_2, C7_2}, //D2-0 + {0, C1_1, C3_2, C4_2}, //D20-1 + {0, C5_1, C6_1, C7_1}, //D36-2 + {0, C2_1, C3_1, C4_1}, //D46-3 + {0, C5_4, C6_4, C7_4}, //D65-4 + {0, C1_3, C2_3, C3_3}, //D26-5 + {0, C5_3, C6_3, C7_3}, //D37-6 + {0, C1_2, C2_2, C4_3}, //D47-7 + {0, C4_5, C5_5, C7_6}, //D11-8 + {0, C1_5, C2_5, C3_5}, //D27-9 + {0, C4_4, C6_5, C7_5}, //D38-10 + {0, C1_4, C2_4, C3_4}, //D48-11 + +// left CB + {0, C2_9, C3_9, C4_9}, //D17-12 + {0, C5_9, C6_9, C7_9}, //D28-13 + {0, C1_9, C3_10, C4_10}, //D39-14 + {0, C5_10, C6_10, C7_10}, //D49-15 + {0, C1_10, C2_10, C4_11}, //D18-16 + {0, C5_11, C6_11, C7_11}, //D29-17 + {0, C1_11, C2_11, C3_11}, //D40-18 + {0, C5_12, C6_12, C7_12}, //D50-19 + {0, C1_12, C2_12, C3_12}, //D19-20 + {0, C1_13, C2_13, C3_13}, //D61-21 + {0, C4_13, C5_13, C7_14}, //D35-22 + {0, C1_14, C2_14, C3_14}, //D41-23 + {0, C4_14, C5_14, C6_14}, //D51-24 +}; + +led_config_t g_led_config = { { + // Key Matrix to LED Index + {0, 1, 2, 3}, + {4, 5, 6, 7}, + {8, 9, 10, 11}, + {12, 13, 14, 15}, + {16, 17, 18, 19}, + {20, 22, 23, 24} + }, + { + //LED Index to Physical Positon + { 0, 0}, { 75, 0}, {149, 0}, {224, 0}, + { 0, 13}, { 75, 13}, {149, 13}, {224, 13}, + { 0, 25}, { 75, 25}, {149, 25}, {224, 25}, + { 0, 38}, { 75, 38}, {149, 38}, {224, 38}, + { 0, 51}, { 75, 51}, {149, 51}, {224, 51}, + { 0, 64}, { 37, 64}, { 75, 64}, {149, 64}, {224, 64}, +}, { + 4, 4, 4, 4, + 4, 1, 1, 4, + 4, 1, 1, 4, + 4, 1, 1, 4, + 4, 1, 1, 4, + 4, 0, 1, 1, 4, +} }; + +void rgb_matrix_indicators_user(void) { + if (host_keyboard_led_state().num_lock) { + rgb_matrix_set_color(4, 255, 255, 255); + } +} + +uint32_t layer_state_set_user(uint32_t state) +{ + // if on layer 1, turn on L1 LED, otherwise off. + if (biton32(state) == 0) { + rgb_matrix_set_color(1, 255, 0, 0); + } else { + rgb_matrix_set_color(1, 0, 0, 0); + } + // if on layer 2, turn on L2 LED, otherwise off. + if (biton32(state) == 1) { + rgb_matrix_set_color(0, 255, 0, 0); + } else { + rgb_matrix_set_color(0, 0, 0, 0); + } + + // if on layer 3, turn on L3 LED, otherwise off. + if (biton32(state) == 2) { + rgb_matrix_set_color(3, 255, 0, 0); + } else { + rgb_matrix_set_color(3, 0, 0, 0); + } + + // if on layer 4, turn on L4 LED, otherwise off. + if (biton32(state) == 3) { + rgb_matrix_set_color(2, 255, 0, 0); + } else { + rgb_matrix_set_color(2, 0, 0, 0); + } + + return state; +} + +#endif + +#ifndef RAW_ENABLE +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { +#else +bool process_record_user(uint16_t keycode, keyrecord_t *record) { +#endif + if (record->event.pressed) { + switch(keycode) { + #ifdef RGB_MATRIX_ENABLE + case KC_F13: // toggle rgb matrix + rgb_matrix_toggle(); + return false; + case KC_F14: + rgb_matrix_step(); + return false; + case KC_F15: + rgb_matrix_increase_speed(); + return false; + case KC_F16: + rgb_matrix_decrease_speed(); + return false; + case KC_F17: + rgb_matrix_increase_hue(); + return false; + case KC_F18: + rgb_matrix_decrease_hue(); + return false; + case KC_F19: + rgb_matrix_increase_sat(); + return false; + case KC_F20: + rgb_matrix_decrease_sat(); + return false; + case KC_F21: + rgb_matrix_increase_val(); + return false; + case KC_F22: + rgb_matrix_decrease_val(); + return false; + #endif + default: + break; + } + } + return true; +} diff --git a/keyboards/mechlovin/delphine/rgb_led/rgb_led.h b/keyboards/mechlovin/delphine/rgb_led/rgb_led.h new file mode 100644 index 000000000000..60d581734472 --- /dev/null +++ b/keyboards/mechlovin/delphine/rgb_led/rgb_led.h @@ -0,0 +1,19 @@ +/* Copyright 2020 Team Mechlovin' + * + * 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" diff --git a/keyboards/mechlovin/delphine/rgb_led/rgb_matrix_drivers.c b/keyboards/mechlovin/delphine/rgb_led/rgb_matrix_drivers.c new file mode 100644 index 000000000000..30a3fd4320c2 --- /dev/null +++ b/keyboards/mechlovin/delphine/rgb_led/rgb_matrix_drivers.c @@ -0,0 +1,94 @@ +/* Copyright 2018 James Laird-Wah + * + * 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 "rgb_matrix.h" + +/* Each driver needs to define the struct + * const rgb_matrix_driver_t rgb_matrix_driver; + * All members must be provided. + * Keyboard custom drivers can define this in their own files, it should only + * be here if shared between boards. + */ + +#if defined(IS31FL3731) +# include "i2c_master.h" + +static void init(void) { + i2c_init(); +# ifdef IS31FL3731 + IS31FL3731_init(DRIVER_ADDR); +# endif + for (int index = 0; index < DRIVER_LED_TOTAL; index++) { + bool enabled = true; + // This only caches it for later +# ifdef IS31FL3731 + IS31FL3731_set_led_control_register(index, enabled, enabled, enabled); +# endif + } + // This actually updates the LED drivers +# ifdef IS31FL3731 + IS31FL3731_update_led_control_registers(DRIVER_ADDR, 0); +# endif +} + +# ifdef IS31FL3731 +static void flush(void) { + IS31FL3731_update_pwm_buffers(DRIVER_ADDR, 0); +} + +const rgb_matrix_driver_t rgb_matrix_driver = { + .init = init, + .flush = flush, + .set_color = IS31FL3731_set_color, + .set_color_all = IS31FL3731_set_color_all, +}; +# endif + +#elif defined(WS2812) + +// LED color buffer +LED_TYPE led[DRIVER_LED_TOTAL]; + +static void init(void) {} + +static void flush(void) { + // Assumes use of RGB_DI_PIN + ws2812_setleds(led, DRIVER_LED_TOTAL); +} + +// Set an led in the buffer to a color +static inline void setled(int i, uint8_t r, uint8_t g, uint8_t b) { + led[i].r = r; + led[i].g = g; + led[i].b = b; +# ifdef RGBW + convert_rgb_to_rgbw(led[i]); +# endif +} + +static void setled_all(uint8_t r, uint8_t g, uint8_t b) { + for (int i = 0; i < sizeof(led) / sizeof(led[0]); i++) { + setled(i, r, g, b); + } +} + +const rgb_matrix_driver_t rgb_matrix_driver = { + .init = init, + .flush = flush, + .set_color = setled, + .set_color_all = setled_all, +}; +#endif diff --git a/keyboards/mechlovin/delphine/rgb_led/rules.mk b/keyboards/mechlovin/delphine/rgb_led/rules.mk new file mode 100644 index 000000000000..3fac3fed0522 --- /dev/null +++ b/keyboards/mechlovin/delphine/rgb_led/rules.mk @@ -0,0 +1,7 @@ + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +RGB_MATRIX_ENABLE = IS31FL3731 # Use RGB matrix diff --git a/keyboards/mechlovin/delphine/rules.mk b/keyboards/mechlovin/delphine/rules.mk index e2203da6ad3a..0acc0d406599 100644 --- a/keyboards/mechlovin/delphine/rules.mk +++ b/keyboards/mechlovin/delphine/rules.mk @@ -1 +1,36 @@ -DEFAULT_FOLDER = mechlovin/delphine/rev1 + # MCU name + 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 = 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 = yes # USB Nkey Rollover + BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality + RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow + MIDI_ENABLE = no # MIDI support + 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 + HD44780_ENABLE = no # Enable support for HD44780 based LCDs + + # generated by KBFirmware JSON to QMK Parser + # https://noroadsleft.github.io/kbf_qmk_converter/ From 06f82494db9b3749a536396f75d213a2b2c5e4e6 Mon Sep 17 00:00:00 2001 From: mechlovin <57231893+mechlovin@users.noreply.github.com> Date: Sun, 26 Jul 2020 17:59:38 +0700 Subject: [PATCH 3/8] update --- keyboards/mechlovin/delphine/readme.md | 10 +- .../mechlovin/delphine/rgb_led/readme.md | 2 +- .../delphine/rgb_led/rgb_matrix_drivers.c | 94 ------------------- keyboards/mechlovin/delphine/rgb_led/rules.mk | 8 +- keyboards/mechlovin/delphine/rules.mk | 14 +-- 5 files changed, 9 insertions(+), 119 deletions(-) delete mode 100644 keyboards/mechlovin/delphine/rgb_led/rgb_matrix_drivers.c diff --git a/keyboards/mechlovin/delphine/readme.md b/keyboards/mechlovin/delphine/readme.md index e2be948e6fb0..9a5389a5f331 100644 --- a/keyboards/mechlovin/delphine/readme.md +++ b/keyboards/mechlovin/delphine/readme.md @@ -2,14 +2,14 @@ ![delphine](imgur.com image replace me!) -A short description of the keyboard/project +A Number-Pad PCB, Mono backlight and RGB backlight version, Dolpad compatible. -* Keyboard Maintainer: [Team Mechlovin'](https://github.com/yourusername) -* Hardware Supported: The PCBs, controllers supported -* Hardware Availability: Links to where you can find this hardware +* Keyboard Maintainer: [Mechlovin'](https://github.com/mechlovin) +* Hardware Supported: Delphine PCB +* Hardware Availability: [Team Mechlovin'](https://mechlove.com) Make example for this keyboard (after setting up your build environment): - make delphine:default + make mechlovin/delphine: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/mechlovin/delphine/rgb_led/readme.md b/keyboards/mechlovin/delphine/rgb_led/readme.md index 4d1a3fd0ffc5..2e6a90b27d12 100644 --- a/keyboards/mechlovin/delphine/rgb_led/readme.md +++ b/keyboards/mechlovin/delphine/rgb_led/readme.md @@ -10,6 +10,6 @@ A short description of the keyboard/project Make example for this keyboard (after setting up your build environment): - make rgb_led:default + make mechlovin/delphine/rgb_led: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/mechlovin/delphine/rgb_led/rgb_matrix_drivers.c b/keyboards/mechlovin/delphine/rgb_led/rgb_matrix_drivers.c deleted file mode 100644 index 30a3fd4320c2..000000000000 --- a/keyboards/mechlovin/delphine/rgb_led/rgb_matrix_drivers.c +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright 2018 James Laird-Wah - * - * 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 "rgb_matrix.h" - -/* Each driver needs to define the struct - * const rgb_matrix_driver_t rgb_matrix_driver; - * All members must be provided. - * Keyboard custom drivers can define this in their own files, it should only - * be here if shared between boards. - */ - -#if defined(IS31FL3731) -# include "i2c_master.h" - -static void init(void) { - i2c_init(); -# ifdef IS31FL3731 - IS31FL3731_init(DRIVER_ADDR); -# endif - for (int index = 0; index < DRIVER_LED_TOTAL; index++) { - bool enabled = true; - // This only caches it for later -# ifdef IS31FL3731 - IS31FL3731_set_led_control_register(index, enabled, enabled, enabled); -# endif - } - // This actually updates the LED drivers -# ifdef IS31FL3731 - IS31FL3731_update_led_control_registers(DRIVER_ADDR, 0); -# endif -} - -# ifdef IS31FL3731 -static void flush(void) { - IS31FL3731_update_pwm_buffers(DRIVER_ADDR, 0); -} - -const rgb_matrix_driver_t rgb_matrix_driver = { - .init = init, - .flush = flush, - .set_color = IS31FL3731_set_color, - .set_color_all = IS31FL3731_set_color_all, -}; -# endif - -#elif defined(WS2812) - -// LED color buffer -LED_TYPE led[DRIVER_LED_TOTAL]; - -static void init(void) {} - -static void flush(void) { - // Assumes use of RGB_DI_PIN - ws2812_setleds(led, DRIVER_LED_TOTAL); -} - -// Set an led in the buffer to a color -static inline void setled(int i, uint8_t r, uint8_t g, uint8_t b) { - led[i].r = r; - led[i].g = g; - led[i].b = b; -# ifdef RGBW - convert_rgb_to_rgbw(led[i]); -# endif -} - -static void setled_all(uint8_t r, uint8_t g, uint8_t b) { - for (int i = 0; i < sizeof(led) / sizeof(led[0]); i++) { - setled(i, r, g, b); - } -} - -const rgb_matrix_driver_t rgb_matrix_driver = { - .init = init, - .flush = flush, - .set_color = setled, - .set_color_all = setled_all, -}; -#endif diff --git a/keyboards/mechlovin/delphine/rgb_led/rules.mk b/keyboards/mechlovin/delphine/rgb_led/rules.mk index 3fac3fed0522..d9e7c6802e1f 100644 --- a/keyboards/mechlovin/delphine/rgb_led/rules.mk +++ b/keyboards/mechlovin/delphine/rgb_led/rules.mk @@ -1,7 +1,3 @@ - -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration -RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow RGB_MATRIX_ENABLE = IS31FL3731 # Use RGB matrix diff --git a/keyboards/mechlovin/delphine/rules.mk b/keyboards/mechlovin/delphine/rules.mk index 0acc0d406599..7309121a8a35 100644 --- a/keyboards/mechlovin/delphine/rules.mk +++ b/keyboards/mechlovin/delphine/rules.mk @@ -2,13 +2,6 @@ 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 = atmel-dfu # Build Options @@ -25,12 +18,7 @@ NKRO_ENABLE = yes # USB Nkey Rollover BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow - MIDI_ENABLE = no # MIDI support - 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 - HD44780_ENABLE = no # Enable support for HD44780 based LCDs - # generated by KBFirmware JSON to QMK Parser - # https://noroadsleft.github.io/kbf_qmk_converter/ +DEFAULT_FOLDER = mechlovin/delphine/mono_led \ No newline at end of file From dce36d066ef806bea59372e1563cc830527e3c65 Mon Sep 17 00:00:00 2001 From: mechlovin <57231893+mechlovin@users.noreply.github.com> Date: Thu, 30 Jul 2020 21:01:09 +0700 Subject: [PATCH 4/8] update --- keyboards/mechlovin/delphine/config.h | 1 - keyboards/mechlovin/delphine/delphine.c | 31 ++++--------- keyboards/mechlovin/delphine/delphine.h | 5 +-- keyboards/mechlovin/delphine/info.json | 2 +- .../delphine/keymaps/default/keymap.c | 2 +- .../mechlovin/delphine/keymaps/via/keymap.c | 8 ++-- keyboards/mechlovin/delphine/rgb_led/rules.mk | 1 - keyboards/mechlovin/delphine/rules.mk | 43 +++++++++---------- 8 files changed, 36 insertions(+), 57 deletions(-) diff --git a/keyboards/mechlovin/delphine/config.h b/keyboards/mechlovin/delphine/config.h index 66b4f0d51d26..b3a084f67e75 100644 --- a/keyboards/mechlovin/delphine/config.h +++ b/keyboards/mechlovin/delphine/config.h @@ -23,7 +23,6 @@ along with this program. If not, see . #define VENDOR_ID 0x4D4C #define MANUFACTURER Mechlovin #define PRODUCT Mechlovin Delphine -#define DESCRIPTION Mechlovin Delphine /* key matrix size */ #define MATRIX_ROWS 6 diff --git a/keyboards/mechlovin/delphine/delphine.c b/keyboards/mechlovin/delphine/delphine.c index d370d33dede8..dcdc6ea16db7 100644 --- a/keyboards/mechlovin/delphine/delphine.c +++ b/keyboards/mechlovin/delphine/delphine.c @@ -16,35 +16,20 @@ #include "delphine.h" -// Optional override functions below. -// You can leave any or all of these undefined. -// These are only required if you want to perform custom actions. - -/* void matrix_init_kb(void) { - // put your keyboard start-up code here - // runs once when the firmware starts up - matrix_init_user(); + led_init_ports(); } -void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - - matrix_scan_user(); -} - -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_init_ports(void) { + setPinOutput(B5); + writePinLow(B5); } bool led_update_kb(led_t led_state) { - // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + if(led_update_user(led_state)) { + writePin(B3, led_state.num_lock); + } - return led_update_user(led_state); + return true; } -*/ diff --git a/keyboards/mechlovin/delphine/delphine.h b/keyboards/mechlovin/delphine/delphine.h index 4cb2e2d3019a..1112fc27ffde 100644 --- a/keyboards/mechlovin/delphine/delphine.h +++ b/keyboards/mechlovin/delphine/delphine.h @@ -18,7 +18,7 @@ #include "quantum.h" -#define LAYOUT_all( \ +#define LAYOUT_ortho_6x4( \ K00, K01, K02, K03, \ K10, K11, K12, K13, \ K20, K21, K22, K23, \ @@ -33,6 +33,3 @@ { K40, K41, K42, K43 }, \ { K50, K51, K52, K53 }, \ } - -// generated by KBFirmware JSON to QMK Parser -// https://noroadsleft.github.io/kbf_qmk_converter/ diff --git a/keyboards/mechlovin/delphine/info.json b/keyboards/mechlovin/delphine/info.json index ad289b5e0c84..484133f534a1 100644 --- a/keyboards/mechlovin/delphine/info.json +++ b/keyboards/mechlovin/delphine/info.json @@ -5,7 +5,7 @@ "width": 4, "height": 6.25, "layouts": { - "LAYOUT_all": { + "LAYOUT_ortho_6x4": { "key_count": 24, "layout": [ {"label":"K00 (F0,F7)", "x":0, "y":0}, diff --git a/keyboards/mechlovin/delphine/keymaps/default/keymap.c b/keyboards/mechlovin/delphine/keymaps/default/keymap.c index 72ba94359c39..584d0b223ada 100644 --- a/keyboards/mechlovin/delphine/keymaps/default/keymap.c +++ b/keyboards/mechlovin/delphine/keymaps/default/keymap.c @@ -16,7 +16,7 @@ #include QMK_KEYBOARD_H const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = LAYOUT_all( + [0] = LAYOUT_ortho_6x4( KC_ESC, BL_STEP, RGB_TOG, RGB_MOD, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, KC_P7, KC_P8, KC_P9, KC_PPLS, diff --git a/keyboards/mechlovin/delphine/keymaps/via/keymap.c b/keyboards/mechlovin/delphine/keymaps/via/keymap.c index 3c4c291ddd64..18c30fdba09d 100644 --- a/keyboards/mechlovin/delphine/keymaps/via/keymap.c +++ b/keyboards/mechlovin/delphine/keymaps/via/keymap.c @@ -16,7 +16,7 @@ #include QMK_KEYBOARD_H const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = LAYOUT_all( + [0] = LAYOUT_ortho_6x4( KC_ESC, BL_STEP, RGB_TOG, RGB_MOD, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, KC_P7, KC_P8, KC_P9, KC_PPLS, @@ -24,7 +24,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_P1, KC_P2, KC_P3, KC_PENT, KC_P0, KC_P0, KC_PDOT, KC_BSPC ), - [1] = LAYOUT_all( + [1] = LAYOUT_ortho_6x4( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, @@ -32,7 +32,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), - [2] = LAYOUT_all( + [2] = LAYOUT_ortho_6x4( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, @@ -40,7 +40,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), - [3] = LAYOUT_all( + [3] = LAYOUT_ortho_6x4( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, diff --git a/keyboards/mechlovin/delphine/rgb_led/rules.mk b/keyboards/mechlovin/delphine/rgb_led/rules.mk index d9e7c6802e1f..853f740ce9ae 100644 --- a/keyboards/mechlovin/delphine/rgb_led/rules.mk +++ b/keyboards/mechlovin/delphine/rgb_led/rules.mk @@ -1,3 +1,2 @@ -BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow RGB_MATRIX_ENABLE = IS31FL3731 # Use RGB matrix diff --git a/keyboards/mechlovin/delphine/rules.mk b/keyboards/mechlovin/delphine/rules.mk index 7309121a8a35..d394188e94ce 100644 --- a/keyboards/mechlovin/delphine/rules.mk +++ b/keyboards/mechlovin/delphine/rules.mk @@ -1,24 +1,23 @@ - # 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 = yes # USB Nkey Rollover - BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality - RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow - BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID - AUDIO_ENABLE = no # Audio output on port C6 +# 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 = yes # USB Nkey Rollover +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_6x4 DEFAULT_FOLDER = mechlovin/delphine/mono_led \ No newline at end of file From c1b032f019fb6a62f7c6ff6b5b2ecfc1e8c3d98b Mon Sep 17 00:00:00 2001 From: mechlovin <57231893+mechlovin@users.noreply.github.com> Date: Thu, 30 Jul 2020 22:20:58 +0700 Subject: [PATCH 5/8] update --- keyboards/mechlovin/delphine/info.json | 1 - keyboards/mechlovin/delphine/rgb_led/rgb_led.c | 8 ++++---- keyboards/mechlovin/delphine/rules.mk | 2 ++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/keyboards/mechlovin/delphine/info.json b/keyboards/mechlovin/delphine/info.json index 484133f534a1..6356f4a3d602 100644 --- a/keyboards/mechlovin/delphine/info.json +++ b/keyboards/mechlovin/delphine/info.json @@ -6,7 +6,6 @@ "height": 6.25, "layouts": { "LAYOUT_ortho_6x4": { - "key_count": 24, "layout": [ {"label":"K00 (F0,F7)", "x":0, "y":0}, {"label":"K01 (F0,D7)", "x":1, "y":0}, diff --git a/keyboards/mechlovin/delphine/rgb_led/rgb_led.c b/keyboards/mechlovin/delphine/rgb_led/rgb_led.c index 58a6a33ea862..893c16f6b918 100644 --- a/keyboards/mechlovin/delphine/rgb_led/rgb_led.c +++ b/keyboards/mechlovin/delphine/rgb_led/rgb_led.c @@ -84,27 +84,27 @@ void rgb_matrix_indicators_user(void) { uint32_t layer_state_set_user(uint32_t state) { // if on layer 1, turn on L1 LED, otherwise off. - if (biton32(state) == 0) { + if (get_highest_layer(state) == 0) { rgb_matrix_set_color(1, 255, 0, 0); } else { rgb_matrix_set_color(1, 0, 0, 0); } // if on layer 2, turn on L2 LED, otherwise off. - if (biton32(state) == 1) { + if (get_highest_layer(state) == 1) { rgb_matrix_set_color(0, 255, 0, 0); } else { rgb_matrix_set_color(0, 0, 0, 0); } // if on layer 3, turn on L3 LED, otherwise off. - if (biton32(state) == 2) { + if (get_highest_layer(state) == 2) { rgb_matrix_set_color(3, 255, 0, 0); } else { rgb_matrix_set_color(3, 0, 0, 0); } // if on layer 4, turn on L4 LED, otherwise off. - if (biton32(state) == 3) { + if (get_highest_layer(state) == 3) { rgb_matrix_set_color(2, 255, 0, 0); } else { rgb_matrix_set_color(2, 0, 0, 0); diff --git a/keyboards/mechlovin/delphine/rules.mk b/keyboards/mechlovin/delphine/rules.mk index d394188e94ce..217bb758b252 100644 --- a/keyboards/mechlovin/delphine/rules.mk +++ b/keyboards/mechlovin/delphine/rules.mk @@ -1,7 +1,9 @@ # MCU name MCU = atmega32u4 + # Bootloader selection BOOTLOADER = atmel-dfu + # Build Options # change yes to no to disable # From d16d444467af1f9844a0255e4338a789caf3d0e2 Mon Sep 17 00:00:00 2001 From: mechlovin <57231893+mechlovin@users.noreply.github.com> Date: Fri, 31 Jul 2020 17:53:37 +0700 Subject: [PATCH 6/8] update --- keyboards/mechlovin/delphine/delphine.c | 2 +- keyboards/mechlovin/delphine/rgb_led/readme.md | 15 --------------- 2 files changed, 1 insertion(+), 16 deletions(-) delete mode 100644 keyboards/mechlovin/delphine/rgb_led/readme.md diff --git a/keyboards/mechlovin/delphine/delphine.c b/keyboards/mechlovin/delphine/delphine.c index dcdc6ea16db7..52292b3c9228 100644 --- a/keyboards/mechlovin/delphine/delphine.c +++ b/keyboards/mechlovin/delphine/delphine.c @@ -28,7 +28,7 @@ void led_init_ports(void) { bool led_update_kb(led_t led_state) { if(led_update_user(led_state)) { - writePin(B3, led_state.num_lock); + writePin(B5, led_state.num_lock); } return true; diff --git a/keyboards/mechlovin/delphine/rgb_led/readme.md b/keyboards/mechlovin/delphine/rgb_led/readme.md deleted file mode 100644 index 2e6a90b27d12..000000000000 --- a/keyboards/mechlovin/delphine/rgb_led/readme.md +++ /dev/null @@ -1,15 +0,0 @@ -# rgb_led - -![rgb_led](imgur.com image replace me!) - -A short description of the keyboard/project - -* Keyboard Maintainer: [Team Mechlovin'](https://github.com/yourusername) -* Hardware Supported: The PCBs, controllers supported -* Hardware Availability: Links to where you can find this hardware - -Make example for this keyboard (after setting up your build environment): - - make mechlovin/delphine/rgb_led: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). From a04e7fa80d5114307e2cd1ae4bceb40f2fb50fe3 Mon Sep 17 00:00:00 2001 From: mechlovin <57231893+mechlovin@users.noreply.github.com> Date: Tue, 4 Aug 2020 15:51:43 +0700 Subject: [PATCH 7/8] Update rgb_led.c --- keyboards/mechlovin/delphine/rgb_led/rgb_led.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/keyboards/mechlovin/delphine/rgb_led/rgb_led.c b/keyboards/mechlovin/delphine/rgb_led/rgb_led.c index 893c16f6b918..ba7c34d079a5 100644 --- a/keyboards/mechlovin/delphine/rgb_led/rgb_led.c +++ b/keyboards/mechlovin/delphine/rgb_led/rgb_led.c @@ -75,14 +75,14 @@ led_config_t g_led_config = { { 4, 0, 1, 1, 4, } }; -void rgb_matrix_indicators_user(void) { +void rgb_matrix_indicators_kb(void) { if (host_keyboard_led_state().num_lock) { rgb_matrix_set_color(4, 255, 255, 255); } } -uint32_t layer_state_set_user(uint32_t state) -{ +__attribute__((weak)) +layer_state_t layer_state_set_user(layer_state_t state) { // if on layer 1, turn on L1 LED, otherwise off. if (get_highest_layer(state) == 0) { rgb_matrix_set_color(1, 255, 0, 0); From 505efb8afd5b57b51c74d3cc4208d4960b57c738 Mon Sep 17 00:00:00 2001 From: mechlovin <57231893+mechlovin@users.noreply.github.com> Date: Mon, 24 Aug 2020 12:07:38 +0700 Subject: [PATCH 8/8] Update rgb_led.c --- keyboards/mechlovin/delphine/rgb_led/rgb_led.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/keyboards/mechlovin/delphine/rgb_led/rgb_led.c b/keyboards/mechlovin/delphine/rgb_led/rgb_led.c index ba7c34d079a5..6f3e3ec731e6 100644 --- a/keyboards/mechlovin/delphine/rgb_led/rgb_led.c +++ b/keyboards/mechlovin/delphine/rgb_led/rgb_led.c @@ -115,11 +115,9 @@ layer_state_t layer_state_set_user(layer_state_t state) { #endif -#ifndef RAW_ENABLE bool process_record_kb(uint16_t keycode, keyrecord_t *record) { -#else -bool process_record_user(uint16_t keycode, keyrecord_t *record) { -#endif + if (!process_record_user(keycode, record)) { return false; } + if (record->event.pressed) { switch(keycode) { #ifdef RGB_MATRIX_ENABLE