Acrosser AR-ES6050FLD-W User Manual
Page 44

Revision: 1.0
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
output port.
Return Value:
If the function sets the values successfully, it returns
STATUS_SUCCESS, any other returned value stands for error.
4. Syntax:
Status_t getGpioLevel( uint32_t Id, uint32_t *pLevel )
Description:
Get the current state of the GPIO ports.
Parameters:
The argument ‘Id’ has two formats of parameters. If ‘Id’ is ‘GPIO_ALL’, the returned
value at *pLevel shows the state of every GPIO port. A bit ‘1’ at the value of *pLevel
stands for a logical high. A bit ‘0’ at the value of *pLevel stands for a logical low. For
example, say, the *pLevel is 0x00000085, this indicates that the ports GPIO7, GPIO2,
GPIO0 are at the state of logical high. Other GPIO ports (if enabled) are at the state of
logical low. The other format of the argument ‘Id’ is that the ‘Id’ is ‘GPIO_ID0’ ~
‘GPIO_ID32’. For example, say, ‘Id’ is GPIO_ID2, the returned value of *pLevel is
0x1(logical high) or 0x0(logical low).
Return Value:
If the function gets the values successfully, it returns
STATUS_SUCCESS, any other returned value stands for error.
5. Syntax:
44