Skip to content

Commit c62250c

Browse files
committed
Fix compiler warning: assignment makes pointer from integer without a cast
Fix #44 cores/arduino/stm32/PortNames.c:38:22: warning: assignment makes pointer from integer without a cast [-Wint-conversion] gpioPort = GPIOA_BASE; Signed-off-by: Frederic.Pillon <[email protected]>
1 parent 06d8d46 commit c62250c

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

cores/arduino/stm32/PortNames.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -35,54 +35,54 @@ GPIO_TypeDef *get_GPIO_Port(uint32_t port_idx) {
3535
GPIO_TypeDef* gpioPort = 0;
3636
switch (port_idx) {
3737
case PortA:
38-
gpioPort = GPIOA_BASE;
38+
gpioPort = (GPIO_TypeDef *)GPIOA_BASE;
3939
break;
4040
case PortB:
41-
gpioPort = GPIOB_BASE;
41+
gpioPort = (GPIO_TypeDef *)GPIOB_BASE;
4242
break;
4343
#if defined GPIOC_BASE
4444
case PortC:
45-
gpioPort = GPIOC_BASE;
45+
gpioPort = (GPIO_TypeDef *)GPIOC_BASE;
4646
break;
4747
#endif
4848
#if defined GPIOD_BASE
4949
case PortD:
50-
gpioPort = GPIOD_BASE;
50+
gpioPort = (GPIO_TypeDef *)GPIOD_BASE;
5151
break;
5252
#endif
5353
#if defined GPIOE_BASE
5454
case PortE:
55-
gpioPort = GPIOE_BASE;
55+
gpioPort = (GPIO_TypeDef *)GPIOE_BASE;
5656
break;
5757
#endif
5858
#if defined GPIOF_BASE
5959
case PortF:
60-
gpioPort = GPIOF_BASE;
60+
gpioPort = (GPIO_TypeDef *)GPIOF_BASE;
6161
break;
6262
#endif
6363
#if defined GPIOG_BASE
6464
case PortG:
65-
gpioPort = GPIOG_BASE;
65+
gpioPort = (GPIO_TypeDef *)GPIOG_BASE;
6666
break;
6767
#endif
6868
#if defined GPIOH_BASE
6969
case PortH:
70-
gpioPort = GPIOH_BASE;
70+
gpioPort = (GPIO_TypeDef *)GPIOH_BASE;
7171
break;
7272
#endif
7373
#if defined GPIOI_BASE
7474
case PortI:
75-
gpioPort = GPIOI_BASE;
75+
gpioPort = (GPIO_TypeDef *)GPIOI_BASE;
7676
break;
7777
#endif
7878
#if defined GPIOJ_BASE
7979
case PortJ:
80-
gpioPort = GPIOJ_BASE;
80+
gpioPort = (GPIO_TypeDef *)GPIOJ_BASE;
8181
break;
8282
#endif
8383
#if defined GPIOK_BASE
8484
case PortK:
85-
gpioPort = GPIOK_BASE;
85+
gpioPort = (GPIO_TypeDef *)GPIOK_BASE;
8686
break;
8787
#endif
8888
default:
@@ -99,64 +99,64 @@ GPIO_TypeDef *set_GPIO_Port_Clock(uint32_t port_idx) {
9999
GPIO_TypeDef* gpioPort = 0;
100100
switch (port_idx) {
101101
case PortA:
102-
gpioPort = GPIOA_BASE;
102+
gpioPort = (GPIO_TypeDef *)GPIOA_BASE;
103103
__HAL_RCC_GPIOA_CLK_ENABLE();
104104
break;
105105
case PortB:
106-
gpioPort = GPIOB_BASE;
106+
gpioPort = (GPIO_TypeDef *)GPIOB_BASE;
107107
__HAL_RCC_GPIOB_CLK_ENABLE();
108108
break;
109109
#if defined GPIOC_BASE
110110
case PortC:
111-
gpioPort = GPIOC_BASE;
111+
gpioPort = (GPIO_TypeDef *)GPIOC_BASE;
112112
__HAL_RCC_GPIOC_CLK_ENABLE();
113113
break;
114114
#endif
115115
#if defined GPIOD_BASE
116116
case PortD:
117-
gpioPort = GPIOD_BASE;
117+
gpioPort = (GPIO_TypeDef *)GPIOD_BASE;
118118
__HAL_RCC_GPIOD_CLK_ENABLE();
119119
break;
120120
#endif
121121
#if defined GPIOE_BASE
122122
case PortE:
123-
gpioPort = GPIOE_BASE;
123+
gpioPort = (GPIO_TypeDef *)GPIOE_BASE;
124124
__HAL_RCC_GPIOE_CLK_ENABLE();
125125
break;
126126
#endif
127127
#if defined GPIOF_BASE
128128
case PortF:
129-
gpioPort = GPIOF_BASE;
129+
gpioPort = (GPIO_TypeDef *)GPIOF_BASE;
130130
__HAL_RCC_GPIOF_CLK_ENABLE();
131131
break;
132132
#endif
133133
#if defined GPIOG_BASE
134134
case PortG:
135-
gpioPort = GPIOG_BASE;
135+
gpioPort = (GPIO_TypeDef *)GPIOG_BASE;
136136
__HAL_RCC_GPIOG_CLK_ENABLE();
137137
break;
138138
#endif
139139
#if defined GPIOH_BASE
140140
case PortH:
141-
gpioPort = GPIOH_BASE;
141+
gpioPort = (GPIO_TypeDef *)GPIOH_BASE;
142142
__HAL_RCC_GPIOH_CLK_ENABLE();
143143
break;
144144
#endif
145145
#if defined GPIOI_BASE
146146
case PortI:
147-
gpioPort = GPIOI_BASE;
147+
gpioPort = (GPIO_TypeDef *)GPIOI_BASE;
148148
__HAL_RCC_GPIOI_CLK_ENABLE();
149149
break;
150150
#endif
151151
#if defined GPIOJ_BASE
152152
case PortJ:
153-
gpioPort = GPIOJ_BASE;
153+
gpioPort = (GPIO_TypeDef *)GPIOJ_BASE;
154154
__HAL_RCC_GPIOJ_CLK_ENABLE();
155155
break;
156156
#endif
157157
#if defined GPIOK_BASE
158158
case PortK:
159-
gpioPort = GPIOK_BASE;
159+
gpioPort = (GPIO_TypeDef *)GPIOK_BASE;
160160
__HAL_RCC_GPIOK_CLK_ENABLE();
161161
break;
162162
#endif

0 commit comments

Comments
 (0)