Skip to content

Commit

Permalink
Merge pull request #29 from speedypotato/feature/qol_rgb_mouse
Browse files Browse the repository at this point in the history
Disable RGB on start hold, added mouse sens multiplier
  • Loading branch information
speedypotato authored Jan 6, 2022
2 parents 34077ac + f9dd89b commit 5e33a3d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
Binary file modified build_uf2/Pico_Game_Controller.uf2
Binary file not shown.
1 change: 1 addition & 0 deletions src/controller_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#define LED_GPIO_SIZE 10 // Number of switch LEDs
#define ENC_GPIO_SIZE 2 // Number of encoders
#define ENC_PPR 600 // Encoder PPR
#define MOUSE_SENS 1 // Mouse sensitivity multiplier
#define ENC_DEBOUNCE true // Encoder Debouncing
#define SW_DEBOUNCE_TIME_US 4000 // Switch debounce delay in us
#define ENC_PULSE (ENC_PPR * 4) // 4 pulses per PPR
Expand Down
28 changes: 16 additions & 12 deletions src/pico_game_controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ void key_mode() {
tud_hid_n_report(0x00, REPORT_ID_KEYBOARD, &nkro_report,
sizeof(nkro_report));
} else {
tud_hid_mouse_report(REPORT_ID_MOUSE, 0x00, delta[0], delta[1], 0, 0);
tud_hid_mouse_report(REPORT_ID_MOUSE, 0x00, delta[0] * MOUSE_SENS,
delta[1] * MOUSE_SENS, 0, 0);
}
// Alternate reports
kbm_report = !kbm_report;
Expand Down Expand Up @@ -239,6 +240,17 @@ void dma_handler() {
}
}

/**
* Second Core Runnable
**/
void core1_entry() {
uint32_t counter = 0;
while (1) {
ws2812b_update(++counter);
sleep_ms(5);
}
}

/**
* Initialize Board Pins
**/
Expand Down Expand Up @@ -308,16 +320,10 @@ void init() {
loop_mode = &joy_mode;
joy_mode_check = true;
}
}

/**
* Second Core Runnable
**/
void core1_entry() {
uint32_t counter = 0;
while (1) {
ws2812b_update(++counter);
sleep_ms(5);
// Disable RGB
if (gpio_get(SW_GPIO[8])) {
multicore_launch_core1(core1_entry);
}
}

Expand All @@ -329,8 +335,6 @@ int main(void) {
init();
tusb_init();

multicore_launch_core1(core1_entry);

while (1) {
tud_task(); // tinyusb device task
update_inputs();
Expand Down

0 comments on commit 5e33a3d

Please sign in to comment.