Skip to content

Commit 093234c

Browse files
committed
clang format
1 parent 6c0a99b commit 093234c

File tree

4 files changed

+51
-60
lines changed

4 files changed

+51
-60
lines changed

src/arduino/Adafruit_USBH_Host.cpp

Lines changed: 26 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -29,59 +29,49 @@
2929
#include "Adafruit_TinyUSB_API.h"
3030
#include "Adafruit_USBH_Host.h"
3131

32-
Adafruit_USBH_Host::Adafruit_USBH_Host(void)
33-
{
32+
Adafruit_USBH_Host::Adafruit_USBH_Host(void) {}
3433

35-
}
36-
37-
bool Adafruit_USBH_Host::configure(uint8_t rhport, uint32_t cfg_id, const void* cfg_param)
38-
{
34+
bool Adafruit_USBH_Host::configure(uint8_t rhport, uint32_t cfg_id,
35+
const void *cfg_param) {
3936
return tuh_configure(rhport, cfg_id, cfg_param);
4037
}
4138

4239
#ifdef ARDUINO_ARCH_RP2040
43-
bool Adafruit_USBH_Host::configure_pio_usb(uint8_t rhport, const void* cfg_param)
44-
{
40+
bool Adafruit_USBH_Host::configure_pio_usb(uint8_t rhport,
41+
const void *cfg_param) {
4542
return configure(rhport, TUH_CFGID_RPI_PIO_USB_CONFIGURATION, cfg_param);
4643
}
4744
#endif
4845

49-
bool Adafruit_USBH_Host::begin(uint8_t rhport)
50-
{
51-
return tuh_init(rhport);
52-
}
46+
bool Adafruit_USBH_Host::begin(uint8_t rhport) { return tuh_init(rhport); }
5347

54-
void Adafruit_USBH_Host::task(void)
55-
{
56-
tuh_task();
57-
}
48+
void Adafruit_USBH_Host::task(void) { tuh_task(); }
5849

5950
// Invoked when device with hid interface is mounted
60-
// Report descriptor is also available for use. tuh_hid_parse_report_descriptor()
61-
// can be used to parse common/simple enough descriptor.
62-
// Note: if report descriptor length > CFG_TUH_ENUMERATION_BUFSIZE, it will be skipped
63-
// therefore report_desc = NULL, desc_len = 0
64-
void tuh_hid_mount_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* desc_report, uint16_t desc_len)
65-
{
66-
(void) dev_addr;
67-
(void) instance;
68-
(void) desc_report;
69-
(void) desc_len;
51+
// Report descriptor is also available for use.
52+
// tuh_hid_parse_report_descriptor() can be used to parse common/simple enough
53+
// descriptor. Note: if report descriptor length > CFG_TUH_ENUMERATION_BUFSIZE,
54+
// it will be skipped therefore report_desc = NULL, desc_len = 0
55+
void tuh_hid_mount_cb(uint8_t dev_addr, uint8_t instance,
56+
uint8_t const *desc_report, uint16_t desc_len) {
57+
(void)dev_addr;
58+
(void)instance;
59+
(void)desc_report;
60+
(void)desc_len;
7061
}
7162

7263
// Invoked when device with hid interface is un-mounted
73-
void tuh_hid_umount_cb(uint8_t dev_addr, uint8_t instance)
74-
{
75-
(void) dev_addr;
76-
(void) instance;
64+
void tuh_hid_umount_cb(uint8_t dev_addr, uint8_t instance) {
65+
(void)dev_addr;
66+
(void)instance;
7767
}
7868

7969
// Invoked when received report from device via interrupt endpoint
80-
void tuh_hid_report_received_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len)
81-
{
82-
(void) dev_addr;
83-
(void) instance;
84-
(void) report;
85-
(void) len;
70+
void tuh_hid_report_received_cb(uint8_t dev_addr, uint8_t instance,
71+
uint8_t const *report, uint16_t len) {
72+
(void)dev_addr;
73+
(void)instance;
74+
(void)report;
75+
(void)len;
8676
}
8777
#endif

src/arduino/Adafruit_USBH_Host.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,28 @@
3434

3535
class Adafruit_USBH_Host {
3636
private:
37-
3837
public:
3938
Adafruit_USBH_Host(void);
4039

41-
bool configure(uint8_t rhport, uint32_t cfg_id, const void* cfg_param);
40+
bool configure(uint8_t rhport, uint32_t cfg_id, const void *cfg_param);
4241

4342
#ifdef ARDUINO_ARCH_RP2040
44-
bool configure_pio_usb(uint8_t rhport, const void* cfg_param);
43+
bool configure_pio_usb(uint8_t rhport, const void *cfg_param);
4544
#endif
4645

4746
bool begin(uint8_t rhport);
4847
void task(void);
4948

5049
private:
51-
// uint16_t const *descrip`tor_string_cb(uint8_t index, uint16_t langid);
52-
//
53-
// friend uint8_t const *tud_descriptor_device_cb(void);
54-
// friend uint8_t const *tud_descriptor_configuration_cb(uint8_t index);
55-
// friend uint16_t const *tud_descriptor_string_cb(uint8_t index,
56-
// uint16_t langid);
50+
// uint16_t const *descrip`tor_string_cb(uint8_t index, uint16_t langid);
51+
//
52+
// friend uint8_t const *tud_descriptor_device_cb(void);
53+
// friend uint8_t const *tud_descriptor_configuration_cb(uint8_t index);
54+
// friend uint16_t const *tud_descriptor_string_cb(uint8_t index,
55+
// uint16_t langid);
5756
};
5857

59-
//extern Adafruit_USBH_Host TinyUSBHost;
58+
// extern Adafruit_USBH_Host TinyUSBHost;
6059
//
6160
//// USBHost has a high chance to conflict with other usb stack
6261
//// only define if supported BSP

src/arduino/ports/rp2040/Adafruit_TinyUSB_rp2040.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ int serial1_printf(const char *__restrict format, ...) {
163163
return len;
164164
}
165165
#endif
166-
167166
}
168167

169168
#endif

src/arduino/ports/rp2040/tusb_config_rp2040.h

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ extern "C" {
3535
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
3636

3737
// Enable device stack
38-
#define CFG_TUD_ENABLED 1
38+
#define CFG_TUD_ENABLED 1
3939

4040
// Enable host stack with pio-usb if Pico-PIO-USB library is available
4141
#if __has_include("pio_usb.h")
42-
#define CFG_TUH_ENABLED 1
42+
#define CFG_TUH_ENABLED 1
4343
#define CFG_TUH_RPI_PIO_USB 1
4444
#endif
4545

@@ -48,26 +48,29 @@ extern "C" {
4848
#endif
4949
#define CFG_TUSB_OS OPT_OS_PICO
5050

51+
#ifndef CFG_TUSB_DEBUG
5152
#define CFG_TUSB_DEBUG 0
53+
#endif
54+
5255
#if CFG_TUSB_DEBUG
53-
#define CFG_TUSB_DEBUG_PRINTF serial1_printf
54-
extern int serial1_printf(const char *__restrict __format, ...);
56+
#define CFG_TUSB_DEBUG_PRINTF serial1_printf
57+
extern int serial1_printf(const char *__restrict __format, ...);
5558
#endif
5659

5760
#define CFG_TUSB_MEM_SECTION
58-
#define CFG_TUSB_MEM_ALIGN TU_ATTR_ALIGNED(4)
61+
#define CFG_TUSB_MEM_ALIGN TU_ATTR_ALIGNED(4)
5962

6063
//--------------------------------------------------------------------
6164
// Device Configuration
6265
//--------------------------------------------------------------------
6366

6467
#define CFG_TUD_ENDOINT0_SIZE 64
6568

66-
#define CFG_TUD_CDC 1
67-
#define CFG_TUD_MSC 1
68-
#define CFG_TUD_HID 1
69-
#define CFG_TUD_MIDI 1
70-
#define CFG_TUD_VENDOR 1
69+
#define CFG_TUD_CDC 1
70+
#define CFG_TUD_MSC 1
71+
#define CFG_TUD_HID 1
72+
#define CFG_TUD_MIDI 1
73+
#define CFG_TUD_VENDOR 1
7174

7275
// CDC FIFO size of TX and RX
7376
#define CFG_TUD_CDC_RX_BUFSIZE 256
@@ -94,14 +97,14 @@ extern "C" {
9497
// Size of buffer to hold descriptors and other data used for enumeration
9598
#define CFG_TUH_ENUMERATION_BUFSIZE 256
9699

97-
#define CFG_TUH_HUB 1
100+
#define CFG_TUH_HUB 1
98101
// max device support (excluding hub device)
99-
#define CFG_TUH_DEVICE_MAX (CFG_TUH_HUB ? 4 : 1) // hub typically has 4 ports
102+
#define CFG_TUH_DEVICE_MAX (CFG_TUH_HUB ? 4 : 1) // hub typically has 4 ports
100103

101104
// Enable tuh_edpt_xfer() API
102105
//#define CFG_TUH_API_EDPT_XFER 1
103106

104-
#define CFG_TUH_HID 4
107+
#define CFG_TUH_HID 4
105108

106109
#ifdef __cplusplus
107110
}

0 commit comments

Comments
 (0)