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
PollSwitch/PollSwitch.cpp
- Committer:
- pspatel321
- Date:
- 2014-10-25
- Revision:
- 17:c9ce210f6654
- Parent:
- 16:a72ffe7d879d
- Child:
- 29:f148490b5f65
File content as of revision 17:c9ce210f6654:
#include "PollSwitch.h"
LPCDigitalIn sw[]={ LPCDigitalIn(p1_0, PullDown),
LPCDigitalIn(p1_1, PullDown),
LPCDigitalIn(p1_4, PullDown),
LPCDigitalIn(p1_8, PullDown),
LPCDigitalIn(p1_9, PullDown),
LPCDigitalIn(p1_10, PullDown),
LPCDigitalIn(p1_14, PullDown),
LPCDigitalIn(p1_15, PullDown),
LPCDigitalIn(p1_16, PullDown),
LPCDigitalIn(p1_17, PullDown),
LPCDigitalIn(p1_27, PullDown),
LPCDigitalIn(p1_28, PullDown)
};
PollSwitch::PollSwitch(){
switchState = 0;
}
uint16_t PollSwitch::poll(){
int i = 0;
// if a low signal is detected, previous switch is broken
for(i = 1; i < sizeof(sw)/sizeof(sw[0]); i++){
if(!sw[i].read())
break;
}
// bit on: switch may be broken
switchState = (1 << i);
return (1 << i);
}
