From 943006daefeca420749768a4d4e9810a258f2b92 Mon Sep 17 00:00:00 2001 From: Perry Hung Date: Tue, 21 Sep 2010 20:22:17 -0400 Subject: 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. --- wirish/io.h | 3 ++- wirish/wirish_digital.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3