3 api list and descriptions – Acrosser AR-ES6003FL User Manual
Page 83
8.3 API List and Descriptions
GPIO
1. Syntax:
i32 getInChLevel( i32 channel, u8 *val )
Description: Get the value of GPIO Input and put the value at *val.
Parameters:
I.
The parameter ‘channel’ indicates the GPIO Input pins to show. Users can
use the macros GPI0, GPI1, GPI2, GPI3 to indicate the GPIO Input channel.
For example:
getInChLevel( GPI2, &val); // Indicate the GPIO Input channel 2
getInChLevel( GPI0 | GPI3, &val); // Indicate the GPIO Input
// channel 0 and channel 3
II. The parameter ‘val’ is an unsigned character pointer. The function puts the
values of the indicated GPIO channels at the memory pointed by ‘val’. The
bit 0 of *val shows the value of GPIO Input channel 0. The bit 1 of *val
shows the value of GPIO Input channel 1. Other bits show the
corresponding GPIO Input channels. Because there are only four channels,
bit 4 ~ bit 7 of *val are always zero.
Here is an example:
If GPIO Input channel 1 and channel 3 are both 1.
unsigned char ch;
getInChLevel( GPI1|GPI3, &ch );
The returned value of variable ‘ch’ is 0xa.
Return Value: If the function gets the values successfully, it returns 0. If any error,
it returns –1.
2. Syntax:
i32 setOutChLevel( i32 channel, u8 val )
Description: Set the value of GPIO Output according to the variable ‘val’.
83