From 2e03b27cf4f574677dfde6efe80f90e19ba2c74d Mon Sep 17 00:00:00 2001 From: bryan065 <30362590+bryan065@users.noreply.github.com> Date: Fri, 3 Sep 2021 23:11:04 -0400 Subject: [PATCH] Cleanup code to prep for PR Clean up code for PR Initial support for STL/STEP files Added crude wiring diagram Update readme.md Revert "Initial support for STL/STEP files" This reverts commit 87f5929e5b9a3f407c8b499fce28ed06e63130cd. Update readme.md Update keymap.c Update info.json --- keyboards/handwired/ghero20/MPU9250/MPU9250.c | 28 ++++++++-------- keyboards/handwired/ghero20/MPU9250/MPU9250.h | 21 +++++++++--- .../ghero20/MPU9250/MPU9250RegisterMap.h | 22 ++++++++++--- keyboards/handwired/ghero20/config.h | 18 +---------- keyboards/handwired/ghero20/ghero20.c | 9 ------ keyboards/handwired/ghero20/info.json | 28 ++++++++++++---- .../ghero20/keymaps/default/keymap.c | 18 ++--------- .../ghero20/keymaps/default/readme.md | 1 - keyboards/handwired/ghero20/readme.md | 32 +++++++++++-------- keyboards/handwired/ghero20/rules.mk | 3 +- 10 files changed, 93 insertions(+), 87 deletions(-) delete mode 100644 keyboards/handwired/ghero20/keymaps/default/readme.md diff --git a/keyboards/handwired/ghero20/MPU9250/MPU9250.c b/keyboards/handwired/ghero20/MPU9250/MPU9250.c index 898c6bdbeeb..4ea30e87404 100644 --- a/keyboards/handwired/ghero20/MPU9250/MPU9250.c +++ b/keyboards/handwired/ghero20/MPU9250/MPU9250.c @@ -1,4 +1,6 @@ -/* Copyright 2021 bryan065 +/* Copyright 2021 bryan065 / hideakitai + * + * https://github.com/hideakitai/MPU9250 * * 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 @@ -42,7 +44,7 @@ i2c_status_t update_accel_gyro(void) { }; return status; -}; +} i2c_status_t mpu_readAccel(int16_t* read) { uint8_t data[6]; @@ -55,7 +57,7 @@ i2c_status_t mpu_readAccel(int16_t* read) { }; return status; -}; +} i2c_status_t mpu_readGyro(int16_t* read) { uint8_t data[6]; @@ -68,7 +70,7 @@ i2c_status_t mpu_readGyro(int16_t* read) { }; return status; -}; +} i2c_status_t mpu_readAccelGyro(int16_t* read) { uint8_t data[14]; @@ -85,13 +87,13 @@ i2c_status_t mpu_readAccelGyro(int16_t* read) { }; return status; -}; +} int16_t mpu_readTemp(void) { uint8_t data[2]; i2c_readReg(MPU9250_ADDR,TEMP_OUT_H,data,sizeof(data),I2C_TIMEOUT); return (data[0]<<8|data[1])/334+21;; -}; +} void initMPU9250(void) { acc_resolution = 16.0 / 32768.0; @@ -159,17 +161,17 @@ void initMPU9250(void) { send_data = 0x01; i2c_writeReg(MPU9250_ADDR, INT_ENABLE, &send_data, 1, I2C_TIMEOUT); _delay_ms(100); -}; +} // get accel and gyro data as float float getAcc(const uint8_t i) { return (i < 3) ? Acc[i] : 0.f; -}; +} float getGyro(const uint8_t i) { return (i < 3) ? Gyro[i] : 0.f; -}; +} // Get scaled raw data as int16 instead of float int16_t getAccScaled(const uint8_t i, const uint8_t o) { @@ -181,7 +183,7 @@ int16_t getAccScaled(const uint8_t i, const uint8_t o) { data = (int16_t)scale; return data; -}; +} int16_t getGyroScaled(const uint8_t i, const uint8_t o) { if (i >= 3) {return 0;}; @@ -192,7 +194,7 @@ int16_t getGyroScaled(const uint8_t i, const uint8_t o) { data = (int16_t)scale; return data; -}; +} // Get Raw accel and gyro data mpu_data_t getAccRaw(const uint8_t i) { @@ -204,7 +206,7 @@ mpu_data_t getAccRaw(const uint8_t i) { else { return 0; }; -}; +} mpu_data_t getGyroRaw(const uint8_t i) { @@ -216,4 +218,4 @@ mpu_data_t getGyroRaw(const uint8_t i) { else { return 0; }; -}; +} diff --git a/keyboards/handwired/ghero20/MPU9250/MPU9250.h b/keyboards/handwired/ghero20/MPU9250/MPU9250.h index 8787ffb68af..a4cd2bae6b6 100644 --- a/keyboards/handwired/ghero20/MPU9250/MPU9250.h +++ b/keyboards/handwired/ghero20/MPU9250/MPU9250.h @@ -1,13 +1,24 @@ -#pragma once +/* Copyright 2021 bryan065 + * + * 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 . + */ -#ifndef MPU9250_H -#define MPU9250_H +#pragma once #include "MPU9250RegisterMap.h" #include "i2c_master.h" -#endif - enum Axis { x, y, diff --git a/keyboards/handwired/ghero20/MPU9250/MPU9250RegisterMap.h b/keyboards/handwired/ghero20/MPU9250/MPU9250RegisterMap.h index d893cda36d5..e74d3930430 100644 --- a/keyboards/handwired/ghero20/MPU9250/MPU9250RegisterMap.h +++ b/keyboards/handwired/ghero20/MPU9250/MPU9250RegisterMap.h @@ -1,6 +1,22 @@ +/* Copyright 2021 bryan065 / hideakitai + * + * https://github.com/hideakitai/MPU9250 + * + * 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 -#ifndef MPU9250REGISTERMAP_H -#define MPU9250REGISTERMAP_H //Magnetometer Registers // #define AK8963_ADDRESS 0x0C @@ -147,5 +163,3 @@ #define YA_OFFSET_L 0x7B #define ZA_OFFSET_H 0x7D #define ZA_OFFSET_L 0x7E - -#endif // MPU9250REGISTERMAP_H diff --git a/keyboards/handwired/ghero20/config.h b/keyboards/handwired/ghero20/config.h index de3927ca94c..ef63c1f9cbe 100644 --- a/keyboards/handwired/ghero20/config.h +++ b/keyboards/handwired/ghero20/config.h @@ -35,6 +35,7 @@ along with this program. If not, see . * Valid parameters: -40, -20, -16, -12, -8, -4, 0, 4 * (https://learn.adafruit.com/adafruit-feather-32u4-bluefruit-le/ble-generic#at-plus-blepowerlevel) * +* Used with my customized version of adafruit_ble */ #define POWER_LEVEL 4 @@ -87,24 +88,7 @@ along with this program. If not, see . #define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */ #define RGBLIGHT_DEFAULT_VAL 255 #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 */ diff --git a/keyboards/handwired/ghero20/ghero20.c b/keyboards/handwired/ghero20/ghero20.c index d2afa810e2b..5a46660db23 100644 --- a/keyboards/handwired/ghero20/ghero20.c +++ b/keyboards/handwired/ghero20/ghero20.c @@ -24,10 +24,6 @@ bool star_power = false; const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[] PROGMEM = {1, 1, 1}; -void keyboard_pre_init_kb(void) { - // Call the keyboard pre init code. -} - void keyboard_post_init_kb(void) { // Init i2c i2c_init(); @@ -42,11 +38,6 @@ void keyboard_post_init_kb(void) { init_GH_color(); } -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) diff --git a/keyboards/handwired/ghero20/info.json b/keyboards/handwired/ghero20/info.json index f384f23ad51..b535d072115 100644 --- a/keyboards/handwired/ghero20/info.json +++ b/keyboards/handwired/ghero20/info.json @@ -2,17 +2,31 @@ "keyboard_name": "GHero20", "url": "", "maintainer": "bryan065", - "width": 3, - "height": 2, + "width": 5, + "height": 4, "layouts": { "LAYOUT": { "layout": [ - {"label": "k00", "x": 0, "y": 0}, - {"label": "k01", "x": 1, "y": 0}, - {"label": "k02", "x": 2, "y": 0}, + {"label": "1", "x": 0, "y": 0}, + {"label": "2", "x": 1, "y": 0}, + {"label": "3", "x": 2, "y": 0}, + {"label": "4", "x": 3, "y": 0}, + {"label": "5", "x": 4, "y": 0}, - {"label": "k10", "x": 0, "y": 1, "w": 1.5}, - {"label": "k12", "x": 1.5, "y": 1, "w": 1.5} + {"label": "q", "x": 0, "y": 1}, + {"label": "w", "x": 1, "y": 1}, + {"label": "e", "x": 2, "y": 1}, + {"label": "r", "x": 3, "y": 1}, + {"label": "t", "x": 4, "y": 1}, + + {"label": "Down", "x": 0, "y": 2}, + {"label": "Up", "x": 1, "y": 2}, + {"label": "Mute", "x": 2, "y": 2}, + + {"label": "Space", "x": 0, "y": 3}, + {"label": "RGB", "x": 1, "y": 3}, + {"label": "Mute", "x": 2, "y": 3}, + {"label": "Enter", "x": 3, "y": 3} ] } } diff --git a/keyboards/handwired/ghero20/keymaps/default/keymap.c b/keyboards/handwired/ghero20/keymaps/default/keymap.c index 31270d8ff49..57c19898fc3 100644 --- a/keyboards/handwired/ghero20/keymaps/default/keymap.c +++ b/keyboards/handwired/ghero20/keymaps/default/keymap.c @@ -27,7 +27,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_1, KC_2, KC_3, KC_4, KC_5, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_DOWN, KC_UP, KC_MUTE, - KC_M, RGB_TOG, KC_N, KC_G + KC_SPC, RGB_TOG, KC_MUTE, KC_ENT ), [_GUITAR] = LAYOUT( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, @@ -35,18 +35,4 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ) -}; - -void matrix_init_user(void) { -} - -void matrix_scan_user(void) { -} - -void keyboard_post_init_user(void) { - // Customise these values to desired behaviour - //debug_enable=true; - //debug_matrix=true; - //debug_keyboard=true; - //debug_mouse=true; -} +}; \ No newline at end of file diff --git a/keyboards/handwired/ghero20/keymaps/default/readme.md b/keyboards/handwired/ghero20/keymaps/default/readme.md deleted file mode 100644 index ca108450301..00000000000 --- a/keyboards/handwired/ghero20/keymaps/default/readme.md +++ /dev/null @@ -1 +0,0 @@ -# The default keymap for ghero20 diff --git a/keyboards/handwired/ghero20/readme.md b/keyboards/handwired/ghero20/readme.md index 51993ac2437..174f3a6539e 100644 --- a/keyboards/handwired/ghero20/readme.md +++ b/keyboards/handwired/ghero20/readme.md @@ -32,26 +32,32 @@ See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_to ### Modular Design - The design is seperated into several modules which can each be printed on a standard Ender 3 (230mm x 230mm print bed). -- Upper Neck Module (in development). +- Upper Neck Module. - Houses the main frets and 5 mechanical switches. - Hotswap socket not available. - Fret buttons are mounted directly to swtiches like a regular keycap. -- Lower Neck Module (on hold). - - Houses the seconday frets meant to be spaced closer together and lower actuation distance. + - Optional stabilizers. +- Lower Neck Module. + - Customizable faceplate for your own needs. + - Currently houses the accelerometer. - Strum Module. - Houses the strum bar. - Controller Module. - Houses the 4 macro keys, controller, and wireless Qi/Magsafe receiver. - Cosmetic Modules. - Different guitar styles can be customized or designed. + +### Fret buttons + +- Can be customized with any set of mechanical switches. + - *Customizable with various switches, travel, and bottom out distances" ### Strum Bar - Can be customized with any pair of mechanical keyboard switches. - *The design expects an actuation distance of 2 to 3mm and bottom out of 4mm* - - *Using "Fast" switches like Cherry MX Speed is not recommended!* + - *Using "fast" switches like Cherry MX Speed is not tested (1 to 1.5mm actuation distance)* - Features a flexible mounting system to accommodate for various tolerances in 3D printer models. - - *The same mounting can be used to adjust the bar to the user's liking.* - Features a magnetic centering system. - *No springs involved so you don't get the annoying pinging.* - *Silent strumming unless you choose clicky mechanical switches.* @@ -63,7 +69,7 @@ See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_to - 4 standard mechanical switch + keycap sockets. - *Can be customized with any mechanical switch.* - - *Regular OEM/Cherry keycaps may be too tall for some users, in those cases, XDA/DSA profile is recommended.* + - *Regular OEM/Cherry keycaps may be too tall for some users (gets in the way of strumming), in those cases, XDA/DSA profile is recommended.* - Hotswap socket compatible. - *You can solder to the switches directly or use the optional hotswap socket holder* @@ -89,9 +95,9 @@ Enter the bootloader in 3 ways: * **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead * **Keycode in layout**: Press the key mapped to `RESET` if it is available -## Wiring +## Build instructions / Wiring / STL's -![Alt text](/keyboards/handwired/GHero20/Layout-Wiring.png?raw=true "") +Assembly instruction and STL/STEP files to be available soon. ## To-do @@ -102,9 +108,9 @@ Enter the bootloader in 3 ways: - [ ] ~~OLED Display~~ - Used for info display such as battery life - [x] BLE Battery Service - - Will report battery level to Windows 10 1809 or newer. - - OLED Display no longer needed. -- [x] Additional ground breakouts for WS2812 and MPU-9250. + - Will report battery level to Windows 10 1809 or newer + - OLED Display no longer needed +- [x] Additional ground breakouts for WS2812 and MPU-9250 - [x] Update strum part to enable tuning - [x] Tension - [x] Actuation distance/angle @@ -114,7 +120,7 @@ Enter the bootloader in 3 ways: - [x] Strum switches - [x] Macro switches - [x] ~~Fret switches~~ *(Not enough clearance in neck for sockets)* - - *Upper neck would have to be redesigned to have a removable PCB part like the lower neck to accommodate something like Kailh low profile switches to make room for hotswap sockets.* + - *Something like Kailh low profile switches are needed to accommodate hotswap design* - [ ] Upload STL's for guitar components - [x] WS2812 RGB's - - Per key lighting & dynamic lightin + - Per key lighting & dynamic lighting diff --git a/keyboards/handwired/ghero20/rules.mk b/keyboards/handwired/ghero20/rules.mk index 50634f214b2..d42ad10a44e 100644 --- a/keyboards/handwired/ghero20/rules.mk +++ b/keyboards/handwired/ghero20/rules.mk @@ -24,7 +24,7 @@ F_CPU = 8000000 # ATmega328P USBasp BOOTLOADER = caterina -# Interrupt driven control endpoint task(+60) +# Interrupt driven control endpoint task OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT # Build Options @@ -44,7 +44,6 @@ RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow BLUETOOTH_ENABLE = no # Enable Bluetooth AUDIO_ENABLE = no # Audio output BLUETOOTH = AdafruitBLE -LTO_ENABLE = yes QUANTUM_LIB_SRC += i2c_master.c SRC += MPU9250/MPU9250.c