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 /tmk_core/protocol/chibios | |
parent | afcdd7079c774dec2aa4b7f2d08adf8b7310919b (diff) | |
download | qmk_firmware-63646e8906e062d1c1de3925cba70c4e3426a855.tar.gz qmk_firmware-63646e8906e062d1c1de3925cba70c4e3426a855.zip |
Format code according to conventions (#16322)
Diffstat (limited to 'tmk_core/protocol/chibios')
-rw-r--r-- | tmk_core/protocol/chibios/chibios.c | 8 | ||||
-rw-r--r-- | tmk_core/protocol/chibios/usb_driver.c | 32 | ||||
-rw-r--r-- | tmk_core/protocol/chibios/usb_main.c | 24 | ||||
-rw-r--r-- | tmk_core/protocol/chibios/usb_util.c | 8 |
4 files changed, 52 insertions, 20 deletions
diff --git a/tmk_core/protocol/chibios/chibios.c b/tmk_core/protocol/chibios/chibios.c index b6cff05e9f..c9a480c325 100644 --- a/tmk_core/protocol/chibios/chibios.c +++ b/tmk_core/protocol/chibios/chibios.c @@ -107,7 +107,7 @@ __attribute__((weak)) void early_hardware_init_pre(void) { #if EARLY_INIT_PERFORM_BOOTLOADER_JUMP void enter_bootloader_mode_if_requested(void); enter_bootloader_mode_if_requested(); -#endif // EARLY_INIT_PERFORM_BOOTLOADER_JUMP +#endif // EARLY_INIT_PERFORM_BOOTLOADER_JUMP } __attribute__((weak)) void early_hardware_init_post(void) {} @@ -176,7 +176,9 @@ void protocol_pre_init(void) { print("USB configured.\n"); } -void protocol_post_init(void) { host_set_driver(driver); } +void protocol_post_init(void) { + host_set_driver(driver); +} void protocol_pre_task(void) { usb_event_queue_task(); @@ -186,7 +188,7 @@ void protocol_pre_task(void) { print("[s]"); while (USB_DRIVER.state == USB_SUSPENDED) { /* Do this in the suspended state */ - suspend_power_down(); // on AVR this deep sleeps for 15ms + suspend_power_down(); // on AVR this deep sleeps for 15ms /* Remote wakeup */ if (suspend_wakeup_condition()) { usbWakeupHost(&USB_DRIVER); diff --git a/tmk_core/protocol/chibios/usb_driver.c b/tmk_core/protocol/chibios/usb_driver.c index cc0ce7600f..4de060f306 100644 --- a/tmk_core/protocol/chibios/usb_driver.c +++ b/tmk_core/protocol/chibios/usb_driver.c @@ -80,21 +80,37 @@ static bool qmkusb_start_receive(QMKUSBDriver *qmkusbp) { * Interface implementation. */ -static size_t _write(void *ip, const uint8_t *bp, size_t n) { return obqWriteTimeout(&((QMKUSBDriver *)ip)->obqueue, bp, n, TIME_INFINITE); } +static size_t _write(void *ip, const uint8_t *bp, size_t n) { + return obqWriteTimeout(&((QMKUSBDriver *)ip)->obqueue, bp, n, TIME_INFINITE); +} -static size_t _read(void *ip, uint8_t *bp, size_t n) { return ibqReadTimeout(&((QMKUSBDriver *)ip)->ibqueue, bp, n, TIME_INFINITE); } +static size_t _read(void *ip, uint8_t *bp, size_t n) { + return ibqReadTimeout(&((QMKUSBDriver *)ip)->ibqueue, bp, n, TIME_INFINITE); +} -static msg_t _put(void *ip, uint8_t b) { return obqPutTimeout(&((QMKUSBDriver *)ip)->obqueue, b, TIME_INFINITE); } +static msg_t _put(void *ip, uint8_t b) { + return obqPutTimeout(&((QMKUSBDriver *)ip)->obqueue, b, TIME_INFINITE); +} -static msg_t _get(void *ip) { return ibqGetTimeout(&((QMKUSBDriver *)ip)->ibqueue, TIME_INFINITE); } +static msg_t _get(void *ip) { + return ibqGetTimeout(&((QMKUSBDriver *)ip)->ibqueue, TIME_INFINITE); +} -static msg_t _putt(void *ip, uint8_t b, sysinterval_t timeout) { return obqPutTimeout(&((QMKUSBDriver *)ip)->obqueue, b, timeout); } +static msg_t _putt(void *ip, uint8_t b, sysinterval_t timeout) { + return obqPutTimeout(&((QMKUSBDriver *)ip)->obqueue, b, timeout); +} -static msg_t _gett(void *ip, sysinterval_t timeout) { return ibqGetTimeout(&((QMKUSBDriver *)ip)->ibqueue, timeout); } +static msg_t _gett(void *ip, sysinterval_t timeout) { + return ibqGetTimeout(&((QMKUSBDriver *)ip)->ibqueue, timeout); +} -static size_t _writet(void *ip, const uint8_t *bp, size_t n, sysinterval_t timeout) { return obqWriteTimeout(&((QMKUSBDriver *)ip)->obqueue, bp, n, timeout); } +static size_t _writet(void *ip, const uint8_t *bp, size_t n, sysinterval_t timeout) { + return obqWriteTimeout(&((QMKUSBDriver *)ip)->obqueue, bp, n, timeout); +} -static size_t _readt(void *ip, uint8_t *bp, size_t n, sysinterval_t timeout) { return ibqReadTimeout(&((QMKUSBDriver *)ip)->ibqueue, bp, n, timeout); } +static size_t _readt(void *ip, uint8_t *bp, size_t n, sysinterval_t timeout) { + return ibqReadTimeout(&((QMKUSBDriver *)ip)->ibqueue, bp, n, timeout); +} static const struct QMKUSBDriverVMT vmt = {0, _write, _read, _put, _get, _putt, _gett, _writet, _readt}; diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index 30bfac9f3e..d9aa351ecb 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -775,7 +775,9 @@ void kbd_in_cb(USBDriver *usbp, usbep_t ep) { /* start-of-frame handler * TODO: i guess it would be better to re-implement using timers, * so that this is not going to have to be checked every 1ms */ -void kbd_sof_cb(USBDriver *usbp) { (void)usbp; } +void kbd_sof_cb(USBDriver *usbp) { + (void)usbp; +} /* Idle requests timer code * callback (called from ISR, unlocked state) */ @@ -815,7 +817,9 @@ static void keyboard_idle_timer_cb(void *arg) { } /* LED status */ -uint8_t keyboard_leds(void) { return keyboard_led_state; } +uint8_t keyboard_leds(void) { + return keyboard_led_state; +} /* prepare and start sending a report IN * not callable from ISR or locked state */ @@ -915,7 +919,9 @@ void send_mouse(report_mouse_t *report) { } #else /* MOUSE_ENABLE */ -void send_mouse(report_mouse_t *report) { (void)report; } +void send_mouse(report_mouse_t *report) { + (void)report; +} #endif /* MOUSE_ENABLE */ /* --------------------------------------------------------- @@ -1107,7 +1113,9 @@ void raw_hid_task(void) { #ifdef MIDI_ENABLE -void send_midi_packet(MIDI_EventPacket_t *event) { chnWrite(&drivers.midi_driver.driver, (uint8_t *)event, sizeof(MIDI_EventPacket_t)); } +void send_midi_packet(MIDI_EventPacket_t *event) { + chnWrite(&drivers.midi_driver.driver, (uint8_t *)event, sizeof(MIDI_EventPacket_t)); +} bool recv_midi_packet(MIDI_EventPacket_t *const event) { size_t size = chnReadTimeout(&drivers.midi_driver.driver, (uint8_t *)event, sizeof(MIDI_EventPacket_t), TIME_IMMEDIATE); @@ -1130,7 +1138,9 @@ void midi_ep_task(void) { void virtser_init(void) {} -void virtser_send(const uint8_t byte) { chnWrite(&drivers.serial_driver.driver, &byte, 1); } +void virtser_send(const uint8_t byte) { + chnWrite(&drivers.serial_driver.driver, &byte, 1); +} __attribute__((weak)) void virtser_recv(uint8_t c) { // Ignore by default @@ -1174,7 +1184,7 @@ void send_joystick_packet(joystick_t *joystick) { joystick->axes[5], # endif }, -# endif // JOYSTICK_AXES_COUNT>0 +# endif // JOYSTICK_AXES_COUNT>0 # if JOYSTICK_BUTTON_COUNT > 0 .buttons = { @@ -1190,7 +1200,7 @@ void send_joystick_packet(joystick_t *joystick) { joystick->buttons[3], # endif } -# endif // JOYSTICK_BUTTON_COUNT>0 +# endif // JOYSTICK_BUTTON_COUNT>0 }; // chnWrite(&drivers.joystick_driver.driver, (uint8_t *)&rep, sizeof(rep)); diff --git a/tmk_core/protocol/chibios/usb_util.c b/tmk_core/protocol/chibios/usb_util.c index e32d6ebfa4..c8b435db0c 100644 --- a/tmk_core/protocol/chibios/usb_util.c +++ b/tmk_core/protocol/chibios/usb_util.c @@ -16,6 +16,10 @@ #include <hal.h> #include "usb_util.h" -void usb_disconnect(void) { usbStop(&USBD1); } +void usb_disconnect(void) { + usbStop(&USBD1); +} -bool usb_connected_state(void) { return usbGetDriverStateI(&USBD1) == USB_ACTIVE; } +bool usb_connected_state(void) { + return usbGetDriverStateI(&USBD1) == USB_ACTIVE; +} |