xd

Dependencies:   mbed

Fork of Simple_Touch_Sens by Veikko Kero

Committer:
tanssisatu
Date:
Thu Jan 30 06:24:52 2014 +0000
Revision:
2:30d2ced09088
Parent:
1:7ed7d128d225
plob multitouch

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Vekotin 1:7ed7d128d225 1 /* Copyright (c) 2010-2011 mbed.org, MIT License
Vekotin 1:7ed7d128d225 2 *
Vekotin 1:7ed7d128d225 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
Vekotin 1:7ed7d128d225 4 * and associated documentation files (the "Software"), to deal in the Software without
Vekotin 1:7ed7d128d225 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
Vekotin 1:7ed7d128d225 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
Vekotin 1:7ed7d128d225 7 * Software is furnished to do so, subject to the following conditions:
Vekotin 1:7ed7d128d225 8 *
Vekotin 1:7ed7d128d225 9 * The above copyright notice and this permission notice shall be included in all copies or
Vekotin 1:7ed7d128d225 10 * substantial portions of the Software.
Vekotin 1:7ed7d128d225 11 *
Vekotin 1:7ed7d128d225 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
Vekotin 1:7ed7d128d225 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Vekotin 1:7ed7d128d225 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
Vekotin 1:7ed7d128d225 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Vekotin 1:7ed7d128d225 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Vekotin 1:7ed7d128d225 17 */
Vekotin 1:7ed7d128d225 18
Vekotin 1:7ed7d128d225 19 #ifndef USBBUSINTERFACE_H
Vekotin 1:7ed7d128d225 20 #define USBBUSINTERFACE_H
Vekotin 1:7ed7d128d225 21
Vekotin 1:7ed7d128d225 22 #include "mbed.h"
Vekotin 1:7ed7d128d225 23 #include "USBEndpoints.h"
Vekotin 1:7ed7d128d225 24
Vekotin 1:7ed7d128d225 25 class USBHAL {
Vekotin 1:7ed7d128d225 26 public:
Vekotin 1:7ed7d128d225 27 /* Configuration */
Vekotin 1:7ed7d128d225 28 USBHAL();
Vekotin 1:7ed7d128d225 29 ~USBHAL();
Vekotin 1:7ed7d128d225 30 void connect(void);
Vekotin 1:7ed7d128d225 31 void disconnect(void);
Vekotin 1:7ed7d128d225 32 void configureDevice(void);
Vekotin 1:7ed7d128d225 33 void unconfigureDevice(void);
Vekotin 1:7ed7d128d225 34 void setAddress(uint8_t address);
Vekotin 1:7ed7d128d225 35 void remoteWakeup(void);
Vekotin 1:7ed7d128d225 36
Vekotin 1:7ed7d128d225 37 /* Endpoint 0 */
Vekotin 1:7ed7d128d225 38 void EP0setup(uint8_t *buffer);
Vekotin 1:7ed7d128d225 39 void EP0read(void);
Vekotin 1:7ed7d128d225 40 void EP0readStage(void);
Vekotin 1:7ed7d128d225 41 uint32_t EP0getReadResult(uint8_t *buffer);
Vekotin 1:7ed7d128d225 42 void EP0write(uint8_t *buffer, uint32_t size);
Vekotin 1:7ed7d128d225 43 void EP0getWriteResult(void);
Vekotin 1:7ed7d128d225 44 void EP0stall(void);
Vekotin 1:7ed7d128d225 45
Vekotin 1:7ed7d128d225 46 /* Other endpoints */
Vekotin 1:7ed7d128d225 47 EP_STATUS endpointRead(uint8_t endpoint, uint32_t maximumSize);
Vekotin 1:7ed7d128d225 48 EP_STATUS endpointReadResult(uint8_t endpoint, uint8_t *data, uint32_t *bytesRead);
Vekotin 1:7ed7d128d225 49 EP_STATUS endpointWrite(uint8_t endpoint, uint8_t *data, uint32_t size);
Vekotin 1:7ed7d128d225 50 EP_STATUS endpointWriteResult(uint8_t endpoint);
Vekotin 1:7ed7d128d225 51 void stallEndpoint(uint8_t endpoint);
Vekotin 1:7ed7d128d225 52 void unstallEndpoint(uint8_t endpoint);
Vekotin 1:7ed7d128d225 53 bool realiseEndpoint(uint8_t endpoint, uint32_t maxPacket, uint32_t options);
Vekotin 1:7ed7d128d225 54 bool getEndpointStallState(unsigned char endpoint);
Vekotin 1:7ed7d128d225 55 uint32_t endpointReadcore(uint8_t endpoint, uint8_t *buffer);
Vekotin 1:7ed7d128d225 56
Vekotin 1:7ed7d128d225 57 protected:
Vekotin 1:7ed7d128d225 58 virtual void busReset(void){};
Vekotin 1:7ed7d128d225 59 virtual void EP0setupCallback(void){};
Vekotin 1:7ed7d128d225 60 virtual void EP0out(void){};
Vekotin 1:7ed7d128d225 61 virtual void EP0in(void){};
Vekotin 1:7ed7d128d225 62 virtual void connectStateChanged(unsigned int connected){};
Vekotin 1:7ed7d128d225 63 virtual void suspendStateChanged(unsigned int suspended){};
Vekotin 1:7ed7d128d225 64 virtual void SOF(int frameNumber){};
Vekotin 1:7ed7d128d225 65
Vekotin 1:7ed7d128d225 66 virtual bool EP1_OUT_callback(){return false;};
Vekotin 1:7ed7d128d225 67 virtual bool EP1_IN_callback(){return false;};
Vekotin 1:7ed7d128d225 68 virtual bool EP2_OUT_callback(){return false;};
Vekotin 1:7ed7d128d225 69 virtual bool EP2_IN_callback(){return false;};
Vekotin 1:7ed7d128d225 70 virtual bool EP3_OUT_callback(){return false;};
Vekotin 1:7ed7d128d225 71 virtual bool EP3_IN_callback(){return false;};
Vekotin 1:7ed7d128d225 72 virtual bool EP4_OUT_callback(){return false;};
Vekotin 1:7ed7d128d225 73 virtual bool EP4_IN_callback(){return false;};
Vekotin 1:7ed7d128d225 74
Vekotin 1:7ed7d128d225 75 #if !defined(TARGET_LPC11U24)
Vekotin 1:7ed7d128d225 76 virtual bool EP5_OUT_callback(){return false;};
Vekotin 1:7ed7d128d225 77 virtual bool EP5_IN_callback(){return false;};
Vekotin 1:7ed7d128d225 78 virtual bool EP6_OUT_callback(){return false;};
Vekotin 1:7ed7d128d225 79 virtual bool EP6_IN_callback(){return false;};
Vekotin 1:7ed7d128d225 80 virtual bool EP7_OUT_callback(){return false;};
Vekotin 1:7ed7d128d225 81 virtual bool EP7_IN_callback(){return false;};
Vekotin 1:7ed7d128d225 82 virtual bool EP8_OUT_callback(){return false;};
Vekotin 1:7ed7d128d225 83 virtual bool EP8_IN_callback(){return false;};
Vekotin 1:7ed7d128d225 84 virtual bool EP9_OUT_callback(){return false;};
Vekotin 1:7ed7d128d225 85 virtual bool EP9_IN_callback(){return false;};
Vekotin 1:7ed7d128d225 86 virtual bool EP10_OUT_callback(){return false;};
Vekotin 1:7ed7d128d225 87 virtual bool EP10_IN_callback(){return false;};
Vekotin 1:7ed7d128d225 88 virtual bool EP11_OUT_callback(){return false;};
Vekotin 1:7ed7d128d225 89 virtual bool EP11_IN_callback(){return false;};
Vekotin 1:7ed7d128d225 90 virtual bool EP12_OUT_callback(){return false;};
Vekotin 1:7ed7d128d225 91 virtual bool EP12_IN_callback(){return false;};
Vekotin 1:7ed7d128d225 92 virtual bool EP13_OUT_callback(){return false;};
Vekotin 1:7ed7d128d225 93 virtual bool EP13_IN_callback(){return false;};
Vekotin 1:7ed7d128d225 94 virtual bool EP14_OUT_callback(){return false;};
Vekotin 1:7ed7d128d225 95 virtual bool EP14_IN_callback(){return false;};
Vekotin 1:7ed7d128d225 96 virtual bool EP15_OUT_callback(){return false;};
Vekotin 1:7ed7d128d225 97 virtual bool EP15_IN_callback(){return false;};
Vekotin 1:7ed7d128d225 98 #endif
Vekotin 1:7ed7d128d225 99
Vekotin 1:7ed7d128d225 100 private:
Vekotin 1:7ed7d128d225 101 void usbisr(void);
Vekotin 1:7ed7d128d225 102 static void _usbisr(void);
Vekotin 1:7ed7d128d225 103 static USBHAL * instance;
Vekotin 1:7ed7d128d225 104
Vekotin 1:7ed7d128d225 105 #if defined(TARGET_LPC11U24)
Vekotin 1:7ed7d128d225 106 bool (USBHAL::*epCallback[10 - 2])(void);
Vekotin 1:7ed7d128d225 107 #else
Vekotin 1:7ed7d128d225 108 bool (USBHAL::*epCallback[32 - 2])(void);
Vekotin 1:7ed7d128d225 109 #endif
Vekotin 1:7ed7d128d225 110
Vekotin 1:7ed7d128d225 111
Vekotin 1:7ed7d128d225 112 };
Vekotin 1:7ed7d128d225 113 #endif