Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
externalin.cpp
00001 #include "externalin.h" 00002 00003 ExternalIn::ExternalIn(PCA9555 *ioExt, unsigned int pin) 00004 : extIO(ioExt), inPin(pin) { 00005 00006 pinState = false; 00007 00008 extIO->change(this, &ExternalIn::callChange); 00009 } 00010 00011 ExternalIn::ExternalIn(PCA9555 *ioExt, unsigned int pin, bool defaultState) 00012 : extIO(ioExt), inPin(pin), pinState(defaultState) { 00013 00014 extIO->change(this, &ExternalIn::callChange); 00015 } 00016 00017 bool ExternalIn::read() { 00018 return extIO->getPin(inPin); 00019 } 00020 00021 void ExternalIn::setState(bool newState) { 00022 bool oldState = pinState; 00023 pinState = newState; 00024 /*if (oldState != newState) { 00025 _callbackChange.call(); 00026 }*/ 00027 } 00028 00029 void ExternalIn::change(void (*function)(void)) { 00030 _callbackChange.attach(function); 00031 } 00032 /* 00033 template<typename T> 00034 void BallSens::change(T *object, void (T::*member)(void)) { 00035 _callbackChange.attach(object, member); 00036 } 00037 */ 00038 void ExternalIn::callChange(void) { 00039 //setState((extIO->read() & ((unsigned int)1 << inPin)) > 0); 00040 _callbackChange.call(); 00041 }
Generated on Wed Jul 13 2022 02:15:07 by
1.7.2