Skip to content

Commit 4ad143a

Browse files
committed
Typo corrections
1 parent ae20d14 commit 4ad143a

File tree

15 files changed

+24
-53
lines changed

15 files changed

+24
-53
lines changed

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/gpio_api.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,13 @@ uint32_t gpio_set(PinName pin) {
4242
}
4343

4444
void gpio_init(gpio_t *obj, PinName pin, PinDirection direction) {
45-
GPIO_TypeDef *gpio;
46-
4745
if (pin == NC) return;
4846

4947
uint32_t port_index = STM_PORT(pin);
5048

5149
// Enable GPIO clock
5250
uint32_t gpio_add = Set_GPIO_Clock(port_index);
53-
gpio = (GPIO_TypeDef *)gpio_add;
51+
GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add;
5452

5553
// Fill GPIO object structure for future use
5654
obj->pin = pin;

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/gpio_irq_api.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ static uint32_t channel_pin[CHANNEL_NUM] = {0, 0, 0};
4848
static gpio_irq_handler irq_handler;
4949

5050
static void handle_interrupt_in(uint32_t irq_index) {
51-
5251
// Retrieve the gpio and pin that generate the irq
5352
GPIO_TypeDef *gpio = (GPIO_TypeDef *)(channel_gpio[irq_index]);
5453
uint32_t pin = (uint32_t)(1 << channel_pin[irq_index]);

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/pinmap.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include "pinmap.h"
3131
#include "error.h"
3232

33-
// Not an API function
3433
// Enable GPIO clock and return GPIO base address
3534
uint32_t Set_GPIO_Clock(uint32_t port_idx) {
3635
uint32_t gpio_add = 0;
@@ -66,9 +65,6 @@ uint32_t Set_GPIO_Clock(uint32_t port_idx) {
6665
* Configure pin (mode, speed, output type and pull-up/pull-down)
6766
*/
6867
void pin_function(PinName pin, int data) {
69-
GPIO_TypeDef *gpio;
70-
GPIO_InitTypeDef GPIO_InitStructure;
71-
7268
if (pin == NC) return;
7369

7470
// Get the pin informations
@@ -82,7 +78,7 @@ void pin_function(PinName pin, int data) {
8278

8379
// Enable GPIO clock
8480
uint32_t gpio_add = Set_GPIO_Clock(port_index);
85-
gpio = (GPIO_TypeDef *)gpio_add;
81+
GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add;
8682

8783
// Configure Alternate Function
8884
// Warning: Must be done before the GPIO is initialized
@@ -91,6 +87,7 @@ void pin_function(PinName pin, int data) {
9187
}
9288

9389
// Configure GPIO
90+
GPIO_InitTypeDef GPIO_InitStructure;
9491
GPIO_InitStructure.GPIO_Pin = (uint16_t)(1 << pin_index);
9592
GPIO_InitStructure.GPIO_Mode = (GPIOMode_TypeDef)mode;
9693
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_Level_3;
@@ -113,16 +110,14 @@ void pin_function(PinName pin, int data) {
113110
* Configure pin pull-up/pull-down
114111
*/
115112
void pin_mode(PinName pin, PinMode mode) {
116-
GPIO_TypeDef *gpio;
117-
118113
if (pin == NC) return;
119114

120115
uint32_t port_index = STM_PORT(pin);
121116
uint32_t pin_index = STM_PIN(pin);
122117

123118
// Enable GPIO clock
124119
uint32_t gpio_add = Set_GPIO_Clock(port_index);
125-
gpio = (GPIO_TypeDef *)gpio_add;
120+
GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add;
126121

127122
// Configure pull-up/pull-down resistors
128123
uint32_t pupd = (uint32_t)mode;

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/port_api.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,11 @@ PinName port_pin(PortName port, int pin_n) {
4343
}
4444

4545
void port_init(port_t *obj, PortName port, int mask, PinDirection dir) {
46-
GPIO_TypeDef *gpio;
47-
48-
uint32_t port_index = (uint32_t)port; // (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, ...)
46+
uint32_t port_index = (uint32_t)port;
4947

5048
// Enable GPIO clock
5149
uint32_t gpio_add = Set_GPIO_Clock(port_index);
52-
gpio = (GPIO_TypeDef *)gpio_add;
50+
GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add;
5351

5452
// Fill PORT object structure for future use
5553
obj->port = port;

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/sleep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void sleep(void)
3838
SCB->SCR = 0; // Normal sleep mode for ARM core
3939
__WFI();
4040

41-
// Re-ensable us_ticker update interrupt
41+
// Re-enable us_ticker update interrupt
4242
TIM_ITConfig(TIM1, TIM_IT_Update, ENABLE);
4343
}
4444

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/gpio_api.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,20 @@ uint32_t gpio_set(PinName pin) {
4242
}
4343

4444
void gpio_init(gpio_t *obj, PinName pin, PinDirection direction) {
45-
GPIO_TypeDef *gpio;
46-
4745
if (pin == NC) return;
4846

4947
uint32_t port_index = STM_PORT(pin);
5048

5149
// Enable GPIO clock
5250
uint32_t gpio_add = Set_GPIO_Clock(port_index);
53-
gpio = (GPIO_TypeDef *)gpio_add;
51+
GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add;
5452

5553
// Fill GPIO object structure for future use
5654
obj->pin = pin;
5755
obj->mask = gpio_set(pin);
5856
obj->reg_in = &gpio->IDR;
5957
obj->reg_set = &gpio->BSRR;
60-
obj->reg_clr = &gpio->BRR;
58+
obj->reg_clr = &gpio->BRR;
6159

6260
// Configure GPIO
6361
if (direction == PIN_OUTPUT) {

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/gpio_irq_api.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ static uint32_t channel_pin[CHANNEL_NUM] = {0, 0, 0, 0};
4848
static gpio_irq_handler irq_handler;
4949

5050
static void handle_interrupt_in(uint32_t irq_index) {
51-
5251
// Retrieve the gpio and pin that generate the irq
5352
GPIO_TypeDef *gpio = (GPIO_TypeDef *)(channel_gpio[irq_index]);
5453
uint32_t pin = (uint32_t)(1 << channel_pin[irq_index]);

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/pinmap.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ static const uint32_t AF_mapping[] = {
4343
GPIO_Remap_I2C1 // 8
4444
};
4545

46-
// Not an API function
4746
// Enable GPIO clock and return GPIO base address
4847
uint32_t Set_GPIO_Clock(uint32_t port_idx) {
4948
uint32_t gpio_add = 0;
@@ -75,9 +74,6 @@ uint32_t Set_GPIO_Clock(uint32_t port_idx) {
7574
* Configure pin (input, output, alternate function or analog) + output speed + AF
7675
*/
7776
void pin_function(PinName pin, int data) {
78-
GPIO_TypeDef *gpio;
79-
GPIO_InitTypeDef GPIO_InitStructure;
80-
8177
if (pin == NC) return;
8278

8379
// Get the pin informations
@@ -89,7 +85,7 @@ void pin_function(PinName pin, int data) {
8985

9086
// Enable GPIO clock
9187
uint32_t gpio_add = Set_GPIO_Clock(port_index);
92-
gpio = (GPIO_TypeDef *)gpio_add;
88+
GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add;
9389

9490
// Enable AFIO clock
9591
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
@@ -101,6 +97,7 @@ void pin_function(PinName pin, int data) {
10197
}
10298

10399
// Configure GPIO
100+
GPIO_InitTypeDef GPIO_InitStructure;
104101
GPIO_InitStructure.GPIO_Pin = (uint16_t)(1 << pin_index);
105102
GPIO_InitStructure.GPIO_Mode = (GPIOMode_TypeDef)mode;
106103
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
@@ -120,17 +117,16 @@ void pin_function(PinName pin, int data) {
120117
* Configure pin pull-up/pull-down
121118
*/
122119
void pin_mode(PinName pin, PinMode mode) {
123-
GPIO_TypeDef *gpio;
124120
GPIO_InitTypeDef GPIO_InitStructure;
125-
121+
126122
if (pin == NC) return;
127123

128124
uint32_t port_index = STM_PORT(pin);
129125
uint32_t pin_index = STM_PIN(pin);
130126

131127
// Enable GPIO clock
132128
uint32_t gpio_add = Set_GPIO_Clock(port_index);
133-
gpio = (GPIO_TypeDef *)gpio_add;
129+
GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add;
134130

135131
// Configure open-drain and pull-up/down
136132
switch (mode) {

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/port_api.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,11 @@ PinName port_pin(PortName port, int pin_n) {
4343
}
4444

4545
void port_init(port_t *obj, PortName port, int mask, PinDirection dir) {
46-
GPIO_TypeDef *gpio;
47-
48-
uint32_t port_index = (uint32_t)port; // (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, ...)
46+
uint32_t port_index = (uint32_t)port;
4947

5048
// Enable GPIO clock
5149
uint32_t gpio_add = Set_GPIO_Clock(port_index);
52-
gpio = (GPIO_TypeDef *)gpio_add;
50+
GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add;
5351

5452
// Fill PORT object structure for future use
5553
obj->port = port;

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/sleep.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void sleep(void)
3838
SCB->SCR = 0; // Normal sleep mode for ARM core
3939
__WFI();
4040

41-
// Re-ensable us_ticker update interrupt
41+
// Re-enable us_ticker update interrupt
4242
TIM_ITConfig(TIM1, TIM_IT_Update, ENABLE);
4343
}
4444

@@ -53,6 +53,6 @@ void deepsleep(void)
5353
// Request to enter STOP mode with regulator in low power mode
5454
PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);
5555

56-
// Re-ensable us_ticker update interrupt
56+
// Re-enable us_ticker update interrupt
5757
TIM_ITConfig(TIM1, TIM_IT_Update, ENABLE);
5858
}

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/gpio_api.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,13 @@ uint32_t gpio_set(PinName pin) {
4242
}
4343

4444
void gpio_init(gpio_t *obj, PinName pin, PinDirection direction) {
45-
GPIO_TypeDef *gpio;
46-
4745
if (pin == NC) return;
4846

4947
uint32_t port_index = STM_PORT(pin);
5048

5149
// Enable GPIO clock
5250
uint32_t gpio_add = Set_GPIO_Clock(port_index);
53-
gpio = (GPIO_TypeDef *)gpio_add;
51+
GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add;
5452

5553
// Fill GPIO object structure for future use
5654
obj->pin = pin;

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/gpio_irq_api.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ static uint32_t channel_pin[CHANNEL_NUM] = {0, 0, 0, 0};
4848
static gpio_irq_handler irq_handler;
4949

5050
static void handle_interrupt_in(uint32_t irq_index) {
51-
5251
// Retrieve the gpio and pin that generate the irq
5352
GPIO_TypeDef *gpio = (GPIO_TypeDef *)(channel_gpio[irq_index]);
5453
uint32_t pin = (uint32_t)(1 << channel_pin[irq_index]);

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/pinmap.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include "pinmap.h"
3131
#include "error.h"
3232

33-
// Not an API function
3433
// Enable GPIO clock and return GPIO base address
3534
uint32_t Set_GPIO_Clock(uint32_t port_idx) {
3635
uint32_t gpio_add = 0;
@@ -66,9 +65,6 @@ uint32_t Set_GPIO_Clock(uint32_t port_idx) {
6665
* Configure pin (mode, speed, output type and pull-up/pull-down)
6766
*/
6867
void pin_function(PinName pin, int data) {
69-
GPIO_TypeDef *gpio;
70-
GPIO_InitTypeDef GPIO_InitStructure;
71-
7268
if (pin == NC) return;
7369

7470
// Get the pin informations
@@ -82,7 +78,7 @@ void pin_function(PinName pin, int data) {
8278

8379
// Enable GPIO clock
8480
uint32_t gpio_add = Set_GPIO_Clock(port_index);
85-
gpio = (GPIO_TypeDef *)gpio_add;
81+
GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add;
8682

8783
// Configure Alternate Function
8884
// Warning: Must be done before the GPIO is initialized
@@ -91,6 +87,7 @@ void pin_function(PinName pin, int data) {
9187
}
9288

9389
// Configure GPIO
90+
GPIO_InitTypeDef GPIO_InitStructure;
9491
GPIO_InitStructure.GPIO_Pin = (uint16_t)(1 << pin_index);
9592
GPIO_InitStructure.GPIO_Mode = (GPIOMode_TypeDef)mode;
9693
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_40MHz;
@@ -113,16 +110,14 @@ void pin_function(PinName pin, int data) {
113110
* Configure pin pull-up/pull-down
114111
*/
115112
void pin_mode(PinName pin, PinMode mode) {
116-
GPIO_TypeDef *gpio;
117-
118113
if (pin == NC) return;
119114

120115
uint32_t port_index = STM_PORT(pin);
121116
uint32_t pin_index = STM_PIN(pin);
122117

123118
// Enable GPIO clock
124119
uint32_t gpio_add = Set_GPIO_Clock(port_index);
125-
gpio = (GPIO_TypeDef *)gpio_add;
120+
GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add;
126121

127122
// Configure pull-up/pull-down resistors
128123
uint32_t pupd = (uint32_t)mode;

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/port_api.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,11 @@ PinName port_pin(PortName port, int pin_n) {
4343
}
4444

4545
void port_init(port_t *obj, PortName port, int mask, PinDirection dir) {
46-
GPIO_TypeDef *gpio;
47-
48-
uint32_t port_index = (uint32_t)port; // (0=A, 1=B, 2=C, 3=D, 4=E, 5=F, ...)
46+
uint32_t port_index = (uint32_t)port;
4947

5048
// Enable GPIO clock
5149
uint32_t gpio_add = Set_GPIO_Clock(port_index);
52-
gpio = (GPIO_TypeDef *)gpio_add;
50+
GPIO_TypeDef *gpio = (GPIO_TypeDef *)gpio_add;
5351

5452
// Fill PORT object structure for future use
5553
obj->port = port;

libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/sleep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void sleep(void)
111111
// Request to enter SLEEP mode with regulator ON
112112
PWR_EnterSleepMode(PWR_Regulator_ON, PWR_SLEEPEntry_WFI);
113113

114-
// Re-ensable us_ticker update interrupt
114+
// Re-enable us_ticker update interrupt
115115
TIM_ITConfig(TIM9, TIM_IT_Update, ENABLE);
116116
}
117117

0 commit comments

Comments
 (0)