Browse Source

Major cleanup

pull/20108/head
elpekenin 1 year ago
committed by 9R
parent
commit
fb51f86c66
28 changed files with 518 additions and 776 deletions
  1. +11
    -0
      keyboards/handwired/replicazeron/.vscode/settings.json
  2. +18
    -24
      keyboards/handwired/replicazeron/common/leds.c
  3. +6
    -3
      keyboards/handwired/replicazeron/common/leds.h
  4. +56
    -62
      keyboards/handwired/replicazeron/common/oled.c
  5. +9
    -17
      keyboards/handwired/replicazeron/common/oled.h
  6. +7
    -7
      keyboards/handwired/replicazeron/common/state.c
  7. +9
    -7
      keyboards/handwired/replicazeron/common/state.h
  8. +62
    -87
      keyboards/handwired/replicazeron/common/thumbstick.c
  9. +17
    -22
      keyboards/handwired/replicazeron/common/thumbstick.h
  10. +24
    -8
      keyboards/handwired/replicazeron/config.h
  11. +32
    -32
      keyboards/handwired/replicazeron/info.json
  12. +38
    -149
      keyboards/handwired/replicazeron/keymaps/default/keymap.c
  13. +0
    -2
      keyboards/handwired/replicazeron/keymaps/default/readme.md
  14. +0
    -15
      keyboards/handwired/replicazeron/keymaps/default/rules.mk
  15. +38
    -149
      keyboards/handwired/replicazeron/keymaps/via/keymap.c
  16. +0
    -2
      keyboards/handwired/replicazeron/keymaps/via/readme.md
  17. +0
    -15
      keyboards/handwired/replicazeron/keymaps/via/rules.mk
  18. +0
    -35
      keyboards/handwired/replicazeron/promicro/config.h
  19. +5
    -3
      keyboards/handwired/replicazeron/promicro/info.json
  20. +0
    -17
      keyboards/handwired/replicazeron/promicro/promicro.h
  21. +6
    -29
      keyboards/handwired/replicazeron/promicro/rules.mk
  22. +104
    -0
      keyboards/handwired/replicazeron/replicazeron.c
  23. +34
    -9
      keyboards/handwired/replicazeron/replicazeron.h
  24. +31
    -0
      keyboards/handwired/replicazeron/rules.mk
  25. +1
    -33
      keyboards/handwired/replicazeron/stm32f103/config.h
  26. +4
    -2
      keyboards/handwired/replicazeron/stm32f103/info.json
  27. +6
    -30
      keyboards/handwired/replicazeron/stm32f103/rules.mk
  28. +0
    -17
      keyboards/handwired/replicazeron/stm32f103/stm32f103.h

+ 11
- 0
keyboards/handwired/replicazeron/.vscode/settings.json View File

@ -0,0 +1,11 @@
{
"files.associations": {
"stdint.h": "c",
"stdint-gcc.h": "c",
"leds.h": "c",
"stdbool.h": "c",
"*.tcc": "c",
"math.h": "c",
"state.h": "c"
}
}

+ 18
- 24
keyboards/handwired/replicazeron/common/leds.c View File

@ -18,30 +18,24 @@
//////////// Status LEDs //////////////
void init_leds(void) {
setPinOutput(STATUS_LED_A_PIN) ;
setPinOutput(STATUS_LED_B_PIN) ;
writePinHigh(STATUS_LED_A_PIN) ; //Led0 off
writePinHigh(STATUS_LED_B_PIN) ; //Led1 off
// Both LEDs off, they have inverted logic
setPinOutput(STATUS_LED_A_PIN);
setPinOutput(STATUS_LED_B_PIN);
writePinHigh(STATUS_LED_A_PIN);
writePinHigh(STATUS_LED_B_PIN);
}
void set_leds(int active_layer) {
//display active layer in binary
switch (active_layer) {
case 1:
writePinLow(STATUS_LED_A_PIN); //Led0 on
writePinHigh(STATUS_LED_B_PIN); //Led1 off
break;
case 2:
writePinHigh(STATUS_LED_A_PIN); //Led0 off
writePinLow(STATUS_LED_B_PIN); //Led1 on
break;
case 3:
writePinLow(STATUS_LED_A_PIN); //Led0 on
writePinLow(STATUS_LED_B_PIN); //Led1 on
break;
default:
writePinHigh(STATUS_LED_A_PIN); //Led0 off
writePinHigh(STATUS_LED_B_PIN); //Led1 off
break;
}
void set_leds(uint8_t highest_active_layer) {
// any layer other than 0-3, quit and LEDs off
if (highest_active_layer > 3) {
writePinHigh(STATUS_LED_A_PIN);
writePinHigh(STATUS_LED_B_PIN);
return;
}
// use bitwise operations to display active layer in binary
bool bit1 = !(highest_active_layer & 1);
bool bit2 = !(highest_active_layer & 2);
writePin(STATUS_LED_A_PIN, bit1);
writePin(STATUS_LED_A_PIN, bit2);
}

+ 6
- 3
keyboards/handwired/replicazeron/common/leds.h View File

@ -14,8 +14,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
#pragma once
void init_leds(void) ;
#include "gpio.h"
#include "stdbool.h"
void set_leds(int active_layer) ;
void init_leds(void);
void set_leds(uint8_t active_layer);

+ 56
- 62
keyboards/handwired/replicazeron/common/oled.c View File

@ -20,78 +20,72 @@ uint8_t shiftbits =32 ;
//////////// OLED output helpers //////////////
void draw_mode(controller_state_t controller_state) {
//draw oled row showing thumbstick mode
oled_write_P(PSTR("Mode: "), false);
if (controller_state.wasdShiftMode) {
oled_write_ln_P(PSTR("WASD + Shift"), false);
} else if (controller_state.wasdMode) {
oled_write_ln_P(PSTR("WASD"), false);
} else {
oled_write_ln_P(PSTR("JoyStick"), false);
}
//draw oled row showing thumbstick mode
oled_write_P(PSTR("Mode: "), false);
if (controller_state.wasdShiftMode) {
oled_write_ln_P(PSTR("WASD + Shift"), false);
} else if (controller_state.wasdMode) {
oled_write_ln_P(PSTR("WASD"), false);
} else {
oled_write_ln_P(PSTR("JoyStick"), false);
}
}
void draw_wasd_key(wasd_state_t wasd_state) {
//draw oled row showing active keypresses emulated from thumbstick
const char* keys = "wasd" ;
bool keystates [] = {wasd_state.w, wasd_state.a, wasd_state.s, wasd_state.d } ;
// iterate over keystates
for ( int i = 0 ; i < 4 ; i++ ){
if ( keystates[i]) {
char k = keys[i] ;
//bitshift char to upper case
if (wasd_state.shift) {
k &= ~shiftbits;
}
sprintf (stringbuffer , "%c", k);
oled_write(stringbuffer , false);
}
else {
oled_write_P(PSTR(" "), false);
//draw oled row showing active keypresses emulated from thumbstick
const char* keys = "wasd";
bool keystates [] = { wasd_state.w, wasd_state.a, wasd_state.s, wasd_state.d };
// iterate over keystates
for (uint8_t i = 0 ; i < ARRAY_SIZE(keystates); ++i) {
if (keystates[i]) {
char k = keys[i] ;
//bitshift char to upper case
if (wasd_state.shift) {
k &= ~shiftbits;
}
sprintf(stringbuffer, "%c", k);
oled_write(stringbuffer, false);
} else {
oled_write_P(PSTR(" "), false);
}
}
}
}
void draw_thumb_debug(thumbstick_polar_position_t thumbstick_polar_position) {
//draw oled row showing thumbstick direction and distance from center
oled_write_P(PSTR("Dir: "), false);
sprintf (stringbuffer , "%d", thumbstick_polar_position.angle);
oled_write(stringbuffer , false);
oled_write_P(PSTR(" Dist: "), false);
sprintf (stringbuffer , "%d", thumbstick_polar_position.distance);
oled_write_ln(stringbuffer , false);
//print registered key codes
oled_write_P(PSTR("Keycodes: "), false);
draw_wasd_key( wasd_state );
//draw oled row showing thumbstick direction and distance from center
oled_write_P(PSTR("Dir: "), false);
sprintf (stringbuffer , "%d", thumbstick_polar_position.angle);
oled_write(stringbuffer , false);
oled_write_P(PSTR(" Dist: "), false);
sprintf (stringbuffer , "%d", thumbstick_polar_position.distance);
oled_write_ln(stringbuffer , false);
//print registered key codes
oled_write_P(PSTR("Keycodes: "), false);
draw_wasd_key( wasd_state );
}
//////////// draw OLED output //////////////
void draw_oled(controller_state_t controller_state) {
oled_write_P(PSTR("Layer: "), false);
oled_write_P(PSTR("Layer: "), false);
switch (controller_state.highestActiveLayer) {
case _SHOOTER:
oled_write_ln_P(PSTR("Shooter"), false);
break;
case _MISC:
oled_write_ln_P(PSTR("Misc"), false);
break;
case _SETTINGS:
oled_write_ln_P(PSTR("Settings"), false);
break;
default:
oled_write_ln_P(PSTR("Default"), false);
}
switch (controller_state.activeLayer) {
case LAYER_SHOOTER:
oled_write_ln_P(PSTR("Shooter"), false);
draw_mode(controller_state);
oled_write_ln_P(PSTR(" "), false);
oled_write_ln_P(PSTR(" "), false);
break;
case LAYER_MISC:
oled_write_ln_P(PSTR("Misc"), false);
draw_mode(controller_state);
oled_write_ln_P(PSTR(" "), false);
oled_write_ln_P(PSTR(" "), false);
break;
case LAYER_SETTINGS:
oled_write_ln_P(PSTR("Settings"), false);
draw_mode(controller_state);
draw_thumb_debug(thumbstick_polar_position);
oled_write_ln_P(PSTR(" "), false);
break;
default:
oled_write_ln_P(PSTR("Default"), false);
draw_mode(controller_state);
oled_write_ln_P(PSTR(" "), false);
oled_write_ln_P(PSTR(" "), false);
}
draw_mode(controller_state);
oled_write_ln_P(PSTR(" "), false);
oled_write_ln_P(PSTR(" "), false);
}

+ 9
- 17
keyboards/handwired/replicazeron/common/oled.h View File

@ -15,30 +15,22 @@
*/
#pragma once
#include "print.h"
#include QMK_KEYBOARD_H
#include <stdio.h>
#include "oled_driver.h"
#include "print.h"
#include "state.h"
#include "stdio.h"
#include "thumbstick.h"
uint8_t shiftbits ;
char stringbuffer[8] ;
enum keymap_layers {
LAYER_BASE = 0,
LAYER_SHOOTER,
LAYER_MISC,
LAYER_SETTINGS,
};
uint8_t shiftbits;
void draw_oled(controller_state_t controller_state) ;
char stringbuffer[8];
void draw_mode(controller_state_t controller_state) ;
void draw_oled(controller_state_t controller_state);
void draw_thumb_debug(thumbstick_polar_position_t thumbstick_polar_position) ;
void draw_mode(controller_state_t controller_state);
void draw_wasd_key(wasd_state_t wasd_state) ;
void draw_thumb_debug(thumbstick_polar_position_t thumbstick_polar_position);
void draw_settings(void) ;
void draw_wasd_key(wasd_state_t wasd_state);

+ 7
- 7
keyboards/handwired/replicazeron/common/state.c View File

@ -17,12 +17,12 @@
#include "state.h"
controller_state_t init_state (void) {
controller_state_t controller_state = {
.wasdMode = true ,
.wasdShiftMode = false ,
.autoRun = false ,
.activeLayer = 0,
} ;
controller_state_t controller_state = {
.wasdMode = true,
.wasdShiftMode = false,
.autoRun = false,
.highestActiveLayer = 0,
};
return controller_state;
return controller_state;
}

+ 9
- 7
keyboards/handwired/replicazeron/common/state.h View File

@ -14,13 +14,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "quantum.h"
#include "stdbool.h"
#include "stdint.h"
typedef struct {
bool wasdMode;
bool wasdShiftMode;
bool autoRun;
int activeLayer;
}controller_state_t ;
bool wasdMode;
bool wasdShiftMode;
bool autoRun;
uint8_t highestActiveLayer;
} controller_state_t;
controller_state_t init_state (void) ;
controller_state_t init_state(void);

+ 62
- 87
keyboards/handwired/replicazeron/common/thumbstick.c View File

@ -17,117 +17,92 @@
#include "thumbstick.h"
void init_wasd_state (void) {
wasd_state.w = wasd_state.a = wasd_state.s = wasd_state.d = false ;
last_wasd_state = wasd_state ;
wasd_state.shift = false ;
wasd_state.w = wasd_state.a = wasd_state.s = wasd_state.d = false;
wasd_state.shift = false;
}
thumbstick_polar_position_t get_thumbstick_polar_position (int x, int y ) {
thumbstick_polar_position_t position ;
int x_centered = x - 512;
int y_centered = y - 512;
thumbstick_polar_position_t get_thumbstick_polar_position(int16_t x, int16_t y) {
static thumbstick_polar_position_t position;
int16_t x_centered = x - 512;
int16_t y_centered = y - 512;
#ifdef THUMBSTICK_DEBUG
print("xN: ");
uprintf("%4d", x_centered);
print(" yN: ");
uprintf("%4d", y_centered);
dprintf("xN: %4d yN: %4d\n", x_centered, y_centered);
#endif
//transform to carthesian coordinates to polar coordinates
//get distance from center as int in range [0-600]
position.distance = (double)sqrt( (double)x_centered * (double)x_centered + (double)y_centered * (double)y_centered );
//get direction as int in range [0 to 359]
position.angle = (double) atan2( y_centered, x_centered ) * (180 /M_PI)+180;
//transform to carthesian coordinates to polar coordinates
//get distance from center as int in range [0-600]
position.distance = (double)sqrt((double)x_centered * (double)x_centered + (double)y_centered * (double)y_centered);
//get direction as int in range [0 to 359]
position.angle = (double)atan2(y_centered, x_centered) * (180 /M_PI) + 180;
//apply thumbstick rotation const to modify forward direction
position.angle = ( position.angle + _THUMBSTICK_ROTATION )%360 ;
//apply thumbstick rotation const to modify forward direction
position.angle = (position.angle + _THUMBSTICK_ROTATION) % 360;
return position;
return position;
}
bool update_keystate( bool keystate, int angle_from, int angle_to, int angle ){
if (angle_from < angle && angle <= angle_to ) {
keystate = true ;
}
if (angle <= angle_from || angle_to < angle ) {
keystate = false ;
}
return keystate ;
bool update_keystate(uint16_t angle_from, uint16_t angle_to, uint16_t angle) {
return (angle_from < angle && angle <= angle_to);
}
void update_keycode(uint16_t keycode, bool keystate, bool last_keystate) {
if (keystate && keystate != last_keystate ) {
register_code(keycode);
}
else if (!keystate) {
unregister_code (keycode) ;
}
void update_keycode(uint16_t keycode, bool keystate) {
if (keystate) {
register_code16(keycode);
} else {
unregister_code16(keycode);
}
}
void thumbstick(controller_state_t controller_state) {
// FIXME: Can't you use the builtin/default joytstick configuration for scanning it?
yPos = analogReadPin(B1);
xPos = analogReadPin(B0);
yPos = analogReadPin(B1);
xPos = analogReadPin(B0);
thumbstick_polar_position = get_thumbstick_polar_position (xPos, yPos);
thumbstick_polar_position = get_thumbstick_polar_position(xPos, yPos);
#ifdef THUMBSTICK_DEBUG
print(" distance: ");
uprintf("%5d", thumbstick_polar_position.angle);
print(" angle: ");
uprintf("%5d", thumbstick_polar_position.distance);
print("\n");
dprintf("distance: %5d angle: %5d\n", thumbstick_polar_position.distance, thumbstick_polar_position.angle);
#endif
// Update WASD state depending on thumbstick position
// if thumbstick out of of deadzone
if ( thumbstick_polar_position.distance >= _DEADZONE ) {
wasd_state.w = update_keystate (wasd_state.w, 0, 90, thumbstick_polar_position.angle);
if ( !wasd_state.w ) {
wasd_state.w = update_keystate (wasd_state.w, 315, 360, thumbstick_polar_position.angle);
// Update WASD state depending on thumbstick position
// if thumbstick out of of deadzone
if (thumbstick_polar_position.distance >= _DEADZONE) {
wasd_state.w = update_keystate( 0, 90, thumbstick_polar_position.angle);
// A angle: 45 - 180
wasd_state.a = update_keystate( 45, 181, thumbstick_polar_position.angle);
// S angle: 135 - 270
wasd_state.s = update_keystate(135, 270, thumbstick_polar_position.angle);
// D angle: 225 - 359
wasd_state.d = update_keystate(225, 359, thumbstick_polar_position.angle);
if (!wasd_state.w ) {
wasd_state.w = update_keystate(315, 360, thumbstick_polar_position.angle);
}
} else {
//reset WASD state when in _DEADZONE
init_wasd_state();
}
// A angle: 45 - 180
wasd_state.a = update_keystate (wasd_state.a, 45, 181, thumbstick_polar_position.angle);
// S angle: 135 - 270
wasd_state.s = update_keystate (wasd_state.s, 135, 270, thumbstick_polar_position.angle);
// D angle: 225 - 359
wasd_state.d = update_keystate (wasd_state.d, 225, 359, thumbstick_polar_position.angle);
}
//reset WASD state when in _DEADZONE
else {
init_wasd_state () ;
}
#ifdef THUMBSTICK_DEBUG
print(" w: ");
uprintf("%2d", wasd_state.w);
print(" a: ");
uprintf("%2d", wasd_state.a);
print(" s: ");
uprintf("%2d", wasd_state.s);
print(" d: ");
uprintf("%2d", wasd_state.d);
print("\n");
dprintf("w: %2d a: %2d s: %2d d: %2d\n", wasd_state.w, wasd_state.a, wasd_state.s, wasd_state.d);
#endif
update_keycode (KC_W, wasd_state.w, last_wasd_state.w) ;
update_keycode (KC_A, wasd_state.a, last_wasd_state.a) ;
update_keycode (KC_S, wasd_state.s, last_wasd_state.s) ;
update_keycode (KC_D, wasd_state.d, last_wasd_state.d) ;
last_wasd_state = wasd_state ;
// handle WASD-Shift mode
if (controller_state.wasdShiftMode) {
bool Shifted = thumbstick_polar_position.distance > _SHIFTZONE;
if (!wasd_state.shift && Shifted) {
register_code(KC_LSFT);
wasd_state.shift = true;
}
else if (wasd_state.shift && !Shifted) {
unregister_code(KC_LSFT);
wasd_state.shift = false;
update_keycode(KC_W, wasd_state.w);
update_keycode(KC_A, wasd_state.a);
update_keycode(KC_S, wasd_state.s);
update_keycode(KC_D, wasd_state.d);
// handle WASD-Shift mode
if (controller_state.wasdShiftMode) {
bool Shifted = thumbstick_polar_position.distance > _SHIFTZONE;
if (!wasd_state.shift && Shifted) {
register_code(KC_LSFT);
wasd_state.shift = true;
} else if (wasd_state.shift && !Shifted) {
unregister_code(KC_LSFT);
wasd_state.shift = false;
}
}
}
}

+ 17
- 22
keyboards/handwired/replicazeron/common/thumbstick.h View File

@ -15,43 +15,38 @@
*/
#pragma once
#define _DEADZONE 100 // 0 to _SHIFTZONE-1
#define _SHIFTZONE 350 // _DEADZONE+1 to 600
#define _THUMBSTICK_ROTATION 100 //degrees, adjusts forward direction
#include QMK_KEYBOARD_H
#include "analog.h"
#include <math.h>
#include "debug.h"
#include "math.h"
#include "quantum.h"
#include "state.h"
int xPos;
int yPos;
int16_t xPos;
int16_t yPos;
typedef struct {
int angle;
int distance;
uint16_t angle;
uint16_t distance;
} thumbstick_polar_position_t;
typedef struct {
bool w;
bool a;
bool s;
bool d;
bool shift;
bool w;
bool a;
bool s;
bool d;
bool shift;
} wasd_state_t;
thumbstick_polar_position_t thumbstick_polar_position ;
wasd_state_t wasd_state;
wasd_state_t last_wasd_state;
void init_wasd_state (void) ;
void init_wasd_state(void);
thumbstick_polar_position_t get_thumbstick_polar_position (int x, int y ) ;
thumbstick_polar_position_t get_thumbstick_polar_position(int16_t x, int16_t y);
bool update_keystate(bool keyheld , int angle_from, int angle_to, int angle ) ;
bool update_keystate(uint16_t angle_from, uint16_t angle_to, uint16_t angle);
void update_keycode(uint16_t keycode, bool keystate, bool last_keystate) ;
void update_keycode(uint16_t keycode, bool keystate);
void thumbstick(controller_state_t controller_state) ;
void thumbstick(controller_state_t controller_state);

keyboards/handwired/replicazeron/promicro/promicro.c → keyboards/handwired/replicazeron/config.h View File

@ -14,12 +14,28 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "promicro.h"
#pragma once
void keyboard_post_init_user(void) {
// Customise these values to desired behaviour
debug_enable=true;
debug_matrix=true;
//debug_keyboard=true;
//debug_mouse=true;
}
#define THUMBSTICK_DEBUG
/* joystick configuration */
#define JOYSTICK_BUTTON_COUNT 0
#define JOYSTICK_AXIS_COUNT 2
#define JOYSTICK_AXIS_RESOLUTION 10
#define _DEADZONE 100 // 0 to _SHIFTZONE-1
#define _SHIFTZONE 350 // _DEADZONE+1 to 600
#define _THUMBSTICK_ROTATION 100 //degrees, adjusts forward direction
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
/* RGB Config */
#define RGB_DI_PIN B14
#define RGBLED_NUM 6
#define RGBLIGHT_EFFECT_BREATHING
#define RGBLIGHT_EFFECT_KNIGHT
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
#define RGBLIGHT_EFFECT_RGB_TEST
#define RGBLIGHT_EFFECT_TWINKLE

+ 32
- 32
keyboards/handwired/replicazeron/info.json View File

@ -1,51 +1,51 @@
{
"keyboard_name": "Replicazeron",
"manufacturer": "9R",
"url": "",
"url": "https://github.com/9R/replicazeron",
"maintainer": "9R",
"usb": {
"vid": "0x4142",
"pid": "0x2305",
"device_version": "0.0.1"
},
"diode_direction": "COL2ROW",
"layouts": {
"LAYOUT": {
"layout": [
{"label":"K04", "x":1.75, "y":1, "w":1.25, "matrix": [0,0]},
{"label":"K10", "x":3, "y":1, "w":1.25, "matrix": [0,1]},
{"label":"K16", "x":4.25, "y":1, "w":1.25, "matrix": [0,2]},
{"label":"K22", "x":5.5, "y":1, "w":1.25, "matrix": [0,3]},
{"label":"dwn", "x":9.5, "y":2.75, "w":1.25, "matrix": [0,4]},
{"label":"K04", "x":1.75, "y":0.25, "w":1.25, "matrix": [0,0]},
{"label":"K10", "x":3, "y":0.25, "w":1.25, "matrix": [0,1]},
{"label":"K16", "x":4.25, "y":0.25, "w":1.25, "matrix": [0,2]},
{"label":"K22", "x":5.5, "y":0.25, "w":1.25, "matrix": [0,3]},
{"label":"dwn", "x":9.5, "y":2, "w":1.25, "matrix": [0,4]},
{"label":"K03", "x":1.75, "y":1.7, "h":1.25, "w":1.25, "matrix": [1,0]},
{"label":"K09", "x":3, "y":1.7, "h":1.25, "w":1.25, "matrix": [1,1]},
{"label":"K15", "x":4.25, "y":1.7, "h":1.25, "w":1.25, "matrix": [1,2]},
{"label":"K21", "x":5.5, "y":1.7, "h":1.25, "w":1.25, "matrix": [1,3]},
{"label":"lft", "x":8.25, "y":1.75, "w":1.25, "matrix": [1,4]},
{"label":"K03", "x":1.75, "y":1, "h":1.25, "w":1.25, "matrix": [1,0]},
{"label":"K09", "x":3, "y":1, "h":1.25, "w":1.25, "matrix": [1,1]},
{"label":"K15", "x":4.25, "y":1, "h":1.25, "w":1.25, "matrix": [1,2]},
{"label":"K21", "x":5.5, "y":1, "h":1.25, "w":1.25, "matrix": [1,3]},
{"label":"lft", "x":8.25, "y":1, "w":1.25, "matrix": [1,4]},
{"label":"K02", "x":1.75, "y":3.25, "h":1.25, "w":1.25, "matrix": [2,0]},
{"label":"K08", "x":3, "y":3.25, "h":1.25, "w":1.25, "matrix": [2,1]},
{"label":"K14", "x":4.25, "y":3.25, "h":1.25, "w":1.25, "matrix": [2,2]},
{"label":"K20", "x":5.5, "y":3.25, "h":1.25, "w":1.25, "matrix": [2,3]},
{"label":"ent", "x":9.5, "y":1.75, "w":1.25, "matrix": [2,4]},
{"label":"K02", "x":1.75, "y":2.5, "h":1.25, "w":1.25, "matrix": [2,0]},
{"label":"K08", "x":3, "y":2.5, "h":1.25, "w":1.25, "matrix": [2,1]},
{"label":"K14", "x":4.25, "y":2.5, "h":1.25, "w":1.25, "matrix": [2,2]},
{"label":"K20", "x":5.5, "y":2.5, "h":1.25, "w":1.25, "matrix": [2,3]},
{"label":"ent", "x":9.5, "y":1, "w":1.25, "matrix": [2,4]},
{"label":"K01", "x":1.75, "y":4.5, "w":1.25, "matrix": [3,0]},
{"label":"K07", "x":3, "y":4.5, "w":1.25, "matrix": [3,1]},
{"label":"K13", "x":4.25, "y":4.5, "w":1.25, "matrix": [3,2]},
{"label":"K19", "x":5.5, "y":4.5, "w":1.25, "matrix": [3,3]},
{"label":"rgt", "x":10.75, "y":1.75, "w":1.25, "matrix": [3,4]},
{"label":"K01", "x":1.75, "y":3.75, "w":1.25, "matrix": [3,0]},
{"label":"K07", "x":3, "y":3.75, "w":1.25, "matrix": [3,1]},
{"label":"K13", "x":4.25, "y":3.75, "w":1.25, "matrix": [3,2]},
{"label":"K19", "x":5.5, "y":3.75, "w":1.25, "matrix": [3,3]},
{"label":"rgt", "x":10.75, "y":1, "w":1.25, "matrix": [3,4]},
{"label":"K00", "x":1.75, "y":5.5, "w":1.25, "matrix": [4,0]},
{"label":"K06", "x":3, "y":5.5, "w":1.25, "matrix": [4,1]},
{"label":"K12", "x":4.25, "y":5.5, "w":1.25, "matrix": [4,2]},
{"label":"K18", "x":5.5, "y":5.5, "w":1.25, "matrix": [4,3]},
{"label":"up ", "x":9.5, "y":0.75, "w":1.25, "matrix": [4,4]},
{"label":"K00", "x":1.75, "y":4.75, "w":1.25, "matrix": [4,0]},
{"label":"K06", "x":3, "y":4.75, "w":1.25, "matrix": [4,1]},
{"label":"K12", "x":4.25, "y":4.75, "w":1.25, "matrix": [4,2]},
{"label":"K18", "x":5.5, "y":4.75, "w":1.25, "matrix": [4,3]},
{"label":"up ", "x":9.5, "y":0, "w":1.25, "matrix": [4,4]},
{"label":"K05", "x":0, "y":3.25, "w":1.75, "matrix": [5,0]},
{"label":"lyr", "x":7.5, "y":5, "w":1.5, "matrix": [5,1]},
{"label":"K17", "x":10.75, "y":4.75, "w":1.5, "matrix": [5,2]},
{"label":"K23", "x":6.75, "y":3.25, "w":1.5, "matrix": [5,3]},
{"label":"spc", "x":10.75, "y":3.75, "w":1.25, "matrix": [5,4]}
{"label":"K05", "x":0, "y":2.5, "w":1.75, "matrix": [5,0]},
{"label":"lyr", "x":7.5, "y":4.25, "w":1.5, "matrix": [5,1]},
{"label":"K17", "x":10.75, "y":4, "w":1.5, "matrix": [5,2]},
{"label":"K23", "x":6.75, "y":2.5, "w":1.5, "matrix": [5,3]},
{"label":"spc", "x":10.75, "y":3, "w":1.25, "matrix": [5,4]}
]
}
}


+ 38
- 149
keyboards/handwired/replicazeron/keymaps/default/keymap.c View File

@ -14,155 +14,44 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef LEDS_ENABLE
# include "../common/leds.h"
#endif
#include QMK_KEYBOARD_H
#ifdef OLED_ENABLE
# include "../common/oled.h"
#endif
#ifdef THUMBSTICK_ENABLE
# include "../common/thumbstick.h"
#endif
#include "../common/state.h"
controller_state_t controller_state ;
#ifndef OLED_ENABLE
enum keymap_layers {
LAYER_BASE = 0,
LAYER_SHOOTER,
LAYER_MISC,
LAYER_SETTINGS,
};
#endif
enum custom_keycodes {
JOYMODE = SAFE_RANGE,
AUTORUN,
M_UP,
M_DWN,
M_L,
M_R,
M_SEL
};
//////////// Status LEDs //////////////
#ifdef LEDS_ENABLE
void keyboard_pre_init_user(void) {
init_leds() ;
}
#endif
//////////// WASD THUMBSTICK //////////////
#ifdef THUMBSTICK_ENABLE
void matrix_init_user(void) {
init_wasd_state() ;
controller_state = init_state();
}
void matrix_scan_user(void) {
if (controller_state.wasdMode) {
thumbstick (controller_state);
}
}
#endif
#ifdef JOYSTICK_ENABLE
//joystick config
joystick_config_t joystick_axes[JOYSTICK_AXIS_COUNT] = {
JOYSTICK_AXIS_IN(B0, 0, 512, 1023),
JOYSTICK_AXIS_IN(B1, 0, 512, 1023)
};
#endif
//////////// KEYMAPS //////////////
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(
// | little | ring | middle | index | 5way-dpad | -finger
KC_GRV, KC_ESC, KC_J, KC_M, KC_RIGHT, // up
KC_T, KC_3, KC_4, KC_R, KC_ENT, // forward
KC_X, KC_LCTL, KC_LCTL, KC_LALT, KC_DOWN, // down
KC_LSFT, KC_SPC, KC_C, KC_F, KC_LEFT, // back 2
KC_LSFT, KC_6, KC_Z, KC_V, KC_UP, // back 1
KC_TAB, TG(1), KC_I, KC_B, KC_P // special
// ^side_l | ^case | ^thumb | ^side_r | ^analog click <= special row mapping
),
[LAYER_SHOOTER] = LAYOUT(
// | little | ring | middle | index | 5way-dpad | -finger
KC_NO, KC_NO, KC_NO, KC_NO, KC_RIGHT, // up
KC_NO, KC_NO, KC_NO, KC_NO, KC_ENT, // forward
KC_NO, KC_NO, KC_NO, KC_NO, KC_DOWN, // down
KC_NO, KC_NO, KC_NO, KC_NO, KC_LEFT, // back 2
KC_NO, KC_NO, KC_NO, KC_NO, KC_UP, // back 1
KC_NO, TG(2), KC_NO, KC_NO, KC_P // special
// ^side_l | ^case | ^thumb | ^side_r | ^analog click <= special row mapping
),
[LAYER_MISC] = LAYOUT(
// | little | ring | middle | index | 5way-dpad | -finger
KC_NO, KC_NO, KC_NO, KC_NO, KC_RIGHT, // up
KC_NO, KC_NO, KC_NO, KC_NO, KC_ENT, // forward
KC_NO, KC_NO, KC_NO, KC_NO, KC_DOWN, // down
KC_NO, KC_NO, KC_NO, KC_NO, KC_LEFT, // back 2
KC_NO, KC_NO, KC_NO, KC_NO, KC_UP, // back 1
KC_NO, TG(3), KC_NO, KC_NO, KC_P // special
// ^side_l | ^case | ^thumb | ^side_r | ^analog click <= special row mapping
),
[LAYER_SETTINGS] = LAYOUT(
// | little | ring | middle | index | 5way-dpad | -finger
RGB_M_P, RGB_M_B, RGB_M_K, RGB_M_T, KC_RIGHT, // up
KC_NO, RGB_SAI, RGB_VAI, RGB_HUI, KC_ENT, // forward
RGB_TOG, KC_NO, KC_NO, KC_NO , KC_DOWN, // down
EE_CLR, RGB_SAD, RGB_VAD, RGB_HUD, KC_LEFT, // back 2
QK_BOOT, AUTORUN, JOYMODE, KC_V, KC_UP, // back 1
RGB_MOD, TO(0), KC_NO, RGB_RMOD, KC_P // special
// ^side_l | ^case | ^thumb | ^side_r | ^analog click <= special row mapping
)
};
//////////// Change modes on keypress //////////////
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (keycode == JOYMODE && record->event.pressed) {
if (!controller_state.wasdMode) {
controller_state.wasdMode = true;
} else if (controller_state.wasdMode && !controller_state.wasdShiftMode) {
controller_state.wasdShiftMode = true;
} else {
controller_state.wasdMode = false;
controller_state.wasdShiftMode = false;
}
} else if (keycode == AUTORUN && record->event.pressed) {
if (!controller_state.autoRun) {
controller_state.autoRun = true;
register_code(KC_W);
} else {
controller_state.autoRun = false;
unregister_code(KC_W);
}
}
return true;
[_BASE] = LAYOUT(
// little | ring | middle | index | 5way-dpad | -finger
KC_GRV, KC_ESC, KC_J, KC_M, KC_RIGHT, // up
KC_T, KC_3, KC_4, KC_R, KC_ENT, // forward
KC_X, KC_LCTL, KC_LCTL, KC_LALT, KC_DOWN, // down
KC_LSFT, KC_SPC, KC_C, KC_F, KC_LEFT, // back 2
KC_LSFT, KC_6, KC_Z, KC_V, KC_UP, // back 1
KC_TAB, TG(_SHOOTER), KC_I, KC_B, KC_P // special
// ^side_l | ^case | ^thumb | ^side_r | ^analog click <= special row mapping
),
[_SHOOTER] = LAYOUT(
KC_NO, KC_NO, KC_NO, KC_NO, KC_RIGHT,
KC_NO, KC_NO, KC_NO, KC_NO, KC_ENT,
KC_NO, KC_NO, KC_NO, KC_NO, KC_DOWN,
KC_NO, KC_NO, KC_NO, KC_NO, KC_LEFT,
KC_NO, KC_NO, KC_NO, KC_NO, KC_UP,
KC_NO, TG(_MISC), KC_NO, KC_NO, KC_P
),
[_MISC] = LAYOUT(
KC_NO, KC_NO, KC_NO, KC_NO, KC_RIGHT,
KC_NO, KC_NO, KC_NO, KC_NO, KC_ENT,
KC_NO, KC_NO, KC_NO, KC_NO, KC_DOWN,
KC_NO, KC_NO, KC_NO, KC_NO, KC_LEFT,
KC_NO, KC_NO, KC_NO, KC_NO, KC_UP,
KC_NO, TG(_SETTINGS), KC_NO, KC_NO, KC_P
),
[_SETTINGS] = LAYOUT(
RGB_M_P, RGB_M_B, RGB_M_K, RGB_M_T, KC_RIGHT,
KC_NO, RGB_SAI, RGB_VAI, RGB_HUI, KC_ENT,
RGB_TOG, KC_NO, KC_NO, KC_NO , KC_DOWN,
EE_CLR, RGB_SAD, RGB_VAD, RGB_HUD, KC_LEFT,
QK_BOOT, AUTORUN, JOYMODE, KC_V, KC_UP,
RGB_MOD, TO(_BASE), KC_NO, RGB_RMOD, KC_P
)
};
//////////// Draw OLED menu //////////////
#ifdef OLED_ENABLE
bool oled_task_user(void) {
draw_oled(controller_state);
return false;
}
#endif
//////////// Handle layer changes //////////////
layer_state_t layer_state_set_user(layer_state_t state) {
controller_state.activeLayer = get_highest_layer(state) ;
#ifdef LEDS_ENABLE
set_leds(controller_state.activeLayer) ;
#endif
return state ;
}

+ 0
- 2
keyboards/handwired/replicazeron/keymaps/default/readme.md View File

@ -1,2 +0,0 @@
# Replicazeron Gamepad
Default layout with 2 axies thumbstick

+ 0
- 15
keyboards/handwired/replicazeron/keymaps/default/rules.mk View File

@ -1,15 +0,0 @@
ifeq ($(strip $(LEDS_ENABLE)), yes)
OPT_DEFS += -DLEDS_ENABLE
SRC += ../common/leds.c
endif
ifeq ($(strip $(OLED_ENABLE)), yes)
SRC += ../common/oled.c
endif
ifeq ($(strip $(THUMBSTICK_ENABLE)), yes)
# POINTING_DEVICE_ENABLE = yes
OPT_DEFS += -DTHUMBSTICK_ENABLE
SRC += analog.c
SRC += ../common/thumbstick.c
endif

+ 38
- 149
keyboards/handwired/replicazeron/keymaps/via/keymap.c View File

@ -14,155 +14,44 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef LEDS_ENABLE
# include "../common/leds.h"
#endif
#include QMK_KEYBOARD_H
#ifdef OLED_ENABLE
# include "../common/oled.h"
#endif
#ifdef THUMBSTICK_ENABLE
# include "../common/thumbstick.h"
#endif
#include "../common/state.h"
controller_state_t controller_state ;
#ifndef OLED_ENABLE
enum keymap_layers {
LAYER_BASE = 0,
LAYER_SHOOTER,
LAYER_MISC,
LAYER_SETTINGS,
};
#endif
enum custom_keycodes {
JOYMODE = SAFE_RANGE,
AUTORUN,
M_UP,
M_DWN,
M_L,
M_R,
M_SEL
};
//////////// Status LEDs //////////////
#ifdef LEDS_ENABLE
void keyboard_pre_init_user(void) {
init_leds() ;
}
#endif
//////////// WASD THUMBSTICK //////////////
#ifdef THUMBSTICK_ENABLE
void matrix_init_user(void) {
init_wasd_state() ;
controller_state = init_state();
}
void matrix_scan_user(void) {
if (controller_state.wasdMode) {
thumbstick (controller_state);
}
}
#endif
#ifdef JOYSTICK_ENABLE
//joystick config
joystick_config_t joystick_axes[JOYSTICK_AXIS_COUNT] = {
JOYSTICK_AXIS_IN(B0, 0, 512, 1023),
JOYSTICK_AXIS_IN(B1, 0, 512, 1023)
};
#endif
//////////// KEYMAPS //////////////
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(
// | little | ring | middle | index | 5way-dpad | -finger
KC_GRV, KC_ESC, KC_J, KC_M, KC_RIGHT, // up
KC_T, KC_3, KC_4, KC_R, KC_ENT, // forward
KC_X, KC_LCTL, KC_LCTL, KC_LALT, KC_DOWN, // down
KC_LSFT, KC_SPC, KC_C, KC_F, KC_LEFT, // back 2
KC_LSFT, KC_6, KC_Z, KC_V, KC_UP, // back 1
KC_TAB, TG(1), KC_I, KC_B, KC_P // special
// ^side_l | ^case | ^thumb | ^side_r | ^analog click <= special row mapping
),
[LAYER_SHOOTER] = LAYOUT(
// | little | ring | middle | index | 5way-dpad | -finger
KC_NO, KC_NO, KC_NO, KC_NO, KC_RIGHT, // up
KC_NO, KC_NO, KC_NO, KC_NO, KC_ENT, // forward
KC_NO, KC_NO, KC_NO, KC_NO, KC_DOWN, // down
KC_NO, KC_NO, KC_NO, KC_NO, KC_LEFT, // back 2
KC_NO, KC_NO, KC_NO, KC_NO, KC_UP, // back 1
KC_NO, TG(2), KC_NO, KC_NO, KC_P // special
// ^side_l | ^case | ^thumb | ^side_r | ^analog click <= special row mapping
),
[LAYER_MISC] = LAYOUT(
// | little | ring | middle | index | 5way-dpad | -finger
KC_NO, KC_NO, KC_NO, KC_NO, KC_RIGHT, // up
KC_NO, KC_NO, KC_NO, KC_NO, KC_ENT, // forward
KC_NO, KC_NO, KC_NO, KC_NO, KC_DOWN, // down
KC_NO, KC_NO, KC_NO, KC_NO, KC_LEFT, // back 2
KC_NO, KC_NO, KC_NO, KC_NO, KC_UP, // back 1
KC_NO, TG(3), KC_NO, KC_NO, KC_P // special
// ^side_l | ^case | ^thumb | ^side_r | ^analog click <= special row mapping
),
[LAYER_SETTINGS] = LAYOUT(
// | little | ring | middle | index | 5way-dpad | -finger
RGB_M_P, RGB_M_B, RGB_M_K, RGB_M_T, KC_RIGHT, // up
KC_NO, RGB_SAI, RGB_VAI, RGB_HUI, KC_ENT, // forward
RGB_TOG, KC_NO, KC_NO, KC_NO , KC_DOWN, // down
EE_CLR, RGB_SAD, RGB_VAD, RGB_HUD, KC_LEFT, // back 2
QK_BOOT, AUTORUN, JOYMODE, KC_V, KC_UP, // back 1
RGB_MOD, TO(0), KC_NO, RGB_RMOD, KC_P // special
// ^side_l | ^case | ^thumb | ^side_r | ^analog click <= special row mapping
)
};
//////////// Change modes on keypress //////////////
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (keycode == JOYMODE && record->event.pressed) {
if (!controller_state.wasdMode) {
controller_state.wasdMode = true;
} else if (controller_state.wasdMode && !controller_state.wasdShiftMode) {
controller_state.wasdShiftMode = true;
} else {
controller_state.wasdMode = false;
controller_state.wasdShiftMode = false;
}
} else if (keycode == AUTORUN && record->event.pressed) {
if (!controller_state.autoRun) {
controller_state.autoRun = true;
register_code(KC_W);
} else {
controller_state.autoRun = false;
unregister_code(KC_W);
}
}
return true;
[_BASE] = LAYOUT(
// | little | ring | middle | index | 5way-dpad | -finger
KC_GRV, KC_ESC, KC_J, KC_M, KC_RIGHT, // up
KC_T, KC_3, KC_4, KC_R, KC_ENT, // forward
KC_X, KC_LCTL, KC_LCTL, KC_LALT, KC_DOWN, // down
KC_LSFT, KC_SPC, KC_C, KC_F, KC_LEFT, // back 2
KC_LSFT, KC_6, KC_Z, KC_V, KC_UP, // back 1
KC_TAB, TG(_SHOOTER), KC_I, KC_B, KC_P // special
// ^side_l | ^case | ^thumb | ^side_r | ^analog click <= special row mapping
),
[_SHOOTER] = LAYOUT(
KC_NO, KC_NO, KC_NO, KC_NO, KC_RIGHT,
KC_NO, KC_NO, KC_NO, KC_NO, KC_ENT,
KC_NO, KC_NO, KC_NO, KC_NO, KC_DOWN,
KC_NO, KC_NO, KC_NO, KC_NO, KC_LEFT,
KC_NO, KC_NO, KC_NO, KC_NO, KC_UP,
KC_NO, TG(_MISC), KC_NO, KC_NO, KC_P
),
[_MISC] = LAYOUT(
KC_NO, KC_NO, KC_NO, KC_NO, KC_RIGHT,
KC_NO, KC_NO, KC_NO, KC_NO, KC_ENT,
KC_NO, KC_NO, KC_NO, KC_NO, KC_DOWN,
KC_NO, KC_NO, KC_NO, KC_NO, KC_LEFT,
KC_NO, KC_NO, KC_NO, KC_NO, KC_UP,
KC_NO, TG(_SETTINGS), KC_NO, KC_NO, KC_P
),
[_SETTINGS] = LAYOUT(
RGB_M_P, RGB_M_B, RGB_M_K, RGB_M_T, KC_RIGHT,
KC_NO, RGB_SAI, RGB_VAI, RGB_HUI, KC_ENT,
RGB_TOG, KC_NO, KC_NO, KC_NO , KC_DOWN,
EE_CLR, RGB_SAD, RGB_VAD, RGB_HUD, KC_LEFT,
QK_BOOT, AUTORUN, JOYMODE, KC_V, KC_UP,
RGB_MOD, TO(_BASE), KC_NO, RGB_RMOD, KC_P
)
};
//////////// Draw OLED menu //////////////
#ifdef OLED_ENABLE
bool oled_task_user(void) {
draw_oled(controller_state);
return false;
}
#endif
//////////// Handle layer changes //////////////
layer_state_t layer_state_set_user(layer_state_t state) {
controller_state.activeLayer = get_highest_layer(state) ;
#ifdef LEDS_ENABLE
set_leds(controller_state.activeLayer) ;
#endif
return state ;
}

+ 0
- 2
keyboards/handwired/replicazeron/keymaps/via/readme.md View File

@ -1,2 +0,0 @@
# Replicazeron Gamepad - via layout
VIA layout with 2 axies thumbstick

+ 0
- 15
keyboards/handwired/replicazeron/keymaps/via/rules.mk View File

@ -1,16 +1 @@
VIA_ENABLE = yes
ifeq ($(strip $(LEDS_ENABLE)), yes)
OPT_DEFS += -DLEDS_ENABLE
SRC += ../common/leds.c
endif
ifeq ($(strip $(OLED_ENABLE)), yes)
SRC += ../common/oled.c
endif
ifeq ($(strip $(THUMBSTICK_ENABLE)), yes)
# POINTING_DEVICE_ENABLE = yes
OPT_DEFS += -DTHUMBSTICK_ENABLE
SRC += analog.c
SRC += ../common/thumbstick.c
endif

+ 0
- 35
keyboards/handwired/replicazeron/promicro/config.h View File

@ -16,40 +16,5 @@
#pragma once
/* key matrix size */
#define MATRIX_ROWS 6
#define MATRIX_COLS 5
/* joystick configuration */
#define JOYSTICK_BUTTON_COUNT 0
#define JOYSTICK_AXIS_COUNT 2
#define JOYSTICK_AXIS_RESOLUTION 10
/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
//////////////////////////////
#define DYNAMIC_KEYMAP_LAYER_COUNT 4
#define STATUS_LED_A_PIN D2
#define STATUS_LED_B_PIN D3
#ifdef RGBLIGHT_ENABLE
#define RGB_DI_PIN B14
#define RGBLED_NUM 6
#define RGBLIGHT_EFFECT_BREATHING
#define RGBLIGHT_EFFECT_KNIGHT
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
#define RGBLIGHT_EFFECT_RGB_TEST
#define RGBLIGHT_EFFECT_TWINKLE
#endif
#define THUMBSTICK_DEBUG

+ 5
- 3
keyboards/handwired/replicazeron/promicro/info.json View File

@ -1,9 +1,11 @@
{
"usb": {
"device_version": "0.0.1"
},
"matrix_pins": {
"cols": [ "C6", "D4", "D7", "E6", "F7" ],
"rows": [ "B1", "B3", "B2", "B6", "B5", "B4" ]
"cols": ["C6", "D4", "D7", "E6", "F7"],
"rows": ["B1", "B3", "B2", "B6", "B5", "B4"]
},
"diode_direction": "COL2ROW",
"processor": "atmega32u4",
"bootloader": "qmk-dfu"
}

+ 0
- 17
keyboards/handwired/replicazeron/promicro/promicro.h View File

@ -1,17 +0,0 @@
/* Copyright 2023 9R
*
* 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 "quantum.h"

+ 6
- 29
keyboards/handwired/replicazeron/promicro/rules.mk View File

@ -1,29 +1,6 @@
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
MOUSEKEY_ENABLE = no # 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 = no # Enable N-Key Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output
TAP_DANCE_ENABLE = no # Tap Dance
JOYSTICK_ENABLE = yes
JOYSTICK_DRIVER = analog
OLED_ENABLE = yes
OLED_DRIVER = SSD1306
LTO_ENABLE = yes
##########
QMK_SETTINGS = yes
LEDS_ENABLE = yes
THUMBSTICK_ENABLE = yes
SRC += ../common/state.c
BOOTMAGIC_ENABLE = no
CONSOLE_ENABLE = no
EXTRAKEY_ENABLE = no
MOUSEKEY_ENABLE = no
NKRO_ENABLE = no
RGBLIGHT_ENABLE = no

+ 104
- 0
keyboards/handwired/replicazeron/replicazeron.c View File

@ -0,0 +1,104 @@
/* Copyright 2023 9R
*
* 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
controller_state_t controller_state;
#ifdef JOYSTICK_ENABLE
// FIXME: Can't you use the builtin/default joytstick configuration for scanning it?
joystick_config_t joystick_axes[JOYSTICK_AXIS_COUNT] = {
JOYSTICK_AXIS_IN(B0, 0, 512, 1023),
JOYSTICK_AXIS_IN(B1, 0, 512, 1023)
};
#endif
#ifdef THUMBSTICK_ENABLE
void housekeeping_tak_user(void) {
if (controller_state.wasdMode) {
thumbstick(controller_state);
}
}
#endif
void keyboard_post_init_kb(void) {
// Customise these values to desired behaviour
debug_enable = true;
debug_matrix = true;
// debug_keyboard = true;
// debug_mouse = true;
#ifdef LEDS_ENABLE
init_leds();
#endif // LEDS_ENABLE
#ifdef THUMBSTICK_ENABLE
init_wasd_state();
#endif // THUMBSTICK_ENABLE
// FIXME: This was inside the thumbstick's ifdef, moved it out assuming it was a typo
controller_state = init_state();
keyboard_post_init_user();
}
#ifdef OLED_ENABLE
bool oled_task_kb(void) {
if (!oled_task_user()) {
return false;
}
draw_oled(controller_state);
return false;
}
#endif
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) {
return false;
}
if (keycode == JOYMODE && record->event.pressed) {
if (!controller_state.wasdMode) {
controller_state.wasdMode = true;
} else if (controller_state.wasdMode && !controller_state.wasdShiftMode) {
controller_state.wasdShiftMode = true;
} else {
controller_state.wasdMode = false;
controller_state.wasdShiftMode = false;
}
} else if (keycode == AUTORUN && record->event.pressed) {
if (!controller_state.autoRun) {
controller_state.autoRun = true;
register_code(KC_W);
} else {
controller_state.autoRun = false;
unregister_code(KC_W);
}
}
return true;
};
layer_state_t layer_state_set_kb(layer_state_t state) {
controller_state.highestActiveLayer = get_highest_layer(state) ;
#ifdef LEDS_ENABLE
set_leds(controller_state.highestActiveLayer) ;
#endif // LEDS_ENABLE
return state;
}

keyboards/handwired/replicazeron/stm32f103/stm32f103.c → keyboards/handwired/replicazeron/replicazeron.h View File

@ -14,12 +14,37 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "stm32f103.h"
void keyboard_post_init_user(void) {
// Customise these values to desired behaviour
debug_enable=true;
debug_matrix=true;
//debug_keyboard=true;
//debug_mouse=true;
}
#pragma once
// FIXME: The "common/" prefixes can probably be removed using VPATH or whatever on the mk file
#include "common/state.h"
#ifdef LEDS_ENABLE
# include "common/leds.h"
#endif
#ifdef OLED_ENABLE
# include "common/oled.h"
#endif
#ifdef THUMBSTICK_ENABLE
# include "common/thumbstick.h"
#endif
enum kb_layers {
_BASE,
_SHOOTER,
_MISC,
_SETTINGS,
};
enum kb_keycodes {
JOYMODE = QK_KB,
AUTORUN,
M_UP,
M_DWN,
M_L,
M_R,
M_SEL
};

+ 31
- 0
keyboards/handwired/replicazeron/rules.mk View File

@ -0,0 +1,31 @@
AUDIO_ENABLE = no
BACKLIGHT_ENABLE = no
COMMAND_ENABLE = no
JOYSTICK_ENABLE = yes
JOYSTICK_DRIVER = analog
LTO_ENABLE = yes # FIXME: If im not mistaken, this can cause issues on ARM (ie STM32)
OLED_ENABLE = yes
TAP_DANCE_ENABLE = no
LEDS_ENABLE = yes
THUMBSTICK_ENABLE = yes
SRC += common/state.c
# redirect compilation against "handwired/replicazeron" to the stm32 variant
DEFAULT_FOLDER = handwired/replicazeron/stm32f103
ifeq ($(strip $(LEDS_ENABLE)), yes)
OPT_DEFS += -DLEDS_ENABLE
SRC += common/leds.c
endif
ifeq ($(strip $(OLED_ENABLE)), yes)
SRC += common/oled.c
endif
ifeq ($(strip $(THUMBSTICK_ENABLE)), yes)
OPT_DEFS += -DTHUMBSTICK_ENABLE
SRC += analog.c \
common/thumbstick.c
endif

+ 1
- 33
keyboards/handwired/replicazeron/stm32f103/config.h View File

@ -16,42 +16,10 @@
#pragma once
/* key matrix size */
#define MATRIX_ROWS 6
#define MATRIX_COLS 5
/* joystick configuration */
#define JOYSTICK_BUTTON_COUNT 0
#define JOYSTICK_AXIS_COUNT 2
#define JOYSTICK_AXIS_RESOLUTION 10
/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5
/* Use I2C2 */
/* I2C Config */
#define I2C_DRIVER I2CD2
#define I2C1_SDA_PIN B11
#define I2C1_SCL_PIN B10
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
//////////////////////////////
#define DYNAMIC_KEYMAP_LAYER_COUNT 4
#define STATUS_LED_A_PIN B13
#define STATUS_LED_B_PIN B12
#define RGB_DI_PIN B14
#define RGBLED_NUM 6
#define RGBLIGHT_EFFECT_BREATHING
#define RGBLIGHT_EFFECT_KNIGHT
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
#define RGBLIGHT_EFFECT_RGB_TEST
#define RGBLIGHT_EFFECT_TWINKLE
#define THUMBSTICK_DEBUG

+ 4
- 2
keyboards/handwired/replicazeron/stm32f103/info.json View File

@ -1,9 +1,11 @@
{
"usb": {
"device_version": "0.0.2"
},
"matrix_pins": {
"cols": ["A7", "A6", "A5", "A4", "B4"],
"rows": [ "B15", "A8", "A9", "A10", "A15", "B3" ]
"rows": ["B15", "A8", "A9", "A10", "A15", "B3"]
},
"diode_direction": "COL2ROW",
"processor": "STM32F103",
"bootloader": "stm32duino"
}

+ 6
- 30
keyboards/handwired/replicazeron/stm32f103/rules.mk View File

@ -1,33 +1,9 @@
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = yes # 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 = yes # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output
TAP_DANCE_ENABLE = no # Tap Dance
JOYSTICK_ENABLE = yes
JOYSTICK_DRIVER = analog
OLED_ENABLE = yes
OLED_DRIVER = SSD1306
OLED_BRIGHTNESS = 32
LTO_ENABLE = yes
BOOTMAGIC_ENABLE = yes
CONSOLE_ENABLE = yes
EXTRAKEY_ENABLE = yes
MOUSEKEY_ENABLE = yes
NKRO_ENABLE = yes
RGBLIGHT_ENABLE = yes
# Enter lower-power sleep mode when on the ChibiOS idle thread
OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE
##########
QMK_SETTINGS = yes
LEDS_ENABLE = yes
THUMBSTICK_ENABLE = yes
SRC += ../common/state.c

+ 0
- 17
keyboards/handwired/replicazeron/stm32f103/stm32f103.h View File

@ -1,17 +0,0 @@
/* Copyright 2023 9R
*
* 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 "quantum.h"

Loading…
Cancel
Save