Silicon Labs Host Libraries
SLABHIDtoUART.h
1 // SLABHIDtoUART.h
3 // For SLABHIDtoUART.dll
4 // and Silicon Labs CP2110/CP2114 HID to UART
6 #ifndef HOST_LIB_SLABHIDUART_INCLUDE_SLABHIDTOUART_H_INCLUDED_XF4QYQM3BK
7 #define HOST_LIB_SLABHIDUART_INCLUDE_SLABHIDTOUART_H_INCLUDED_XF4QYQM3BK
8 
41 
43 // Includes
45 
46 #include "silabs_defs.h"
47 #include "silabs_sal.h"
48 #include "Types.h"
49 
51 // Tool-chain-dependent hacks
53 #ifdef _WIN32
54 // The following ifdef block is the standard way of creating macros which make exporting
55 // from a DLL simpler. All files within this DLL are compiled with the HID_TO_UART_EXPORTS
56 // symbol defined on the command line. this symbol should not be defined on any project
57 // that uses this DLL. This way any other project whose source files include this file see
58 // HID_TO_UART_API functions as being imported from a DLL, whereas this DLL sees symbols
59 // defined with this macro as being exported.
60 #if defined(HID_TO_UART_EXPORTS)
61 #define HID_TO_UART_API
62 #else
63 #if defined(SILABS_STATIC_LINK)
64 #define HID_TO_UART_API extern
65 #pragma comment(lib, "SLABHIDtoUART.static.lib")
66 #else // defined(SILABS_STATIC_LINK)
67 #define HID_TO_UART_API __declspec(dllimport)
68 #pragma comment(lib, "SLABHIDtoUART.lib")
69 #endif // defined(SILABS_STATIC_LINK)
70 #endif // defined(HID_TO_UART_EXPORTS)
71 #else // !_WIN32
72 #define HID_TO_UART_API
73 #define WINAPI
74 #endif // !_WIN32
75 
76 
77 
79 // Return Code Definitions
81 
82 #if !defined(USE_LEGACY_HID_UART_STATUS)
83 typedef enum _HID_UART_STATUS {
92 
101 
103 
108 #else // defined(USE_LEGACY_HID_UART_STATUS)
109 typedef int HID_UART_STATUS;
114 // API Status Return Codes
115 #define HID_UART_SUCCESS 0x00
116 #define HID_UART_DEVICE_NOT_FOUND 0x01
117 #define HID_UART_INVALID_HANDLE 0x02
118 #define HID_UART_INVALID_DEVICE_OBJECT 0x03
119 #define HID_UART_INVALID_PARAMETER 0x04
120 #define HID_UART_INVALID_REQUEST_LENGTH 0x05
121 
122 #define HID_UART_READ_ERROR 0x10
123 #define HID_UART_WRITE_ERROR 0x11
124 #define HID_UART_READ_TIMED_OUT 0x12
125 #define HID_UART_WRITE_TIMED_OUT 0x13
126 #define HID_UART_DEVICE_IO_FAILED 0x14
127 #define HID_UART_DEVICE_ACCESS_ERROR 0x15
128 #define HID_UART_DEVICE_NOT_SUPPORTED 0x16
129 #define HID_UART_INVALID_CONFIG_VERSION 0x17
130 
131 #define HID_UART_UNKNOWN_ERROR SILABS_STATUS_UNKNOWN_ERROR
132 #endif // defined(USE_LEGACY_HID_UART_STATUS)
134 
136 // String Definitions
138 
142 #define HID_UART_GET_VID_STR 0x01
143 #define HID_UART_GET_PID_STR 0x02
144 #define HID_UART_GET_PATH_STR 0x03
145 #define HID_UART_GET_SERIAL_STR 0x04
146 #define HID_UART_GET_MANUFACTURER_STR 0x05
147 #define HID_UART_GET_PRODUCT_STR 0x06
148 
150 // String Lengths
151 #define HID_UART_DEVICE_STRLEN 260
152 typedef char HID_UART_DEVICE_STR[HID_UART_DEVICE_STRLEN];
155 
157 // UART Definitions
159 
164 #define HID_UART_PARITY_ERROR 0x01
165 #define HID_UART_OVERRUN_ERROR 0x02
166 
167 #define HID_UART_LINE_BREAK_INACTIVE 0x00
169 #define HID_UART_LINE_BREAK_ACTIVE 0x01
170 
172 #define HID_UART_FIVE_DATA_BITS 0x00
177 #define HID_UART_SIX_DATA_BITS 0x01
178 #define HID_UART_SEVEN_DATA_BITS 0x02
179 #define HID_UART_EIGHT_DATA_BITS 0x03
180 
182 #define HID_UART_NO_PARITY 0x00
187 #define HID_UART_ODD_PARITY 0x01
188 #define HID_UART_EVEN_PARITY 0x02
189 #define HID_UART_MARK_PARITY 0x03
190 #define HID_UART_SPACE_PARITY 0x04
191 
193 #define HID_UART_SHORT_STOP_BIT 0x00
201 #define HID_UART_LONG_STOP_BIT 0x01
202 
204 #define HID_UART_NO_FLOW_CONTROL 0x00
209 #define HID_UART_RTS_CTS_FLOW_CONTROL 0x01
210 
212 // Read/Write Limits
215 #define HID_UART_MIN_READ_SIZE 1
216 #define HID_UART_MAX_READ_SIZE 32768
217 #define HID_UART_MIN_WRITE_SIZE 1
218 #define HID_UART_MAX_WRITE_SIZE 4096
219 
221 // User Customization Definitions
224 
225 // User-Customizable Field Lock Bitmasks
228 #define HID_UART_LOCK_PRODUCT_STR_1 0x0001
229 #define HID_UART_LOCK_PRODUCT_STR_2 0x0002
230 #define HID_UART_LOCK_SERIAL_STR 0x0004
231 #define HID_UART_LOCK_PIN_CONFIG 0x0008
232 #define HID_UART_LOCK_VID 0x0100
233 #define HID_UART_LOCK_PID 0x0200
234 #define HID_UART_LOCK_POWER 0x0400
235 #define HID_UART_LOCK_POWER_MODE 0x0800
236 #define HID_UART_LOCK_RELEASE_VERSION 0x1000
237 #define HID_UART_LOCK_FLUSH_BUFFERS 0x2000
238 #define HID_UART_LOCK_MFG_STR_1 0x4000
239 #define HID_UART_LOCK_MFG_STR_2 0x8000
240 
242 // Field Lock Bit Values
245 #define HID_UART_LOCK_UNLOCKED 1
246 #define HID_UART_LOCK_LOCKED 0
247 
249 #define HID_UART_BUS_POWER_MAX 0xFA
251 
252 #define HID_UART_BUS_POWER 0x00
256 #define HID_UART_SELF_POWER_VREG_DIS 0x01
257 #define HID_UART_SELF_POWER_VREG_EN 0x02
258 
260 #define HID_UART_FLUSH_TX_OPEN 0x01
264 #define HID_UART_FLUSH_TX_CLOSE 0x02
265 #define HID_UART_FLUSH_RX_OPEN 0x04
266 #define HID_UART_FLUSH_RX_CLOSE 0x08
267 
269 #define HID_UART_SET_VID 0x01
274 #define HID_UART_SET_PID 0x02
275 #define HID_UART_SET_POWER 0x04
276 #define HID_UART_SET_POWER_MODE 0x08
277 #define HID_UART_SET_RELEASE_VERSION 0x10
278 #define HID_UART_SET_FLUSH_BUFFERS 0x20
279 
280 #define HID_UART_SET_IGNORE 0
282 #define HID_UART_SET_PROGRAM 1
283 
285 #define HID_UART_MFG_STRLEN 62
289 #define HID_UART_PRODUCT_STRLEN 62
290 #define HID_UART_SERIAL_STRLEN 30
291 
296 
300 
304 
306 // Pin Definitions
308 
312 #define HID_UART_GPIO_MODE_INPUT 0x00
313 #define HID_UART_GPIO_MODE_OUTPUT_OD 0x01
314 #define HID_UART_GPIO_MODE_OUTPUT_PP 0x02
315 #define HID_UART_GPIO_MODE_FUNCTION1 0x03
316 #define HID_UART_GPIO_MODE_FUNCTION2 0x04
317 
319 #define HID_UART_VALUE_SUSPEND_LO 0
323 #define HID_UART_VALUE_SUSPEND_HI 1
324 
326 #define HID_UART_MODE_SUSPEND_OD 0
330 #define HID_UART_MODE_SUSPEND_PP 1
331 
333 #define HID_UART_MODE_RS485_ACTIVE_LO 0x00
337 #define HID_UART_MODE_RS485_ACTIVE_HI 0x01
338 
340 // Typedefs
345 typedef void* HID_UART_DEVICE;
348 typedef unsigned char U8;
351 typedef unsigned short U16;
352 
354 // Exported Library Functions
356 
357 #ifdef __cplusplus
358 extern "C" {
359 #endif // __cplusplus
360 
372 _Check_return_
374 _Success_(return == HID_UART_SUCCESS)
376 HidUart_GetNumDevices(_Out_writes_bytes_(sizeof(DWORD)) _Pre_defensive_ LPDWORD lpdwNumDevices, _In_ _Pre_defensive_ const WORD vid, _In_ _Pre_defensive_ const WORD pid);
377 
401 _Check_return_
403 _Success_(return == HID_UART_SUCCESS)
405 HidUart_GetString(_In_ _Pre_defensive_ const DWORD deviceNum, _In_ _Pre_defensive_ const WORD vid, _In_ _Pre_defensive_ const WORD pid, _Out_ _Pre_defensive_ char* deviceString, _In_ _Pre_defensive_ const DWORD options);
406 
424 _Check_return_
426 _Success_(return == HID_UART_SUCCESS)
428 HidUart_GetOpenedString(_In_ _Pre_defensive_ const HID_UART_DEVICE device, char* deviceString, _In_ _Pre_defensive_ const DWORD options);
429 
449 _Check_return_
451 _Success_(return == HID_UART_SUCCESS)
453 HidUart_GetIndexedString(_In_ _Pre_defensive_ const DWORD deviceNum, _In_ _Pre_defensive_ const WORD vid, _In_ _Pre_defensive_ const WORD pid, _In_ _Pre_defensive_ const DWORD stringIndex, char* deviceString);
454 
469 _Check_return_
471 _Success_(return == HID_UART_SUCCESS)
473 HidUart_GetOpenedIndexedString(_In_ _Pre_defensive_ const HID_UART_DEVICE device, _In_ _Pre_defensive_ const DWORD stringIndex, char* deviceString);
474 
494 _Check_return_
496 _Success_(return == HID_UART_SUCCESS)
498 HidUart_GetAttributes(_In_ _Pre_defensive_ const DWORD deviceNum, _In_ _Pre_defensive_ const WORD vid, _In_ _Pre_defensive_ const WORD pid, _Out_writes_bytes_(sizeof(WORD)) _Pre_defensive_ WORD* deviceVid, _Out_writes_bytes_(sizeof(WORD)) _Pre_defensive_ WORD* devicePid, _Out_writes_bytes_(sizeof(WORD)) _Pre_defensive_ WORD* pDeviceReleaseNumber);
499 
513 _Check_return_
515 _Success_(return == HID_UART_SUCCESS)
517 HidUart_GetOpenedAttributes(_In_ _Pre_defensive_ const HID_UART_DEVICE device, _Out_writes_bytes_(sizeof(WORD)) _Pre_defensive_ WORD* pDeviceVid, _Out_writes_bytes_(sizeof(WORD)) _Pre_defensive_ WORD* pDevicePid, _Out_writes_bytes_(sizeof(WORD)) _Pre_defensive_ WORD* pDeviceReleaseNumber);
518 
540 _Check_return_
542 _Success_(return == HID_UART_SUCCESS)
544 HidUart_Open(_Out_ HID_UART_DEVICE* pdevice, _In_ _Pre_defensive_ const DWORD deviceNum, _In_ _Pre_defensive_ const WORD vid, _In_ _Pre_defensive_ const WORD pid);
545 
557 _Check_return_
559 _Success_(return == HID_UART_SUCCESS)
561 HidUart_Close(_In_ _Pre_defensive_ const HID_UART_DEVICE device);
562 
572 _Check_return_
574 _Success_(return == HID_UART_SUCCESS)
576 HidUart_IsOpened(_In_ _Pre_defensive_ const HID_UART_DEVICE device, _Out_writes_bytes_(sizeof(BOOL)) _Pre_defensive_ BOOL* pbIsOpened);
577 
590 _Check_return_
592 _Success_(return == HID_UART_SUCCESS)
594 HidUart_SetUartEnable(_In_ _Pre_defensive_ const HID_UART_DEVICE device, _In_ _Pre_defensive_ const BOOL enable);
595 
606 _Check_return_
608 _Success_(return == HID_UART_SUCCESS)
610 HidUart_GetUartEnable(_In_ _Pre_defensive_ const HID_UART_DEVICE device, _Out_writes_bytes_(sizeof(BOOL)) _Pre_defensive_ BOOL* penable);
611 
630 _Check_return_
632 _Success_(return == HID_UART_SUCCESS)
634 HidUart_Read(_In_ _Pre_defensive_ const HID_UART_DEVICE device, BYTE* buffer, _In_ _Pre_defensive_ const DWORD numBytesToRead, _Out_writes_bytes_(sizeof(DWORD)) _Pre_defensive_ DWORD* pNumBytesRead);
635 
661 _Check_return_
663 _Success_(return == HID_UART_SUCCESS)
665 HidUart_Write(_In_ _Pre_defensive_ const HID_UART_DEVICE device, BYTE* buffer, _In_ _Pre_defensive_ const DWORD numBytesToWrite, _Out_writes_bytes_(sizeof(DWORD)) _Pre_defensive_ DWORD* pNumBytesWritten);
666 
679 _Check_return_
681 _Success_(return == HID_UART_SUCCESS)
683 HidUart_FlushBuffers(_In_ _Pre_defensive_ const HID_UART_DEVICE device, _In_ _Pre_defensive_ const BOOL bFlushTransmit, _In_ _Pre_defensive_ const BOOL bFlushReceive);
684 
692 _Check_return_
694 _Success_(return == HID_UART_SUCCESS)
696 HidUart_CancelIo(_In_ _Pre_defensive_ const HID_UART_DEVICE device);
697 
716 _Check_return_
718 _Success_(return == HID_UART_SUCCESS)
720 HidUart_SetTimeouts(_In_ _Pre_defensive_ const HID_UART_DEVICE device, _In_ _Pre_defensive_ const DWORD ReadTimeoutInMilliseconds, _In_ _Pre_defensive_ const DWORD WriteTimeoutInMilliseconds);
721 
734 _Check_return_
736 _Success_(return == HID_UART_SUCCESS)
738 HidUart_GetTimeouts(_In_ _Pre_defensive_ const HID_UART_DEVICE device, _Out_writes_bytes_(sizeof(DWORD)) _Pre_defensive_ DWORD* pReadTimeoutInMilliseconds, _Out_writes_bytes_(sizeof(DWORD)) _Pre_defensive_ DWORD* pWriteTimeoutInMilliseconds);
739 
759 _Check_return_
761 _Success_(return == HID_UART_SUCCESS)
763 HidUart_GetUartStatus(_In_ _Pre_defensive_ const HID_UART_DEVICE device, _Out_writes_bytes_(sizeof(WORD)) _Pre_defensive_ WORD* transmitFifoSize, _Out_writes_bytes_(sizeof(WORD)) _Pre_defensive_ WORD* receiveFifoSize, _Out_writes_bytes_(sizeof(BYTE)) _Pre_defensive_ BYTE* errorStatus, _Out_writes_bytes_(sizeof(BYTE)) _Pre_defensive_ BYTE* lineBreakStatus);
764 
783 _Check_return_
785 _Success_(return == HID_UART_SUCCESS)
787 HidUart_SetUartConfig(_In_ _Pre_defensive_ const HID_UART_DEVICE device, _In_ _Pre_defensive_ const DWORD baudRate, _In_ _Pre_defensive_ const BYTE dataBits, _In_ _Pre_defensive_ const BYTE parity, _In_ _Pre_defensive_ const BYTE stopBits, _In_ _Pre_defensive_ const BYTE flowControl);
788 
807 _Check_return_
809 _Success_(return == HID_UART_SUCCESS)
811 HidUart_GetUartConfig(_In_ _Pre_defensive_ const HID_UART_DEVICE device, _Out_writes_bytes_(sizeof(DWORD)) _Pre_defensive_ DWORD* pBaudRate, _Out_writes_bytes_(sizeof(BYTE)) _Pre_defensive_ BYTE* pDataBits, _Out_writes_bytes_(sizeof(BYTE)) _Pre_defensive_ BYTE* pParity, _Out_writes_bytes_(sizeof(BYTE)) _Pre_defensive_ BYTE* pStopBits, _Out_writes_bytes_(sizeof(BYTE)) _Pre_defensive_ BYTE* pFlowControl);
812 
823 _Check_return_
825 _Success_(return == HID_UART_SUCCESS)
827 HidUart_StartBreak(_In_ _Pre_defensive_ const HID_UART_DEVICE device, _In_ _Pre_defensive_ const BYTE DurationInMilliseconds);
828 
839 _Check_return_
841 _Success_(return == HID_UART_SUCCESS)
843 HidUart_StopBreak(_In_ _Pre_defensive_ const HID_UART_DEVICE device);
844 
858 _Check_return_
860 _Success_(return == HID_UART_SUCCESS)
862 HidUart_Reset(_In_ _Pre_defensive_ const HID_UART_DEVICE device);
863 
882 _Check_return_
884 _Success_(return == HID_UART_SUCCESS)
886 HidUart_ReadLatch(_In_ _Pre_defensive_ const HID_UART_DEVICE device, _Out_writes_bytes_(sizeof(WORD)) _Pre_defensive_ WORD* pLatchValue);
887 
905 _Check_return_
907 _Success_(return == HID_UART_SUCCESS)
909 HidUart_WriteLatch(_In_ _Pre_defensive_ const HID_UART_DEVICE device, _In_ _Pre_defensive_ const WORD LatchValue, _In_ _Pre_defensive_ const WORD LatchMask);
910 
921 _Check_return_
923 _Success_(return == HID_UART_SUCCESS)
925 HidUart_GetPartNumber(_In_ _Pre_defensive_ const HID_UART_DEVICE device, _Out_writes_bytes_(sizeof(BYTE)) _Pre_defensive_ BYTE* pPartNumber, _Out_writes_bytes_(sizeof(BYTE)) _Pre_defensive_ BYTE* pVersion);
926 
936 _Check_return_
938 _Success_(return == HID_UART_SUCCESS)
940 HidUart_GetLibraryVersion(_Out_writes_bytes_(1) BYTE* pMajor, _Out_writes_bytes_(1) BYTE* pMinor, _Out_writes_bytes_(sizeof(BOOL)) BOOL* pIsReleaseBuild);
941 
951 _Check_return_
953 _Success_(return == HID_UART_SUCCESS)
955 HidUart_GetHidLibraryVersion(_Out_writes_bytes_(1) BYTE* pMajor, _Out_writes_bytes_(1) BYTE* pMinor, _Out_writes_bytes_(sizeof(BOOL)) BOOL* pIsReleaseBuild);
956 
964 #ifdef _WIN32
965 #endif
967 _Check_return_
973 _Success_(return == HID_UART_SUCCESS)
975 HidUart_GetHidGuid(_Out_ void* pHIDGuid);
976 #ifdef _WIN32
977 
987 _Check_return_
989 _Success_(return == HID_UART_SUCCESS)
991 HidUart_GetHidGuidSafe(_Out_ GUID *pHIDGuid);
992 #endif // _WIN32
993 
1009 _Check_return_
1011 _Success_(return == HID_UART_SUCCESS)
1013 HidUart_SetLock(_In_ _Pre_defensive_ const HID_UART_DEVICE device, _In_ _Pre_defensive_ const WORD lock);
1014 
1025 _Check_return_
1027 _Success_(return == HID_UART_SUCCESS)
1029 HidUart_GetLock(_In_ _Pre_defensive_ const HID_UART_DEVICE device, _Out_writes_bytes_(sizeof(WORD)) _Pre_defensive_ WORD* lock);
1030 
1049 _Check_return_
1051 _Success_(return == HID_UART_SUCCESS)
1053 HidUart_SetUsbConfig(_In_ _Pre_defensive_ const HID_UART_DEVICE device, _In_ const WORD vid, _In_ const WORD pid, _In_ const BYTE power, _In_ const BYTE powerMode, _In_ const WORD releaseVersion, _In_ const BYTE flushBuffers, _In_ const BYTE mask);
1054 
1058 
1072 _Check_return_
1074 _Success_(return == HID_UART_SUCCESS)
1076 HidUart_GetUsbConfig(_In_ _Pre_defensive_ const HID_UART_DEVICE device, _Out_writes_bytes_(sizeof(WORD)) _Pre_defensive_ WORD* pVid, _Out_writes_bytes_(sizeof(WORD)) _Pre_defensive_ WORD* pPid, _Out_writes_bytes_(sizeof(BYTE)) _Pre_defensive_ BYTE* pPower, _Out_writes_bytes_(sizeof(BYTE)) _Pre_defensive_ BYTE* pPowerMode, _Out_writes_bytes_(sizeof(WORD)) _Pre_defensive_ WORD* pReleaseVersion, _Out_writes_bytes_(sizeof(BYTE)) _Pre_defensive_ BYTE* pFlushBuffers);
1077 
1090 _Check_return_
1092 _Success_(return == HID_UART_SUCCESS)
1094 HidUart_SetManufacturingString(_In_ _Pre_defensive_ const HID_UART_DEVICE device, char* manufacturingString, _In_ _Pre_defensive_ const BYTE strlen);
1095 
1108 _Check_return_
1110 _Success_(return == HID_UART_SUCCESS)
1112 HidUart_GetManufacturingString(_In_ _Pre_defensive_ const HID_UART_DEVICE device, char* manufacturingString, _Out_writes_bytes_(sizeof(BYTE)) _Pre_defensive_ BYTE* strlen);
1113 
1126 _Check_return_
1128 _Success_(return == HID_UART_SUCCESS)
1130 HidUart_SetProductString(_In_ _Pre_defensive_ const HID_UART_DEVICE device, char* productString, _In_ _Pre_defensive_ const BYTE strlen);
1131 
1144 _Check_return_
1146 _Success_(return == HID_UART_SUCCESS)
1148 HidUart_GetProductString(_In_ _Pre_defensive_ const HID_UART_DEVICE device, char* productString, _Out_writes_bytes_(sizeof(BYTE)) _Pre_defensive_ BYTE* strlen);
1149 
1162 _Check_return_
1164 _Success_(return == HID_UART_SUCCESS)
1166 HidUart_SetSerialString(_In_ _Pre_defensive_ const HID_UART_DEVICE device, char* serialString, _In_ _Pre_defensive_ const BYTE strlen);
1167 
1180 _Check_return_
1182 _Success_(return == HID_UART_SUCCESS)
1184 HidUart_GetSerialString(_In_ _Pre_defensive_ const HID_UART_DEVICE device, char* serialString, _Out_writes_bytes_(sizeof(BYTE)) _Pre_defensive_ BYTE* strlen);
1185 
1186 #ifdef __cplusplus
1187 }
1188 #endif // __cplusplus
1189 
1191 
1192 #endif // HOST_LIB_SLABHIDUART_INCLUDE_SLABHIDTOUART_H_INCLUDED_XF4QYQM3BK
HID_UART_STATUS HidUart_GetOpenedIndexedString(const HID_UART_DEVICE device, const DWORD stringIndex, char *deviceString)
This function returns a null-terminated USB string descriptor for the device specified by device...
HID_UART_STATUS HidUart_GetProductString(const HID_UART_DEVICE device, char *productString, BYTE *strlen)
Retrieves the USB product string.
HID_UART_STATUS HidUart_Write(const HID_UART_DEVICE device, BYTE *buffer, const DWORD numBytesToWrite, DWORD *pNumBytesWritten)
Write the specified number of bytes from the supplied buffer to the device. This function returns syn...
a parameter was not valid
Definition: SLABHIDtoUART.h:90
the device or device property could not be accessed.Either the device is not opened, already opened when trying to open, or an error occurred when trying to get HID information.
Definition: SLABHIDtoUART.h:98
HID_UART_STATUS HidUart_SetUartEnable(const HID_UART_DEVICE device, const BOOL enable)
Enables or disables the UART.
HID_UART_STATUS HidUart_FlushBuffers(const HID_UART_DEVICE device, const BOOL bFlushTransmit, const BOOL bFlushReceive)
Flushes the receive buffer in the device and the HID driver and/or the transmit buffer in the device...
HID_UART_STATUS HidUart_GetOpenedString(const HID_UART_DEVICE device, char *deviceString, const DWORD options)
This function returns a null-terminated vendor ID string, product ID string, serial number string...
HID_UART_STATUS HidUart_GetHidLibraryVersion(BYTE *pMajor, BYTE *pMinor, BOOL *pIsReleaseBuild)
Returns the version of the underlying HID Device Interface Library that is currently in use...
#define WINAPI
Win API.
Definition: SLABHIDtoUART.h:73
the current device does not support the corresponding action
Definition: SLABHIDtoUART.h:99
HID_UART_STATUS
Definition: SLABHIDtoUART.h:85
HID_UART_STATUS HidUart_CancelIo(const HID_UART_DEVICE device)
cancels any pending HID reads and writes. (Windows only)
HID_UART_STATUS HidUart_SetManufacturingString(const HID_UART_DEVICE device, char *manufacturingString, const BYTE strlen)
Allows one-time customization of the USB manufacturing string.
HID_UART_STATUS HidUart_GetUartEnable(const HID_UART_DEVICE device, BOOL *penable)
Returns the UART enable status.
#define HID_UART_SERIAL_STRLEN
device Max Serial Number string length
Definition: SLABHIDtoUART.h:290
HID_UART_STATUS HidUart_GetHidGuid(void *pHIDGuid)
Return the GUID for HIDClass devices ("return the HID GUID") (Windows only)
HID_UART_STATUS HidUart_GetLibraryVersion(BYTE *pMajor, BYTE *pMinor, BOOL *pIsReleaseBuild)
Returns the HID-to-UART Interface Library version information.
HID_UART_STATUS HidUart_ReadLatch(const HID_UART_DEVICE device, WORD *pLatchValue)
Get the current port latch value from the device.
This value should never be returned.
Definition: SLABHIDtoUART.h:104
HID_UART_STATUS HidUart_IsOpened(const HID_UART_DEVICE device, BOOL *pbIsOpened)
Returns the device opened status.
HID_UART_STATUS HidUart_WriteLatch(const HID_UART_DEVICE device, const WORD LatchValue, const WORD LatchMask)
Sets the current port latch value to the device.
HID_UART_STATUS HidUart_SetProductString(const HID_UART_DEVICE device, char *productString, const BYTE strlen)
Allows one-time customization of the USB product string.
unsigned char U8
unsigned uint 8
Definition: SLABHIDtoUART.h:348
HID_UART_STATUS HidUart_GetAttributes(const DWORD deviceNum, const WORD vid, const WORD pid, WORD *deviceVid, WORD *devicePid, WORD *pDeviceReleaseNumber)
This function returns the device vendor ID, product ID, and device release number for the device spec...
HID_UART_STATUS HidUart_GetUartStatus(const HID_UART_DEVICE device, WORD *transmitFifoSize, WORD *receiveFifoSize, BYTE *errorStatus, BYTE *lineBreakStatus)
Returns the number of bytes held in the device receive and transmit FIFO. Returns the parity/error st...
HID_UART_STATUS HidUart_SetLock(const HID_UART_DEVICE device, const WORD lock)
Permanently locks/disables device customization.
Success.
Definition: SLABHIDtoUART.h:86
unsigned short U16
unsigned uint 16
Definition: SLABHIDtoUART.h:351
HID_UART_STATUS HidUart_StartBreak(const HID_UART_DEVICE device, const BYTE DurationInMilliseconds)
Causes the device to transmit a line break, holding the TX pin low, for the specified duration in mil...
enum _HID_UART_STATUS * PHID_UART_STATUS
API Status Return Codes pointer.
HID_UART_STATUS HidUart_GetPartNumber(const HID_UART_DEVICE device, BYTE *pPartNumber, BYTE *pVersion)
Retrieves the part number and version of the CP211x device.
HID_UART_STATUS HidUart_SetUartConfig(const HID_UART_DEVICE device, const DWORD baudRate, const BYTE dataBits, const BYTE parity, const BYTE stopBits, const BYTE flowControl)
Sets the baud rate, data bits, parity, stop bits, and flow control.
char HID_UART_SERIAL_STR[30]
HID to UART serial string.
Definition: SLABHIDtoUART.h:303
#define HID_TO_UART_API
HID to UART API.
Definition: SLABHIDtoUART.h:72
an handle parameter was not valid
Definition: SLABHIDtoUART.h:88
HID_UART_STATUS HidUart_StopBreak(const HID_UART_DEVICE device)
Stops the device from transmitting a line break.
HID_UART_STATUS HidUart_Read(const HID_UART_DEVICE device, BYTE *buffer, const DWORD numBytesToRead, DWORD *pNumBytesRead)
Reads the available number of bytes into the supplied buffer and returns the number of bytes read whi...
HID_UART_STATUS HidUart_GetLock(const HID_UART_DEVICE device, WORD *lock)
Returns the device customization lock status.
the specified device was not found
Definition: SLABHIDtoUART.h:87
HID_UART_STATUS HidUart_GetNumDevices(LPDWORD lpdwNumDevices, const WORD vid, const WORD pid)
Determines the number of devices connected to the system with matching Vendor ID and Product ID...
HID_UART_STATUS HidUart_SetSerialString(const HID_UART_DEVICE device, char *serialString, const BYTE strlen)
Allows one-time customization of the USB serial number string.
a read failed to return the number of bytes requested before the read timeout elapsed.
Definition: SLABHIDtoUART.h:95
HID_UART_STATUS HidUart_Reset(const HID_UART_DEVICE device)
Initiates a full device reset.
HID_UART_STATUS HidUart_GetIndexedString(const DWORD deviceNum, const WORD vid, const WORD pid, const DWORD stringIndex, char *deviceString)
This function returns a null-terminated USB string descriptor for the device specified by an index pa...
HID_UART_STATUS HidUart_GetSerialString(const HID_UART_DEVICE device, char *serialString, BYTE *strlen)
Retrieves the USB Serial Number string.
HID_UART_STATUS HidUart_GetOpenedAttributes(const HID_UART_DEVICE device, WORD *pDeviceVid, WORD *pDevicePid, WORD *pDeviceReleaseNumber)
This function returns the device vendor ID, product ID, and device release number for the opened devi...
unsigned char BYTE
Byte definition.
Definition: silabs_defs.h:41
HID_UART_STATUS HidUart_GetUsbConfig(const HID_UART_DEVICE device, WORD *pVid, WORD *pPid, BYTE *pPower, BYTE *pPowerMode, WORD *pReleaseVersion, BYTE *pFlushBuffers)
Retrieves USB configuration, which includes vendor ID, product ID, power, power mode, release version, and flush buffers setting.
host was unable to get or set a feature report.
Definition: SLABHIDtoUART.h:97
char HID_UART_MFG_STR[62]
HID to UART manufacturing string.
Definition: SLABHIDtoUART.h:295
the device object pointer does not match the address of a valid HID - to - UART device ...
Definition: SLABHIDtoUART.h:89
an otherwise unclassified error occurred
Definition: silabs_defs.h:280
HID_UART_STATUS HidUart_SetTimeouts(const HID_UART_DEVICE device, const DWORD ReadTimeoutInMilliseconds, const DWORD WriteTimeoutInMilliseconds)
Sets the read and write timeouts.
the read was not successful and did not time out.
Definition: SLABHIDtoUART.h:93
#define HID_UART_PRODUCT_STRLEN
device Max Product string length
Definition: SLABHIDtoUART.h:289
the write was not successful.
Definition: SLABHIDtoUART.h:94
HID_UART_STATUS HidUart_GetString(const DWORD deviceNum, const WORD vid, const WORD pid, char *deviceString, const DWORD options)
This function returns a null-terminated vendor ID string, product ID string, serial number string...
tbd
Definition: SLABHIDtoUART.h:100
HID_UART_STATUS HidUart_SetUsbConfig(const HID_UART_DEVICE device, const WORD vid, const WORD pid, const BYTE power, const BYTE powerMode, const WORD releaseVersion, const BYTE flushBuffers, const BYTE mask)
Allows one-time customization of the USB configuration, which includes vendor ID, product ID...
HID_UART_STATUS HidUart_Close(const HID_UART_DEVICE device)
Closes an opened device using the device object pointer provided by HidUart_Open().
a write failed to complete sending the number of bytes requested before the write timeout elapsed...
Definition: SLABHIDtoUART.h:96
the specified number of bytes to read or write is invalid.
Definition: SLABHIDtoUART.h:91
HID_UART_STATUS HidUart_Open(HID_UART_DEVICE *pdevice, const DWORD deviceNum, const WORD vid, const WORD pid)
Opens a device using a device number between 0 and HidUart_GetNumDevices() - 1, enables the UART...
char HID_UART_PRODUCT_STR[62]
HID to UART product string.
Definition: SLABHIDtoUART.h:299
HID_UART_STATUS HidUart_GetUartConfig(const HID_UART_DEVICE device, DWORD *pBaudRate, BYTE *pDataBits, BYTE *pParity, BYTE *pStopBits, BYTE *pFlowControl)
Gets the baud rate, data bits, parity, stop bits, and flow control.
HID_UART_STATUS HidUart_GetTimeouts(const HID_UART_DEVICE device, DWORD *pReadTimeoutInMilliseconds, DWORD *pWriteTimeoutInMilliseconds)
Returns the current read and write timeouts specified in milliseconds.
HID_UART_STATUS HidUart_GetManufacturingString(const HID_UART_DEVICE device, char *manufacturingString, BYTE *strlen)
Retrieves the USB manufacturing string.
void * HID_UART_DEVICE
HID to UART device.
Definition: SLABHIDtoUART.h:345
#define HID_UART_MFG_STRLEN
device Max Manufacturing string length
Definition: SLABHIDtoUART.h:288
the specified device is already (exclusively) opened
Definition: SLABHIDtoUART.h:102