ADC Niose test Connect four analog signals to your MBED. and then run the Windows app. The four traces are displayed on an oscilloscope like display. I have used a USB HID DEVICE link, so connections to D+, D- are required. The MBED code is otherwise quite basic, So you can modify it to your own test needs. Additionaly, there is a 16 bit count value, in my MBED code Mainly to test if MSB & LSB are correct.
HID/USBDescriptor.h@0:cbe01b678bd4, 2011-11-19 (annotated)
- Committer:
- ceri
- Date:
- Sat Nov 19 22:54:22 2011 +0000
- Revision:
- 0:cbe01b678bd4
just enough to work
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ceri | 0:cbe01b678bd4 | 1 | /* USBDescriptor.h */ |
ceri | 0:cbe01b678bd4 | 2 | /* Definitions and macros for constructing USB descriptors */ |
ceri | 0:cbe01b678bd4 | 3 | /* Copyright (c) 2011 ARM Limited. All rights reserved. */ |
ceri | 0:cbe01b678bd4 | 4 | |
ceri | 0:cbe01b678bd4 | 5 | /* Standard descriptor types */ |
ceri | 0:cbe01b678bd4 | 6 | #define DEVICE_DESCRIPTOR (1) |
ceri | 0:cbe01b678bd4 | 7 | #define CONFIGURATION_DESCRIPTOR (2) |
ceri | 0:cbe01b678bd4 | 8 | #define STRING_DESCRIPTOR (3) |
ceri | 0:cbe01b678bd4 | 9 | #define INTERFACE_DESCRIPTOR (4) |
ceri | 0:cbe01b678bd4 | 10 | #define ENDPOINT_DESCRIPTOR (5) |
ceri | 0:cbe01b678bd4 | 11 | |
ceri | 0:cbe01b678bd4 | 12 | /* Standard descriptor lengths */ |
ceri | 0:cbe01b678bd4 | 13 | #define DEVICE_DESCRIPTOR_LENGTH (0x12) |
ceri | 0:cbe01b678bd4 | 14 | #define CONFIGURATION_DESCRIPTOR_LENGTH (0x09) |
ceri | 0:cbe01b678bd4 | 15 | #define INTERFACE_DESCRIPTOR_LENGTH (0x09) |
ceri | 0:cbe01b678bd4 | 16 | #define ENDPOINT_DESCRIPTOR_LENGTH (0x07) |
ceri | 0:cbe01b678bd4 | 17 | |
ceri | 0:cbe01b678bd4 | 18 | |
ceri | 0:cbe01b678bd4 | 19 | /*string offset*/ |
ceri | 0:cbe01b678bd4 | 20 | #define STRING_OFFSET_LANGID (0) |
ceri | 0:cbe01b678bd4 | 21 | #define STRING_OFFSET_IMANUFACTURER (1) |
ceri | 0:cbe01b678bd4 | 22 | #define STRING_OFFSET_IPRODUCT (2) |
ceri | 0:cbe01b678bd4 | 23 | #define STRING_OFFSET_ISERIAL (3) |
ceri | 0:cbe01b678bd4 | 24 | #define STRING_OFFSET_ICONFIGURATION (4) |
ceri | 0:cbe01b678bd4 | 25 | #define STRING_OFFSET_IINTERFACE (5) |
ceri | 0:cbe01b678bd4 | 26 | |
ceri | 0:cbe01b678bd4 | 27 | /* USB Specification Release Number */ |
ceri | 0:cbe01b678bd4 | 28 | #define USB_VERSION_2_0 (0x0200) |
ceri | 0:cbe01b678bd4 | 29 | |
ceri | 0:cbe01b678bd4 | 30 | /* Least/Most significant byte of short integer */ |
ceri | 0:cbe01b678bd4 | 31 | #define LSB(n) ((n)&0xff) |
ceri | 0:cbe01b678bd4 | 32 | #define MSB(n) (((n)&0xff00)>>8) |
ceri | 0:cbe01b678bd4 | 33 | |
ceri | 0:cbe01b678bd4 | 34 | /* Convert physical endpoint number to descriptor endpoint number */ |
ceri | 0:cbe01b678bd4 | 35 | #define PHY_TO_DESC(endpoint) (((endpoint)>>1) | (((endpoint) & 1) ? 0x80:0)) |
ceri | 0:cbe01b678bd4 | 36 | |
ceri | 0:cbe01b678bd4 | 37 | /* bmAttributes in configuration descriptor */ |
ceri | 0:cbe01b678bd4 | 38 | /* C_RESERVED must always be set */ |
ceri | 0:cbe01b678bd4 | 39 | #define C_RESERVED (1U<<7) |
ceri | 0:cbe01b678bd4 | 40 | #define C_SELF_POWERED (1U<<6) |
ceri | 0:cbe01b678bd4 | 41 | #define C_REMOTE_WAKEUP (1U<<5) |
ceri | 0:cbe01b678bd4 | 42 | |
ceri | 0:cbe01b678bd4 | 43 | /* bMaxPower in configuration descriptor */ |
ceri | 0:cbe01b678bd4 | 44 | #define C_POWER(mA) ((mA)/2) |
ceri | 0:cbe01b678bd4 | 45 | |
ceri | 0:cbe01b678bd4 | 46 | /* bmAttributes in endpoint descriptor */ |
ceri | 0:cbe01b678bd4 | 47 | #define E_CONTROL (0x00) |
ceri | 0:cbe01b678bd4 | 48 | #define E_ISOCHRONOUS (0x01) |
ceri | 0:cbe01b678bd4 | 49 | #define E_BULK (0x02) |
ceri | 0:cbe01b678bd4 | 50 | #define E_INTERRUPT (0x03) |
ceri | 0:cbe01b678bd4 | 51 | |
ceri | 0:cbe01b678bd4 | 52 | /* For isochronous endpoints only: */ |
ceri | 0:cbe01b678bd4 | 53 | #define E_NO_SYNCHRONIZATION (0x00) |
ceri | 0:cbe01b678bd4 | 54 | #define E_ASYNCHRONOUS (0x04) |
ceri | 0:cbe01b678bd4 | 55 | #define E_ADAPTIVE (0x08) |
ceri | 0:cbe01b678bd4 | 56 | #define E_SYNCHRONOUS (0x0C) |
ceri | 0:cbe01b678bd4 | 57 | #define E_DATA (0x00) |
ceri | 0:cbe01b678bd4 | 58 | #define E_FEEDBACK (0x10) |
ceri | 0:cbe01b678bd4 | 59 | #define E_IMPLICIT_FEEDBACK (0x20) |