diff options
Diffstat (limited to 'platforms/arm/stm32/fastpin_arm_stm32.h')
-rw-r--r-- | platforms/arm/stm32/fastpin_arm_stm32.h | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/platforms/arm/stm32/fastpin_arm_stm32.h b/platforms/arm/stm32/fastpin_arm_stm32.h index bb8981d3..c80390f3 100644 --- a/platforms/arm/stm32/fastpin_arm_stm32.h +++ b/platforms/arm/stm32/fastpin_arm_stm32.h @@ -56,22 +56,44 @@ public: }; #if defined(STM32F10X_MD) - #define _RD32(T) struct __gen_struct_ ## T { static __attribute__((always_inline)) inline volatile GPIO_TypeDef * r() { return T; } }; - #define _FL_IO(L) _RD32(GPIO ## L) + #define _R(T) struct __gen_struct_ ## T + #define _RD32(T) struct __gen_struct_ ## T { static __attribute__((always_inline)) inline volatile GPIO_TypeDef * r() { return T; } }; + #define _FL_IO(L,C) _RD32(GPIO ## L); __FL_DEFINE_PORT3(L, C, _R(GPIO ## L)); #elif defined(__STM32F1__) - #define _RD32(T) struct __gen_struct_ ## T { static __attribute__((always_inline)) inline gpio_reg_map* r() { return T->regs; } }; - #define _FL_IO(L) _RD32(GPIO ## L) + #define _R(T) struct __gen_struct_ ## T + #define _RD32(T) struct __gen_struct_ ## T { static __attribute__((always_inline)) inline gpio_reg_map* r() { return T->regs; } }; + #define _FL_IO(L,C) _RD32(GPIO ## L); __FL_DEFINE_PORT3(L, C, _R(GPIO ## L)); #else #error "Platform not supported" #endif -#define _R(T) struct __gen_struct_ ## T #define _FL_DEFPIN(PIN, BIT, L) template<> class FastPin<PIN> : public _ARMPIN<PIN, BIT, 1 << BIT, _R(GPIO ## L)> {}; +#ifdef GPIOA +_FL_IO(A,0); +#endif +#ifdef GPIOB +_FL_IO(B,1); +#endif +#ifdef GPIOC +_FL_IO(C,2); +#endif +#ifdef GPIOD +_FL_IO(D,3); +#endif +#ifdef GPIOE +_FL_IO(E,4); +#endif +#ifdef GPIOF +_FL_IO(F,5); +#endif +#ifdef GPIOG +_FL_IO(G,6); +#endif + // Actual pin definitions #if defined(SPARK) // Sparkfun STM32F103 based board -_FL_IO(A); _FL_IO(B); _FL_IO(C); _FL_IO(D); _FL_IO(E); _FL_IO(F); _FL_IO(G); #define MAX_PIN 19 @@ -106,8 +128,6 @@ _FL_DEFPIN(19, 2, A); #if defined(__STM32F1__) // Generic STM32F103 aka "Blue Pill" -_FL_IO(A); _FL_IO(B); _FL_IO(C); - #define MAX_PIN 46 _FL_DEFPIN(10, 0, A); // PA0 - PA7 |