ME11B Sample Code in Maxim Integrated Team

Dependencies:   BMI160 max32630hsp3 MemoryLCD USBDevice

Fork of Host_Software_MAX32664GWEB_HR_EXTENDED by Seyhmus Cacina

Committer:
seyhmus.cacina
Date:
Mon Mar 18 10:21:53 2019 +0300
Revision:
0:ac4dea3e2894
ME11B Sample Code First Commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
seyhmus.cacina 0:ac4dea3e2894 1 /* Copyright (c) 2010-2011 mbed.org, MIT License
seyhmus.cacina 0:ac4dea3e2894 2 *
seyhmus.cacina 0:ac4dea3e2894 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
seyhmus.cacina 0:ac4dea3e2894 4 * and associated documentation files (the "Software"), to deal in the Software without
seyhmus.cacina 0:ac4dea3e2894 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
seyhmus.cacina 0:ac4dea3e2894 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
seyhmus.cacina 0:ac4dea3e2894 7 * Software is furnished to do so, subject to the following conditions:
seyhmus.cacina 0:ac4dea3e2894 8 *
seyhmus.cacina 0:ac4dea3e2894 9 * The above copyright notice and this permission notice shall be included in all copies or
seyhmus.cacina 0:ac4dea3e2894 10 * substantial portions of the Software.
seyhmus.cacina 0:ac4dea3e2894 11 *
seyhmus.cacina 0:ac4dea3e2894 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
seyhmus.cacina 0:ac4dea3e2894 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
seyhmus.cacina 0:ac4dea3e2894 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
seyhmus.cacina 0:ac4dea3e2894 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
seyhmus.cacina 0:ac4dea3e2894 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
seyhmus.cacina 0:ac4dea3e2894 17 */
seyhmus.cacina 0:ac4dea3e2894 18
seyhmus.cacina 0:ac4dea3e2894 19 /* Standard descriptor types */
seyhmus.cacina 0:ac4dea3e2894 20 #define DEVICE_DESCRIPTOR (1)
seyhmus.cacina 0:ac4dea3e2894 21 #define CONFIGURATION_DESCRIPTOR (2)
seyhmus.cacina 0:ac4dea3e2894 22 #define STRING_DESCRIPTOR (3)
seyhmus.cacina 0:ac4dea3e2894 23 #define INTERFACE_DESCRIPTOR (4)
seyhmus.cacina 0:ac4dea3e2894 24 #define ENDPOINT_DESCRIPTOR (5)
seyhmus.cacina 0:ac4dea3e2894 25 #define QUALIFIER_DESCRIPTOR (6)
seyhmus.cacina 0:ac4dea3e2894 26
seyhmus.cacina 0:ac4dea3e2894 27 /* Standard descriptor lengths */
seyhmus.cacina 0:ac4dea3e2894 28 #define DEVICE_DESCRIPTOR_LENGTH (0x12)
seyhmus.cacina 0:ac4dea3e2894 29 #define CONFIGURATION_DESCRIPTOR_LENGTH (0x09)
seyhmus.cacina 0:ac4dea3e2894 30 #define INTERFACE_DESCRIPTOR_LENGTH (0x09)
seyhmus.cacina 0:ac4dea3e2894 31 #define ENDPOINT_DESCRIPTOR_LENGTH (0x07)
seyhmus.cacina 0:ac4dea3e2894 32
seyhmus.cacina 0:ac4dea3e2894 33
seyhmus.cacina 0:ac4dea3e2894 34 /*string offset*/
seyhmus.cacina 0:ac4dea3e2894 35 #define STRING_OFFSET_LANGID (0)
seyhmus.cacina 0:ac4dea3e2894 36 #define STRING_OFFSET_IMANUFACTURER (1)
seyhmus.cacina 0:ac4dea3e2894 37 #define STRING_OFFSET_IPRODUCT (2)
seyhmus.cacina 0:ac4dea3e2894 38 #define STRING_OFFSET_ISERIAL (3)
seyhmus.cacina 0:ac4dea3e2894 39 #define STRING_OFFSET_ICONFIGURATION (4)
seyhmus.cacina 0:ac4dea3e2894 40 #define STRING_OFFSET_IINTERFACE (5)
seyhmus.cacina 0:ac4dea3e2894 41
seyhmus.cacina 0:ac4dea3e2894 42 /* USB Specification Release Number */
seyhmus.cacina 0:ac4dea3e2894 43 #define USB_VERSION_2_0 (0x0200)
seyhmus.cacina 0:ac4dea3e2894 44
seyhmus.cacina 0:ac4dea3e2894 45 /* Least/Most significant byte of short integer */
seyhmus.cacina 0:ac4dea3e2894 46 #define LSB(n) ((n)&0xff)
seyhmus.cacina 0:ac4dea3e2894 47 #define MSB(n) (((n)&0xff00)>>8)
seyhmus.cacina 0:ac4dea3e2894 48
seyhmus.cacina 0:ac4dea3e2894 49 /* Convert physical endpoint number to descriptor endpoint number */
seyhmus.cacina 0:ac4dea3e2894 50 #define PHY_TO_DESC(endpoint) (((endpoint)>>1) | (((endpoint) & 1) ? 0x80:0))
seyhmus.cacina 0:ac4dea3e2894 51
seyhmus.cacina 0:ac4dea3e2894 52 /* bmAttributes in configuration descriptor */
seyhmus.cacina 0:ac4dea3e2894 53 /* C_RESERVED must always be set */
seyhmus.cacina 0:ac4dea3e2894 54 #define C_RESERVED (1U<<7)
seyhmus.cacina 0:ac4dea3e2894 55 #define C_SELF_POWERED (1U<<6)
seyhmus.cacina 0:ac4dea3e2894 56 #define C_REMOTE_WAKEUP (1U<<5)
seyhmus.cacina 0:ac4dea3e2894 57
seyhmus.cacina 0:ac4dea3e2894 58 /* bMaxPower in configuration descriptor */
seyhmus.cacina 0:ac4dea3e2894 59 #define C_POWER(mA) ((mA)/2)
seyhmus.cacina 0:ac4dea3e2894 60
seyhmus.cacina 0:ac4dea3e2894 61 /* bmAttributes in endpoint descriptor */
seyhmus.cacina 0:ac4dea3e2894 62 #define E_CONTROL (0x00)
seyhmus.cacina 0:ac4dea3e2894 63 #define E_ISOCHRONOUS (0x01)
seyhmus.cacina 0:ac4dea3e2894 64 #define E_BULK (0x02)
seyhmus.cacina 0:ac4dea3e2894 65 #define E_INTERRUPT (0x03)
seyhmus.cacina 0:ac4dea3e2894 66
seyhmus.cacina 0:ac4dea3e2894 67 /* For isochronous endpoints only: */
seyhmus.cacina 0:ac4dea3e2894 68 #define E_NO_SYNCHRONIZATION (0x00)
seyhmus.cacina 0:ac4dea3e2894 69 #define E_ASYNCHRONOUS (0x04)
seyhmus.cacina 0:ac4dea3e2894 70 #define E_ADAPTIVE (0x08)
seyhmus.cacina 0:ac4dea3e2894 71 #define E_SYNCHRONOUS (0x0C)
seyhmus.cacina 0:ac4dea3e2894 72 #define E_DATA (0x00)
seyhmus.cacina 0:ac4dea3e2894 73 #define E_FEEDBACK (0x10)
seyhmus.cacina 0:ac4dea3e2894 74 #define E_IMPLICIT_FEEDBACK (0x20)