Gpio and watchdog, Gpio – Acrosser AR-R5800A User Manual

Page 38

Advertising
background image

AR-B5800 User Manual




GPIO and Watchdog

GPIO

1. Syntax:

i32 setChDir( u8 val )

Description: Set the direction (Input/Output) of GPIO ports according to the parameter ‘val’.

Parameters: The parameter ‘val’ is an unsigned character. Each bit of *val corresponds to a GPIO port.
Bit 0 corresponds to GPIO0. Bit 1 corresponds to GPIO1. Bit 2 corresponds to GPIO2, and so on.
Setting a bit of ‘val’ as 0 configures the corresponding port as Output. Setting a bit of ‘val’ as 1
configures the corresponding port as Input.

Return Value: If the function gets the configuration successfully, it returns 0. If any error, it returns –1.

2. Syntax:

i32 getChDir( u8 *val )

Description: Get the direction (Input/Output) of GPIO ports and put the configuration at *val.

Parameters: The parameter ‘val’ points to an unsigned character. Each bit of *val corresponds to a
GPIO port. Bit 0 corresponds to GPIO0. Bit 1 corresponds to GPIO1. Bit 2 corresponds to GPIO2, and
so on. A ‘0’ bit at *val indicates the corresponding port is an Output port. A ‘1’ bit at *val indicates the
corresponding port is an Input port.

Return Value: If the function gets the configuration successfully, it returns 0. If any error, it returns –1.


3. Syntax:
i32 getChLevel( u8 *val )

Description: Get the status value of GPIO ports 0~7 and put the value at *val.

Parameters: The parameter ‘val’ points to an unsigned character. If a GPIO port is configured as an
Output port, the bit at *val which corresponds to this port indicates this port is outputting a ‘1’ or ‘0’. If

38


Advertising
This manual is related to the following products: