summaryrefslogtreecommitdiff
path: root/gpio/pin.h
diff options
context:
space:
mode:
Diffstat (limited to 'gpio/pin.h')
-rw-r--r--gpio/pin.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/gpio/pin.h b/gpio/pin.h
index 90026c3..aede480 100644
--- a/gpio/pin.h
+++ b/gpio/pin.h
@@ -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;
}