Penn Electric Racing / Mbed 2 deprecated SystemManagement

Dependencies:   mbed CANBuffer Watchdog MODSERIAL mbed-rtos xbeeRelay IAP

Fork of SystemManagement by Martin Deng

Committer:
martydd3
Date:
Wed Oct 01 12:52:26 2014 +0000
Revision:
0:e516fcccccda
Child:
6:6a04210a3f4f
Added LPCDigitalOut, LPCDigitalIn, and CANBuffer Libaries; Comments on code in SysMngmt.cpp involving register and pin access; Note: LPCDigitalOut.h defines a void mode(PinMode) which isn't in LPCDigitalOut.cpp, causes a linking error if used

Who changed what in which revision?

UserRevisionLine numberNew contents of line
martydd3 0:e516fcccccda 1 #include"LPCDigitalOut.h"
martydd3 0:e516fcccccda 2 #include"LPCDigitalIn.h"
martydd3 0:e516fcccccda 3
martydd3 0:e516fcccccda 4 //Serial pc(USBTX,USBRX);
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 0:e516fcccccda 24 /*
martydd3 0:e516fcccccda 25 _(invariant each iteration input is mode neither)
martydd3 0:e516fcccccda 26 _(ensures all are inputs mode neither)
martydd3 0:e516fcccccda 27 _(at a time only one is ioutput)
martydd3 0:e516fcccccda 28 */
martydd3 0:e516fcccccda 29
martydd3 0:e516fcccccda 30 for(i=0; i<11; i++){
martydd3 0:e516fcccccda 31 ++switchn;
martydd3 0:e516fcccccda 32
martydd3 0:e516fcccccda 33 poll[i].write(1);
martydd3 0:e516fcccccda 34
martydd3 0:e516fcccccda 35 wait_ms(25);
martydd3 0:e516fcccccda 36
martydd3 0:e516fcccccda 37 //poll[i+1].mode(PullDown);
martydd3 0:e516fcccccda 38 a|=((1 - poll[i+1].read()) << switchn);
martydd3 0:e516fcccccda 39
martydd3 0:e516fcccccda 40 //poll[i].mode(PullNone);
martydd3 0:e516fcccccda 41 //poll[i+1].mode(PullNone);
martydd3 0:e516fcccccda 42 }
martydd3 0:e516fcccccda 43 // poll[i].mode(neither);
martydd3 0:e516fcccccda 44 return a;
martydd3 0:e516fcccccda 45 }