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.

Dependencies:   mbed

Committer:
ceri
Date:
Sat Nov 19 22:54:22 2011 +0000
Revision:
0:cbe01b678bd4
just enough to work

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ceri 0:cbe01b678bd4 1 /* USBDevice_Types.h */
ceri 0:cbe01b678bd4 2 /* USB Device type definitions, conversions and constants */
ceri 0:cbe01b678bd4 3 /* Copyright (c) 2011 ARM Limited. All rights reserved. */
ceri 0:cbe01b678bd4 4
ceri 0:cbe01b678bd4 5 #ifndef USBDEVICE_TYPES_H
ceri 0:cbe01b678bd4 6 #define USBDEVICE_TYPES_H
ceri 0:cbe01b678bd4 7
ceri 0:cbe01b678bd4 8 /* Standard requests */
ceri 0:cbe01b678bd4 9 #define GET_STATUS (0)
ceri 0:cbe01b678bd4 10 #define CLEAR_FEATURE (1)
ceri 0:cbe01b678bd4 11 #define SET_FEATURE (3)
ceri 0:cbe01b678bd4 12 #define SET_ADDRESS (5)
ceri 0:cbe01b678bd4 13 #define GET_DESCRIPTOR (6)
ceri 0:cbe01b678bd4 14 #define SET_DESCRIPTOR (7)
ceri 0:cbe01b678bd4 15 #define GET_CONFIGURATION (8)
ceri 0:cbe01b678bd4 16 #define SET_CONFIGURATION (9)
ceri 0:cbe01b678bd4 17 #define GET_INTERFACE (10)
ceri 0:cbe01b678bd4 18 #define SET_INTERFACE (11)
ceri 0:cbe01b678bd4 19
ceri 0:cbe01b678bd4 20 /* bmRequestType.dataTransferDirection */
ceri 0:cbe01b678bd4 21 #define HOST_TO_DEVICE (0)
ceri 0:cbe01b678bd4 22 #define DEVICE_TO_HOST (1)
ceri 0:cbe01b678bd4 23
ceri 0:cbe01b678bd4 24 /* bmRequestType.Type*/
ceri 0:cbe01b678bd4 25 #define STANDARD_TYPE (0)
ceri 0:cbe01b678bd4 26 #define CLASS_TYPE (1)
ceri 0:cbe01b678bd4 27 #define VENDOR_TYPE (2)
ceri 0:cbe01b678bd4 28 #define RESERVED_TYPE (3)
ceri 0:cbe01b678bd4 29
ceri 0:cbe01b678bd4 30 /* bmRequestType.Recipient */
ceri 0:cbe01b678bd4 31 #define DEVICE_RECIPIENT (0)
ceri 0:cbe01b678bd4 32 #define INTERFACE_RECIPIENT (1)
ceri 0:cbe01b678bd4 33 #define ENDPOINT_RECIPIENT (2)
ceri 0:cbe01b678bd4 34 #define OTHER_RECIPIENT (3)
ceri 0:cbe01b678bd4 35
ceri 0:cbe01b678bd4 36 /* Descriptors */
ceri 0:cbe01b678bd4 37 #define DESCRIPTOR_TYPE(wValue) (wValue >> 8)
ceri 0:cbe01b678bd4 38 #define DESCRIPTOR_INDEX(wValue) (wValue & 0xf)
ceri 0:cbe01b678bd4 39
ceri 0:cbe01b678bd4 40 typedef struct {
ceri 0:cbe01b678bd4 41 struct {
ceri 0:cbe01b678bd4 42 uint8_t dataTransferDirection;
ceri 0:cbe01b678bd4 43 uint8_t Type;
ceri 0:cbe01b678bd4 44 uint8_t Recipient;
ceri 0:cbe01b678bd4 45 } bmRequestType;
ceri 0:cbe01b678bd4 46 uint8_t bRequest;
ceri 0:cbe01b678bd4 47 uint16_t wValue;
ceri 0:cbe01b678bd4 48 uint16_t wIndex;
ceri 0:cbe01b678bd4 49 uint16_t wLength;
ceri 0:cbe01b678bd4 50 } SETUP_PACKET;
ceri 0:cbe01b678bd4 51
ceri 0:cbe01b678bd4 52 typedef struct {
ceri 0:cbe01b678bd4 53 SETUP_PACKET setup;
ceri 0:cbe01b678bd4 54 uint8_t *ptr;
ceri 0:cbe01b678bd4 55 uint32_t remaining;
ceri 0:cbe01b678bd4 56 uint8_t direction;
ceri 0:cbe01b678bd4 57 bool zlp;
ceri 0:cbe01b678bd4 58 bool notify;
ceri 0:cbe01b678bd4 59 } CONTROL_TRANSFER;
ceri 0:cbe01b678bd4 60
ceri 0:cbe01b678bd4 61 typedef enum {ATTACHED, POWERED, DEFAULT, ADDRESS, CONFIGURED} DEVICE_STATE;
ceri 0:cbe01b678bd4 62
ceri 0:cbe01b678bd4 63 typedef struct {
ceri 0:cbe01b678bd4 64 volatile DEVICE_STATE state;
ceri 0:cbe01b678bd4 65 uint8_t configuration;
ceri 0:cbe01b678bd4 66 bool suspended;
ceri 0:cbe01b678bd4 67 } USB_DEVICE;
ceri 0:cbe01b678bd4 68
ceri 0:cbe01b678bd4 69 #endif