format code according to conventions [skip ci]

This commit is contained in:
QMK Bot 2020-08-29 22:57:48 +00:00
parent 000eb14d78
commit a3db72df72
14 changed files with 93 additions and 96 deletions

View file

@ -447,7 +447,7 @@ void oled_pan(bool left) {
oled_buffer_reader_t oled_read_raw(uint16_t start_index) { oled_buffer_reader_t oled_read_raw(uint16_t start_index) {
if (start_index > OLED_MATRIX_SIZE) start_index = OLED_MATRIX_SIZE; if (start_index > OLED_MATRIX_SIZE) start_index = OLED_MATRIX_SIZE;
oled_buffer_reader_t ret_reader; oled_buffer_reader_t ret_reader;
ret_reader.current_element = &oled_buffer[start_index]; ret_reader.current_element = &oled_buffer[start_index];
ret_reader.remaining_element_count = OLED_MATRIX_SIZE - start_index; ret_reader.remaining_element_count = OLED_MATRIX_SIZE - start_index;
return ret_reader; return ret_reader;
} }

View file

@ -155,7 +155,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif #endif
typedef struct __attribute__((__packed__)) { typedef struct __attribute__((__packed__)) {
uint8_t *current_element; uint8_t *current_element;
uint16_t remaining_element_count; uint16_t remaining_element_count;
} oled_buffer_reader_t; } oled_buffer_reader_t;

View file

@ -1,4 +1,4 @@
#pragma once #pragma once
#define JOYSTICK_AXES_COUNT 2 #define JOYSTICK_AXES_COUNT 2
#define JOYSTICK_BUTTON_COUNT 1 #define JOYSTICK_BUTTON_COUNT 1

View file

@ -1 +1 @@
JOYSTICK_ENABLE = analog JOYSTICK_ENABLE = analog

View file

@ -41,34 +41,34 @@ void autoshift_flush(void) {
} }
void autoshift_on(uint16_t keycode) { void autoshift_on(uint16_t keycode) {
autoshift_time = timer_read(); autoshift_time = timer_read();
autoshift_lastkey = keycode; autoshift_lastkey = keycode;
} }
void autoshift_toggle(void) { void autoshift_toggle(void) {
if (autoshift_enabled) { if (autoshift_enabled) {
autoshift_enabled = false; autoshift_enabled = false;
autoshift_flush(); autoshift_flush();
} else { } else {
autoshift_enabled = true; autoshift_enabled = true;
} }
} }
void autoshift_enable(void) { autoshift_enabled = true; } void autoshift_enable(void) { autoshift_enabled = true; }
void autoshift_disable(void) { void autoshift_disable(void) {
autoshift_enabled = false; autoshift_enabled = false;
autoshift_flush(); autoshift_flush();
} }
#ifndef AUTO_SHIFT_NO_SETUP # ifndef AUTO_SHIFT_NO_SETUP
void autoshift_timer_report(void) { void autoshift_timer_report(void) {
char display[8]; char display[8];
snprintf(display, 8, "\n%d\n", autoshift_timeout); snprintf(display, 8, "\n%d\n", autoshift_timeout);
send_string((const char *)display); send_string((const char *)display);
} }
#endif # endif
bool get_autoshift_state(void) { return autoshift_enabled; } bool get_autoshift_state(void) { return autoshift_enabled; }
@ -79,7 +79,6 @@ void set_autoshift_timeout(uint16_t timeout) { autoshift_timeout = timeout; }
bool process_auto_shift(uint16_t keycode, keyrecord_t *record) { bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) { if (record->event.pressed) {
switch (keycode) { switch (keycode) {
case KC_ASTG: case KC_ASTG:
autoshift_toggle(); autoshift_toggle();
return true; return true;
@ -92,10 +91,10 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
return true; return true;
# ifndef AUTO_SHIFT_NO_SETUP # ifndef AUTO_SHIFT_NO_SETUP
case KC_ASUP: case KC_ASUP:
autoshift_timeout += 5; autoshift_timeout += 5;
return true; return true;
case KC_ASDN: case KC_ASDN:
autoshift_timeout -= 5; autoshift_timeout -= 5;
return true; return true;

View file

@ -27,7 +27,7 @@ extern int COMBO_LEN;
__attribute__((weak)) void process_combo_event(uint16_t combo_index, bool pressed) {} __attribute__((weak)) void process_combo_event(uint16_t combo_index, bool pressed) {}
static uint16_t timer = 0; static uint16_t timer = 0;
static uint16_t current_combo_index = 0; static uint16_t current_combo_index = 0;
static bool drop_buffer = false; static bool drop_buffer = false;
static bool is_active = false; static bool is_active = false;
static bool b_combo_enable = true; // defaults to enabled static bool b_combo_enable = true; // defaults to enabled
@ -82,7 +82,7 @@ static inline void dump_key_buffer(bool emit) {
} while (0) } while (0)
static bool process_single_combo(combo_t *combo, uint16_t keycode, keyrecord_t *record) { static bool process_single_combo(combo_t *combo, uint16_t keycode, keyrecord_t *record) {
uint8_t count = 0; uint8_t count = 0;
uint16_t index = -1; uint16_t index = -1;
/* Find index of keycode and number of combo keys */ /* Find index of keycode and number of combo keys */
for (const uint16_t *keys = combo->keys;; ++count) { for (const uint16_t *keys = combo->keys;; ++count) {

View file

@ -17,8 +17,7 @@ bool process_joystick(uint16_t keycode, keyrecord_t *record) {
return true; return true;
} }
__attribute__((weak)) __attribute__((weak)) void joystick_task(void) {
void joystick_task(void) {
if (process_joystick_analogread() && (joystick_status.status & JS_UPDATED)) { if (process_joystick_analogread() && (joystick_status.status & JS_UPDATED)) {
send_joystick_packet(&joystick_status); send_joystick_packet(&joystick_status);
joystick_status.status &= ~JS_UPDATED; joystick_status.status &= ~JS_UPDATED;
@ -47,16 +46,11 @@ uint16_t savePinState(pin_t pin) {
return ((PORTx_ADDRESS(pin) >> pinNumber) & 0x1) << 1 | ((DDRx_ADDRESS(pin) >> pinNumber) & 0x1); return ((PORTx_ADDRESS(pin) >> pinNumber) & 0x1) << 1 | ((DDRx_ADDRESS(pin) >> pinNumber) & 0x1);
#elif defined(PROTOCOL_CHIBIOS) #elif defined(PROTOCOL_CHIBIOS)
/* /*
The pin configuration is backed up in the following format : The pin configuration is backed up in the following format :
bit 15 9 8 7 6 5 4 3 2 1 0 bit 15 9 8 7 6 5 4 3 2 1 0
|unused|ODR|IDR|PUPDR|OSPEEDR|OTYPER|MODER| |unused|ODR|IDR|PUPDR|OSPEEDR|OTYPER|MODER|
*/ */
return (( PAL_PORT(pin)->MODER >> (2*PAL_PAD(pin))) & 0x3) return ((PAL_PORT(pin)->MODER >> (2 * PAL_PAD(pin))) & 0x3) | (((PAL_PORT(pin)->OTYPER >> (1 * PAL_PAD(pin))) & 0x1) << 2) | (((PAL_PORT(pin)->OSPEEDR >> (2 * PAL_PAD(pin))) & 0x3) << 3) | (((PAL_PORT(pin)->PUPDR >> (2 * PAL_PAD(pin))) & 0x3) << 5) | (((PAL_PORT(pin)->IDR >> (1 * PAL_PAD(pin))) & 0x1) << 7) | (((PAL_PORT(pin)->ODR >> (1 * PAL_PAD(pin))) & 0x1) << 8);
| (((PAL_PORT(pin)->OTYPER >> (1*PAL_PAD(pin))) & 0x1) << 2)
| (((PAL_PORT(pin)->OSPEEDR >> (2*PAL_PAD(pin))) & 0x3) << 3)
| (((PAL_PORT(pin)->PUPDR >> (2*PAL_PAD(pin))) & 0x3) << 5)
| (((PAL_PORT(pin)->IDR >> (1*PAL_PAD(pin))) & 0x1) << 7)
| (((PAL_PORT(pin)->ODR >> (1*PAL_PAD(pin))) & 0x1) << 8);
#else #else
return 0; return 0;
#endif #endif
@ -68,12 +62,12 @@ void restorePinState(pin_t pin, uint16_t restoreState) {
PORTx_ADDRESS(pin) = (PORTx_ADDRESS(pin) & ~_BV(pinNumber)) | (((restoreState >> 1) & 0x1) << pinNumber); PORTx_ADDRESS(pin) = (PORTx_ADDRESS(pin) & ~_BV(pinNumber)) | (((restoreState >> 1) & 0x1) << pinNumber);
DDRx_ADDRESS(pin) = (DDRx_ADDRESS(pin) & ~_BV(pinNumber)) | ((restoreState & 0x1) << pinNumber); DDRx_ADDRESS(pin) = (DDRx_ADDRESS(pin) & ~_BV(pinNumber)) | ((restoreState & 0x1) << pinNumber);
#elif defined(PROTOCOL_CHIBIOS) #elif defined(PROTOCOL_CHIBIOS)
PAL_PORT(pin)->MODER = (PAL_PORT(pin)->MODER & ~(0x3<< (2*PAL_PAD(pin)))) | (restoreState & 0x3) << (2*PAL_PAD(pin)); PAL_PORT(pin)->MODER = (PAL_PORT(pin)->MODER & ~(0x3 << (2 * PAL_PAD(pin)))) | (restoreState & 0x3) << (2 * PAL_PAD(pin));
PAL_PORT(pin)->OTYPER = (PAL_PORT(pin)->OTYPER & ~(0x1<< (1*PAL_PAD(pin)))) | ((restoreState>>2) & 0x1) << (1*PAL_PAD(pin)); PAL_PORT(pin)->OTYPER = (PAL_PORT(pin)->OTYPER & ~(0x1 << (1 * PAL_PAD(pin)))) | ((restoreState >> 2) & 0x1) << (1 * PAL_PAD(pin));
PAL_PORT(pin)->OSPEEDR= (PAL_PORT(pin)->OSPEEDR & ~(0x3<< (2*PAL_PAD(pin)))) | ((restoreState>>3) & 0x3) << (2*PAL_PAD(pin)); PAL_PORT(pin)->OSPEEDR = (PAL_PORT(pin)->OSPEEDR & ~(0x3 << (2 * PAL_PAD(pin)))) | ((restoreState >> 3) & 0x3) << (2 * PAL_PAD(pin));
PAL_PORT(pin)->PUPDR = (PAL_PORT(pin)->PUPDR & ~(0x3<< (2*PAL_PAD(pin)))) | ((restoreState>>5) & 0x3) << (2*PAL_PAD(pin)); PAL_PORT(pin)->PUPDR = (PAL_PORT(pin)->PUPDR & ~(0x3 << (2 * PAL_PAD(pin)))) | ((restoreState >> 5) & 0x3) << (2 * PAL_PAD(pin));
PAL_PORT(pin)->IDR = (PAL_PORT(pin)->IDR & ~(0x1<< (1*PAL_PAD(pin)))) | ((restoreState>>7) & 0x1) << (1*PAL_PAD(pin)); PAL_PORT(pin)->IDR = (PAL_PORT(pin)->IDR & ~(0x1 << (1 * PAL_PAD(pin)))) | ((restoreState >> 7) & 0x1) << (1 * PAL_PAD(pin));
PAL_PORT(pin)->ODR = (PAL_PORT(pin)->ODR & ~(0x1<< (1*PAL_PAD(pin)))) | ((restoreState>>8) & 0x1) << (1*PAL_PAD(pin)); PAL_PORT(pin)->ODR = (PAL_PORT(pin)->ODR & ~(0x1 << (1 * PAL_PAD(pin)))) | ((restoreState >> 8) & 0x1) << (1 * PAL_PAD(pin));
#else #else
return; return;
#endif #endif
@ -132,21 +126,21 @@ bool process_joystick_analogread_quantum() {
int16_t axis_val = joystick_axes[axis_index].mid_digit; int16_t axis_val = joystick_axes[axis_index].mid_digit;
# endif # endif
//test the converted value against the lower range // test the converted value against the lower range
int32_t ref = joystick_axes[axis_index].mid_digit; int32_t ref = joystick_axes[axis_index].mid_digit;
int32_t range = joystick_axes[axis_index].min_digit; int32_t range = joystick_axes[axis_index].min_digit;
int32_t ranged_val = ((axis_val - ref) * -127) / (range - ref) ; int32_t ranged_val = ((axis_val - ref) * -127) / (range - ref);
if (ranged_val > 0) { if (ranged_val > 0) {
//the value is in the higher range // the value is in the higher range
range = joystick_axes[axis_index].max_digit; range = joystick_axes[axis_index].max_digit;
ranged_val = ((axis_val - ref) * 127) / (range - ref); ranged_val = ((axis_val - ref) * 127) / (range - ref);
} }
//clamp the result in the valid range // clamp the result in the valid range
ranged_val = ranged_val < -127 ? -127 : ranged_val; ranged_val = ranged_val < -127 ? -127 : ranged_val;
ranged_val = ranged_val > 127 ? 127 : ranged_val; ranged_val = ranged_val > 127 ? 127 : ranged_val;
if (ranged_val != joystick_status.axes[axis_index]) { if (ranged_val != joystick_status.axes[axis_index]) {
joystick_status.axes[axis_index] = ranged_val; joystick_status.axes[axis_index] = ranged_val;
joystick_status.status |= JS_UPDATED; joystick_status.status |= JS_UPDATED;

View file

@ -407,7 +407,6 @@ void rgblight_decrease_val_helper(bool write_to_eeprom) {
void rgblight_decrease_val_noeeprom(void) { rgblight_decrease_val_helper(false); } void rgblight_decrease_val_noeeprom(void) { rgblight_decrease_val_helper(false); }
void rgblight_decrease_val(void) { rgblight_decrease_val_helper(true); } void rgblight_decrease_val(void) { rgblight_decrease_val_helper(true); }
void rgblight_increase_speed_helper(bool write_to_eeprom) { void rgblight_increase_speed_helper(bool write_to_eeprom) {
if (rgblight_config.speed < 3) rgblight_config.speed++; if (rgblight_config.speed < 3) rgblight_config.speed++;
// RGBLIGHT_SPLIT_SET_CHANGE_HSVS; // NEED? // RGBLIGHT_SPLIT_SET_CHANGE_HSVS; // NEED?
@ -428,7 +427,6 @@ void rgblight_decrease_speed_helper(bool write_to_eeprom) {
void rgblight_decrease_speed(void) { rgblight_decrease_speed_helper(true); } void rgblight_decrease_speed(void) { rgblight_decrease_speed_helper(true); }
void rgblight_decrease_speed_noeeprom(void) { rgblight_decrease_speed_helper(false); } void rgblight_decrease_speed_noeeprom(void) { rgblight_decrease_speed_helper(false); }
void rgblight_sethsv_noeeprom_old(uint8_t hue, uint8_t sat, uint8_t val) { void rgblight_sethsv_noeeprom_old(uint8_t hue, uint8_t sat, uint8_t val) {
if (rgblight_config.enable) { if (rgblight_config.enable) {
LED_TYPE tmp_led; LED_TYPE tmp_led;
@ -1170,17 +1168,17 @@ void rgblight_effect_knight(animation_status_t *anim) {
*/ */
void rgblight_effect_christmas(animation_status_t *anim) { void rgblight_effect_christmas(animation_status_t *anim) {
static int8_t increment = 1; static int8_t increment = 1;
const uint8_t max_pos = 32; const uint8_t max_pos = 32;
const uint8_t hue_green = 85; const uint8_t hue_green = 85;
uint32_t xa; uint32_t xa;
uint8_t hue, val; uint8_t hue, val;
uint8_t i; uint8_t i;
// The effect works by animating anim->pos from 0 to 32 and back to 0. // The effect works by animating anim->pos from 0 to 32 and back to 0.
// The pos is used in a cubic bezier formula to ease-in-out between red and green, leaving the interpolated colors visible as short as possible. // The pos is used in a cubic bezier formula to ease-in-out between red and green, leaving the interpolated colors visible as short as possible.
xa = CUBED((uint32_t) anim->pos); xa = CUBED((uint32_t)anim->pos);
hue = ((uint32_t) hue_green) * xa / (xa + CUBED((uint32_t) (max_pos - anim->pos))); hue = ((uint32_t)hue_green) * xa / (xa + CUBED((uint32_t)(max_pos - anim->pos)));
// Additionally, these interpolated colors get shown with a slightly darker value, to make them less prominent than the main colors. // Additionally, these interpolated colors get shown with a slightly darker value, to make them less prominent than the main colors.
val = 255 - (3 * (hue < hue_green / 2 ? hue : hue_green - hue) / 2); val = 255 - (3 * (hue < hue_green / 2 ? hue : hue_green - hue) / 2);

View file

@ -82,9 +82,9 @@ void layer_on(uint8_t layer);
void layer_off(uint8_t layer); void layer_off(uint8_t layer);
void layer_invert(uint8_t layer); void layer_invert(uint8_t layer);
/* bitwise operation */ /* bitwise operation */
void layer_or(layer_state_t state); void layer_or(layer_state_t state);
void layer_and(layer_state_t state); void layer_and(layer_state_t state);
void layer_xor(layer_state_t state); void layer_xor(layer_state_t state);
layer_state_t layer_state_set_user(layer_state_t state); layer_state_t layer_state_set_user(layer_state_t state);
layer_state_t layer_state_set_kb(layer_state_t state); layer_state_t layer_state_set_kb(layer_state_t state);
#else #else
@ -107,7 +107,6 @@ layer_state_t layer_state_set_kb(layer_state_t state);
# define layer_state_set_user(state) (void)state # define layer_state_set_user(state) (void)state
#endif #endif
/* pressed actions cache */ /* pressed actions cache */
#if !defined(NO_ACTION_LAYER) && !defined(STRICT_LAYER_RELEASE) #if !defined(NO_ACTION_LAYER) && !defined(STRICT_LAYER_RELEASE)

View file

@ -33,8 +33,8 @@ inline int8_t times_inv_sqrt2(int8_t x) {
static report_mouse_t mouse_report = {0}; static report_mouse_t mouse_report = {0};
static void mousekey_debug(void); static void mousekey_debug(void);
static uint8_t mousekey_accel = 0; static uint8_t mousekey_accel = 0;
static uint8_t mousekey_repeat = 0; static uint8_t mousekey_repeat = 0;
static uint8_t mousekey_wheel_repeat = 0; static uint8_t mousekey_wheel_repeat = 0;
#ifndef MK_3_SPEED #ifndef MK_3_SPEED
@ -225,7 +225,6 @@ void mousekey_on(uint8_t code) {
mousekey_accel |= (1 << 1); mousekey_accel |= (1 << 1);
else if (code == KC_MS_ACCEL2) else if (code == KC_MS_ACCEL2)
mousekey_accel |= (1 << 2); mousekey_accel |= (1 << 2);
} }
void mousekey_off(uint8_t code) { void mousekey_off(uint8_t code) {
@ -284,10 +283,10 @@ uint16_t w_intervals[mkspd_COUNT] = {MK_W_INTERVAL_UNMOD, MK_W_INTERVAL_0
void mousekey_task(void) { void mousekey_task(void) {
// report cursor and scroll movement independently // report cursor and scroll movement independently
report_mouse_t const tmpmr = mouse_report; report_mouse_t const tmpmr = mouse_report;
mouse_report.x = 0; mouse_report.x = 0;
mouse_report.y = 0; mouse_report.y = 0;
mouse_report.v = 0; mouse_report.v = 0;
mouse_report.h = 0; mouse_report.h = 0;
if ((tmpmr.x || tmpmr.y) && timer_elapsed(last_timer_c) > c_intervals[mk_speed]) { if ((tmpmr.x || tmpmr.y) && timer_elapsed(last_timer_c) > c_intervals[mk_speed]) {
mouse_report.x = tmpmr.x; mouse_report.x = tmpmr.x;
@ -421,10 +420,10 @@ void mousekey_send(void) {
} }
void mousekey_clear(void) { void mousekey_clear(void) {
mouse_report = (report_mouse_t){}; mouse_report = (report_mouse_t){};
mousekey_repeat = 0; mousekey_repeat = 0;
mousekey_wheel_repeat = 0; mousekey_wheel_repeat = 0;
mousekey_accel = 0; mousekey_accel = 0;
} }
static void mousekey_debug(void) { static void mousekey_debug(void) {

View file

@ -4,7 +4,7 @@
# include <avr/pgmspace.h> # include <avr/pgmspace.h>
#else #else
# define PROGMEM # define PROGMEM
# define PGM_P const char * # define PGM_P const char*
# define memcpy_P(dest, src, n) memcpy(dest, src, n) # define memcpy_P(dest, src, n) memcpy(dest, src, n)
# define pgm_read_byte(address_short) *((uint8_t*)(address_short)) # define pgm_read_byte(address_short) *((uint8_t*)(address_short))
# define pgm_read_word(address_short) *((uint16_t*)(address_short)) # define pgm_read_word(address_short) *((uint16_t*)(address_short))

View file

@ -888,39 +888,43 @@ void virtser_task(void) {
void send_joystick_packet(joystick_t *joystick) { void send_joystick_packet(joystick_t *joystick) {
joystick_report_t rep = { joystick_report_t rep = {
# if JOYSTICK_AXES_COUNT > 0 # if JOYSTICK_AXES_COUNT > 0
.axes = {joystick->axes[0], .axes =
{
joystick->axes[0],
# if JOYSTICK_AXES_COUNT >= 2 # if JOYSTICK_AXES_COUNT >= 2
joystick->axes[1], joystick->axes[1],
# endif # endif
# if JOYSTICK_AXES_COUNT >= 3 # if JOYSTICK_AXES_COUNT >= 3
joystick->axes[2], joystick->axes[2],
# endif # endif
# if JOYSTICK_AXES_COUNT >= 4 # if JOYSTICK_AXES_COUNT >= 4
joystick->axes[3], joystick->axes[3],
# endif # endif
# if JOYSTICK_AXES_COUNT >= 5 # if JOYSTICK_AXES_COUNT >= 5
joystick->axes[4], joystick->axes[4],
# endif # endif
# if JOYSTICK_AXES_COUNT >= 6 # if JOYSTICK_AXES_COUNT >= 6
joystick->axes[5], joystick->axes[5],
# endif # endif
}, },
# endif // JOYSTICK_AXES_COUNT>0 # endif // JOYSTICK_AXES_COUNT>0
# if JOYSTICK_BUTTON_COUNT > 0 # if JOYSTICK_BUTTON_COUNT > 0
.buttons = {joystick->buttons[0], .buttons =
{
joystick->buttons[0],
# if JOYSTICK_BUTTON_COUNT > 8 # if JOYSTICK_BUTTON_COUNT > 8
joystick->buttons[1], joystick->buttons[1],
# endif # endif
# if JOYSTICK_BUTTON_COUNT > 16 # if JOYSTICK_BUTTON_COUNT > 16
joystick->buttons[2], joystick->buttons[2],
# endif # endif
# if JOYSTICK_BUTTON_COUNT > 24 # if JOYSTICK_BUTTON_COUNT > 24
joystick->buttons[3], joystick->buttons[3],
# endif # endif
} }
# endif // JOYSTICK_BUTTON_COUNT>0 # endif // JOYSTICK_BUTTON_COUNT>0
}; };

View file

@ -41,12 +41,12 @@ extern bool adafruit_ble_send_keys(uint8_t hid_modifier_mask, uint8_t *keys, uin
* (milliseconds) */ * (milliseconds) */
extern bool adafruit_ble_send_consumer_key(uint16_t keycode, int hold_duration); extern bool adafruit_ble_send_consumer_key(uint16_t keycode, int hold_duration);
# ifdef MOUSE_ENABLE #ifdef MOUSE_ENABLE
/* Send a mouse/wheel movement report. /* Send a mouse/wheel movement report.
* The parameters are signed and indicate positive of negative direction * The parameters are signed and indicate positive of negative direction
* change. */ * change. */
extern bool adafruit_ble_send_mouse_move(int8_t x, int8_t y, int8_t scroll, int8_t pan, uint8_t buttons); extern bool adafruit_ble_send_mouse_move(int8_t x, int8_t y, int8_t scroll, int8_t pan, uint8_t buttons);
# endif #endif
/* Compute battery voltage by reading an analog pin. /* Compute battery voltage by reading an analog pin.
* Returns the integer number of millivolts */ * Returns the integer number of millivolts */

View file

@ -316,39 +316,43 @@ void send_joystick_packet(joystick_t *joystick) {
joystick_report_t r = { joystick_report_t r = {
# if JOYSTICK_AXES_COUNT > 0 # if JOYSTICK_AXES_COUNT > 0
.axes = {joystick->axes[0], .axes =
{
joystick->axes[0],
# if JOYSTICK_AXES_COUNT >= 2 # if JOYSTICK_AXES_COUNT >= 2
joystick->axes[1], joystick->axes[1],
# endif # endif
# if JOYSTICK_AXES_COUNT >= 3 # if JOYSTICK_AXES_COUNT >= 3
joystick->axes[2], joystick->axes[2],
# endif # endif
# if JOYSTICK_AXES_COUNT >= 4 # if JOYSTICK_AXES_COUNT >= 4
joystick->axes[3], joystick->axes[3],
# endif # endif
# if JOYSTICK_AXES_COUNT >= 5 # if JOYSTICK_AXES_COUNT >= 5
joystick->axes[4], joystick->axes[4],
# endif # endif
# if JOYSTICK_AXES_COUNT >= 6 # if JOYSTICK_AXES_COUNT >= 6
joystick->axes[5], joystick->axes[5],
# endif # endif
}, },
# endif // JOYSTICK_AXES_COUNT>0 # endif // JOYSTICK_AXES_COUNT>0
# if JOYSTICK_BUTTON_COUNT > 0 # if JOYSTICK_BUTTON_COUNT > 0
.buttons = {joystick->buttons[0], .buttons =
{
joystick->buttons[0],
# if JOYSTICK_BUTTON_COUNT > 8 # if JOYSTICK_BUTTON_COUNT > 8
joystick->buttons[1], joystick->buttons[1],
# endif # endif
# if JOYSTICK_BUTTON_COUNT > 16 # if JOYSTICK_BUTTON_COUNT > 16
joystick->buttons[2], joystick->buttons[2],
# endif # endif
# if JOYSTICK_BUTTON_COUNT > 24 # if JOYSTICK_BUTTON_COUNT > 24
joystick->buttons[3], joystick->buttons[3],
# endif # endif
} }
# endif // JOYSTICK_BUTTON_COUNT>0 # endif // JOYSTICK_BUTTON_COUNT>0
}; };