diff options
Diffstat (limited to 'gpio/pin.h')
-rw-r--r-- | gpio/pin.h | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -36,6 +36,13 @@ class Pin { PullDown, }; + enum Speed { + Low, + Medium, + Fast, + High, + }; + void set_mode(Mode m) { #if defined(STM32F1) if(n < 8) { @@ -78,6 +85,10 @@ class Pin { #endif } + void set_speed(Speed s) { + g.OSPEEDR = (g.OSPEEDR & ~(3 << (n * 2))) | s << (n * 2); + } + void on() { g.BSRR = 1 << n; } |