summaryrefslogtreecommitdiffstats
path: root/tmk_core/protocol/lufa
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/protocol/lufa')
-rw-r--r--tmk_core/protocol/lufa/lufa.c53
-rw-r--r--tmk_core/protocol/lufa/usb_util.c8
2 files changed, 41 insertions, 20 deletions
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c
index 3943f8c92b..b4b03357a3 100644
--- a/tmk_core/protocol/lufa/lufa.c
+++ b/tmk_core/protocol/lufa/lufa.c
@@ -256,7 +256,8 @@ static void Console_Task(void) {
}
// fill empty bank
- while (Endpoint_IsReadWriteAllowed()) Endpoint_Write_8(0);
+ while (Endpoint_IsReadWriteAllowed())
+ Endpoint_Write_8(0);
// flush sendchar packet
if (Endpoint_IsINReady()) {
@@ -296,7 +297,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 = {
@@ -312,14 +313,15 @@ void send_joystick_packet(joystick_t *joystick) {
joystick->buttons[3],
# endif
}
-# endif // JOYSTICK_BUTTON_COUNT>0
+# endif // JOYSTICK_BUTTON_COUNT>0
};
/* Select the Joystick Report Endpoint */
Endpoint_SelectEndpoint(JOYSTICK_IN_EPNUM);
/* Check if write ready for a polling interval around 10ms */
- while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(40);
+ while (timeout-- && !Endpoint_IsReadWriteAllowed())
+ _delay_us(40);
if (!Endpoint_IsReadWriteAllowed()) return;
/* Write Joystick Report Data */
@@ -414,9 +416,11 @@ void EVENT_USB_Device_WakeUp() {
#ifdef CONSOLE_ENABLE
static bool console_flush = false;
-# define CONSOLE_FLUSH_SET(b) \
- do { \
- ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { console_flush = b; } \
+# define CONSOLE_FLUSH_SET(b) \
+ do { \
+ ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { \
+ console_flush = b; \
+ } \
} while (0)
/** \brief Event USB Device Start Of Frame
@@ -634,7 +638,9 @@ void EVENT_USB_Device_ControlRequest(void) {
*
* FIXME: Needs doc
*/
-static uint8_t keyboard_leds(void) { return keyboard_led_state; }
+static uint8_t keyboard_leds(void) {
+ return keyboard_led_state;
+}
/** \brief Send Keyboard
*
@@ -665,7 +671,8 @@ static void send_keyboard(report_keyboard_t *report) {
#endif
Endpoint_SelectEndpoint(ep);
/* Check if write ready for a polling interval around 10ms */
- while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(40);
+ while (timeout-- && !Endpoint_IsReadWriteAllowed())
+ _delay_us(40);
if (!Endpoint_IsReadWriteAllowed()) return;
/* If we're in Boot Protocol, don't send any report ID or other funky fields */
@@ -705,7 +712,8 @@ static void send_mouse(report_mouse_t *report) {
Endpoint_SelectEndpoint(MOUSE_IN_EPNUM);
/* Check if write ready for a polling interval around 10ms */
- while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(40);
+ while (timeout-- && !Endpoint_IsReadWriteAllowed())
+ _delay_us(40);
if (!Endpoint_IsReadWriteAllowed()) return;
/* Write Mouse Report Data */
@@ -725,7 +733,8 @@ static void send_report(void *report, size_t size) {
Endpoint_SelectEndpoint(SHARED_IN_EPNUM);
/* Check if write ready for a polling interval around 10ms */
- while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(40);
+ while (timeout-- && !Endpoint_IsReadWriteAllowed())
+ _delay_us(40);
if (!Endpoint_IsReadWriteAllowed()) return;
Endpoint_Write_Stream_LE(report, size, NULL);
@@ -876,9 +885,13 @@ USB_ClassInfo_MIDI_Device_t USB_MIDI_Interface = {
// clang-format on
-void send_midi_packet(MIDI_EventPacket_t *event) { MIDI_Device_SendEventPacket(&USB_MIDI_Interface, event); }
+void send_midi_packet(MIDI_EventPacket_t *event) {
+ MIDI_Device_SendEventPacket(&USB_MIDI_Interface, event);
+}
-bool recv_midi_packet(MIDI_EventPacket_t *const event) { return MIDI_Device_ReceiveEventPacket(&USB_MIDI_Interface, event); }
+bool recv_midi_packet(MIDI_EventPacket_t *const event) {
+ return MIDI_Device_ReceiveEventPacket(&USB_MIDI_Interface, event);
+}
#endif
@@ -934,7 +947,8 @@ void virtser_send(const uint8_t byte) {
return;
}
- while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(40);
+ while (timeout-- && !Endpoint_IsReadWriteAllowed())
+ _delay_us(40);
Endpoint_Write_8(byte);
CDC_Device_Flush(&cdc_device);
@@ -957,7 +971,8 @@ void send_digitizer(report_digitizer_t *report) {
Endpoint_SelectEndpoint(DIGITIZER_IN_EPNUM);
/* Check if write ready for a polling interval around 10ms */
- while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(40);
+ while (timeout-- && !Endpoint_IsReadWriteAllowed())
+ _delay_us(40);
if (!Endpoint_IsReadWriteAllowed()) return;
Endpoint_Write_Stream_LE(report, sizeof(report_digitizer_t), NULL);
@@ -1033,7 +1048,9 @@ void protocol_pre_init(void) {
#endif
}
-void protocol_post_init(void) { host_set_driver(&lufa_driver); }
+void protocol_post_init(void) {
+ host_set_driver(&lufa_driver);
+}
void protocol_pre_task(void) {
#if !defined(NO_USB_STARTUP_CHECK)
@@ -1084,4 +1101,6 @@ void protocol_post_task(void) {
#endif
}
-uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint16_t wIndex, const void **const DescriptorAddress) { return get_usb_descriptor(wValue, wIndex, DescriptorAddress); }
+uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint16_t wIndex, const void **const DescriptorAddress) {
+ return get_usb_descriptor(wValue, wIndex, DescriptorAddress);
+}
diff --git a/tmk_core/protocol/lufa/usb_util.c b/tmk_core/protocol/lufa/usb_util.c
index 9691eff1e4..2e3b86b80e 100644
--- a/tmk_core/protocol/lufa/usb_util.c
+++ b/tmk_core/protocol/lufa/usb_util.c
@@ -22,13 +22,15 @@ void usb_disconnect(void) {
USB_DeviceState = DEVICE_STATE_Unattached;
}
-bool usb_connected_state(void) { return USB_Device_IsAddressSet(); }
+bool usb_connected_state(void) {
+ return USB_Device_IsAddressSet();
+}
#if defined(OTGPADE)
bool usb_vbus_state(void) {
- USB_OTGPAD_On(); // enables VBUS pad
+ USB_OTGPAD_On(); // enables VBUS pad
wait_us(5);
- return USB_VBUS_GetStatus(); // checks state of VBUS
+ return USB_VBUS_GetStatus(); // checks state of VBUS
}
#endif