12 #ifndef SOURCE_CHIP_STM32_PERIPHERALS_GPIOV2_INCLUDE_DISTORTOS_CHIP_STM32_GPIOV2_HPP_ 13 #define SOURCE_CHIP_STM32_PERIPHERALS_GPIOV2_INCLUDE_DISTORTOS_CHIP_STM32_GPIOV2_HPP_ 30 static_assert((GPIOA_BASE & 15) == 0,
"Cannot combine pin number with GPIOA address!");
34 static_assert((GPIOB_BASE & 15) == 0,
"Cannot combine pin number with GPIOB address!");
38 static_assert((GPIOC_BASE & 15) == 0,
"Cannot combine pin number with GPIOC address!");
42 static_assert((GPIOD_BASE & 15) == 0,
"Cannot combine pin number with GPIOD address!");
46 static_assert((GPIOE_BASE & 15) == 0,
"Cannot combine pin number with GPIOE address!");
50 static_assert((GPIOF_BASE & 15) == 0,
"Cannot combine pin number with GPIOF address!");
54 static_assert((GPIOG_BASE & 15) == 0,
"Cannot combine pin number with GPIOG address!");
58 static_assert((GPIOH_BASE & 15) == 0,
"Cannot combine pin number with GPIOH address!");
62 static_assert((GPIOI_BASE & 15) == 0,
"Cannot combine pin number with GPIOI address!");
66 static_assert((GPIOJ_BASE & 15) == 0,
"Cannot combine pin number with GPIOJ address!");
70 static_assert((GPIOK_BASE & 15) == 0,
"Cannot combine pin number with GPIOK address!");
74 enum class Pin : uint32_t
99 pa10 = GPIOA_BASE | 10,
101 pa11 = GPIOA_BASE | 11,
103 pa12 = GPIOA_BASE | 12,
105 pa13 = GPIOA_BASE | 13,
107 pa14 = GPIOA_BASE | 14,
109 pa15 = GPIOA_BASE | 15,
116 pb0 = GPIOB_BASE | 0,
118 pb1 = GPIOB_BASE | 1,
120 pb2 = GPIOB_BASE | 2,
122 pb3 = GPIOB_BASE | 3,
124 pb4 = GPIOB_BASE | 4,
126 pb5 = GPIOB_BASE | 5,
128 pb6 = GPIOB_BASE | 6,
130 pb7 = GPIOB_BASE | 7,
132 pb8 = GPIOB_BASE | 8,
134 pb9 = GPIOB_BASE | 9,
136 pb10 = GPIOB_BASE | 10,
138 pb11 = GPIOB_BASE | 11,
140 pb12 = GPIOB_BASE | 12,
142 pb13 = GPIOB_BASE | 13,
144 pb14 = GPIOB_BASE | 14,
146 pb15 = GPIOB_BASE | 15,
153 pc0 = GPIOC_BASE | 0,
155 pc1 = GPIOC_BASE | 1,
157 pc2 = GPIOC_BASE | 2,
159 pc3 = GPIOC_BASE | 3,
161 pc4 = GPIOC_BASE | 4,
163 pc5 = GPIOC_BASE | 5,
165 pc6 = GPIOC_BASE | 6,
167 pc7 = GPIOC_BASE | 7,
169 pc8 = GPIOC_BASE | 8,
171 pc9 = GPIOC_BASE | 9,
173 pc10 = GPIOC_BASE | 10,
175 pc11 = GPIOC_BASE | 11,
177 pc12 = GPIOC_BASE | 12,
179 pc13 = GPIOC_BASE | 13,
181 pc14 = GPIOC_BASE | 14,
183 pc15 = GPIOC_BASE | 15,
190 pd0 = GPIOD_BASE | 0,
192 pd1 = GPIOD_BASE | 1,
194 pd2 = GPIOD_BASE | 2,
196 pd3 = GPIOD_BASE | 3,
198 pd4 = GPIOD_BASE | 4,
200 pd5 = GPIOD_BASE | 5,
202 pd6 = GPIOD_BASE | 6,
204 pd7 = GPIOD_BASE | 7,
206 pd8 = GPIOD_BASE | 8,
208 pd9 = GPIOD_BASE | 9,
210 pd10 = GPIOD_BASE | 10,
212 pd11 = GPIOD_BASE | 11,
214 pd12 = GPIOD_BASE | 12,
216 pd13 = GPIOD_BASE | 13,
218 pd14 = GPIOD_BASE | 14,
220 pd15 = GPIOD_BASE | 15,
227 pe0 = GPIOE_BASE | 0,
229 pe1 = GPIOE_BASE | 1,
231 pe2 = GPIOE_BASE | 2,
233 pe3 = GPIOE_BASE | 3,
235 pe4 = GPIOE_BASE | 4,
237 pe5 = GPIOE_BASE | 5,
239 pe6 = GPIOE_BASE | 6,
241 pe7 = GPIOE_BASE | 7,
243 pe8 = GPIOE_BASE | 8,
245 pe9 = GPIOE_BASE | 9,
247 pe10 = GPIOE_BASE | 10,
249 pe11 = GPIOE_BASE | 11,
251 pe12 = GPIOE_BASE | 12,
253 pe13 = GPIOE_BASE | 13,
255 pe14 = GPIOE_BASE | 14,
257 pe15 = GPIOE_BASE | 15,
264 pf0 = GPIOF_BASE | 0,
266 pf1 = GPIOF_BASE | 1,
268 pf2 = GPIOF_BASE | 2,
270 pf3 = GPIOF_BASE | 3,
272 pf4 = GPIOF_BASE | 4,
274 pf5 = GPIOF_BASE | 5,
276 pf6 = GPIOF_BASE | 6,
278 pf7 = GPIOF_BASE | 7,
280 pf8 = GPIOF_BASE | 8,
282 pf9 = GPIOF_BASE | 9,
284 pf10 = GPIOF_BASE | 10,
286 pf11 = GPIOF_BASE | 11,
288 pf12 = GPIOF_BASE | 12,
290 pf13 = GPIOF_BASE | 13,
292 pf14 = GPIOF_BASE | 14,
294 pf15 = GPIOF_BASE | 15,
301 pg0 = GPIOG_BASE | 0,
303 pg1 = GPIOG_BASE | 1,
305 pg2 = GPIOG_BASE | 2,
307 pg3 = GPIOG_BASE | 3,
309 pg4 = GPIOG_BASE | 4,
311 pg5 = GPIOG_BASE | 5,
313 pg6 = GPIOG_BASE | 6,
315 pg7 = GPIOG_BASE | 7,
317 pg8 = GPIOG_BASE | 8,
319 pg9 = GPIOG_BASE | 9,
321 pg10 = GPIOG_BASE | 10,
323 pg11 = GPIOG_BASE | 11,
325 pg12 = GPIOG_BASE | 12,
327 pg13 = GPIOG_BASE | 13,
329 pg14 = GPIOG_BASE | 14,
331 pg15 = GPIOG_BASE | 15,
338 ph0 = GPIOH_BASE | 0,
340 ph1 = GPIOH_BASE | 1,
342 ph2 = GPIOH_BASE | 2,
344 ph3 = GPIOH_BASE | 3,
346 ph4 = GPIOH_BASE | 4,
348 ph5 = GPIOH_BASE | 5,
350 ph6 = GPIOH_BASE | 6,
352 ph7 = GPIOH_BASE | 7,
354 ph8 = GPIOH_BASE | 8,
356 ph9 = GPIOH_BASE | 9,
358 ph10 = GPIOH_BASE | 10,
360 ph11 = GPIOH_BASE | 11,
362 ph12 = GPIOH_BASE | 12,
364 ph13 = GPIOH_BASE | 13,
366 ph14 = GPIOH_BASE | 14,
368 ph15 = GPIOH_BASE | 15,
375 pi0 = GPIOI_BASE | 0,
377 pi1 = GPIOI_BASE | 1,
379 pi2 = GPIOI_BASE | 2,
381 pi3 = GPIOI_BASE | 3,
383 pi4 = GPIOI_BASE | 4,
385 pi5 = GPIOI_BASE | 5,
387 pi6 = GPIOI_BASE | 6,
389 pi7 = GPIOI_BASE | 7,
391 pi8 = GPIOI_BASE | 8,
393 pi9 = GPIOI_BASE | 9,
395 pi10 = GPIOI_BASE | 10,
397 pi11 = GPIOI_BASE | 11,
399 pi12 = GPIOI_BASE | 12,
401 pi13 = GPIOI_BASE | 13,
403 pi14 = GPIOI_BASE | 14,
405 pi15 = GPIOI_BASE | 15,
412 pj0 = GPIOJ_BASE | 0,
414 pj1 = GPIOJ_BASE | 1,
416 pj2 = GPIOJ_BASE | 2,
418 pj3 = GPIOJ_BASE | 3,
420 pj4 = GPIOJ_BASE | 4,
422 pj5 = GPIOJ_BASE | 5,
424 pj6 = GPIOJ_BASE | 6,
426 pj7 = GPIOJ_BASE | 7,
428 pj8 = GPIOJ_BASE | 8,
430 pj9 = GPIOJ_BASE | 9,
432 pj10 = GPIOJ_BASE | 10,
434 pj11 = GPIOJ_BASE | 11,
436 pj12 = GPIOJ_BASE | 12,
438 pj13 = GPIOJ_BASE | 13,
440 pj14 = GPIOJ_BASE | 14,
442 pj15 = GPIOJ_BASE | 15,
449 pk0 = GPIOK_BASE | 0,
451 pk1 = GPIOK_BASE | 1,
453 pk2 = GPIOK_BASE | 2,
455 pk3 = GPIOK_BASE | 3,
457 pk4 = GPIOK_BASE | 4,
459 pk5 = GPIOK_BASE | 5,
461 pk6 = GPIOK_BASE | 6,
463 pk7 = GPIOK_BASE | 7,
465 pk8 = GPIOK_BASE | 8,
467 pk9 = GPIOK_BASE | 9,
469 pk10 = GPIOK_BASE | 10,
471 pk11 = GPIOK_BASE | 11,
473 pk12 = GPIOK_BASE | 12,
475 pk13 = GPIOK_BASE | 13,
477 pk14 = GPIOK_BASE | 14,
479 pk15 = GPIOK_BASE | 15,
503 #ifdef DISTORTOS_CHIP_GPIO_HAS_4_AF_BITS 520 #endif // def DISTORTOS_CHIP_GPIO_HAS_4_AF_BITS 543 #ifdef DISTORTOS_CHIP_GPIO_HAS_HIGH_SPEED 546 #endif // def DISTORTOS_CHIP_GPIO_HAS_HIGH_SPEED 631 const PinPull pull = {},
const bool initialState = {})
646 return std::make_pair(reinterpret_cast<GPIO_TypeDef*>(static_cast<uint32_t>(pin) & ~15),
647 static_cast<uint32_t>(pin) & 15);
654 #endif // SOURCE_CHIP_STM32_PERIPHERALS_GPIOV2_INCLUDE_DISTORTOS_CHIP_STM32_GPIOV2_HPP_
PinAlternateFunction
all possible alternate functions of pin
Definition: STM32-GPIOv2.hpp:485
constexpr std::pair< GPIO_TypeDef *, uint8_t > decodePin(const Pin pin)
Decodes pin identifier into address of associated GPIO port and its pin number.
Definition: STM32-GPIOv2.hpp:644
CMSIS proxy header for STM32F4.
void configureAnalogPin(const Pin pin)
Configures pin for "analog" mode.
Definition: STM32-GPIOv2.hpp:603
PinPull
all possible pull-up/pull-down configurations of pin
Definition: STM32-GPIOv2.hpp:552
Top-level namespace of distortos project.
Definition: buttons.hpp:33
void configureOutputPin(const Pin pin, const bool openDrain={}, const PinOutputSpeed outputSpeed={}, const PinPull pull={}, const bool initialState={})
Configures pin for "output" mode.
Definition: STM32-GPIOv2.hpp:630
PinMode
all possible modes of pin
Definition: STM32-GPIOv2.hpp:524
PinOutputSpeed
all possible output speeds of pin
Definition: STM32-GPIOv2.hpp:537
void configureAlternateFunctionPin(const Pin pin, const PinAlternateFunction alternateFunction, const bool openDrain={}, const PinOutputSpeed outputSpeed={}, const PinPull pull={})
Configures pin for "alternate function" mode.
Definition: STM32-GPIOv2.hpp:591
void configureInputPin(const Pin pin, const PinPull pull={})
Configures pin for "input" mode.
Definition: STM32-GPIOv2.hpp:615
Pin
identifier of single pin - combined address of GPIO port with pin number
Definition: STM32-GPIOv2.hpp:74
void configurePin(Pin pin, PinMode mode, bool openDrain, PinOutputSpeed outputSpeed, PinPull pull, PinAlternateFunction alternateFunction, bool initialState={})
Configures pin.
Definition: STM32-GPIOv2.cpp:39