![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
IVSC Project
Diff: main.cpp
- Revision:
- 1:82f2ef52759e
- Parent:
- 0:960d250e49b2
- Child:
- 2:d0778c36d28d
--- a/main.cpp Thu May 17 23:11:08 2012 +0000 +++ b/main.cpp Wed Nov 14 20:01:50 2012 +0000 @@ -1,27 +1,60 @@ #include "mbed.h" -#include "MCP4661.h" +#include "USBHID.h" +#include "DigiPot.h" +#include "Max5250.h" +#include "Relay.h" -DigitalOut myled(LED1); -DigitalOut res(LED2); -MCP4661 pot1(p28, p27, 0x5c); -Serial pc(USBTX,USBRX); - + Serial pc(USBTX,USBRX); + USBHID hid; + HID_REPORT recv, xmit; + BusOut leds(LED1,LED2,LED3,LED4); + + + int main(void) { + int msgtype; + leds = 0xf; + xmit.length=64; + //Fill the report + for (int i = 0; i < xmit.length; i++) + xmit.data[i] = 0xa5; -int main() { - int mid = 0x1; - int address = 0x5c; - pc.printf("Hello Mbed World\n"); - while(1) { - myled = 1; - wait(0.2); - myled = 0; - res = pot1.SetValue(0,mid); - pc.printf("Val = %d",mid); - //data[0] = 0x04; - //res = i2c.write(address, data, 1); - mid++; - wait(1.0); - res= 0; - wait(1.0); - } -} + pc.printf("Resetting to Room Temp\n"); + PotReset(); + + pc.printf("Hello from mbed\n"); + + DAC_Setup(); + pc.printf("DAC Setup Complete\n"); + + pc.printf("Relays Resetting\n"); + Def_Relay(); + + while (1) { + hid.read(&recv); + leds = recv.data[0]; + msgtype = recv.data[0]; + + switch (msgtype) { + case 0: + case 1: + case 2: + break; + case 3: + pc.printf("Going to Resistor set\n"); + SetResist(recv.data); + case 4: + pc.printf("Going to DAC set\n"); + SetDAC(recv.data); + break; + case 5: + pc.printf("Going to Relay set\n"); + Set_Relay(recv.data); + break; + default: + break; + } //End switch + + hid.send(&xmit); + } //End while + } //End Main +