Embest AM3517 Specifications Page 77

  • Download
  • Add to my manuals
  • Print
  • Page
    / 98
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 76
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:
Mode definition
Description
GPIO_DIR_OUTPUT
Output mode
GPIO_DIR_INPUT
Input mode
GPIO_INT_LOW_HIGH
Rising edge trigger mode
GPIO_INT_HIGH_LOW
Falling edge trigger mode
GPIO_INT_LOW
low level trigger mode
GPIO_INT_HIGH
high level trigger mode
GPIO_DEBOUNCE_ENABLE
Jumping trigger enable
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;
Page view 76
1 2 ... 72 73 74 75 76 77 78 79 80 81 82 ... 97 98

Comments to this Manuals

No comments