USBLibAPIGuide  1.00.00.01
usbdhidsensor.h
Go to the documentation of this file.
1 //*****************************************************************************
2 //
3 // usbdhidsensor.h - Definitions used by HID sensor class devices.
4 //
5 // Copyright (c) 2008-2017 Texas Instruments Incorporated. All rights reserved.
6 // Software License Agreement
7 //
8 // Texas Instruments (TI) is supplying this software for use solely and
9 // exclusively on TI's microcontroller products. The software is owned by
10 // TI and/or its suppliers, and is protected under applicable copyright
11 // laws. You may not combine this software with "viral" open-source
12 // software in order to form a larger program.
13 //
14 // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
15 // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
16 // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17 // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
18 // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
19 // DAMAGES, FOR ANY REASON WHATSOEVER.
20 //
21 //
22 //*****************************************************************************
23 #ifndef __USBDHIDSENSOR_H__
24 #define __USBDHIDSENSOR_H__
25 
26 //*****************************************************************************
27 //
28 // If building with a C++ compiler, make all of the definitions in this header
29 // have a C binding.
30 //
31 //*****************************************************************************
32 #ifdef __cplusplus
33 extern "C"
34 {
35 #endif
36 
37 //*****************************************************************************
38 //
41 //
42 //*****************************************************************************
43 //*****************************************************************************
44 //
45 // PRIVATE
46 //
47 // The first few sections of this header are private defines that are used by
48 // the USB HID sensor code and are here only to help with the application
49 // allocating the correct amount of memory for the USB HID Sensor device
50 // code.
51 //
52 //*****************************************************************************
53 
54 
55 //*****************************************************************************
56 //
57 // PRIVATE
58 //
59 // This enumeration holds the various states that the sensor can be in during
60 // normal operation.
61 //
62 //*****************************************************************************
63 typedef enum
64 {
65  //
66  // Not yet configured.
67  //
69 
70  //
71  // Nothing to transmit and not waiting on data to be sent.
72  //
74 
75  //
76  // Waiting on data to be sent.
77  //
79 }
81 
82 
83 //*****************************************************************************
84 //
85 // PRIVATE
86 //
87 // This structure defines the private instance data structure for the USB HID
88 // sensor device. This structure forms the RAM workspace used by each
89 // instance of the sensor.
90 //
91 //*****************************************************************************
92 typedef struct
93 {
94  //
95  // This is needed for the lower level HID driver.
96  //
98 
99  //
100  // The current state of the game pad device.
101  //
102  tSensorState iState;
103 
104  //
105  // The idle timeout control structure for our input report. This is
106  // required by the lower level HID driver.
107  //
110 
111 //*****************************************************************************
112 //
115 //
116 //*****************************************************************************
117 typedef struct
118 {
119  //
121  //
122  const uint16_t ui16VID;
123 
124  //
126  //
127  const uint16_t ui16PID;
128 
129  //
131  //
132  const uint16_t ui16MaxPowermA;
133 
134  //
139  //
140  const uint8_t ui8PwrAttributes;
141 
145  //
147 
148  //
152  //
153  void *pvCBData;
154 
155  //
166  //
167  const uint8_t * const *ppui8StringDescriptors;
168 
169  //
172  //
173  const uint32_t ui32NumStringDescriptors;
174 
175  //
179  //
181 }
183 
185 //
187 //
188 //*****************************************************************************
189 #define USBDSENSOR_SUCCESS 0
190 
191 //*****************************************************************************
192 //
195 //
196 //*****************************************************************************
197 #define USBDSENSOR_TX_ERROR 1
198 
199 //*****************************************************************************
200 //
202 //
203 //*****************************************************************************
204 #define USBDSENSOR_NOT_CONFIGURED 2
205 
206 
207 //*****************************************************************************
208 //
214 //
215 //*****************************************************************************
216 typedef struct
217 {
218 
219  //
221  //
222  uint8_t ui8SensorState;
223 
224  //
226  //
227  uint8_t ui8SensorEvent;
228 
229  //
231  //
232  int16_t i16Temp;
233 
234 }PACKED tSensorTemperatureReport;
235 
236 
237 //*****************************************************************************
238 //
239 // API Function Prototypes
240 //
241 //*****************************************************************************
242 extern tUSBDHIDSensorDevice *USBDHIDSensorInit(uint32_t ui32Index,
243  tUSBDHIDSensorDevice *psHIDSensor);
244 extern tUSBDHIDSensorDevice *USBDHIDSensorCompositeInit(uint32_t ui32Index,
245  tUSBDHIDSensorDevice *psHIDSensor,
246  tCompositeEntry *psCompEntry);
247 extern void USBDHIDSensorTerm(tUSBDHIDSensorDevice *psCompEntry);
248 
249 extern uint32_t USBDHIDSensorSendReport(tUSBDHIDSensorDevice *psHIDSensor,
250  void *pvReport, uint32_t ui32Size);
251 
252 //*****************************************************************************
253 //
254 // Close the Doxygen group.
256 //
257 //*****************************************************************************
258 
259 
260 
261 //*****************************************************************************
262 //
263 // Mark the end of the C bindings section for C++ compilers.
264 //
265 //*****************************************************************************
266 #ifdef __cplusplus
267 }
268 #endif
269 
270 #endif // __USBDHIDSENSOR_H__
271 
272 
tUSBDHIDSensorDevice * USBDHIDSensorInit(uint32_t ui32Index, tUSBDHIDSensorDevice *psHIDSensorDevice)
Definition: usbdhidsensor.c:631
Definition: usbdhid.h:798
uint8_t ui8SensorState
8-bit value. Sensor state
Definition: usbdhidsensor.h:222
const uint8_t *const * ppui8StringDescriptors
Definition: usbdhidsensor.h:167
Definition: usbdhidsensor.h:68
uint8_t ui8SensorEvent
8-bit value. Sensor Event
Definition: usbdhidsensor.h:227
const uint16_t ui16MaxPowermA
The maximum power consumption of the device, expressed in milliamps.
Definition: usbdhidsensor.h:132
Definition: usbdevice.h:135
void USBDHIDSensorTerm(tUSBDHIDSensorDevice *psSensor)
Definition: usbdhidsensor.c:881
tUSBDHIDDevice sHIDDevice
Definition: usbdhidsensor.h:97
Definition: usbdhidsensor.h:73
Definition: usbdhid.h:839
const uint32_t ui32NumStringDescriptors
Definition: usbdhidsensor.h:173
const uint16_t ui16VID
The vendor ID that this device is to present in the device descriptor.
Definition: usbdhidsensor.h:122
Definition: usbdhidsensor.h:92
const uint16_t ui16PID
The product ID that this device is to present in the device descriptor.
Definition: usbdhidsensor.h:127
int16_t i16Temp
Signed 16-bit temperature value (-32767 to 32767).
Definition: usbdhidsensor.h:232
tSensorState
Definition: usbdhidsensor.h:63
tHIDReportIdle sReportIdle
Definition: usbdhidsensor.h:108
tUSBDHIDSensorDevice * USBDHIDSensorCompositeInit(uint32_t ui32Index, tUSBDHIDSensorDevice *psHIDSensorDevice, tCompositeEntry *psCompEntry)
Definition: usbdhidsensor.c:703
uint32_t USBDHIDSensorSendReport(tUSBDHIDSensorDevice *psHIDSensor, void *pvReport, uint32_t ui32Size)
Definition: usbdhidsensor.c:800
uint32_t(* tUSBCallback)(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgParam, void *pvMsgData)
Definition: usblib.h:1220
void * pvCBData
Definition: usbdhidsensor.h:153
tUSBDSensorInstance sPrivateData
Definition: usbdhidsensor.h:180
Definition: usbdhidsensor.h:117
Definition: usbdhidsensor.h:78
const tUSBCallback pfnCallback
Definition: usbdhidsensor.h:146
tSensorState iState
Definition: usbdhidsensor.h:102
const uint8_t ui8PwrAttributes
Definition: usbdhidsensor.h:140
USB_CDC_GET/SET_LINE_CODING request-specific data.
Definition: usbaudio.h:288
© Copyright 1995-2020, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale