diff options
author | QMK Bot <hello@qmk.fm> | 2022-02-12 10:29:31 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-12 18:29:31 +0000 |
commit | 63646e8906e062d1c1de3925cba70c4e3426a855 (patch) | |
tree | 4e91648b77b838e1125cf86331d7e84bde6d07a9 /drivers/ps2 | |
parent | afcdd7079c774dec2aa4b7f2d08adf8b7310919b (diff) | |
download | qmk_firmware-63646e8906e062d1c1de3925cba70c4e3426a855.tar.gz qmk_firmware-63646e8906e062d1c1de3925cba70c4e3426a855.zip |
Format code according to conventions (#16322)
Diffstat (limited to 'drivers/ps2')
-rw-r--r-- | drivers/ps2/ps2_busywait.c | 6 | ||||
-rw-r--r-- | drivers/ps2/ps2_interrupt.c | 16 | ||||
-rw-r--r-- | drivers/ps2/ps2_mouse.c | 28 |
3 files changed, 33 insertions, 17 deletions
diff --git a/drivers/ps2/ps2_busywait.c b/drivers/ps2/ps2_busywait.c index 983194eea8..c5a0183bb7 100644 --- a/drivers/ps2/ps2_busywait.c +++ b/drivers/ps2/ps2_busywait.c @@ -71,12 +71,12 @@ uint8_t ps2_host_send(uint8_t data) { /* terminate a transmission if we have */ inhibit(); - wait_us(100); // 100us [4]p.13, [5]p.50 + wait_us(100); // 100us [4]p.13, [5]p.50 /* 'Request to Send' and Start bit */ data_lo(); clock_hi(); - WAIT(clock_lo, 10000, 10); // 10ms [5]p.50 + WAIT(clock_lo, 10000, 10); // 10ms [5]p.50 /* Data bit */ for (uint8_t i = 0; i < 8; i++) { @@ -143,7 +143,7 @@ uint8_t ps2_host_recv(void) { idle(); /* start bit [1] */ - WAIT(clock_lo, 100, 1); // TODO: this is enough? + WAIT(clock_lo, 100, 1); // TODO: this is enough? WAIT(data_lo, 1, 2); WAIT(clock_hi, 50, 3); diff --git a/drivers/ps2/ps2_interrupt.c b/drivers/ps2/ps2_interrupt.c index 70debd02f7..c49b4f8b75 100644 --- a/drivers/ps2/ps2_interrupt.c +++ b/drivers/ps2/ps2_interrupt.c @@ -43,7 +43,7 @@ POSSIBILITY OF SUCH DAMAGE. #if defined(__AVR__) # include <avr/interrupt.h> -#elif defined(PROTOCOL_CHIBIOS) // TODO: or STM32 ? +#elif defined(PROTOCOL_CHIBIOS) // TODO: or STM32 ? // chibiOS headers # include "ch.h" # include "hal.h" @@ -71,7 +71,9 @@ static inline void pbuf_clear(void); #if defined(PROTOCOL_CHIBIOS) void ps2_interrupt_service_routine(void); -void palCallback(void *arg) { ps2_interrupt_service_routine(); } +void palCallback(void *arg) { + ps2_interrupt_service_routine(); +} # define PS2_INT_INIT() \ { palSetLineMode(PS2_CLOCK_PIN, PAL_MODE_INPUT); } \ @@ -85,7 +87,7 @@ void palCallback(void *arg) { ps2_interrupt_service_routine(); } # define PS2_INT_OFF() \ { palDisableLineEvent(PS2_CLOCK_PIN); } \ while (0) -#endif // PROTOCOL_CHIBIOS +#endif // PROTOCOL_CHIBIOS void ps2_host_init(void) { idle(); @@ -103,12 +105,12 @@ uint8_t ps2_host_send(uint8_t data) { /* terminate a transmission if we have */ inhibit(); - wait_us(100); // 100us [4]p.13, [5]p.50 + wait_us(100); // 100us [4]p.13, [5]p.50 /* 'Request to Send' and Start bit */ data_lo(); clock_hi(); - WAIT(clock_lo, 10000, 10); // 10ms [5]p.50 + WAIT(clock_lo, 10000, 10); // 10ms [5]p.50 /* Data bit[2-9] */ for (uint8_t i = 0; i < 8; i++) { @@ -244,7 +246,9 @@ RETURN: } #if defined(__AVR__) -ISR(PS2_INT_VECT) { ps2_interrupt_service_routine(); } +ISR(PS2_INT_VECT) { + ps2_interrupt_service_routine(); +} #endif /* send LED state to keyboard */ diff --git a/drivers/ps2/ps2_mouse.c b/drivers/ps2/ps2_mouse.c index 8a6668b410..ccb0a929ae 100644 --- a/drivers/ps2/ps2_mouse.c +++ b/drivers/ps2/ps2_mouse.c @@ -42,7 +42,7 @@ static inline void ps2_mouse_scroll_button_task(report_mouse_t *mouse_report); void ps2_mouse_init(void) { ps2_host_init(); - wait_ms(PS2_MOUSE_INIT_DELAY); // wait for powering up + wait_ms(PS2_MOUSE_INIT_DELAY); // wait for powering up PS2_MOUSE_SEND(PS2_MOUSE_RESET, "ps2_mouse_init: sending reset"); @@ -113,9 +113,13 @@ void ps2_mouse_task(void) { ps2_mouse_clear_report(&mouse_report); } -void ps2_mouse_disable_data_reporting(void) { PS2_MOUSE_SEND(PS2_MOUSE_DISABLE_DATA_REPORTING, "ps2 mouse disable data reporting"); } +void ps2_mouse_disable_data_reporting(void) { + PS2_MOUSE_SEND(PS2_MOUSE_DISABLE_DATA_REPORTING, "ps2 mouse disable data reporting"); +} -void ps2_mouse_enable_data_reporting(void) { PS2_MOUSE_SEND(PS2_MOUSE_ENABLE_DATA_REPORTING, "ps2 mouse enable data reporting"); } +void ps2_mouse_enable_data_reporting(void) { + PS2_MOUSE_SEND(PS2_MOUSE_ENABLE_DATA_REPORTING, "ps2 mouse enable data reporting"); +} void ps2_mouse_set_remote_mode(void) { PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_REMOTE_MODE, "ps2 mouse set remote mode"); @@ -127,13 +131,21 @@ void ps2_mouse_set_stream_mode(void) { ps2_mouse_mode = PS2_MOUSE_STREAM_MODE; } -void ps2_mouse_set_scaling_2_1(void) { PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_2_1, "ps2 mouse set scaling 2:1"); } +void ps2_mouse_set_scaling_2_1(void) { + PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_2_1, "ps2 mouse set scaling 2:1"); +} -void ps2_mouse_set_scaling_1_1(void) { PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_1_1, "ps2 mouse set scaling 1:1"); } +void ps2_mouse_set_scaling_1_1(void) { + PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_1_1, "ps2 mouse set scaling 1:1"); +} -void ps2_mouse_set_resolution(ps2_mouse_resolution_t resolution) { PS2_MOUSE_SET_SAFE(PS2_MOUSE_SET_RESOLUTION, resolution, "ps2 mouse set resolution"); } +void ps2_mouse_set_resolution(ps2_mouse_resolution_t resolution) { + PS2_MOUSE_SET_SAFE(PS2_MOUSE_SET_RESOLUTION, resolution, "ps2 mouse set resolution"); +} -void ps2_mouse_set_sample_rate(ps2_mouse_sample_rate_t sample_rate) { PS2_MOUSE_SET_SAFE(PS2_MOUSE_SET_SAMPLE_RATE, sample_rate, "ps2 mouse set sample rate"); } +void ps2_mouse_set_sample_rate(ps2_mouse_sample_rate_t sample_rate) { + PS2_MOUSE_SET_SAFE(PS2_MOUSE_SET_SAMPLE_RATE, sample_rate, "ps2 mouse set sample rate"); +} /* ============================= HELPERS ============================ */ @@ -165,7 +177,7 @@ static inline void ps2_mouse_convert_report_to_hid(report_mouse_t *mouse_report) #ifdef PS2_MOUSE_INVERT_X mouse_report->x = -mouse_report->x; #endif -#ifndef PS2_MOUSE_INVERT_Y // NOTE if not! +#ifndef PS2_MOUSE_INVERT_Y // NOTE if not! // invert coordinate of y to conform to USB HID mouse mouse_report->y = -mouse_report->y; #endif |