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@6:6a04210a3f4f, 2014-10-10 (annotated)
- Committer:
- martydd3
- Date:
- Fri Oct 10 20:24:22 2014 +0000
- Revision:
- 6:6a04210a3f4f
- Parent:
- 0:e516fcccccda
- Child:
- 7:5f6e31faa08e
Added Watchdog timer, put DC_DC converter and FanPump code into their own classes.; To do: Look into how to call class member functions in a thread. Current thread functions are not members of classes.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| martydd3 | 6:6a04210a3f4f | 1 | #include "LPCDigitalOut.h" |
| martydd3 | 6:6a04210a3f4f | 2 | #include "LPCDigitalIn.h" |
| martydd3 | 0:e516fcccccda | 3 | |
| martydd3 | 6:6a04210a3f4f | 4 | |
| martydd3 | 0:e516fcccccda | 5 | |
| martydd3 | 0:e516fcccccda | 6 | uint16_t PollSwitch() |
| martydd3 | 0:e516fcccccda | 7 | { |
| martydd3 | 0:e516fcccccda | 8 | uint16_t a=0; |
| martydd3 | 0:e516fcccccda | 9 | int switchn=0, i=0; |
| martydd3 | 0:e516fcccccda | 10 | 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}; |
| martydd3 | 0:e516fcccccda | 11 | LPCDigitalOut poll[12]={ LPCDigitalOut(PollPin[0]), |
| martydd3 | 0:e516fcccccda | 12 | LPCDigitalOut(PollPin[1]), |
| martydd3 | 0:e516fcccccda | 13 | LPCDigitalOut(PollPin[2]), |
| martydd3 | 0:e516fcccccda | 14 | LPCDigitalOut(PollPin[3]), |
| martydd3 | 0:e516fcccccda | 15 | LPCDigitalOut(PollPin[4]), |
| martydd3 | 0:e516fcccccda | 16 | LPCDigitalOut(PollPin[5]), |
| martydd3 | 0:e516fcccccda | 17 | LPCDigitalOut(PollPin[6]), |
| martydd3 | 0:e516fcccccda | 18 | LPCDigitalOut(PollPin[7]), |
| martydd3 | 0:e516fcccccda | 19 | LPCDigitalOut(PollPin[8]), |
| martydd3 | 0:e516fcccccda | 20 | LPCDigitalOut(PollPin[9]), |
| martydd3 | 0:e516fcccccda | 21 | LPCDigitalOut(PollPin[10]), |
| martydd3 | 0:e516fcccccda | 22 | LPCDigitalOut(PollPin[11])}; |
| martydd3 | 0:e516fcccccda | 23 | |
| martydd3 | 6:6a04210a3f4f | 24 | // poll each switch 1 at a time |
| martydd3 | 6:6a04210a3f4f | 25 | // first failed switch is returned |
| martydd3 | 6:6a04210a3f4f | 26 | |
| martydd3 | 6:6a04210a3f4f | 27 | for(i=0; i<11; i++){ |
| martydd3 | 0:e516fcccccda | 28 | ++switchn; |
| martydd3 | 0:e516fcccccda | 29 | |
| martydd3 | 0:e516fcccccda | 30 | poll[i].write(1); |
| martydd3 | 0:e516fcccccda | 31 | |
| martydd3 | 0:e516fcccccda | 32 | wait_ms(25); |
| martydd3 | 0:e516fcccccda | 33 | |
| martydd3 | 0:e516fcccccda | 34 | //poll[i+1].mode(PullDown); |
| martydd3 | 0:e516fcccccda | 35 | a|=((1 - poll[i+1].read()) << switchn); |
| martydd3 | 0:e516fcccccda | 36 | |
| martydd3 | 0:e516fcccccda | 37 | //poll[i].mode(PullNone); |
| martydd3 | 0:e516fcccccda | 38 | //poll[i+1].mode(PullNone); |
| martydd3 | 0:e516fcccccda | 39 | } |
| martydd3 | 0:e516fcccccda | 40 | // poll[i].mode(neither); |
| martydd3 | 0:e516fcccccda | 41 | return a; |
| martydd3 | 0:e516fcccccda | 42 | } |
