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.
Dependencies: mbed CANBuffer Watchdog MODSERIAL mbed-rtos xbeeRelay IAP
Fork of SystemManagement by
Diff: Libs/PollSwitch/PollSwitch.cpp
- Revision:
- 36:0afc0fc8f86b
- Parent:
- 30:91af74a299e1
--- a/Libs/PollSwitch/PollSwitch.cpp Wed Jan 07 03:36:43 2015 +0000
+++ b/Libs/PollSwitch/PollSwitch.cpp Thu Jan 22 07:58:51 2015 +0000
@@ -1,6 +1,6 @@
#include "PollSwitch.h"
-PollSwitch::PollSwitch(LPCDigitalIn *swArr, int numSw){
+PollSwitch::PollSwitch(DigitalIn *swArr, int numSw){
numSwitches = numSw;
sw = swArr;
}
@@ -8,10 +8,11 @@
char PollSwitch::poll(){
char i = 0;
- // if a low signal is detected, previous switch is broken
+ // If a low signal is detected, previous switch is broken
for (i = 0; i < numSwitches; i++) {
- if (!sw[i].read()) break;
+ if (sw[i].read() == 0) break;
}
if (i >= numSwitches) i = 0;
- return i+1;
+ else i++;
+ return i;
}
\ No newline at end of file
