Gpio Application Interfaces And Examples - Embest SBC8600B User Manual

Hide thumbs Also See for SBC8600B:
Table of Contents

Advertisement

Embest Technology Co., Ltd
to control the status of GPIO pins under \WINCE700\app\GPIOAppDemo of the
DVD-ROM.
Pleaes refer to the help documents for MSDN Windows Embedded Compact 7 API to
learn about the definitions of Windows Embedded Compact 7 standard API.

5.5.2 GPIO Application Interfaces and Examples

GPIO application interfaces and examples:
IOCTL code
IOCTL_GPIO_SETBIT
IOCTL_GPIO_CLRBIT
IOCTL_GPIO_GETBIT
IOCTL_GPIO_SETMODE
IOCTL_GPIO_GETMODE
IOCTL_GPIO_GETIRQ
Please follow the steps listed below:
1)
Enable GPIO device
HANDLE hFile = CreateFile (_T ("GIO1:"), (GENERIC_READ|GENERIC_WRITE),
(FILE_SHARE_READ|FILE_SHARE_WRITE), 0, OPEN_EXISTING, 0, 0);
2)
Configure GPIO operating mode
DWORD id = 48, mode = GPIO_DIR_OUTPUT;
Configure GPIO operating mode
DWORD pInBuffer [2];
pInBuffer [0] = id;
pInBuffer [1] = mode;
DeviceIoControl (hFile, IOCTL_GPIO_SETMODE, pInBuffer, sizeof (pInBuffer),
NULL, 0, NULL, NULL);
Read mode of GPIO:
DeviceIoControl (hFile, IOCTL_GPIO_GETMODE, &id, sizeof(DWORD), &mode,
sizeof(DWORD), NULL, NULL);
"id" refers to the pin code of GPIO, "mode" refers to the mode definition of GPIO,
including:
Copyright © 2017 Embest Technology
Table 5-5
GPIO IOCTL
Description
Set GPIO pin as 1
Set GPIO pin as 0
Read GPIO pin
Set the working mode of GPIO pin
Read the working mode of GPIO pin
Read the corresponding IRQ of GPIO pin
SBC8600B-UM-V2.0
123

Advertisement

Table of Contents
loading

Table of Contents