Open OBC / Mbed 2 deprecated obdtest

Dependencies:   mbed e36obd

Committer:
openobc
Date:
Fri May 20 22:39:24 2011 +0000
Revision:
2:9ca330b0352c
Parent:
0:d66afef7590a

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
openobc 0:d66afef7590a 1 #include "mbed.h"
openobc 0:d66afef7590a 2
openobc 0:d66afef7590a 3 #include "E36obd.h"
openobc 0:d66afef7590a 4
openobc 0:d66afef7590a 5 Serial dbg(USBTX, USBRX);
openobc 0:d66afef7590a 6
openobc 0:d66afef7590a 7 int main()
openobc 0:d66afef7590a 8 {
openobc 2:9ca330b0352c 9 //dbg.baud(115200);
openobc 0:d66afef7590a 10
openobc 0:d66afef7590a 11 //the DS2 class will need two bus objects for TXD (K bus) and RXD (L bus)
openobc 0:d66afef7590a 12 //the Bus class derives from the mbed Serial class and each needs a tx/rx pair of serial pins
openobc 0:d66afef7590a 13 //4 pins total are used in this implementation (2 serial port peripherals)
openobc 0:d66afef7590a 14 Bus* k_line = new Bus(p9, p10);
openobc 0:d66afef7590a 15 Bus* l_line = new Bus(p13, p14);
openobc 0:d66afef7590a 16 DS2 ds2(k_line, l_line);
openobc 0:d66afef7590a 17
openobc 0:d66afef7590a 18 //we can run some basic tests on the interface
openobc 0:d66afef7590a 19 //if they fail, check the source to see how
openobc 0:d66afef7590a 20 if(!k_line->test())
openobc 0:d66afef7590a 21 printf("k_line test failed - check interface hardware\r\n");
openobc 0:d66afef7590a 22 if(!l_line->test())
openobc 0:d66afef7590a 23 printf("l_line test failed - check interface hardware\r\n");
openobc 0:d66afef7590a 24 if(!ds2.test())
openobc 0:d66afef7590a 25 printf("ds2 test failed\r\n");
openobc 0:d66afef7590a 26 //nothing below will work if these failed
openobc 0:d66afef7590a 27
openobc 0:d66afef7590a 28 //DS2::testModule will attempt to raise a module by address
openobc 0:d66afef7590a 29 //in much the same way that INPA does
openobc 0:d66afef7590a 30 int address = 0x00; //zke4
openobc 0:d66afef7590a 31 ds2.testModule(address);
openobc 0:d66afef7590a 32
openobc 0:d66afef7590a 33 //more modules - some have multiple addresses to try
openobc 0:d66afef7590a 34 ds2.testModule(0x80); //kombi
openobc 0:d66afef7590a 35 ds2.testModule(0x0d); //kombi
openobc 0:d66afef7590a 36 ds2.testModule(0x59); //ihkr
openobc 0:d66afef7590a 37 ds2.testModule(0x5b); //ihka
openobc 0:d66afef7590a 38 ds2.testModule(0x36); //mk4
openobc 0:d66afef7590a 39 ds2.testModule(0x56); //mk20
openobc 0:d66afef7590a 40 ds2.testModule(0xcd); //obc
openobc 0:d66afef7590a 41 ds2.testModule(0xa4); //srs
openobc 0:d66afef7590a 42 ds2.testModule(0x44); //ews
openobc 0:d66afef7590a 43 ds2.testModule(0x60); //pdc
openobc 0:d66afef7590a 44 ds2.testModule(0x12); //dme4
openobc 0:d66afef7590a 45
openobc 0:d66afef7590a 46 printf("done querying modules\r\n");
openobc 0:d66afef7590a 47
openobc 0:d66afef7590a 48 //here we can snoop inpa traffic and print it to dbg
openobc 0:d66afef7590a 49 //this will never return
openobc 0:d66afef7590a 50 ds2.snoop();
openobc 0:d66afef7590a 51
openobc 0:d66afef7590a 52
openobc 0:d66afef7590a 53 }