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.
ballsens.cpp
00001 #include "ballsens.h" 00002 00003 BallSens::BallSens(PCA9555 *ioExt, unsigned int ballPin) 00004 : extIO(ioExt), ballPinNumber(ballPin) { 00005 00006 ballState = false; 00007 00008 extIO->change(this, &BallSens::callChange); 00009 } 00010 00011 bool BallSens::read() { 00012 //return ballState; 00013 return (extIO->read() & 0x0400) > 0; 00014 } 00015 00016 void BallSens::setState(bool newState) { 00017 bool oldState = ballState; 00018 ballState = newState; 00019 /*if (oldState != newState) { 00020 _callbackChange.call(); 00021 }*/ 00022 } 00023 00024 void BallSens::change(void (*function)(void)) { 00025 _callbackChange.attach(function); 00026 } 00027 /* 00028 template<typename T> 00029 void BallSens::change(T *object, void (T::*member)(void)) { 00030 _callbackChange.attach(object, member); 00031 } 00032 */ 00033 void BallSens::callChange(void) { 00034 setState((extIO->read() & 0x0400) > 0); 00035 _callbackChange.call(); 00036 }
Generated on Tue Jul 19 2022 00:06:39 by
1.7.2