Remodeling Xbox Wireless controller with mbed LPC1768
Fork of XBOX-NHK2015 by
main.cpp@0:a44e054c96e8, 2016-01-22 (annotated)
- Committer:
- eil4nyqn
- Date:
- Fri Jan 22 08:56:17 2016 +0000
- Revision:
- 0:a44e054c96e8
AyaneLDK
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
eil4nyqn | 0:a44e054c96e8 | 1 | #include "mbed.h" |
eil4nyqn | 0:a44e054c96e8 | 2 | #include "ACM1602NI.h" |
eil4nyqn | 0:a44e054c96e8 | 3 | |
eil4nyqn | 0:a44e054c96e8 | 4 | |
eil4nyqn | 0:a44e054c96e8 | 5 | ACM1602NI lcd(p28,p27); |
eil4nyqn | 0:a44e054c96e8 | 6 | BusIn XYAB(p5,p6,p7,p8); |
eil4nyqn | 0:a44e054c96e8 | 7 | BusIn cross(p9,p10,p11,p12); |
eil4nyqn | 0:a44e054c96e8 | 8 | AnalogIn left(p15); |
eil4nyqn | 0:a44e054c96e8 | 9 | AnalogIn Right(p17); |
eil4nyqn | 0:a44e054c96e8 | 10 | AnalogIn RH(p18); |
eil4nyqn | 0:a44e054c96e8 | 11 | AnalogIn LH(p16); |
eil4nyqn | 0:a44e054c96e8 | 12 | //JST = Joy Stick TactSW |
eil4nyqn | 0:a44e054c96e8 | 13 | BusIn JST(p23,p24); |
eil4nyqn | 0:a44e054c96e8 | 14 | BusIn SB(p29,p30); |
eil4nyqn | 0:a44e054c96e8 | 15 | BusIn other(p21,p22); |
eil4nyqn | 0:a44e054c96e8 | 16 | AnalogIn LT(p20); |
eil4nyqn | 0:a44e054c96e8 | 17 | AnalogIn RT(p19); |
eil4nyqn | 0:a44e054c96e8 | 18 | DigitalOut led(p26); |
eil4nyqn | 0:a44e054c96e8 | 19 | DigitalOut led2(p25); |
eil4nyqn | 0:a44e054c96e8 | 20 | Serial con(p13,p14); |
eil4nyqn | 0:a44e054c96e8 | 21 | |
eil4nyqn | 0:a44e054c96e8 | 22 | int main() { |
eil4nyqn | 0:a44e054c96e8 | 23 | XYAB.mode(PullUp); |
eil4nyqn | 0:a44e054c96e8 | 24 | other.mode(PullUp); |
eil4nyqn | 0:a44e054c96e8 | 25 | SB.mode(PullUp); |
eil4nyqn | 0:a44e054c96e8 | 26 | JST.mode(PullUp); |
eil4nyqn | 0:a44e054c96e8 | 27 | cross.mode(PullUp); |
eil4nyqn | 0:a44e054c96e8 | 28 | uint8_t i,n,m,p,q; |
eil4nyqn | 0:a44e054c96e8 | 29 | double z,x,c,v,g,j; |
eil4nyqn | 0:a44e054c96e8 | 30 | |
eil4nyqn | 0:a44e054c96e8 | 31 | char data=0,check=255; |
eil4nyqn | 0:a44e054c96e8 | 32 | |
eil4nyqn | 0:a44e054c96e8 | 33 | //lcd.printf("Start\n"); |
eil4nyqn | 0:a44e054c96e8 | 34 | //wait(2); |
eil4nyqn | 0:a44e054c96e8 | 35 | |
eil4nyqn | 0:a44e054c96e8 | 36 | while(1) { |
eil4nyqn | 0:a44e054c96e8 | 37 | i = XYAB; |
eil4nyqn | 0:a44e054c96e8 | 38 | n = cross; |
eil4nyqn | 0:a44e054c96e8 | 39 | m = JST; |
eil4nyqn | 0:a44e054c96e8 | 40 | p = SB; |
eil4nyqn | 0:a44e054c96e8 | 41 | q = other; |
eil4nyqn | 0:a44e054c96e8 | 42 | |
eil4nyqn | 0:a44e054c96e8 | 43 | z = left; |
eil4nyqn | 0:a44e054c96e8 | 44 | x = Right; |
eil4nyqn | 0:a44e054c96e8 | 45 | c = LT; |
eil4nyqn | 0:a44e054c96e8 | 46 | v = RT; |
eil4nyqn | 0:a44e054c96e8 | 47 | g = RH; |
eil4nyqn | 0:a44e054c96e8 | 48 | j = LH; |
eil4nyqn | 0:a44e054c96e8 | 49 | |
eil4nyqn | 0:a44e054c96e8 | 50 | led = 1; |
eil4nyqn | 0:a44e054c96e8 | 51 | led2 = 1; |
eil4nyqn | 0:a44e054c96e8 | 52 | |
eil4nyqn | 0:a44e054c96e8 | 53 | data=p; |
eil4nyqn | 0:a44e054c96e8 | 54 | |
eil4nyqn | 0:a44e054c96e8 | 55 | con.putc(check); |
eil4nyqn | 0:a44e054c96e8 | 56 | con.putc(data); |
eil4nyqn | 0:a44e054c96e8 | 57 | |
eil4nyqn | 0:a44e054c96e8 | 58 | |
eil4nyqn | 0:a44e054c96e8 | 59 | printf("%d-%d-%d-%d-%d--%lf-%lf-%lf-%lf-%lf-%lf\r\n",i,n,m,p,q,z,x,c,v,j,g); |
eil4nyqn | 0:a44e054c96e8 | 60 | } |
eil4nyqn | 0:a44e054c96e8 | 61 | } |