From 48be688f451e81d2a81c76a85dadf18093e672ab Mon Sep 17 00:00:00 2001 From: Perry Hung Date: Mon, 22 Mar 2010 23:52:08 -0400 Subject: Added open-drain output and analog-input modes --- src/wiring/io.h | 18 ++---------------- src/wiring/wiring_digital.c | 5 +++++ 2 files changed, 7 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/wiring/io.h b/src/wiring/io.h index 9c226c5..a313b2b 100644 --- a/src/wiring/io.h +++ b/src/wiring/io.h @@ -94,29 +94,15 @@ extern "C"{ typedef enum WiringPinMode { OUTPUT, + OUTPUT_OPEN_DRAIN, INPUT, + INPUT_ANALOG, INPUT_PULLUP, INPUT_PULLDOWN, INPUT_FLOATING, PWM } WiringPinMode; -#if 0 -typedef enum PinMode { - INPUT_FLOATING, - INPUT_ANALOG, - INPUT_DIGITAL, - INPUT_PULLDOWN, - INPUT_PULLUP, - INPUT, - OUTPUT, - PWM, - SERIAL, - SPI, - I2C, -} PinMode; -#endif - /* Set pin to mode * pinMode(pin, mode): * pin -> {0-38, D0-D39, A0-16} diff --git a/src/wiring/wiring_digital.c b/src/wiring/wiring_digital.c index 71be17b..b1be9a5 100644 --- a/src/wiring/wiring_digital.c +++ b/src/wiring/wiring_digital.c @@ -97,10 +97,15 @@ void pinMode(uint8_t pin, WiringPinMode mode) { case OUTPUT: outputMode = GPIO_MODE_OUTPUT_PP; break; + case OUTPUT_OPEN_DRAIN: + outputMode = GPIO_MODE_OUTPUT_OD; + break; case INPUT: case INPUT_FLOATING: outputMode = GPIO_MODE_INPUT_FLOATING; break; + case INPUT_ANALOG: + outputMode = GPIO_MODE_INPUT_ANALOG; case INPUT_PULLUP: outputMode = GPIO_MODE_INPUT_PU; break; -- cgit v1.2.3