aboutsummaryrefslogtreecommitdiff
path: root/libraries/Wire/utility/twi.c
diff options
context:
space:
mode:
authorSandeep Mistry <s.mistry@arduino.cc>2015-08-25 10:24:24 -0400
committerSandeep Mistry <s.mistry@arduino.cc>2015-08-25 10:24:24 -0400
commiteab6601ebc4ff975086fe9a69a816f550b22b8f0 (patch)
treee0c4b603ae0d062dd575df48f2e7e03ba2e28665 /libraries/Wire/utility/twi.c
parentc25e80e27c013f5cb1a98b246f69d35b7e969b5a (diff)
implement Wire.end() for AVR core
Diffstat (limited to 'libraries/Wire/utility/twi.c')
-rw-r--r--libraries/Wire/utility/twi.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libraries/Wire/utility/twi.c b/libraries/Wire/utility/twi.c
index 201d7d1..d7d72bc 100644
--- a/libraries/Wire/utility/twi.c
+++ b/libraries/Wire/utility/twi.c
@@ -91,6 +91,22 @@ void twi_init(void)
}
/*
+ * Function twi_disable
+ * Desc disables twi pins
+ * Input none
+ * Output none
+ */
+void twi_disable(void)
+{
+ // disable twi module, acks, and twi interrupt
+ TWCR &= ~(_BV(TWEN) | _BV(TWIE) | _BV(TWEA));
+
+ // deactivate internal pullups for twi.
+ digitalWrite(SDA, 0);
+ digitalWrite(SCL, 0);
+}
+
+/*
* Function twi_slaveInit
* Desc sets slave address and enables interrupt
* Input none