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.h
- Committer:
- martydd3
- Date:
- 2014-10-01
- Revision:
- 0:e516fcccccda
- Child:
- 6:6a04210a3f4f
File content as of revision 0:e516fcccccda:
#include"LPCDigitalOut.h"
#include"LPCDigitalIn.h"
//Serial pc(USBTX,USBRX);
uint16_t PollSwitch()
{
uint16_t a=0;
int switchn=0, i=0;
LPC_pin PollPin[12]={p1_0, p1_1, p1_4, p1_8, p1_9, p1_10, p1_14, p1_15, p1_16, p1_17, p1_27, p1_28};
LPCDigitalOut poll[12]={ LPCDigitalOut(PollPin[0]),
LPCDigitalOut(PollPin[1]),
LPCDigitalOut(PollPin[2]),
LPCDigitalOut(PollPin[3]),
LPCDigitalOut(PollPin[4]),
LPCDigitalOut(PollPin[5]),
LPCDigitalOut(PollPin[6]),
LPCDigitalOut(PollPin[7]),
LPCDigitalOut(PollPin[8]),
LPCDigitalOut(PollPin[9]),
LPCDigitalOut(PollPin[10]),
LPCDigitalOut(PollPin[11])};
/*
_(invariant each iteration input is mode neither)
_(ensures all are inputs mode neither)
_(at a time only one is ioutput)
*/
for(i=0; i<11; i++){
++switchn;
poll[i].write(1);
wait_ms(25);
//poll[i+1].mode(PullDown);
a|=((1 - poll[i+1].read()) << switchn);
//poll[i].mode(PullNone);
//poll[i+1].mode(PullNone);
}
// poll[i].mode(neither);
return a;
}
