Skip to content

Commit d7902e5

Browse files
committed
Style consistency
Correcting the style format errors. Also updating the copyright year.
1 parent 32ecd00 commit d7902e5

File tree

1 file changed

+15
-26
lines changed

1 file changed

+15
-26
lines changed

targets/TARGET_STM/pinmap.c

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* mbed Microcontroller Library
22
*******************************************************************************
3-
* Copyright (c) 2014, STMicroelectronics
3+
* Copyright (c) 2017, STMicroelectronics
44
* All rights reserved.
55
*
66
* Redistribution and use in source and binary forms, with or without
@@ -35,8 +35,7 @@
3535

3636
extern GPIO_TypeDef *Set_GPIO_Clock(uint32_t port_idx);
3737

38-
const uint32_t ll_pin_defines[16] =
39-
{
38+
const uint32_t ll_pin_defines[16] = {
4039
LL_GPIO_PIN_0,
4140
LL_GPIO_PIN_1,
4241
LL_GPIO_PIN_2,
@@ -58,7 +57,8 @@ const uint32_t ll_pin_defines[16] =
5857
/**
5958
* Configure pin (mode, speed, output type and pull-up/pull-down)
6059
*/
61-
void pin_function(PinName pin, int data) {
60+
void pin_function(PinName pin, int data)
61+
{
6262
MBED_ASSERT(pin != (PinName)NC);
6363

6464
// Get the pin informations
@@ -71,8 +71,7 @@ void pin_function(PinName pin, int data) {
7171
// Enable GPIO clock
7272
GPIO_TypeDef *gpio = Set_GPIO_Clock(port);
7373

74-
switch (mode)
75-
{
74+
switch (mode) {
7675
case STM_PIN_INPUT:
7776
ll_mode = LL_GPIO_MODE_INPUT;
7877
break;
@@ -95,24 +94,22 @@ void pin_function(PinName pin, int data) {
9594

9695
#if defined(GPIO_ASCR_ASC0)
9796
/* For families where Analog Control ASC0 register is present */
98-
if (STM_PIN_ANALOG_CONTROL(data))
99-
{
97+
if (STM_PIN_ANALOG_CONTROL(data)) {
10098
LL_GPIO_EnablePinAnalogControl(gpio, ll_pin);
101-
}
102-
else
103-
{
99+
} else {
104100
LL_GPIO_DisablePinAnalogControl(gpio, ll_pin);
105101
}
106102
#endif
107103

108104
/* For now by default use Speed HIGH for output or alt modes */
109105
if ((mode == STM_PIN_OUTPUT) ||(mode == STM_PIN_ALTERNATE)) {
110106
LL_GPIO_SetPinSpeed(gpio, ll_pin, LL_GPIO_SPEED_FREQ_HIGH);
111-
if (STM_PIN_OD(data))
107+
if (STM_PIN_OD(data)) {
112108
LL_GPIO_SetPinOutputType(gpio, ll_pin, LL_GPIO_OUTPUT_OPENDRAIN);
113-
else
109+
} else {
114110
LL_GPIO_SetPinOutputType(gpio, ll_pin, LL_GPIO_OUTPUT_PUSHPULL);
115111
}
112+
}
116113

117114
stm_pin_PullConfig(gpio, ll_pin, STM_PIN_PUPD(data));
118115

@@ -134,26 +131,18 @@ void pin_mode(PinName pin, PinMode mode)
134131

135132
if ((function == LL_GPIO_MODE_OUTPUT) || (function == LL_GPIO_MODE_ALTERNATE))
136133
{
137-
if ((mode == OpenDrainNoPull) || (mode == OpenDrainPullUp) || (mode == OpenDrainPullDown))
138-
{
134+
if ((mode == OpenDrainNoPull) || (mode == OpenDrainPullUp) || (mode == OpenDrainPullDown)) {
139135
LL_GPIO_SetPinOutputType(gpio, ll_pin, LL_GPIO_OUTPUT_OPENDRAIN);
140-
}
141-
else
142-
{
136+
} else {
143137
LL_GPIO_SetPinOutputType(gpio, ll_pin, LL_GPIO_OUTPUT_PUSHPULL);
144138
}
145139
}
146140

147-
if ((mode == OpenDrainPullUp) || (mode == PullUp))
148-
{
141+
if ((mode == OpenDrainPullUp) || (mode == PullUp)) {
149142
stm_pin_PullConfig(gpio, ll_pin, GPIO_PULLUP);
150-
}
151-
else if ((mode == OpenDrainPullDown) || (mode == PullDown))
152-
{
143+
} else if ((mode == OpenDrainPullDown) || (mode == PullDown)) {
153144
stm_pin_PullConfig(gpio, ll_pin, GPIO_PULLDOWN);
154-
}
155-
else
156-
{
145+
} else {
157146
stm_pin_PullConfig(gpio, ll_pin, GPIO_NOPULL);
158147
}
159148
}

0 commit comments

Comments
 (0)