Skip to content

Commit cf29baf

Browse files
maciejbocianskic1728p9
authored andcommitted
code formatting fixes
1 parent eedebd1 commit cf29baf

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

TESTS/usb_device/basic/USBTester.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ USBTester::~USBTester()
6767

6868
const char *USBTester::get_desc_string(const uint8_t *desc)
6969
{
70-
static char ret_string[128] = {};
70+
static char ret_string[128] = { };
7171
const uint8_t desc_size = desc[0] - 2;
7272
const uint8_t *desc_str = &desc[2];
7373
uint32_t j = 0;
74-
for(uint32_t i = 0; i < desc_size; i+=2, j++) {
74+
for (uint32_t i = 0; i < desc_size; i += 2, j++) {
7575
ret_string[j] = desc_str[i];
7676
}
7777
ret_string[j] = '\0';
@@ -80,7 +80,7 @@ const char *USBTester::get_desc_string(const uint8_t *desc)
8080

8181
void USBTester::suspend(bool suspended)
8282
{
83-
if(suspended) {
83+
if (suspended) {
8484
++suspend_count;
8585
} else {
8686
++resume_count;
@@ -146,7 +146,7 @@ void USBTester::callback_request(const setup_packet_t *setup)
146146
case VENDOR_TEST_CTRL_OUT:
147147
result = Receive;
148148
data = ctrl_buf;
149-
size = setup->wValue < 8 ? setup->wValue : 8;
149+
size = setup->wValue < 8 ? setup->wValue : 8;
150150
break;
151151
case VENDOR_TEST_CTRL_NONE:
152152
result = Success;
@@ -176,8 +176,6 @@ void USBTester::callback_request(const setup_packet_t *setup)
176176
} else {
177177
complete_request(result, data, size);
178178
}
179-
180-
181179
}
182180

183181
void USBTester::callback_request_xfer_done(const setup_packet_t *setup, bool aborted)

usb/device/USBDevice/USBDevice.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ bool USBDevice::_request_get_descriptor()
6262
#endif
6363
switch (DESCRIPTOR_TYPE(_transfer.setup.wValue)) {
6464
case DEVICE_DESCRIPTOR:
65+
{
6566
if (device_desc() != NULL) {
6667
if ((device_desc()[0] == DEVICE_DESCRIPTOR_LENGTH) \
6768
&& (device_desc()[1] == DEVICE_DESCRIPTOR)) {
@@ -75,6 +76,7 @@ bool USBDevice::_request_get_descriptor()
7576
}
7677
}
7778
break;
79+
}
7880
case CONFIGURATION_DESCRIPTOR:
7981
{
8082
const uint8_t idx = DESCRIPTOR_INDEX(_transfer.setup.wValue);
@@ -96,6 +98,7 @@ bool USBDevice::_request_get_descriptor()
9698
break;
9799
}
98100
case STRING_DESCRIPTOR:
101+
{
99102
#ifdef DEBUG
100103
printf("str descriptor\r\n");
101104
#endif
@@ -156,21 +159,29 @@ bool USBDevice::_request_get_descriptor()
156159
break;
157160
}
158161
break;
162+
}
159163
case INTERFACE_DESCRIPTOR:
164+
{
160165
#ifdef DEBUG
161166
printf("interface descr\r\n");
162167
#endif
168+
break;
169+
}
163170
case ENDPOINT_DESCRIPTOR:
171+
{
164172
#ifdef DEBUG
165173
printf("endpoint descr\r\n");
166174
#endif
167175
/* TODO: Support is optional, not implemented here */
168176
break;
177+
}
169178
default:
179+
{
170180
#ifdef DEBUG
171181
printf("ERROR\r\n");
172182
#endif
173183
break;
184+
}
174185
}
175186

176187
return success;
@@ -406,7 +417,6 @@ void USBDevice::_complete_set_configuration()
406417
_phy->ep0_stall();
407418
return;
408419
}
409-
410420
}
411421

412422
bool USBDevice::_request_get_configuration()

0 commit comments

Comments
 (0)