Kalibriersoftware Stromwerte

Dependencies:   Matrix mbed

Committer:
Racer01014
Date:
Mon Nov 23 16:09:54 2015 +0000
Revision:
0:5e35c180ed4a
-

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Racer01014 0:5e35c180ed4a 1 /* Copyright (c) 2010-2011 mbed.org, MIT License
Racer01014 0:5e35c180ed4a 2 *
Racer01014 0:5e35c180ed4a 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
Racer01014 0:5e35c180ed4a 4 * and associated documentation files (the "Software"), to deal in the Software without
Racer01014 0:5e35c180ed4a 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
Racer01014 0:5e35c180ed4a 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
Racer01014 0:5e35c180ed4a 7 * Software is furnished to do so, subject to the following conditions:
Racer01014 0:5e35c180ed4a 8 *
Racer01014 0:5e35c180ed4a 9 * The above copyright notice and this permission notice shall be included in all copies or
Racer01014 0:5e35c180ed4a 10 * substantial portions of the Software.
Racer01014 0:5e35c180ed4a 11 *
Racer01014 0:5e35c180ed4a 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
Racer01014 0:5e35c180ed4a 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Racer01014 0:5e35c180ed4a 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
Racer01014 0:5e35c180ed4a 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Racer01014 0:5e35c180ed4a 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Racer01014 0:5e35c180ed4a 17 */
Racer01014 0:5e35c180ed4a 18
Racer01014 0:5e35c180ed4a 19 #ifndef USBDEVICE_TYPES_H
Racer01014 0:5e35c180ed4a 20 #define USBDEVICE_TYPES_H
Racer01014 0:5e35c180ed4a 21
Racer01014 0:5e35c180ed4a 22 /* Standard requests */
Racer01014 0:5e35c180ed4a 23 #define GET_STATUS (0)
Racer01014 0:5e35c180ed4a 24 #define CLEAR_FEATURE (1)
Racer01014 0:5e35c180ed4a 25 #define SET_FEATURE (3)
Racer01014 0:5e35c180ed4a 26 #define SET_ADDRESS (5)
Racer01014 0:5e35c180ed4a 27 #define GET_DESCRIPTOR (6)
Racer01014 0:5e35c180ed4a 28 #define SET_DESCRIPTOR (7)
Racer01014 0:5e35c180ed4a 29 #define GET_CONFIGURATION (8)
Racer01014 0:5e35c180ed4a 30 #define SET_CONFIGURATION (9)
Racer01014 0:5e35c180ed4a 31 #define GET_INTERFACE (10)
Racer01014 0:5e35c180ed4a 32 #define SET_INTERFACE (11)
Racer01014 0:5e35c180ed4a 33
Racer01014 0:5e35c180ed4a 34 /* bmRequestType.dataTransferDirection */
Racer01014 0:5e35c180ed4a 35 #define HOST_TO_DEVICE (0)
Racer01014 0:5e35c180ed4a 36 #define DEVICE_TO_HOST (1)
Racer01014 0:5e35c180ed4a 37
Racer01014 0:5e35c180ed4a 38 /* bmRequestType.Type*/
Racer01014 0:5e35c180ed4a 39 #define STANDARD_TYPE (0)
Racer01014 0:5e35c180ed4a 40 #define CLASS_TYPE (1)
Racer01014 0:5e35c180ed4a 41 #define VENDOR_TYPE (2)
Racer01014 0:5e35c180ed4a 42 #define RESERVED_TYPE (3)
Racer01014 0:5e35c180ed4a 43
Racer01014 0:5e35c180ed4a 44 /* bmRequestType.Recipient */
Racer01014 0:5e35c180ed4a 45 #define DEVICE_RECIPIENT (0)
Racer01014 0:5e35c180ed4a 46 #define INTERFACE_RECIPIENT (1)
Racer01014 0:5e35c180ed4a 47 #define ENDPOINT_RECIPIENT (2)
Racer01014 0:5e35c180ed4a 48 #define OTHER_RECIPIENT (3)
Racer01014 0:5e35c180ed4a 49
Racer01014 0:5e35c180ed4a 50 /* Descriptors */
Racer01014 0:5e35c180ed4a 51 #define DESCRIPTOR_TYPE(wValue) (wValue >> 8)
Racer01014 0:5e35c180ed4a 52 #define DESCRIPTOR_INDEX(wValue) (wValue & 0xf)
Racer01014 0:5e35c180ed4a 53
Racer01014 0:5e35c180ed4a 54 typedef struct {
Racer01014 0:5e35c180ed4a 55 struct {
Racer01014 0:5e35c180ed4a 56 uint8_t dataTransferDirection;
Racer01014 0:5e35c180ed4a 57 uint8_t Type;
Racer01014 0:5e35c180ed4a 58 uint8_t Recipient;
Racer01014 0:5e35c180ed4a 59 } bmRequestType;
Racer01014 0:5e35c180ed4a 60 uint8_t bRequest;
Racer01014 0:5e35c180ed4a 61 uint16_t wValue;
Racer01014 0:5e35c180ed4a 62 uint16_t wIndex;
Racer01014 0:5e35c180ed4a 63 uint16_t wLength;
Racer01014 0:5e35c180ed4a 64 } SETUP_PACKET;
Racer01014 0:5e35c180ed4a 65
Racer01014 0:5e35c180ed4a 66 typedef struct {
Racer01014 0:5e35c180ed4a 67 SETUP_PACKET setup;
Racer01014 0:5e35c180ed4a 68 uint8_t *ptr;
Racer01014 0:5e35c180ed4a 69 uint32_t remaining;
Racer01014 0:5e35c180ed4a 70 uint8_t direction;
Racer01014 0:5e35c180ed4a 71 bool zlp;
Racer01014 0:5e35c180ed4a 72 bool notify;
Racer01014 0:5e35c180ed4a 73 } CONTROL_TRANSFER;
Racer01014 0:5e35c180ed4a 74
Racer01014 0:5e35c180ed4a 75 typedef enum {ATTACHED, POWERED, DEFAULT, ADDRESS, CONFIGURED} DEVICE_STATE;
Racer01014 0:5e35c180ed4a 76
Racer01014 0:5e35c180ed4a 77 typedef struct {
Racer01014 0:5e35c180ed4a 78 volatile DEVICE_STATE state;
Racer01014 0:5e35c180ed4a 79 uint8_t configuration;
Racer01014 0:5e35c180ed4a 80 bool suspended;
Racer01014 0:5e35c180ed4a 81 } USB_DEVICE;
Racer01014 0:5e35c180ed4a 82
Racer01014 0:5e35c180ed4a 83 #endif