Page | 71
pInBuffer[0] = id;
pInBuffer[1] = mode;
DeviceIoControl(hFile, IOCTL_GPIO_SETMODE, pInBuffer, sizeof(pInBuffer),
NULL, 0, NULL, NULL);
Read the working mode of the GPIO:
DeviceIoControl(hFile, IOCTL_GPIO_GETMODE, &id, sizeof(DWORD), &mode,
sizeof(DWORD), NULL, NULL);
"id" is the GPIO Pin number, "mode" is GPIO mode, including:
Falling edge trigger mode
3. The operation of GPIO Pin
DWORD id = 0, pin = 0;
Output high level:
DeviceIoControl(hFile, IOCTL_GPIO_SETBIT, &id, sizeof(DWORD), NULL, 0, NULL,
NULL);
Output low level:
DeviceIoControl(hFile, IOCTL_GPIO_CLRBIT, &id, sizeof(DWORD), NULL, 0, NULL,
NULL);
Read the pin state
DeviceIoControl(hFile, IOCTL_GPIO_GETBIT, &id, sizeof(DWORD), &pin,
sizeof(DWORD), NULL, NULL);
Where "id" is GPIO pin number, "pin" returns to pin state
4. Other optional operations
Read the corresponding IRQ number of GPIO pin
DWORD id = 0, irq = 0;
Comments to this Manuals