summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorzvecr <git@zvecr.com>2019-11-17 14:02:26 +0000
committerDrashna Jaelre <drashna@live.com>2019-11-17 08:25:58 -0800
commita91c0c476507cb8c12840abb59bff34ab0de3c03 (patch)
tree313d9a0ec2f17c47f33305b350eef8768b5efa1c /drivers
parent6b18ca2875ceb38011f32f2d17238ba55ce7ad67 (diff)
Run clang-format manually to fix recently changed files
Diffstat (limited to 'drivers')
-rw-r--r--drivers/haptic/DRV2605L.c12
-rw-r--r--drivers/haptic/haptic.c85
-rw-r--r--drivers/haptic/haptic.h16
3 files changed, 54 insertions, 59 deletions
diff --git a/drivers/haptic/DRV2605L.c b/drivers/haptic/DRV2605L.c
index 728554b01e..c40731913b 100644
--- a/drivers/haptic/DRV2605L.c
+++ b/drivers/haptic/DRV2605L.c
@@ -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);
diff --git a/drivers/haptic/haptic.c b/drivers/haptic/haptic.c
index 989970beee..2ce279b753 100644
--- a/drivers/haptic/haptic.c
+++ b/drivers/haptic/haptic.c
@@ -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) {
@@ -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;
@@ -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();
}
@@ -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
diff --git a/drivers/haptic/haptic.h b/drivers/haptic/haptic.h
index 2f6eb31fc2..5d3bd1c310 100644
--- a/drivers/haptic/haptic.h
+++ b/drivers/haptic/haptic.h
@@ -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;