beautypg.com

Gpio and watchdog, Gpio – Acrosser AIV-HM76V1FL User Manual

Page 56

background image

AIV-HM76V1FL Series User Manual

56

Acrosser Technology Co., Ltd.

5.2.2. GPIO and Watchdog

5.2.2.1. GPIO

Syntax:

i32 getChLevel(u8 *val)

Description:

Get the status of GPIO input pins and output pins, and put

the value at *val.

Parameters:

This function takes a pointer to an unsigned char variable

as the parameter.
The bit0 ~ bit3 in the pointed variable ‘*val’ is the status of

the output pins. The bit4 ~ bit7 in the pointed variable ‘*val’

is the status of the input pins.

For example:

u8 val;

i32 result;

result = getChLevel( &val);

if(result != 0)

printf(“Fail to get GPIO status!\n”);

Return Value:

If the function gets the value successfully, it returns 0, any

other returned value stands for error.

Syntax:

i32 setChLevel(u8 val)

Description:

Set the status of GPIO Output pins.

Parameters:

This function takes an unsigned char as the parameter.

The bit0 ~ bit3 in variable ‘val’ represent the status of the

output pins. The bit3 ~ bit7 in the variable ‘val’ are of no

use and can be neglected.

For example:

u8 val = 0xf;

i32 result;

result = setChLevel(val);

if(result != 0)

printf(“Fail to set GPIO!\n”);

Return Value:

If the function sets the values successfully, it returns 0,

any other returned value stands for error.