format code according to conventions [skip ci]
This commit is contained in:
parent
000eb14d78
commit
a3db72df72
14 changed files with 93 additions and 96 deletions
|
@ -1,4 +1,4 @@
|
|||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#define JOYSTICK_AXES_COUNT 2
|
||||
#define JOYSTICK_BUTTON_COUNT 1
|
||||
|
|
|
@ -1 +1 @@
|
|||
JOYSTICK_ENABLE = analog
|
||||
JOYSTICK_ENABLE = analog
|
||||
|
|
|
@ -60,7 +60,7 @@ void autoshift_disable(void) {
|
|||
autoshift_flush();
|
||||
}
|
||||
|
||||
#ifndef AUTO_SHIFT_NO_SETUP
|
||||
# ifndef AUTO_SHIFT_NO_SETUP
|
||||
void autoshift_timer_report(void) {
|
||||
char display[8];
|
||||
|
||||
|
@ -68,7 +68,7 @@ void autoshift_timer_report(void) {
|
|||
|
||||
send_string((const char *)display);
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
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) {
|
||||
if (record->event.pressed) {
|
||||
switch (keycode) {
|
||||
|
||||
case KC_ASTG:
|
||||
autoshift_toggle();
|
||||
return true;
|
||||
|
|
|
@ -17,8 +17,7 @@ bool process_joystick(uint16_t keycode, keyrecord_t *record) {
|
|||
return true;
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
void joystick_task(void) {
|
||||
__attribute__((weak)) void joystick_task(void) {
|
||||
if (process_joystick_analogread() && (joystick_status.status & JS_UPDATED)) {
|
||||
send_joystick_packet(&joystick_status);
|
||||
joystick_status.status &= ~JS_UPDATED;
|
||||
|
@ -51,12 +50,7 @@ uint16_t savePinState(pin_t pin) {
|
|||
bit 15 9 8 7 6 5 4 3 2 1 0
|
||||
|unused|ODR|IDR|PUPDR|OSPEEDR|OTYPER|MODER|
|
||||
*/
|
||||
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);
|
||||
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);
|
||||
#else
|
||||
return 0;
|
||||
#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);
|
||||
DDRx_ADDRESS(pin) = (DDRx_ADDRESS(pin) & ~_BV(pinNumber)) | ((restoreState & 0x1) << pinNumber);
|
||||
#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)->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)->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)->ODR = (PAL_PORT(pin)->ODR & ~(0x1<< (1*PAL_PAD(pin)))) | ((restoreState>>8) & 0x1) << (1*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)->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)->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));
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
|
@ -132,18 +126,18 @@ bool process_joystick_analogread_quantum() {
|
|||
int16_t axis_val = joystick_axes[axis_index].mid_digit;
|
||||
# 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 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) {
|
||||
//the value is in the higher range
|
||||
// the value is in the higher range
|
||||
range = joystick_axes[axis_index].max_digit;
|
||||
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;
|
||||
|
||||
|
|
|
@ -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(void) { rgblight_decrease_val_helper(true); }
|
||||
|
||||
|
||||
void rgblight_increase_speed_helper(bool write_to_eeprom) {
|
||||
if (rgblight_config.speed < 3) rgblight_config.speed++;
|
||||
// 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_noeeprom(void) { rgblight_decrease_speed_helper(false); }
|
||||
|
||||
|
||||
void rgblight_sethsv_noeeprom_old(uint8_t hue, uint8_t sat, uint8_t val) {
|
||||
if (rgblight_config.enable) {
|
||||
LED_TYPE tmp_led;
|
||||
|
@ -1179,8 +1177,8 @@ void rgblight_effect_christmas(animation_status_t *anim) {
|
|||
|
||||
// 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.
|
||||
xa = CUBED((uint32_t) anim->pos);
|
||||
hue = ((uint32_t) hue_green) * xa / (xa + CUBED((uint32_t) (max_pos - anim->pos)));
|
||||
xa = CUBED((uint32_t)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.
|
||||
val = 255 - (3 * (hue < hue_green / 2 ? hue : hue_green - hue) / 2);
|
||||
|
||||
|
|
|
@ -107,7 +107,6 @@ layer_state_t layer_state_set_kb(layer_state_t state);
|
|||
# define layer_state_set_user(state) (void)state
|
||||
#endif
|
||||
|
||||
|
||||
/* pressed actions cache */
|
||||
#if !defined(NO_ACTION_LAYER) && !defined(STRICT_LAYER_RELEASE)
|
||||
|
||||
|
|
|
@ -225,7 +225,6 @@ void mousekey_on(uint8_t code) {
|
|||
mousekey_accel |= (1 << 1);
|
||||
else if (code == KC_MS_ACCEL2)
|
||||
mousekey_accel |= (1 << 2);
|
||||
|
||||
}
|
||||
|
||||
void mousekey_off(uint8_t code) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# include <avr/pgmspace.h>
|
||||
#else
|
||||
# define PROGMEM
|
||||
# define PGM_P const char *
|
||||
# define PGM_P const char*
|
||||
# define memcpy_P(dest, src, n) memcpy(dest, src, n)
|
||||
# define pgm_read_byte(address_short) *((uint8_t*)(address_short))
|
||||
# define pgm_read_word(address_short) *((uint16_t*)(address_short))
|
||||
|
|
|
@ -888,7 +888,9 @@ void virtser_task(void) {
|
|||
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],
|
||||
|
@ -909,7 +911,9 @@ void send_joystick_packet(joystick_t *joystick) {
|
|||
# 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],
|
||||
|
|
|
@ -41,12 +41,12 @@ extern bool adafruit_ble_send_keys(uint8_t hid_modifier_mask, uint8_t *keys, uin
|
|||
* (milliseconds) */
|
||||
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.
|
||||
* The parameters are signed and indicate positive of negative direction
|
||||
* change. */
|
||||
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.
|
||||
* Returns the integer number of millivolts */
|
||||
|
|
|
@ -316,7 +316,9 @@ 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],
|
||||
|
@ -337,7 +339,9 @@ void send_joystick_packet(joystick_t *joystick) {
|
|||
# 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],
|
||||
|
|
Loading…
Reference in a new issue