beautypg.com

Programming guide for gpio driver – Avalue BFC-10R1 User Manual

Page 42

background image

RSC-IMX51

42 RSC-IMX51 User

’s Manual

3.9 Programming Guide for GPIO Driver

The RSC-iMX51 Windows CE image had included the onboard GPIO and watchdog timer

driver API for application programming. The function that API will provide are list as below,
refer each function’s description to get more detail information.

1) Digital I/O Port

API_LibInit()

BOOL

API_LibInit();

Return Value :

TRUE indicates success, FALSE indicates failure. The error numbers are listed in

Appendix A.

Remarks :

This function assigns JIO1 pin 1(GPIO3_14), 3(GPIO3_6), 5(GPIO3_15) and

7(GPIO1_31) of RSC-iMX51 as input pins, pin 11(GPIO2_13), 13(GPIO2_12),

15(GPIO2_11) and 17(GPIO2_10) as output pins and then returns TRUE if success.


GPIO_BIT_OUTPUT

BOOL GPIO_BIT_OUTPUT(

unsigned

int dwport,

unsigned int

dwbit,

unsigned

int

dwval);

Parameters:

dwport: [in] Port number of GPIO.

dwbit: [in] Bit number of the selected port dwport.

dwval: [in] Control the current state(high/low) of selected pin on selected output

GPIO bit.

0: Low, 1: High.

Return Value :

TRUE indicates success, FALSE indicates failure.

Remarks :

This function will control all 4 pins of selected output port turning on and off.

For example:

GPIO_BIT_OUTPUT(2, 10, 1) is called to turn on GPIO2_10 which is the output

pin 17 of JIO1 on RSC-iMX51.


GPIO_BIT_INPUT

int GPIO_BIT_INPUT(unsigned int dwport, unsigned int dwbit);

Parameters:

dwport: [in] Port number of GPIO.

dwbit: [in] Bit number of the selected port #dwport.

Return Value :

This manual is related to the following products: