JBBoardに接続したモーター2つをRCBControllerでコントロールするテストです。
Dependencies: FatFileSystem TB6612FNG2 mbed
Fork of BTstackLE by
usb/UsbHostMgr.h@0:1ed23ab1345f, 2012-06-26 (annotated)
- Committer:
- va009039
- Date:
- Tue Jun 26 14:27:45 2012 +0000
- Revision:
- 0:1ed23ab1345f
fix overflow spp_service_buffer
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 | 0:1ed23ab1345f | 1 | /* |
va009039 | 0:1ed23ab1345f | 2 | Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com) |
va009039 | 0:1ed23ab1345f | 3 | |
va009039 | 0:1ed23ab1345f | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy |
va009039 | 0:1ed23ab1345f | 5 | of this software and associated documentation files (the "Software"), to deal |
va009039 | 0:1ed23ab1345f | 6 | in the Software without restriction, including without limitation the rights |
va009039 | 0:1ed23ab1345f | 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
va009039 | 0:1ed23ab1345f | 8 | copies of the Software, and to permit persons to whom the Software is |
va009039 | 0:1ed23ab1345f | 9 | furnished to do so, subject to the following conditions: |
va009039 | 0:1ed23ab1345f | 10 | |
va009039 | 0:1ed23ab1345f | 11 | The above copyright notice and this permission notice shall be included in |
va009039 | 0:1ed23ab1345f | 12 | all copies or substantial portions of the Software. |
va009039 | 0:1ed23ab1345f | 13 | |
va009039 | 0:1ed23ab1345f | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
va009039 | 0:1ed23ab1345f | 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
va009039 | 0:1ed23ab1345f | 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
va009039 | 0:1ed23ab1345f | 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
va009039 | 0:1ed23ab1345f | 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
va009039 | 0:1ed23ab1345f | 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
va009039 | 0:1ed23ab1345f | 20 | THE SOFTWARE. |
va009039 | 0:1ed23ab1345f | 21 | */ |
va009039 | 0:1ed23ab1345f | 22 | |
va009039 | 0:1ed23ab1345f | 23 | //Assigns addresses to connected devices... |
va009039 | 0:1ed23ab1345f | 24 | |
va009039 | 0:1ed23ab1345f | 25 | #ifndef USB_HOSTMGR_H |
va009039 | 0:1ed23ab1345f | 26 | #define USB_HOSTMGR_H |
va009039 | 0:1ed23ab1345f | 27 | |
va009039 | 0:1ed23ab1345f | 28 | #include "mbed.h" |
va009039 | 0:1ed23ab1345f | 29 | #include "UsbInc.h" |
va009039 | 0:1ed23ab1345f | 30 | #include "UsbDevice.h" |
va009039 | 0:1ed23ab1345f | 31 | |
va009039 | 0:1ed23ab1345f | 32 | #define USB_HOSTMGR_MAX_DEVS 8 |
va009039 | 0:1ed23ab1345f | 33 | |
va009039 | 0:1ed23ab1345f | 34 | class UsbDevice; |
va009039 | 0:1ed23ab1345f | 35 | |
va009039 | 0:1ed23ab1345f | 36 | class UsbHostMgr //[0-2] inst |
va009039 | 0:1ed23ab1345f | 37 | { |
va009039 | 0:1ed23ab1345f | 38 | public: |
va009039 | 0:1ed23ab1345f | 39 | UsbHostMgr(); |
va009039 | 0:1ed23ab1345f | 40 | ~UsbHostMgr(); |
va009039 | 0:1ed23ab1345f | 41 | |
va009039 | 0:1ed23ab1345f | 42 | UsbErr init(); //Initialize host |
va009039 | 0:1ed23ab1345f | 43 | |
va009039 | 0:1ed23ab1345f | 44 | UsbErr poll(); //Enumerate connected devices, etc |
va009039 | 0:1ed23ab1345f | 45 | |
va009039 | 0:1ed23ab1345f | 46 | int devicesCount(); |
va009039 | 0:1ed23ab1345f | 47 | |
va009039 | 0:1ed23ab1345f | 48 | UsbDevice* getDevice(int item); |
va009039 | 0:1ed23ab1345f | 49 | UsbDevice* getDeviceByClass(uint8_t IfClass, int count = 0); |
va009039 | 0:1ed23ab1345f | 50 | void releaseDevice(UsbDevice* pDev); |
va009039 | 0:1ed23ab1345f | 51 | |
va009039 | 0:1ed23ab1345f | 52 | |
va009039 | 0:1ed23ab1345f | 53 | void UsbIrqhandler(); |
va009039 | 0:1ed23ab1345f | 54 | |
va009039 | 0:1ed23ab1345f | 55 | protected: |
va009039 | 0:1ed23ab1345f | 56 | void onUsbDeviceConnected(int hub, int port); |
va009039 | 0:1ed23ab1345f | 57 | void onUsbDeviceDisconnected(int hub, int port); |
va009039 | 0:1ed23ab1345f | 58 | |
va009039 | 0:1ed23ab1345f | 59 | friend class UsbDevice; |
va009039 | 0:1ed23ab1345f | 60 | void resetPort(int hub, int port); |
va009039 | 0:1ed23ab1345f | 61 | |
va009039 | 0:1ed23ab1345f | 62 | private: |
va009039 | 0:1ed23ab1345f | 63 | /* __align(8)*/ volatile HCCA* m_pHcca; |
va009039 | 0:1ed23ab1345f | 64 | |
va009039 | 0:1ed23ab1345f | 65 | UsbDevice* m_lpDevices[USB_HOSTMGR_MAX_DEVS]; |
va009039 | 0:1ed23ab1345f | 66 | bool m_hardware_init; |
va009039 | 0:1ed23ab1345f | 67 | }; |
va009039 | 0:1ed23ab1345f | 68 | |
va009039 | 0:1ed23ab1345f | 69 | #endif |