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 USBBUSINTERFACE_H
Racer01014 0:5e35c180ed4a 20 #define USBBUSINTERFACE_H
Racer01014 0:5e35c180ed4a 21
Racer01014 0:5e35c180ed4a 22 #include "mbed.h"
Racer01014 0:5e35c180ed4a 23 #include "USBEndpoints.h"
Racer01014 0:5e35c180ed4a 24
Racer01014 0:5e35c180ed4a 25 class USBHAL {
Racer01014 0:5e35c180ed4a 26 public:
Racer01014 0:5e35c180ed4a 27 /* Configuration */
Racer01014 0:5e35c180ed4a 28 USBHAL();
Racer01014 0:5e35c180ed4a 29 ~USBHAL();
Racer01014 0:5e35c180ed4a 30 void connect(void);
Racer01014 0:5e35c180ed4a 31 void disconnect(void);
Racer01014 0:5e35c180ed4a 32 void configureDevice(void);
Racer01014 0:5e35c180ed4a 33 void unconfigureDevice(void);
Racer01014 0:5e35c180ed4a 34 void setAddress(uint8_t address);
Racer01014 0:5e35c180ed4a 35 void remoteWakeup(void);
Racer01014 0:5e35c180ed4a 36
Racer01014 0:5e35c180ed4a 37 /* Endpoint 0 */
Racer01014 0:5e35c180ed4a 38 void EP0setup(uint8_t *buffer);
Racer01014 0:5e35c180ed4a 39 void EP0read(void);
Racer01014 0:5e35c180ed4a 40 void EP0readStage(void);
Racer01014 0:5e35c180ed4a 41 uint32_t EP0getReadResult(uint8_t *buffer);
Racer01014 0:5e35c180ed4a 42 void EP0write(uint8_t *buffer, uint32_t size);
Racer01014 0:5e35c180ed4a 43 void EP0getWriteResult(void);
Racer01014 0:5e35c180ed4a 44 void EP0stall(void);
Racer01014 0:5e35c180ed4a 45
Racer01014 0:5e35c180ed4a 46 /* Other endpoints */
Racer01014 0:5e35c180ed4a 47 EP_STATUS endpointRead(uint8_t endpoint, uint32_t maximumSize);
Racer01014 0:5e35c180ed4a 48 EP_STATUS endpointReadResult(uint8_t endpoint, uint8_t *data, uint32_t *bytesRead);
Racer01014 0:5e35c180ed4a 49 EP_STATUS endpointWrite(uint8_t endpoint, uint8_t *data, uint32_t size);
Racer01014 0:5e35c180ed4a 50 EP_STATUS endpointWriteResult(uint8_t endpoint);
Racer01014 0:5e35c180ed4a 51 void stallEndpoint(uint8_t endpoint);
Racer01014 0:5e35c180ed4a 52 void unstallEndpoint(uint8_t endpoint);
Racer01014 0:5e35c180ed4a 53 bool realiseEndpoint(uint8_t endpoint, uint32_t maxPacket, uint32_t options);
Racer01014 0:5e35c180ed4a 54 bool getEndpointStallState(unsigned char endpoint);
Racer01014 0:5e35c180ed4a 55 uint32_t endpointReadcore(uint8_t endpoint, uint8_t *buffer);
Racer01014 0:5e35c180ed4a 56
Racer01014 0:5e35c180ed4a 57 protected:
Racer01014 0:5e35c180ed4a 58 virtual void busReset(void){};
Racer01014 0:5e35c180ed4a 59 virtual void EP0setupCallback(void){};
Racer01014 0:5e35c180ed4a 60 virtual void EP0out(void){};
Racer01014 0:5e35c180ed4a 61 virtual void EP0in(void){};
Racer01014 0:5e35c180ed4a 62 virtual void connectStateChanged(unsigned int connected){};
Racer01014 0:5e35c180ed4a 63 virtual void suspendStateChanged(unsigned int suspended){};
Racer01014 0:5e35c180ed4a 64 virtual void SOF(int frameNumber){};
Racer01014 0:5e35c180ed4a 65
Racer01014 0:5e35c180ed4a 66 virtual bool EP1_OUT_callback(){return false;};
Racer01014 0:5e35c180ed4a 67 virtual bool EP1_IN_callback(){return false;};
Racer01014 0:5e35c180ed4a 68 virtual bool EP2_OUT_callback(){return false;};
Racer01014 0:5e35c180ed4a 69 virtual bool EP2_IN_callback(){return false;};
Racer01014 0:5e35c180ed4a 70 virtual bool EP3_OUT_callback(){return false;};
Racer01014 0:5e35c180ed4a 71 virtual bool EP3_IN_callback(){return false;};
Racer01014 0:5e35c180ed4a 72 virtual bool EP4_OUT_callback(){return false;};
Racer01014 0:5e35c180ed4a 73 virtual bool EP4_IN_callback(){return false;};
Racer01014 0:5e35c180ed4a 74
Racer01014 0:5e35c180ed4a 75 #if !defined(TARGET_LPC11U24)
Racer01014 0:5e35c180ed4a 76 virtual bool EP5_OUT_callback(){return false;};
Racer01014 0:5e35c180ed4a 77 virtual bool EP5_IN_callback(){return false;};
Racer01014 0:5e35c180ed4a 78 virtual bool EP6_OUT_callback(){return false;};
Racer01014 0:5e35c180ed4a 79 virtual bool EP6_IN_callback(){return false;};
Racer01014 0:5e35c180ed4a 80 virtual bool EP7_OUT_callback(){return false;};
Racer01014 0:5e35c180ed4a 81 virtual bool EP7_IN_callback(){return false;};
Racer01014 0:5e35c180ed4a 82 virtual bool EP8_OUT_callback(){return false;};
Racer01014 0:5e35c180ed4a 83 virtual bool EP8_IN_callback(){return false;};
Racer01014 0:5e35c180ed4a 84 virtual bool EP9_OUT_callback(){return false;};
Racer01014 0:5e35c180ed4a 85 virtual bool EP9_IN_callback(){return false;};
Racer01014 0:5e35c180ed4a 86 virtual bool EP10_OUT_callback(){return false;};
Racer01014 0:5e35c180ed4a 87 virtual bool EP10_IN_callback(){return false;};
Racer01014 0:5e35c180ed4a 88 virtual bool EP11_OUT_callback(){return false;};
Racer01014 0:5e35c180ed4a 89 virtual bool EP11_IN_callback(){return false;};
Racer01014 0:5e35c180ed4a 90 virtual bool EP12_OUT_callback(){return false;};
Racer01014 0:5e35c180ed4a 91 virtual bool EP12_IN_callback(){return false;};
Racer01014 0:5e35c180ed4a 92 virtual bool EP13_OUT_callback(){return false;};
Racer01014 0:5e35c180ed4a 93 virtual bool EP13_IN_callback(){return false;};
Racer01014 0:5e35c180ed4a 94 virtual bool EP14_OUT_callback(){return false;};
Racer01014 0:5e35c180ed4a 95 virtual bool EP14_IN_callback(){return false;};
Racer01014 0:5e35c180ed4a 96 virtual bool EP15_OUT_callback(){return false;};
Racer01014 0:5e35c180ed4a 97 virtual bool EP15_IN_callback(){return false;};
Racer01014 0:5e35c180ed4a 98 #endif
Racer01014 0:5e35c180ed4a 99
Racer01014 0:5e35c180ed4a 100 private:
Racer01014 0:5e35c180ed4a 101 void usbisr(void);
Racer01014 0:5e35c180ed4a 102 static void _usbisr(void);
Racer01014 0:5e35c180ed4a 103 static USBHAL * instance;
Racer01014 0:5e35c180ed4a 104
Racer01014 0:5e35c180ed4a 105 #if defined(TARGET_LPC11U24)
Racer01014 0:5e35c180ed4a 106 bool (USBHAL::*epCallback[10 - 2])(void);
Racer01014 0:5e35c180ed4a 107 #else
Racer01014 0:5e35c180ed4a 108 bool (USBHAL::*epCallback[32 - 2])(void);
Racer01014 0:5e35c180ed4a 109 #endif
Racer01014 0:5e35c180ed4a 110
Racer01014 0:5e35c180ed4a 111
Racer01014 0:5e35c180ed4a 112 };
Racer01014 0:5e35c180ed4a 113 #endif