aboutsummaryrefslogtreecommitdiffstats
path: root/wirish
diff options
context:
space:
mode:
authorPerry Hung <iperry@gmail.com>2010-09-21 20:22:17 -0400
committerPerry Hung <iperry@gmail.com>2010-09-21 20:24:04 -0400
commit943006daefeca420749768a4d4e9810a258f2b92 (patch)
treed2bcc383965eeb7dad4faab584958fbaeb1bb2a9 /wirish
parentf2fd21628e79ac8e9289a1a8b8f7d11ad4797361 (diff)
downloadlibrambutan-943006daefeca420749768a4d4e9810a258f2b92.tar.gz
librambutan-943006daefeca420749768a4d4e9810a258f2b92.zip
Add PWM_OPEN_DRAIN option to pinMode()
Allow for alternate function open drain output mode to be accessed through the wirish interface. This allows for open drain to be used on PWM pins.
Diffstat (limited to 'wirish')
-rw-r--r--wirish/io.h3
-rw-r--r--wirish/wirish_digital.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/wirish/io.h b/wirish/io.h
index e779604..4aa1eef 100644
--- a/wirish/io.h
+++ b/wirish/io.h
@@ -47,7 +47,8 @@ typedef enum WiringPinMode {
INPUT_PULLUP,
INPUT_PULLDOWN,
INPUT_FLOATING,
- PWM
+ PWM,
+ PWM_OPEN_DRAIN,
} WiringPinMode;
diff --git a/wirish/wirish_digital.c b/wirish/wirish_digital.c
index c93c786..9dd46ed 100644
--- a/wirish/wirish_digital.c
+++ b/wirish/wirish_digital.c
@@ -58,6 +58,9 @@ void pinMode(uint8 pin, WiringPinMode mode) {
case PWM:
outputMode = GPIO_MODE_AF_OUTPUT_PP;
break;
+ case PWM_OPEN_DRAIN:
+ outputMode = GPIO_MODE_AF_OUTPUT_OD;
+ break;
default:
ASSERT(0);
return;