ExternalIn

Dependents:   Telliskivi2_2014

Files at this revision

API Documentation at this revision

Comitter:
Reiko
Date:
Sun Nov 03 11:38:18 2013 +0000
Parent:
1:feaee10590b7
Commit message:
Added constructor with ability to specify initial state

Changed in this revision

externalin.cpp Show annotated file Show diff for this revision Revisions of this file
externalin.h Show annotated file Show diff for this revision Revisions of this file
diff -r feaee10590b7 -r 6c525c701aad externalin.cpp
--- a/externalin.cpp	Thu Sep 19 13:10:36 2013 +0000
+++ b/externalin.cpp	Sun Nov 03 11:38:18 2013 +0000
@@ -8,6 +8,12 @@
     extIO->change(this, &ExternalIn::callChange);
 }
 
+ExternalIn::ExternalIn(PCA9555 *ioExt, unsigned int pin, bool defaultState)
+    : extIO(ioExt), inPin(pin), pinState(defaultState) {
+    
+    extIO->change(this, &ExternalIn::callChange);
+}
+
 bool ExternalIn::read() {
     return extIO->getPin(inPin);
 }
diff -r feaee10590b7 -r 6c525c701aad externalin.h
--- a/externalin.h	Thu Sep 19 13:10:36 2013 +0000
+++ b/externalin.h	Sun Nov 03 11:38:18 2013 +0000
@@ -9,6 +9,7 @@
     FunctionPointer _callbackChange;
 public:
     ExternalIn(PCA9555 *ioExt, unsigned int pin);
+    ExternalIn(PCA9555 *ioExt, unsigned int pin, bool defaultState);
     bool read();
     
     void change(void (*function)(void));