![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
IVSC Project
main.cpp@4:262764d24e4d, 2013-06-07 (annotated)
- Committer:
- kevinkent
- Date:
- Fri Jun 07 19:59:29 2013 +0000
- Revision:
- 4:262764d24e4d
- Parent:
- 3:0072c2a81472
Version 1.2
; Added MSG[0] = 0x06 tow write one pot chain with a single message
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kevinkent | 0:960d250e49b2 | 1 | #include "mbed.h" |
kevinkent | 2:d0778c36d28d | 2 | #include "main.h" |
kevinkent | 1:82f2ef52759e | 3 | #include "USBHID.h" |
kevinkent | 1:82f2ef52759e | 4 | #include "DigiPot.h" |
kevinkent | 1:82f2ef52759e | 5 | #include "Max5250.h" |
kevinkent | 1:82f2ef52759e | 6 | #include "Relay.h" |
kevinkent | 0:960d250e49b2 | 7 | |
kevinkent | 2:d0778c36d28d | 8 | |
kevinkent | 1:82f2ef52759e | 9 | USBHID hid; |
kevinkent | 1:82f2ef52759e | 10 | HID_REPORT recv, xmit; |
kevinkent | 1:82f2ef52759e | 11 | BusOut leds(LED1,LED2,LED3,LED4); |
kevinkent | 1:82f2ef52759e | 12 | |
kevinkent | 1:82f2ef52759e | 13 | |
kevinkent | 1:82f2ef52759e | 14 | int main(void) { |
kevinkent | 1:82f2ef52759e | 15 | int msgtype; |
kevinkent | 1:82f2ef52759e | 16 | leds = 0xf; |
kevinkent | 1:82f2ef52759e | 17 | xmit.length=64; |
kevinkent | 1:82f2ef52759e | 18 | //Fill the report |
kevinkent | 1:82f2ef52759e | 19 | for (int i = 0; i < xmit.length; i++) |
kevinkent | 1:82f2ef52759e | 20 | xmit.data[i] = 0xa5; |
kevinkent | 0:960d250e49b2 | 21 | |
kevinkent | 1:82f2ef52759e | 22 | pc.printf("Resetting to Room Temp\n"); |
kevinkent | 1:82f2ef52759e | 23 | PotReset(); |
kevinkent | 1:82f2ef52759e | 24 | |
kevinkent | 1:82f2ef52759e | 25 | pc.printf("Hello from mbed\n"); |
kevinkent | 1:82f2ef52759e | 26 | |
kevinkent | 1:82f2ef52759e | 27 | DAC_Setup(); |
kevinkent | 1:82f2ef52759e | 28 | pc.printf("DAC Setup Complete\n"); |
kevinkent | 1:82f2ef52759e | 29 | |
kevinkent | 1:82f2ef52759e | 30 | pc.printf("Relays Resetting\n"); |
kevinkent | 1:82f2ef52759e | 31 | Def_Relay(); |
kevinkent | 1:82f2ef52759e | 32 | |
kevinkent | 1:82f2ef52759e | 33 | while (1) { |
kevinkent | 1:82f2ef52759e | 34 | hid.read(&recv); |
kevinkent | 1:82f2ef52759e | 35 | leds = recv.data[0]; |
kevinkent | 1:82f2ef52759e | 36 | msgtype = recv.data[0]; |
kevinkent | 1:82f2ef52759e | 37 | |
kevinkent | 1:82f2ef52759e | 38 | switch (msgtype) { |
kevinkent | 1:82f2ef52759e | 39 | case 0: |
kevinkent | 1:82f2ef52759e | 40 | case 1: |
kevinkent | 1:82f2ef52759e | 41 | case 2: |
kevinkent | 1:82f2ef52759e | 42 | break; |
kevinkent | 1:82f2ef52759e | 43 | case 3: |
kevinkent | 1:82f2ef52759e | 44 | pc.printf("Going to Resistor set\n"); |
kevinkent | 1:82f2ef52759e | 45 | SetResist(recv.data); |
kevinkent | 2:d0778c36d28d | 46 | break; |
kevinkent | 1:82f2ef52759e | 47 | case 4: |
kevinkent | 1:82f2ef52759e | 48 | pc.printf("Going to DAC set\n"); |
kevinkent | 1:82f2ef52759e | 49 | SetDAC(recv.data); |
kevinkent | 1:82f2ef52759e | 50 | break; |
kevinkent | 1:82f2ef52759e | 51 | case 5: |
kevinkent | 1:82f2ef52759e | 52 | pc.printf("Going to Relay set\n"); |
kevinkent | 1:82f2ef52759e | 53 | Set_Relay(recv.data); |
kevinkent | 1:82f2ef52759e | 54 | break; |
kevinkent | 3:0072c2a81472 | 55 | case 6: |
kevinkent | 3:0072c2a81472 | 56 | pc.printf("Going to Resistor Chain set\n"); |
kevinkent | 4:262764d24e4d | 57 | SetResistChain(recv.data); |
kevinkent | 3:0072c2a81472 | 58 | break; |
kevinkent | 1:82f2ef52759e | 59 | default: |
kevinkent | 1:82f2ef52759e | 60 | break; |
kevinkent | 1:82f2ef52759e | 61 | } //End switch |
kevinkent | 1:82f2ef52759e | 62 | |
kevinkent | 1:82f2ef52759e | 63 | hid.send(&xmit); |
kevinkent | 1:82f2ef52759e | 64 | } //End while |
kevinkent | 1:82f2ef52759e | 65 | } //End Main |
kevinkent | 1:82f2ef52759e | 66 |