DevKit8500D/A User Manual - DMCS Pages for Students
DevKit8500D/A User Manual - DMCS Pages for Students
DevKit8500D/A User Manual - DMCS Pages for Students
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
DeviceIoControl(hFile, IOCTL_GPIO_SETMODE, pInBuffer, sizeof(pInBuffer), NULL, 0, NULL, NULL);<br />
4) Read the working mode of GPIO:<br />
DeviceIoControl(hFile, IOCTL_GPIO_GETMODE, &id, sizeof(DWORD), &mode, sizeof(DWORD), NULL,<br />
NULL);<br />
"id" is GPIO Pin number, "mode" is GPIO mode, including:<br />
Mode definition<br />
GPIO_DIR_OUTPUT<br />
GPIO_DIR_INPUT<br />
GPIO_INT_LOW_HIGH<br />
GPIO_INT_HIGH_LOW<br />
GPIO_INT_LOW<br />
GPIO_INT_HIGH<br />
GPIO_DEBOUNCE_ENABLE<br />
Description<br />
Output mode<br />
Input mode<br />
Rising edge trigger mode<br />
Falling edge trigger mode<br />
low level trigger mode<br />
high level trigger mode<br />
Jumping trigger enable<br />
5) The operation of GPIO Pin<br />
DWORD id = 0, pin = 0;<br />
6) Output high level:<br />
DeviceIoControl(hFile, IOCTL_GPIO_SETBIT, &id, sizeof(DWORD), NULL, 0, NULL, NULL);<br />
7) Output low level:<br />
DeviceIoControl(hFile, IOCTL_GPIO_CLRBIT, &id, sizeof(DWORD), NULL, 0, NULL, NULL);<br />
8) Read the pin state<br />
DeviceIoControl(hFile, IOCTL_GPIO_GETBIT, &id, sizeof(DWORD), &pin, sizeof(DWORD), NULL, NULL);<br />
"id" is GPIO pin number, "pin" returns to pin state<br />
9) Other optional operation<br />
Read the corresponding IRQ number of GPIO pin<br />
DWORD id = 0, irq = 0;<br />
DeviceIoControl(hFile, IOCTL_GPIO_GETIRQ, &id, sizeof(DWORD), &irq, sizeof(DWORD), NULL, NULL);<br />
"id" is GPIO pin number, "irq" returns IRQ number<br />
10) Close GPIO device<br />
CloseHandle(hFile);<br />
93