6.
Functions for digital input/output
hid_SetDigitalByte
This function sets or clears a byte on a digital output line by USB.
Declaration
BOOL
hid_SetDigitalByte ( HANDLE hDevice,
DWORD
dwPort,
BYTE
byPortState
);
Parameters
hDevice
A valid device handle, previously obtained from hid_OpenDeviceDevice
dwPort
The index of the port on the card to manipulate. The first port has index 0.
For more information, please see “Write Address Table” following below.
byPortState
The new state of the port
Return value
TRUE if successful, FALSE otherwise.
If an error occurred, GetLastError() may return the following values:
ERROR_INVALID_PARAMETER - The handle passed was invalid, or the port number was out of
range for the device selected.
Example
HANDLE hDevice = hid_OpenDevice(0x01,0);
if (hDevice != INVALID_HANDLE_VALUE)
{
hid_SetDigitalByte( hDevice, 0, 0xFF); // set’s all bits on the first port
hid_CloseDevice(hDevice);
}