Acrosser AR-B6050 User Manual
Page 6

3
3
is ‘GPIO_ID0’ ~ ‘GPIO_ID32’. For example, say, ‘Id’ is GPIO_ID2, the returned
value of *pDirection is 0x1(input port) or 0x0(output port).
Code Sample:
Case 1:
Status_t status;
uint32_t Direction;
status = getGpioDirection(GPIO_ALL, &Direction);
Case 2:
Status_t status;
uint32_t Direction;
status = getGpioDirection(GPIO_ID2, &Direction);
if(Direction == 0x1) {
cout << “GPIO2 is an Input port” << endl;
} else {
cout << “GPIO2 is an Output port” << endl;
}
Return Value: If the function gets the values successfully, it returns
STATUS_SUCCESS, any other returned value stands for error.
3. Syntax:
Status_t setGpioDirection( uint32_t Id, uint32_t Direction )
Description: Set the current state of GPIO input/output configuration.
Parameters:
The argument ‘Id’ has two formats of parameters. If ‘Id’ is ‘GPIO_ALL’, the
parameter ‘Direction’ is bit patterns to set the input/output configuration of the
corresponding GPIO ports. A bit ‘1’ at the value of ‘Direction’ sets the
corresponding GPIO port as an input port. A bit ‘0’ at the value of ‘Direction’
sets the corresponding GPIO port as an output port. The other format of the
argument ‘Id’ is that the ‘Id’ is ‘GPIO_ID0’ ~ ‘GPIO_ID32’. For example, say,
‘Id’ is GPIO_ID2. If ‘Direction’ is any value other than 0, it configures the port
GPIO2 as an input port. If ‘Direction’ is 0, it configures the port GPIO2 as an