Skip to content

Commit

Permalink
Run clang-format manually to fix recently changed files
Browse files Browse the repository at this point in the history
  • Loading branch information
zvecr authored and Philip Karlsson committed Dec 3, 2019
1 parent f327f4c commit c1c81ad
Show file tree
Hide file tree
Showing 24 changed files with 235 additions and 235 deletions.
12 changes: 5 additions & 7 deletions drivers/haptic/DRV2605L.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,13 @@ void DRV_init(void) {
}

void DRV_rtp_init(void) {
DRV_write(DRV_GO, 0x00);
DRV_write(DRV_RTP_INPUT, 20); //20 is the lowest value I've found where haptics can still be felt.
DRV_write(DRV_MODE, 0x05);
DRV_write(DRV_GO, 0x01);
DRV_write(DRV_GO, 0x00);
DRV_write(DRV_RTP_INPUT, 20); // 20 is the lowest value I've found where haptics can still be felt.
DRV_write(DRV_MODE, 0x05);
DRV_write(DRV_GO, 0x01);
}

void DRV_amplitude(uint8_t amplitude) {
DRV_write(DRV_RTP_INPUT, amplitude);
}
void DRV_amplitude(uint8_t amplitude) { DRV_write(DRV_RTP_INPUT, amplitude); }

void DRV_pulse(uint8_t sequence) {
DRV_write(DRV_GO, 0x00);
Expand Down
85 changes: 41 additions & 44 deletions drivers/haptic/haptic.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ void haptic_set_mode(uint8_t mode) {
}

void haptic_set_amplitude(uint8_t amp) {
haptic_config.amplitude = amp;
eeconfig_update_haptic(haptic_config.raw);
xprintf("haptic_config.amplitude = %u\n", haptic_config.amplitude);
#ifdef DRV2605L
DRV_amplitude(amp);
#endif
haptic_config.amplitude = amp;
eeconfig_update_haptic(haptic_config.raw);
xprintf("haptic_config.amplitude = %u\n", haptic_config.amplitude);
#ifdef DRV2605L
DRV_amplitude(amp);
#endif
}

void haptic_set_buzz(uint8_t buzz) {
Expand Down Expand Up @@ -211,52 +211,50 @@ uint8_t haptic_get_dwell(void) {
}

void haptic_enable_continuous(void) {
haptic_config.cont = 1;
xprintf("haptic_config.cont = %u\n", haptic_config.cont);
eeconfig_update_haptic(haptic_config.raw);
#ifdef DRV2605L
DRV_rtp_init();
#endif
haptic_config.cont = 1;
xprintf("haptic_config.cont = %u\n", haptic_config.cont);
eeconfig_update_haptic(haptic_config.raw);
#ifdef DRV2605L
DRV_rtp_init();
#endif
}

void haptic_disable_continuous(void) {
haptic_config.cont = 0;
xprintf("haptic_config.cont = %u\n", haptic_config.cont);
eeconfig_update_haptic(haptic_config.raw);
#ifdef DRV2605L
DRV_write(DRV_MODE,0x00);
#endif
haptic_config.cont = 0;
xprintf("haptic_config.cont = %u\n", haptic_config.cont);
eeconfig_update_haptic(haptic_config.raw);
#ifdef DRV2605L
DRV_write(DRV_MODE, 0x00);
#endif
}

void haptic_toggle_continuous(void) {
#ifdef DRV2605L
if (haptic_config.cont) {
haptic_disable_continuous();
} else {
haptic_enable_continuous();
}
eeconfig_update_haptic(haptic_config.raw);
if (haptic_config.cont) {
haptic_disable_continuous();
} else {
haptic_enable_continuous();
}
eeconfig_update_haptic(haptic_config.raw);
#endif
}


void haptic_cont_increase(void) {
uint8_t amp = haptic_config.amplitude + 10;
if (haptic_config.amplitude >= 120) {
amp = 120;
}
haptic_set_amplitude(amp);
uint8_t amp = haptic_config.amplitude + 10;
if (haptic_config.amplitude >= 120) {
amp = 120;
}
haptic_set_amplitude(amp);
}

void haptic_cont_decrease(void) {
uint8_t amp = haptic_config.amplitude - 10;
if (haptic_config.amplitude < 20) {
amp = 20;
}
haptic_set_amplitude(amp);
uint8_t amp = haptic_config.amplitude - 10;
if (haptic_config.amplitude < 20) {
amp = 20;
}
haptic_set_amplitude(amp);
}


void haptic_play(void) {
#ifdef DRV2605L
uint8_t play_eff = 0;
Expand All @@ -269,7 +267,6 @@ void haptic_play(void) {
}

bool process_haptic(uint16_t keycode, keyrecord_t *record) {

if (keycode == HPT_ON && record->event.pressed) {
haptic_enable();
}
Expand Down Expand Up @@ -300,16 +297,16 @@ bool process_haptic(uint16_t keycode, keyrecord_t *record) {
if (keycode == HPT_DWLD && record->event.pressed) {
haptic_dwell_decrease();
}
if (keycode == HPT_CONT && record->event.pressed) {
haptic_toggle_continuous();
if (keycode == HPT_CONT && record->event.pressed) {
haptic_toggle_continuous();
}
if (keycode == HPT_CONI && record->event.pressed) {
haptic_cont_increase();
if (keycode == HPT_CONI && record->event.pressed) {
haptic_cont_increase();
}
if (keycode == HPT_COND && record->event.pressed) {
haptic_cont_decrease();
if (keycode == HPT_COND && record->event.pressed) {
haptic_cont_decrease();
}

if (haptic_config.enable) {
if (record->event.pressed) {
// keypress
Expand Down
16 changes: 8 additions & 8 deletions drivers/haptic/haptic.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
typedef union {
uint32_t raw;
struct {
bool enable :1;
uint8_t feedback :2;
uint8_t mode :7;
bool buzz :1;
uint8_t dwell :7;
bool cont :1;
uint8_t amplitude :8;
uint16_t reserved :7;
bool enable : 1;
uint8_t feedback : 2;
uint8_t mode : 7;
bool buzz : 1;
uint8_t dwell : 7;
bool cont : 1;
uint8_t amplitude : 8;
uint16_t reserved : 7;
};
} haptic_config_t;

Expand Down
2 changes: 1 addition & 1 deletion quantum/backlight/backlight_avr.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ void backlight_off(pin_t backlight_pin) {

# define FOR_EACH_LED(x) \
for (uint8_t i = 0; i < BACKLIGHT_LED_COUNT; i++) { \
pin_t backlight_pin = backlight_pins[i]; \
pin_t backlight_pin = backlight_pins[i]; \
{ x } \
}

Expand Down
39 changes: 20 additions & 19 deletions quantum/config_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,25 +303,26 @@
UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
sei(); \
} while (0)
# elif (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__))
# define SERIAL_UART_BAUD 115200
# define SERIAL_UART_DATA UDR1
/* UBRR should result in ~16 and set UCSR1A = _BV(U2X1) as per rn42 documentation. HC05 needs baudrate configured accordingly */
# define SERIAL_UART_UBRR (F_CPU / (8UL * SERIAL_UART_BAUD) - 1)
# define SERIAL_UART_RXD_VECT USART1_RX_vect
# define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
# define SERIAL_UART_INIT() do { \
UCSR1A = _BV(U2X1); \
/* baud rate */ \
UBRR1L = SERIAL_UART_UBRR; \
/* baud rate */ \
UBRR1H = SERIAL_UART_UBRR >> 8; \
/* enable TX */ \
UCSR1B = _BV(TXEN1); \
/* 8-bit data */ \
UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
sei(); \
} while(0)
# elif (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__))
# define SERIAL_UART_BAUD 115200
# define SERIAL_UART_DATA UDR1
/* UBRR should result in ~16 and set UCSR1A = _BV(U2X1) as per rn42 documentation. HC05 needs baudrate configured accordingly */
# define SERIAL_UART_UBRR (F_CPU / (8UL * SERIAL_UART_BAUD) - 1)
# define SERIAL_UART_RXD_VECT USART1_RX_vect
# define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
# define SERIAL_UART_INIT() \
do { \
UCSR1A = _BV(U2X1); \
/* baud rate */ \
UBRR1L = SERIAL_UART_UBRR; \
/* baud rate */ \
UBRR1H = SERIAL_UART_UBRR >> 8; \
/* enable TX */ \
UCSR1B = _BV(TXEN1); \
/* 8-bit data */ \
UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
sei(); \
} while (0)
# else
# error "USART configuration is needed."
# endif
Expand Down
37 changes: 15 additions & 22 deletions quantum/dip_switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,40 +21,33 @@
// for memcpy
#include <string.h>


#if !defined(DIP_SWITCH_PINS)
# error "No DIP switch pads defined by DIP_SWITCH_PINS"
# error "No DIP switch pads defined by DIP_SWITCH_PINS"
#endif

#define NUMBER_OF_DIP_SWITCHES (sizeof(dip_switch_pad)/sizeof(pin_t))
static pin_t dip_switch_pad[] = DIP_SWITCH_PINS;
static bool dip_switch_state[NUMBER_OF_DIP_SWITCHES] = { 0 };
static bool last_dip_switch_state[NUMBER_OF_DIP_SWITCHES] = { 0 };

#define NUMBER_OF_DIP_SWITCHES (sizeof(dip_switch_pad) / sizeof(pin_t))
static pin_t dip_switch_pad[] = DIP_SWITCH_PINS;
static bool dip_switch_state[NUMBER_OF_DIP_SWITCHES] = {0};
static bool last_dip_switch_state[NUMBER_OF_DIP_SWITCHES] = {0};

__attribute__((weak))
void dip_switch_update_user(uint8_t index, bool active) {}
__attribute__((weak)) void dip_switch_update_user(uint8_t index, bool active) {}

__attribute__((weak))
void dip_switch_update_kb(uint8_t index, bool active) { dip_switch_update_user(index, active); }
__attribute__((weak)) void dip_switch_update_kb(uint8_t index, bool active) { dip_switch_update_user(index, active); }

__attribute__((weak))
void dip_switch_update_mask_user(uint32_t state) {}
__attribute__((weak)) void dip_switch_update_mask_user(uint32_t state) {}

__attribute__((weak))
void dip_switch_update_mask_kb(uint32_t state) { dip_switch_update_mask_user(state); }
__attribute__((weak)) void dip_switch_update_mask_kb(uint32_t state) { dip_switch_update_mask_user(state); }

void dip_switch_init(void) {
for (uint8_t i = 0; i < NUMBER_OF_DIP_SWITCHES; i++) {
setPinInputHigh(dip_switch_pad[i]);
}
dip_switch_read(true);
for (uint8_t i = 0; i < NUMBER_OF_DIP_SWITCHES; i++) {
setPinInputHigh(dip_switch_pad[i]);
}
dip_switch_read(true);
}


void dip_switch_read(bool forced) {
bool has_dip_state_changed = false;
uint32_t dip_switch_mask = 0;
bool has_dip_state_changed = false;
uint32_t dip_switch_mask = 0;

for (uint8_t i = 0; i < NUMBER_OF_DIP_SWITCHES; i++) {
dip_switch_state[i] = !readPin(dip_switch_pad[i]);
Expand Down
8 changes: 4 additions & 4 deletions quantum/encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ static pin_t encoders_pad_b[] = ENCODERS_PAD_B;

static int8_t encoder_LUT[] = {0, -1, 1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 1, -1, 0};

static uint8_t encoder_state[NUMBER_OF_ENCODERS] = {0};
static int8_t encoder_pulses[NUMBER_OF_ENCODERS] = {0};
static uint8_t encoder_state[NUMBER_OF_ENCODERS] = {0};
static int8_t encoder_pulses[NUMBER_OF_ENCODERS] = {0};

#ifdef SPLIT_KEYBOARD
// right half encoders come over as second set of encoders
Expand Down Expand Up @@ -84,7 +84,7 @@ static void encoder_update(int8_t index, uint8_t state) {
encoder_value[index]++;
encoder_update_kb(index, true);
}
if (encoder_pulses[index] <= -ENCODER_RESOLUTION) { // direction is arbitrary here, but this clockwise
if (encoder_pulses[index] <= -ENCODER_RESOLUTION) { // direction is arbitrary here, but this clockwise
encoder_value[index]--;
encoder_update_kb(index, false);
}
Expand All @@ -109,7 +109,7 @@ void encoder_state_raw(uint8_t* slave_state) { memcpy(slave_state, &encoder_valu
void encoder_update_raw(uint8_t* slave_state) {
for (int i = 0; i < NUMBER_OF_ENCODERS; i++) {
uint8_t index = i + thatHand;
int8_t delta = slave_state[i] - encoder_value[index];
int8_t delta = slave_state[i] - encoder_value[index];
while (delta > 0) {
delta--;
encoder_value[index]++;
Expand Down
54 changes: 27 additions & 27 deletions quantum/keymap_extras/keymap_italian.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,36 +78,36 @@
#define IT_MINS KC_SLSH // - and _

// shifted characters
#define IT_DEGR LSFT(IT_AACC) // °
#define IT_EXLM LSFT(KC_1) // !
#define IT_DQOT LSFT(KC_2) // "
#define IT_STRL LSFT(KC_3) // £
#define IT_DLR LSFT(KC_4) // $
#define IT_PERC LSFT(KC_5) // %
#define IT_AMPR LSFT(KC_6) // &
#define IT_SLSH LSFT(KC_7) // /
#define IT_LPRN LSFT(KC_8) // (
#define IT_RPRN LSFT(KC_9) // )
#define IT_EQL LSFT(KC_0) // =
#define IT_QST LSFT(IT_APOS) // ?
#define IT_CRC LSFT(IT_IACC) // ^
#define IT_ASTR LSFT(IT_PLUS) // *
#define IT_MORE LSFT(IT_LESS) // >
#define IT_COLN LSFT(IT_DOT) // :
#define IT_SCLN LSFT(IT_COMM) // ;
#define IT_UNDS LSFT(IT_MINS) // _
#define IT_DEGR LSFT(IT_AACC) // °
#define IT_EXLM LSFT(KC_1) // !
#define IT_DQOT LSFT(KC_2) // "
#define IT_STRL LSFT(KC_3) // £
#define IT_DLR LSFT(KC_4) // $
#define IT_PERC LSFT(KC_5) // %
#define IT_AMPR LSFT(KC_6) // &
#define IT_SLSH LSFT(KC_7) // /
#define IT_LPRN LSFT(KC_8) // (
#define IT_RPRN LSFT(KC_9) // )
#define IT_EQL LSFT(KC_0) // =
#define IT_QST LSFT(IT_APOS) // ?
#define IT_CRC LSFT(IT_IACC) // ^
#define IT_ASTR LSFT(IT_PLUS) // *
#define IT_MORE LSFT(IT_LESS) // >
#define IT_COLN LSFT(IT_DOT) // :
#define IT_SCLN LSFT(IT_COMM) // ;
#define IT_UNDS LSFT(IT_MINS) // _

// Alt Gr-ed characters
#define IT_LCBR ALGR(KC_7) // {
#define IT_LBRC ALGR(IT_EACC) // [
#define IT_RBRC ALGR(IT_PLUS) // ]
#define IT_RCBR ALGR(KC_0) // }
#define IT_AT ALGR(IT_OACC) // @
#define IT_EURO ALGR(KC_E) // €
#define IT_PIPE LSFT(IT_BSLS) // |
#define IT_SHRP ALGR(IT_AACC) // #
#define IT_LCBR ALGR(KC_7) // {
#define IT_LBRC ALGR(IT_EACC) // [
#define IT_RBRC ALGR(IT_PLUS) // ]
#define IT_RCBR ALGR(KC_0) // }
#define IT_AT ALGR(IT_OACC) // @
#define IT_EURO ALGR(KC_E) // €
#define IT_PIPE LSFT(IT_BSLS) // |
#define IT_SHRP ALGR(IT_AACC) // #

// Deprecated
#define IT_X_PLUS X_RBRACKET // #
#define IT_X_PLUS X_RBRACKET // #

#endif
Loading

0 comments on commit c1c81ad

Please sign in to comment.