diff options
Diffstat (limited to 'hal')
-rw-r--r-- | hal/pin.h | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -23,6 +23,12 @@ class Pin { OpenDrain, }; + enum Pull { + PullNone, + PullUp, + PullDown, + }; + void set_mode(Mode m) { g.MODER = (g.MODER & ~(3 << (n * 2))) | m << (n * 2); } @@ -35,6 +41,10 @@ class Pin { } } + void set_pull(Pull p) { + g.PUPDR = (g.PUPDR & ~(3 << (n * 2))) | p << (n * 2); + } + void set_af(int af) { if(n < 8) { g.AFRL = (g.AFRL & ~(0xf << (n * 4))) | af << (n * 4); |