Skip to content

Commit f8864ae

Browse files
committed
Applied suggested astyle fixes
1 parent 5867e99 commit f8864ae

File tree

11 files changed

+60
-45
lines changed

11 files changed

+60
-45
lines changed

TESTS/usb_device/basic/USBTester.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141

4242

4343
USBTester::USBTester(USBPhy *phy, uint16_t vendor_id, uint16_t product_id, uint16_t product_release):
44-
USBDevice(phy, vendor_id, product_id, product_release), interface_0_alt_set(NONE),
45-
interface_1_alt_set(NONE), configuration_set(NONE), reset_count(0),
46-
suspend_count(0), resume_count(0)
44+
USBDevice(phy, vendor_id, product_id, product_release), interface_0_alt_set(NONE),
45+
interface_1_alt_set(NONE), configuration_set(NONE), reset_count(0),
46+
suspend_count(0), resume_count(0)
4747
{
4848

4949
EndpointResolver resolver(endpoint_table());
@@ -269,14 +269,14 @@ bool USBTester::set_configuration(uint16_t configuration)
269269
bulk_buf, sizeof(bulk_buf), &USBTester::epbulk_out_callback);
270270
// interface 1 alternate 0
271271
success &= setup_iterface(int_in, int_out, MAX_EP_SIZE, USB_EP_TYPE_INT,
272-
int_buf, sizeof(int_buf), &USBTester::epint_out_callback);
272+
int_buf, sizeof(int_buf), &USBTester::epint_out_callback);
273273
} else if (configuration == 2) {
274274
// interface 0 alternate 0
275275
success = setup_iterface(int_in, int_out, MIN_EP_SIZE, USB_EP_TYPE_INT,
276276
int_buf, sizeof(int_buf), &USBTester::epint_out_callback);
277277
// interface 1 alternate 0
278278
success &= setup_iterface(bulk_in, bulk_out, MIN_EP_SIZE, USB_EP_TYPE_BULK,
279-
bulk_buf, sizeof(bulk_buf), &USBTester::epbulk_out_callback);
279+
bulk_buf, sizeof(bulk_buf), &USBTester::epbulk_out_callback);
280280
}
281281
if (success) {
282282
configuration_set = configuration;

TESTS/usb_device/basic/USBTester.h

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,30 @@ class USBTester: public USBDevice {
4747
const char *get_serial_desc_string();
4848
const char *get_iproduct_desc_string();
4949
const char *get_iinterface_desc_string();
50-
uint32_t get_reset_count() const { return reset_count; }
51-
uint32_t get_suspend_count() const { return suspend_count; }
52-
uint32_t get_resume_count() const { return resume_count; }
53-
void clear_reset_count() { reset_count = 0; }
54-
void clear_suspend_count() { suspend_count = 0; }
55-
void clear_resume_count() { resume_count = 0; }
50+
uint32_t get_reset_count() const
51+
{
52+
return reset_count;
53+
}
54+
uint32_t get_suspend_count() const
55+
{
56+
return suspend_count;
57+
}
58+
uint32_t get_resume_count() const
59+
{
60+
return resume_count;
61+
}
62+
void clear_reset_count()
63+
{
64+
reset_count = 0;
65+
}
66+
void clear_suspend_count()
67+
{
68+
suspend_count = 0;
69+
}
70+
void clear_resume_count()
71+
{
72+
resume_count = 0;
73+
}
5674

5775
private:
5876

usb/device/USBAudio/USBAudio.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ void USBAudio::callback_request_xfer_done(const setup_packet_t *setup, bool abor
498498
}
499499

500500
if ((setup->wLength == 1) || (setup->wLength == 2)) {
501-
uint16_t data = (_control_receive[0] << 0) | (_control_receive[1] << 8);
501+
uint16_t data = (_control_receive[0] << 0) | (_control_receive[1] << 8);
502502
data &= ((setup->wLength == 1) ? 0xFF : 0xFFFF);
503503
switch (setup->wValue >> 8) {
504504
case MUTE_CONTROL:
@@ -516,7 +516,7 @@ void USBAudio::callback_request_xfer_done(const setup_packet_t *setup, bool abor
516516
case REQUEST_SET_CUR:
517517
_vol_cur = data;
518518
_volume = (float)_vol_cur / (float)_vol_max;
519-
_update_vol.call();
519+
_update_vol.call();
520520
break;
521521
default:
522522
break;

usb/device/USBAudio/USBAudio.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class USBAudio: protected USBDevice {
8080
* @param product_id Your product_id
8181
* @param product_release Your product_release
8282
*/
83-
USBAudio(bool connect=true, uint32_t frequency_rx = 48000, uint8_t channel_count_rx = 1, uint32_t frequency_tx = 8000, uint8_t channel_count_tx = 1, uint32_t buffer_ms=10, uint16_t vendor_id = 0x7bb8, uint16_t product_id = 0x1111, uint16_t product_release = 0x0100);
83+
USBAudio(bool connect = true, uint32_t frequency_rx = 48000, uint8_t channel_count_rx = 1, uint32_t frequency_tx = 8000, uint8_t channel_count_tx = 1, uint32_t buffer_ms = 10, uint16_t vendor_id = 0x7bb8, uint16_t product_id = 0x1111, uint16_t product_release = 0x0100);
8484

8585
/**
8686
* Fully featured constructor
@@ -153,7 +153,7 @@ class USBAudio: protected USBDevice {
153153
* @param clear Reset the overflow count back to 0
154154
* @return Number of packets dropped due to overflow
155155
*/
156-
uint32_t read_overflows(bool clear=false);
156+
uint32_t read_overflows(bool clear = false);
157157

158158
/**
159159
* Check if the audio read channel is open
@@ -196,7 +196,7 @@ class USBAudio: protected USBDevice {
196196
* @return Number of packets that should have been
197197
* sent but weren't due to overflow
198198
*/
199-
uint32_t write_underflows(bool clear=false);
199+
uint32_t write_underflows(bool clear = false);
200200

201201
/**
202202
* Check if the audio write channel is open

usb/device/USBDevice/EndpointResolver.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ bool EndpointResolver::valid()
7373
return _valid && (_cost <= _table->resources);
7474
}
7575

76-
void EndpointResolver::reset() {
76+
void EndpointResolver::reset()
77+
{
7778
_cost = 0;
7879
_used = 0;
7980
_valid = true;

usb/device/USBDevice/USBDevice.cpp

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ bool USBDevice::_request_get_descriptor()
6464
printf("get descr: type: %d\r\n", DESCRIPTOR_TYPE(_transfer.setup.wValue));
6565
#endif
6666
switch (DESCRIPTOR_TYPE(_transfer.setup.wValue)) {
67-
case DEVICE_DESCRIPTOR:
68-
{
67+
case DEVICE_DESCRIPTOR: {
6968
if (device_desc() != NULL) {
7069
if ((device_desc()[0] == DEVICE_DESCRIPTOR_LENGTH) \
7170
&& (device_desc()[1] == DEVICE_DESCRIPTOR)) {
@@ -80,8 +79,7 @@ bool USBDevice::_request_get_descriptor()
8079
}
8180
break;
8281
}
83-
case CONFIGURATION_DESCRIPTOR:
84-
{
82+
case CONFIGURATION_DESCRIPTOR: {
8583
const uint8_t idx = DESCRIPTOR_INDEX(_transfer.setup.wValue);
8684
if (configuration_desc(idx) != NULL) {
8785
if ((configuration_desc(idx)[0] == CONFIGURATION_DESCRIPTOR_LENGTH) \
@@ -91,7 +89,7 @@ bool USBDevice::_request_get_descriptor()
9189
#endif
9290
/* Get wTotalLength */
9391
_transfer.remaining = configuration_desc(idx)[2] \
94-
| (configuration_desc(idx)[3] << 8);
92+
| (configuration_desc(idx)[3] << 8);
9593

9694
_transfer.ptr = (uint8_t *)configuration_desc(idx);
9795
_transfer.direction = Send;
@@ -100,8 +98,7 @@ bool USBDevice::_request_get_descriptor()
10098
}
10199
break;
102100
}
103-
case STRING_DESCRIPTOR:
104-
{
101+
case STRING_DESCRIPTOR: {
105102
#ifdef DEBUG
106103
printf("str descriptor\r\n");
107104
#endif
@@ -163,23 +160,20 @@ bool USBDevice::_request_get_descriptor()
163160
}
164161
break;
165162
}
166-
case INTERFACE_DESCRIPTOR:
167-
{
163+
case INTERFACE_DESCRIPTOR: {
168164
#ifdef DEBUG
169165
printf("interface descr\r\n");
170166
#endif
171167
break;
172168
}
173-
case ENDPOINT_DESCRIPTOR:
174-
{
169+
case ENDPOINT_DESCRIPTOR: {
175170
#ifdef DEBUG
176171
printf("endpoint descr\r\n");
177172
#endif
178173
/* TODO: Support is optional, not implemented here */
179174
break;
180175
}
181-
default:
182-
{
176+
default: {
183177
#ifdef DEBUG
184178
printf("ERROR\r\n");
185179
#endif
@@ -1154,7 +1148,7 @@ void USBDevice::endpoint_stall(usb_ep_t endpoint)
11541148
_phy->endpoint_stall(endpoint);
11551149

11561150
if (info->pending) {
1157-
endpoint_abort(endpoint);
1151+
endpoint_abort(endpoint);
11581152
}
11591153

11601154
unlock();
@@ -1589,7 +1583,8 @@ void USBDevice::assert_locked()
15891583
MBED_ASSERT(_locked > 0);
15901584
}
15911585

1592-
void USBDevice::_change_state(DeviceState new_state) {
1586+
void USBDevice::_change_state(DeviceState new_state)
1587+
{
15931588
assert_locked();
15941589

15951590
DeviceState old_state = _device.state;

usb/device/USBDevice/USBDevice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ class USBDevice: public USBPhyEvents {
403403
* @param data Buffer to send or receive if the result is Send or Receive
404404
* @param size Size to transfer if the result is Send or Receive
405405
*/
406-
void complete_request(RequestResult result, uint8_t *data=NULL, uint32_t size=0);
406+
void complete_request(RequestResult result, uint8_t *data = NULL, uint32_t size = 0);
407407

408408
/**
409409
* Called by USBDevice on data stage completion

usb/device/USBHID/USBMouseKeyboard.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@
6868
*
6969
* @note Synchronization level: Thread safe
7070
*/
71-
class USBMouseKeyboard: public USBHID, public mbed::Stream
72-
{
71+
class USBMouseKeyboard: public USBHID, public mbed::Stream {
7372
public:
7473

7574
/**
@@ -86,7 +85,7 @@ class USBMouseKeyboard: public USBHID, public mbed::Stream
8685
* @param product_release Your preoduct_release (default: 0x0001)
8786
*
8887
*/
89-
USBMouseKeyboard(bool connect_blocking=true, MOUSE_TYPE mouse_type=REL_MOUSE, uint16_t vendor_id=0x0021, uint16_t product_id=0x0011, uint16_t product_release=0x0001);
88+
USBMouseKeyboard(bool connect_blocking = true, MOUSE_TYPE mouse_type = REL_MOUSE, uint16_t vendor_id = 0x0021, uint16_t product_id = 0x0011, uint16_t product_release = 0x0001);
9089

9190
/**
9291
* Fully featured constructor
@@ -106,7 +105,7 @@ class USBMouseKeyboard: public USBHID, public mbed::Stream
106105
* @param product_release Your preoduct_release (default: 0x0001)
107106
*
108107
*/
109-
USBMouseKeyboard(USBPhy *phy, MOUSE_TYPE mouse_type=REL_MOUSE, uint16_t vendor_id=0x0021, uint16_t product_id=0x0011, uint16_t product_release=0x0001);
108+
USBMouseKeyboard(USBPhy *phy, MOUSE_TYPE mouse_type = REL_MOUSE, uint16_t vendor_id = 0x0021, uint16_t product_id = 0x0011, uint16_t product_release = 0x0001);
110109

111110
/**
112111
* Destroy this object
@@ -221,7 +220,7 @@ class USBMouseKeyboard: public USBHID, public mbed::Stream
221220
*
222221
* @returns pointer to the report descriptor
223222
*/
224-
virtual const uint8_t * report_desc();
223+
virtual const uint8_t *report_desc();
225224

226225
/*
227226
* Called when a data is received on the OUT endpoint. Useful to switch on LED of LOCK keys

usb/device/USBMSD/USBMSD.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,14 @@ void USBMSD::attach(mbed::Callback<void()> cb)
212212
unlock();
213213
}
214214

215-
int USBMSD::disk_read(uint8_t* data, uint64_t block, uint8_t count)
215+
int USBMSD::disk_read(uint8_t *data, uint64_t block, uint8_t count)
216216
{
217217
bd_addr_t addr = block * _bd->get_erase_size();
218218
bd_size_t size = count * _bd->get_erase_size();
219219
return _bd->read(data, addr, size);
220220
}
221221

222-
int USBMSD::disk_write(const uint8_t* data, uint64_t block, uint8_t count)
222+
int USBMSD::disk_write(const uint8_t *data, uint64_t block, uint8_t count)
223223
{
224224
bd_addr_t addr = block * _bd->get_erase_size();
225225
bd_size_t size = count * _bd->get_erase_size();
@@ -434,7 +434,7 @@ void USBMSD::_control(const setup_packet_t *setup)
434434
break;
435435
case MSC_REQUEST_GET_MAX_LUN:
436436
result = Send;
437-
data = (uint8_t*)maxLUN;
437+
data = (uint8_t *)maxLUN;
438438
size = 1;
439439
break;
440440
default:

usb/device/USBMSD/USBMSD.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ class USBMSD: public USBDevice {
181181
};
182182

183183
// Bulk-only CBW
184-
typedef MBED_PACKED(struct) {
184+
typedef MBED_PACKED(struct)
185+
{
185186
uint32_t Signature;
186187
uint32_t Tag;
187188
uint32_t DataLength;
@@ -192,7 +193,8 @@ class USBMSD: public USBDevice {
192193
} CBW;
193194

194195
// Bulk-only CSW
195-
typedef MBED_PACKED(struct) {
196+
typedef MBED_PACKED(struct)
197+
{
196198
uint32_t Signature;
197199
uint32_t Tag;
198200
uint32_t DataResidue;

usb/device/USBSerial/USBSerial.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class USBSerial: public USBCDC, public mbed::Stream {
5757
* @param product_release Your product_release (default: 0x0001)
5858
*
5959
*/
60-
USBSerial(bool connect_blocking=true, uint16_t vendor_id=0x1f00, uint16_t product_id=0x2012, uint16_t product_release=0x0001);
60+
USBSerial(bool connect_blocking = true, uint16_t vendor_id = 0x1f00, uint16_t product_id = 0x2012, uint16_t product_release = 0x0001);
6161

6262
/**
6363
* Fully featured constructor
@@ -76,7 +76,7 @@ class USBSerial: public USBCDC, public mbed::Stream {
7676
* @param product_release Your product_release (default: 0x0001)
7777
*
7878
*/
79-
USBSerial(USBPhy *phy, uint16_t vendor_id=0x1f00, uint16_t product_id=0x2012, uint16_t product_release=0x0001);
79+
USBSerial(USBPhy *phy, uint16_t vendor_id = 0x1f00, uint16_t product_id = 0x2012, uint16_t product_release = 0x0001);
8080

8181
/**
8282
* Destroy this object

0 commit comments

Comments
 (0)