diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2012-01-22 10:53:16 +0100 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2012-01-22 10:53:16 +0100 |
commit | 653b809a0ff852c5f5184fd46a5364dd16ac2133 (patch) | |
tree | 8045c25f47c4141923fe211def08132184878b82 | |
parent | 005e0ba51aafb6b26383fbd7df9000399c79098d (diff) |
Added Pin::set_pull().
-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); |