mirror of
https://github.com/qmk/qmk_firmware.git
synced 2026-10-25 02:12:40 +02:00
Joystick 16-bit support (#10439)
* Joystick 16-bit support * Add variable joystick axes resolution * Moved #define statements to .h files * Moved definitions to quantum/joystick.h Removed duplicate definitions from usb_descriptor.h and process_joysick.h Adjust process_joystick.c and usb_descriptor.c to use the pre-computed "JOYSTICK_RESOLUTION" value which contains the logical maximum value of a joystick axis * Cleaning up unnecessary code * Update docs/feature_joystick.md Co-authored-by: Ryan <fauxpark@gmail.com> * Workaround to joystick.h not being included to report.h * Removed unnecessary newlines, updated report.h Changed JOYSTICK_AXES_RESOLUTION conditional in report.h Co-authored-by: Ryan <fauxpark@gmail.com>
This commit is contained in:
+10
-2
@@ -1,5 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef JOYSTICK_BUTTON_COUNT
|
||||
# define JOYSTICK_BUTTON_COUNT 8
|
||||
#endif
|
||||
@@ -8,9 +12,13 @@
|
||||
# define JOYSTICK_AXES_COUNT 4
|
||||
#endif
|
||||
|
||||
#include "quantum.h"
|
||||
#ifndef JOYSTICK_AXES_RESOLUTION
|
||||
# define JOYSTICK_AXES_RESOLUTION 8
|
||||
#elif JOYSTICK_AXES_RESOLUTION < 8 || JOYSTICK_AXES_RESOLUTION > 16
|
||||
# error JOYSTICK_AXES_RESOLUTION must be between 8 and 16
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#define JOYSTICK_RESOLUTION ((1L << (JOYSTICK_AXES_RESOLUTION - 1)) - 1)
|
||||
|
||||
// configure on input_pin of the joystick_axes array entry to JS_VIRTUAL_AXIS
|
||||
// to prevent it from being read from the ADC. This allows outputing forged axis value.
|
||||
|
||||
Reference in New Issue
Block a user