mirror of
https://github.com/mfulz/qmk_firmware.git
synced 2025-07-19 11:55:17 +02:00
The other required set of changes
As per the PR, the changes still holding it up. Add onekey for testing. Fix ARM builds. Fix device descriptor when either axes or buttons is zero. Add compile-time check for at least one axis or button. Move definition to try to fix conflict. PR review comments. qmk cformat
This commit is contained in:
parent
d88bdc6a1b
commit
801be60473
@ -12,9 +12,11 @@ The joystick feature provides two services :
|
||||
* reading an analog input device
|
||||
* sending gamepad HID reports
|
||||
|
||||
Both services can be used without the other, depending on wether you just want to read a device but not send gamepad reports (for volume control for instance)
|
||||
Both services can be used without the other, depending on whether you just want to read a device but not send gamepad reports (for volume control for instance)
|
||||
or send gamepad reports based on values computed by the keyboard.
|
||||
|
||||
!> Reading analog axes is not currently functional on ARM MCUs.
|
||||
|
||||
### Analog circuit
|
||||
|
||||
An analog device such as a potentiometer found on a gamepad's analog axes is based on a [voltage divider](https://en.wikipedia.org/wiki/Voltage_divider).
|
||||
|
3
keyboards/handwired/onekey/keymaps/joystick/config.h
Normal file
3
keyboards/handwired/onekey/keymaps/joystick/config.h
Normal file
@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
#define JOYSTICK_AXES_COUNT 0
|
||||
#define JOYSTICK_BUTTON_COUNT 1
|
5
keyboards/handwired/onekey/keymaps/joystick/keymap.c
Normal file
5
keyboards/handwired/onekey/keymaps/joystick/keymap.c
Normal file
@ -0,0 +1,5 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
LAYOUT( JS_BUTTON0 )
|
||||
};
|
1
keyboards/handwired/onekey/keymaps/joystick/rules.mk
Normal file
1
keyboards/handwired/onekey/keymaps/joystick/rules.mk
Normal file
@ -0,0 +1 @@
|
||||
JOYSTICK_ENABLE = yes
|
@ -1,15 +1,13 @@
|
||||
#include "joystick.h"
|
||||
|
||||
joystick_t joystick_status = {
|
||||
.buttons = {0},
|
||||
.axes = {
|
||||
joystick_t joystick_status = {.buttons = {0},
|
||||
.axes =
|
||||
{
|
||||
#if JOYSTICK_AXES_COUNT > 0
|
||||
0
|
||||
#endif
|
||||
},
|
||||
.status = 0
|
||||
};
|
||||
.status = 0};
|
||||
|
||||
// array defining the reading of analog values for each axis
|
||||
__attribute__ ((weak))
|
||||
joystick_config_t joystick_axes[JOYSTICK_AXES_COUNT] = {};
|
||||
__attribute__((weak)) joystick_config_t joystick_axes[JOYSTICK_AXES_COUNT] = {};
|
||||
|
@ -1,5 +1,4 @@
|
||||
#ifndef JOYSTICK_H
|
||||
#define JOYSTICK_H
|
||||
#pragma once
|
||||
|
||||
#ifndef JOYSTICK_BUTTON_COUNT
|
||||
# define JOYSTICK_BUTTON_COUNT 8
|
||||
@ -16,10 +15,14 @@
|
||||
//
|
||||
#define JS_VIRTUAL_AXIS 0xFF
|
||||
|
||||
#define JOYSTICK_AXIS_VIRTUAL {JS_VIRTUAL_AXIS,JS_VIRTUAL_AXIS,JS_VIRTUAL_AXIS,0 ,1023}
|
||||
#define JOYSTICK_AXIS_IN(INPUT_PIN, LOW, REST, HIGH) {JS_VIRTUAL_AXIS,INPUT_PIN ,JS_VIRTUAL_AXIS,LOW,REST,HIGH}
|
||||
#define JOYSTICK_AXIS_IN_OUT(INPUT_PIN, OUTPUT_PIN, LOW, REST, HIGH) {OUTPUT_PIN ,INPUT_PIN ,JS_VIRTUAL_AXIS,LOW,REST,HIGH}
|
||||
#define JOYSTICK_AXIS_IN_OUT_GROUND(INPUT_PIN, OUTPUT_PIN, GROUND_PIN, LOW, REST, HIGH) {OUTPUT_PIN ,INPUT_PIN ,GROUND_PIN ,LOW,REST,HIGH}
|
||||
#define JOYSTICK_AXIS_VIRTUAL \
|
||||
{ JS_VIRTUAL_AXIS, JS_VIRTUAL_AXIS, JS_VIRTUAL_AXIS, 0, 1023 }
|
||||
#define JOYSTICK_AXIS_IN(INPUT_PIN, LOW, REST, HIGH) \
|
||||
{ JS_VIRTUAL_AXIS, INPUT_PIN, JS_VIRTUAL_AXIS, LOW, REST, HIGH }
|
||||
#define JOYSTICK_AXIS_IN_OUT(INPUT_PIN, OUTPUT_PIN, LOW, REST, HIGH) \
|
||||
{ OUTPUT_PIN, INPUT_PIN, JS_VIRTUAL_AXIS, LOW, REST, HIGH }
|
||||
#define JOYSTICK_AXIS_IN_OUT_GROUND(INPUT_PIN, OUTPUT_PIN, GROUND_PIN, LOW, REST, HIGH) \
|
||||
{ OUTPUT_PIN, INPUT_PIN, GROUND_PIN, LOW, REST, HIGH }
|
||||
|
||||
typedef struct {
|
||||
uint8_t output_pin;
|
||||
@ -34,13 +37,9 @@ typedef struct {
|
||||
|
||||
extern joystick_config_t joystick_axes[JOYSTICK_AXES_COUNT];
|
||||
|
||||
enum joystick_status{
|
||||
JS_INITIALIZED = 1,
|
||||
JS_UPDATED = 2
|
||||
};
|
||||
enum joystick_status { JS_INITIALIZED = 1, JS_UPDATED = 2 };
|
||||
|
||||
typedef struct {
|
||||
|
||||
uint8_t buttons[JOYSTICK_BUTTON_COUNT / 8 + 1];
|
||||
|
||||
int16_t axes[JOYSTICK_AXES_COUNT];
|
||||
@ -51,5 +50,3 @@ extern joystick_t joystick_status;
|
||||
|
||||
// to be implemented in the hid protocol library
|
||||
void send_joystick_packet(joystick_t* joystick);
|
||||
|
||||
#endif //JOYSTICK_H
|
@ -1,21 +1,17 @@
|
||||
#include "joystick.h"
|
||||
#include "process_joystick.h"
|
||||
|
||||
#include <quantum/joystick.h>
|
||||
#include <quantum/quantum_keycodes.h>
|
||||
#include <quantum/config_common.h>
|
||||
|
||||
#ifdef __AVR__
|
||||
# include <drivers/avr/analog.h>
|
||||
# include "analog.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
bool process_joystick_buttons(uint16_t keycode, keyrecord_t *record);
|
||||
|
||||
bool process_joystick(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
if (process_joystick_buttons(keycode, record)
|
||||
&& (joystick_status.status & JS_UPDATED)>0){
|
||||
if (process_joystick_buttons(keycode, record) && (joystick_status.status & JS_UPDATED) > 0) {
|
||||
send_joystick_packet(&joystick_status);
|
||||
joystick_status.status &= ~JS_UPDATED;
|
||||
}
|
||||
@ -23,7 +19,6 @@ bool process_joystick(uint16_t keycode, keyrecord_t *record){
|
||||
return true;
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void joystick_task(void) {
|
||||
if (process_joystick_analogread() && (joystick_status.status & JS_UPDATED)) {
|
||||
send_joystick_packet(&joystick_status);
|
||||
@ -31,10 +26,7 @@ void joystick_task(void){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool process_joystick_buttons(uint16_t keycode, keyrecord_t *record) {
|
||||
|
||||
if (keycode < JS_BUTTON0 || keycode > JS_BUTTON_MAX) {
|
||||
return true;
|
||||
} else {
|
||||
@ -53,8 +45,7 @@ bool process_joystick_buttons(uint16_t keycode, keyrecord_t *record){
|
||||
uint8_t savePinState(uint8_t pin) {
|
||||
#ifdef __AVR__
|
||||
uint8_t pinNumber = pin & 0xF;
|
||||
return ((PORTx_ADDRESS(pin) >> pinNumber) & 0x1) << 1
|
||||
| ((DDRx_ADDRESS(pin) >> pinNumber) & 0x1) ;
|
||||
return ((PORTx_ADDRESS(pin) >> pinNumber) & 0x1) << 1 | ((DDRx_ADDRESS(pin) >> pinNumber) & 0x1);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
@ -70,13 +61,9 @@ void restorePinState(uint8_t pin, uint8_t restoreState){
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
bool process_joystick_analogread(){
|
||||
return process_joystick_analogread_quantum();
|
||||
}
|
||||
__attribute__((weak)) bool process_joystick_analogread() { return process_joystick_analogread_quantum(); }
|
||||
|
||||
bool process_joystick_analogread_quantum() {
|
||||
|
||||
#if JOYSTICK_AXES_COUNT > 0
|
||||
for (int axis_index = 0; axis_index < JOYSTICK_AXES_COUNT; ++axis_index) {
|
||||
if (joystick_axes[axis_index].input_pin == JS_VIRTUAL_AXIS) {
|
||||
@ -151,7 +138,6 @@ bool process_joystick_analogread_quantum(){
|
||||
}
|
||||
|
||||
restorePinState(joystick_axes[axis_index].input_pin, inputSavedState);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,4 @@
|
||||
#ifndef PROCESS_JOYSTICK_H
|
||||
#define PROCESS_JOYSTICK_H
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "quantum.h"
|
||||
@ -10,5 +9,3 @@ void joystick_task(void);
|
||||
|
||||
bool process_joystick_analogread(void);
|
||||
bool process_joystick_analogread_quantum(void);
|
||||
|
||||
#endif //PROCESS_JOYSTICK_H
|
@ -63,10 +63,6 @@ float bell_song[][2] = SONG(TERMINAL_SOUND);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef JOYSTICK_ENABLE
|
||||
#include <process_keycode/process_joystick.h>
|
||||
#endif //JOYSTICK_ENABLE
|
||||
|
||||
static void do_code16(uint16_t code, void (*f)(uint8_t)) {
|
||||
switch (code) {
|
||||
case QK_MODS ... QK_MODS_MAX:
|
||||
|
@ -142,6 +142,10 @@ extern layer_state_t layer_state;
|
||||
# include "process_magic.h"
|
||||
#endif
|
||||
|
||||
#ifdef JOYSTICK_ENABLE
|
||||
# include "process_joystick.h"
|
||||
#endif
|
||||
|
||||
#ifdef GRAVE_ESC_ENABLE
|
||||
# include "process_grave_esc.h"
|
||||
#endif
|
||||
|
@ -185,6 +185,16 @@ typedef struct {
|
||||
int8_t h;
|
||||
} __attribute__((packed)) report_mouse_t;
|
||||
|
||||
typedef struct {
|
||||
#if JOYSTICK_AXES_COUNT > 0
|
||||
int8_t axes[JOYSTICK_AXES_COUNT];
|
||||
#endif
|
||||
|
||||
#if JOYSTICK_BUTTON_COUNT > 0
|
||||
uint8_t buttons[(JOYSTICK_BUTTON_COUNT - 1) / 8 + 1];
|
||||
#endif
|
||||
} __attribute__((packed)) joystick_report_t;
|
||||
|
||||
/* keycode to system usage */
|
||||
static inline uint16_t KEYCODE2SYSTEM(uint8_t key) {
|
||||
switch (key) {
|
||||
|
@ -48,7 +48,7 @@ extern keymap_config_t keymap_config;
|
||||
#endif
|
||||
|
||||
#ifdef JOYSTICK_ENABLE
|
||||
# include <quantum/joystick.h>
|
||||
# include "joystick.h"
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------
|
||||
@ -888,52 +888,48 @@ void virtser_task(void) {
|
||||
|
||||
#ifdef JOYSTICK_ENABLE
|
||||
|
||||
typedef struct {
|
||||
#if JOYSTICK_AXES_COUNT>0
|
||||
int8_t axes[JOYSTICK_AXES_COUNT];
|
||||
#endif
|
||||
|
||||
#if JOYSTICK_BUTTON_COUNT>0
|
||||
uint8_t buttons[(JOYSTICK_BUTTON_COUNT-1)/8+1];
|
||||
#endif
|
||||
} __attribute__ ((packed)) joystick_report_t;
|
||||
|
||||
void send_joystick_packet(joystick_t *joystick) {
|
||||
joystick_report_t rep = {
|
||||
# if JOYSTICK_AXES_COUNT > 0
|
||||
.axes = {
|
||||
joystick->axes[0]
|
||||
.axes = {joystick->axes[0]
|
||||
|
||||
# if JOYSTICK_AXES_COUNT >= 2
|
||||
,joystick->axes[1]
|
||||
,
|
||||
joystick->axes[1]
|
||||
# endif
|
||||
# if JOYSTICK_AXES_COUNT >= 3
|
||||
,joystick->axes[2]
|
||||
,
|
||||
joystick->axes[2]
|
||||
# endif
|
||||
# if JOYSTICK_AXES_COUNT >= 4
|
||||
,joystick->axes[3]
|
||||
,
|
||||
joystick->axes[3]
|
||||
# endif
|
||||
# if JOYSTICK_AXES_COUNT >= 5
|
||||
,joystick->axes[4]
|
||||
,
|
||||
joystick->axes[4]
|
||||
# endif
|
||||
# if JOYSTICK_AXES_COUNT >= 6
|
||||
,joystick->axes[5]
|
||||
,
|
||||
joystick->axes[5]
|
||||
# endif
|
||||
},
|
||||
# endif // JOYSTICK_AXES_COUNT>0
|
||||
|
||||
# if JOYSTICK_BUTTON_COUNT > 0
|
||||
.buttons = {
|
||||
joystick->buttons[0]
|
||||
.buttons = {joystick->buttons[0]
|
||||
|
||||
# if JOYSTICK_BUTTON_COUNT > 8
|
||||
,joystick->buttons[1]
|
||||
,
|
||||
joystick->buttons[1]
|
||||
# endif
|
||||
# if JOYSTICK_BUTTON_COUNT > 16
|
||||
,joystick->buttons[2]
|
||||
,
|
||||
joystick->buttons[2]
|
||||
# endif
|
||||
# if JOYSTICK_BUTTON_COUNT > 24
|
||||
,joystick->buttons[3]
|
||||
,
|
||||
joystick->buttons[3]
|
||||
# endif
|
||||
}
|
||||
# endif // JOYSTICK_BUTTON_COUNT>0
|
||||
|
@ -271,19 +271,7 @@ static void Console_Task(void) {
|
||||
* Joystick
|
||||
******************************************************************************/
|
||||
#ifdef JOYSTICK_ENABLE
|
||||
|
||||
typedef struct {
|
||||
#if JOYSTICK_AXES_COUNT>0
|
||||
int8_t axes[JOYSTICK_AXES_COUNT];
|
||||
#endif
|
||||
|
||||
#if JOYSTICK_BUTTON_COUNT>0
|
||||
uint8_t buttons[(JOYSTICK_BUTTON_COUNT-1)/8+1];
|
||||
#endif
|
||||
} __attribute__ ((packed)) joystick_report_t;
|
||||
|
||||
void send_joystick_packet(joystick_t *joystick) {
|
||||
|
||||
uint8_t timeout = 255;
|
||||
uint8_t where = where_to_send();
|
||||
|
||||
@ -293,39 +281,45 @@ void send_joystick_packet(joystick_t* joystick){
|
||||
|
||||
joystick_report_t r = {
|
||||
# if JOYSTICK_AXES_COUNT > 0
|
||||
.axes = {
|
||||
joystick->axes[0]
|
||||
.axes = {joystick->axes[0]
|
||||
|
||||
# if JOYSTICK_AXES_COUNT >= 2
|
||||
,joystick->axes[1]
|
||||
,
|
||||
joystick->axes[1]
|
||||
# endif
|
||||
# if JOYSTICK_AXES_COUNT >= 3
|
||||
,joystick->axes[2]
|
||||
,
|
||||
joystick->axes[2]
|
||||
# endif
|
||||
# if JOYSTICK_AXES_COUNT >= 4
|
||||
,joystick->axes[3]
|
||||
,
|
||||
joystick->axes[3]
|
||||
# endif
|
||||
# if JOYSTICK_AXES_COUNT >= 5
|
||||
,joystick->axes[4]
|
||||
,
|
||||
joystick->axes[4]
|
||||
# endif
|
||||
# if JOYSTICK_AXES_COUNT >= 6
|
||||
,joystick->axes[5]
|
||||
,
|
||||
joystick->axes[5]
|
||||
# endif
|
||||
},
|
||||
# endif // JOYSTICK_AXES_COUNT>0
|
||||
|
||||
# if JOYSTICK_BUTTON_COUNT > 0
|
||||
.buttons = {
|
||||
joystick->buttons[0]
|
||||
.buttons = {joystick->buttons[0]
|
||||
|
||||
# if JOYSTICK_BUTTON_COUNT > 8
|
||||
,joystick->buttons[1]
|
||||
,
|
||||
joystick->buttons[1]
|
||||
# endif
|
||||
# if JOYSTICK_BUTTON_COUNT > 16
|
||||
,joystick->buttons[2]
|
||||
,
|
||||
joystick->buttons[2]
|
||||
# endif
|
||||
# if JOYSTICK_BUTTON_COUNT > 24
|
||||
,joystick->buttons[3]
|
||||
,
|
||||
joystick->buttons[3]
|
||||
# endif
|
||||
}
|
||||
# endif // JOYSTICK_BUTTON_COUNT>0
|
||||
@ -494,8 +488,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) {
|
||||
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC_IN_EPADDR, EP_TYPE_BULK, CDC_EPSIZE, ENDPOINT_BANK_SINGLE);
|
||||
#endif
|
||||
#ifdef JOYSTICK_ENABLE
|
||||
ConfigSuccess &= ENDPOINT_CONFIG(JOYSTICK_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
|
||||
JOYSTICK_EPSIZE, ENDPOINT_BANK_SINGLE);
|
||||
ConfigSuccess &= ENDPOINT_CONFIG(JOYSTICK_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN, JOYSTICK_EPSIZE, ENDPOINT_BANK_SINGLE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -279,6 +279,9 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM ConsoleReport[] = {
|
||||
#endif
|
||||
|
||||
#ifdef JOYSTICK_ENABLE
|
||||
#if JOYSTICK_AXES_COUNT == 0 && JOYSTICK_BUTTON_COUNT == 0
|
||||
#error Need at least one axis or button for joystick
|
||||
#endif
|
||||
const USB_Descriptor_HIDReport_Datatype_t PROGMEM JoystickReport[] =
|
||||
{
|
||||
HID_RI_USAGE_PAGE(8, 0x01), /* Generic Desktop */
|
||||
@ -304,15 +307,18 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM JoystickReport[] =
|
||||
#if JOYSTICK_AXES_COUNT >= 6
|
||||
HID_RI_USAGE(8, 0x35), // USAGE (RZ)
|
||||
#endif
|
||||
#if JOYSTICK_AXES_COUNT >= 1
|
||||
HID_RI_LOGICAL_MINIMUM(8, -127),
|
||||
HID_RI_LOGICAL_MAXIMUM(8, 127),
|
||||
HID_RI_REPORT_COUNT(8, JOYSTICK_AXES_COUNT),
|
||||
HID_RI_REPORT_SIZE(8, 0x08),
|
||||
HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE),
|
||||
#endif
|
||||
|
||||
#if JOYSTICK_BUTTON_COUNT >= 1
|
||||
HID_RI_USAGE_PAGE(8, 0x09), /* Button */
|
||||
HID_RI_USAGE_MINIMUM(8, 0x01), /* Button 1 */
|
||||
HID_RI_USAGE_MAXIMUM(8, JOYSTICK_BUTTON_COUNT), /* Button 5 */
|
||||
HID_RI_USAGE_MAXIMUM(8, JOYSTICK_BUTTON_COUNT), /* Button max */
|
||||
HID_RI_LOGICAL_MINIMUM(8, 0x00),
|
||||
HID_RI_LOGICAL_MAXIMUM(8, 0x01),
|
||||
HID_RI_REPORT_COUNT(8, JOYSTICK_BUTTON_COUNT),
|
||||
@ -324,6 +330,7 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM JoystickReport[] =
|
||||
HID_RI_REPORT_COUNT(8, 8 - (JOYSTICK_BUTTON_COUNT % 8)),
|
||||
HID_RI_INPUT(8, HID_IOF_CONSTANT),
|
||||
#endif
|
||||
#endif
|
||||
HID_RI_END_COLLECTION(0),
|
||||
HID_RI_END_COLLECTION(0),
|
||||
};
|
||||
@ -863,7 +870,6 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = {
|
||||
},
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Joystick
|
||||
*/
|
||||
@ -902,7 +908,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = {
|
||||
.EndpointAddress = (ENDPOINT_DIR_IN | JOYSTICK_IN_EPNUM),
|
||||
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
|
||||
.EndpointSize = JOYSTICK_EPSIZE,
|
||||
.PollingIntervalMS = 0x0A
|
||||
.PollingIntervalMS = USB_POLLING_INTERVAL_MS
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
@ -27,7 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "host_driver.h"
|
||||
#include "vusb.h"
|
||||
#include "joystick.h"
|
||||
#include "joystick.h"
|
||||
#include <util/delay.h>
|
||||
|
||||
static uint8_t vusb_keyboard_leds = 0;
|
||||
@ -153,44 +152,49 @@ typedef struct {
|
||||
#endif
|
||||
} __attribute__((packed)) vusb_joystick_report_t;
|
||||
|
||||
void send_joystick_packet(joystick_t* status)
|
||||
{
|
||||
void send_joystick_packet(joystick_t *status) {
|
||||
vusb_joystick_report_t r = {
|
||||
.report_id = REPORT_ID_JOYSTICK,
|
||||
#if JOYSTICK_AXES_COUNT > 0
|
||||
.axes = {
|
||||
status->axes[0]
|
||||
.axes = {status->axes[0]
|
||||
|
||||
# if JOYSTICK_AXES_COUNT >= 2
|
||||
,status->axes[1]
|
||||
,
|
||||
status->axes[1]
|
||||
# endif
|
||||
# if JOYSTICK_AXES_COUNT >= 3
|
||||
,status->axes[2]
|
||||
,
|
||||
status->axes[2]
|
||||
# endif
|
||||
# if JOYSTICK_AXES_COUNT >= 4
|
||||
,status->axes[3]
|
||||
,
|
||||
status->axes[3]
|
||||
# endif
|
||||
# if JOYSTICK_AXES_COUNT >= 5
|
||||
,status->axes[4]
|
||||
,
|
||||
status->axes[4]
|
||||
# endif
|
||||
# if JOYSTICK_AXES_COUNT >= 6
|
||||
,status->axes[5]
|
||||
,
|
||||
status->axes[5]
|
||||
# endif
|
||||
},
|
||||
#endif // JOYSTICK_AXES_COUNT>0
|
||||
|
||||
#if JOYSTICK_BUTTON_COUNT > 0
|
||||
.buttons = {
|
||||
status->buttons[0]
|
||||
.buttons = {status->buttons[0]
|
||||
|
||||
# if JOYSTICK_BUTTON_COUNT > 8
|
||||
,status->buttons[1]
|
||||
,
|
||||
status->buttons[1]
|
||||
# endif
|
||||
# if JOYSTICK_BUTTON_COUNT > 16
|
||||
,status->buttons[2]
|
||||
,
|
||||
status->buttons[2]
|
||||
# endif
|
||||
# if JOYSTICK_BUTTON_COUNT > 24
|
||||
,status->buttons[3]
|
||||
,
|
||||
status->buttons[3]
|
||||
# endif
|
||||
}
|
||||
#endif // JOYSTICK_BUTTON_COUNT>0
|
||||
@ -200,8 +204,6 @@ void send_joystick_packet(joystick_t* status)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*------------------------------------------------------------------*
|
||||
* Request from host *
|
||||
*------------------------------------------------------------------*/
|
||||
@ -396,7 +398,8 @@ const PROGMEM uchar mouse_extra_hid_report[] = {
|
||||
0xC0 // End Collection
|
||||
# endif
|
||||
# if JOYSTICK_ENABLE
|
||||
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
|
||||
0x05,
|
||||
0x01, // USAGE_PAGE (Generic Desktop)
|
||||
0x09, 0x04, // USAGE (Joystick)
|
||||
0xa1, 0x01, // COLLECTION (Application)
|
||||
0x85, REPORT_ID_JOYSTICK, // REPORT_ID (6)
|
||||
|
Loading…
x
Reference in New Issue
Block a user