XBee Firmware Library  1.6.0
Functions

Functions

int gpio_config (xpin_t pin, uint8_t cfg)
 Configures the selected pin as a standard GPIO. More...
 
void gpio_config_dir (xpin_t pin, uint8_t dir)
 Configures pin as input or output. More...
 
bool_t gpio_get (xpin_t pin)
 Gets the value of the specified pin. More...
 
void gpio_set (xpin_t pin, bool_t val)
 Sets the specified pin in high or low level. Notice the XBee pin must be configured as output to be able to set it. More...
 
void gpio_toggle (xpin_t pin)
 Inverts the value of a pin. More...
 

Detailed Description

Platform-specific layer provides a consistent GPIO API to upper layers of the driver.

Standard GPIO API Overview

This API contains the functions to configure and control the standard 
GPIOs of the programmable XBee devices.

- GPIO configuration functions:
    - gpio_config()

- GPIO functions to read/write the standard GPIOs:
    - gpio_get()
    - gpio_set()

Platform-specific layer provides a consistent MACROS API to upper layers of the driver.

Standard GPIO Macros

The gpio_config() function needs as second parameter a byte containing the 
configuration masks for the GPIO. These masks are defined with macros and 
they are the following:

    - Macros to configure the GPIO \b type:
            - \b GPIO_CFG_INPUT                     : Configures the standard GPIO as 
                                                                              input.
            - \b GPIO_CFG_OUTPUT                    : Configures the standard GPIO as
                                                                              output.

    - Macros to configure the \b pullup resistors:
            - \b GPIO_CFG_PULL_UP_DIS               : Disables the GPIO Pull-up resistor.
            - \b GPIO_CFG_PULL_UP_EN                : Enables the GPIO Pull-up resistor.

    - Macros to configure the \b slew \b rate:
            - \b GPIO_CFG_SLEW_RATE_DIS     : Disables the GPIO slew rate.
            - \b GPIO_CFG_SLEW_RATE_EN      : Enables the GPIO slew rate.

    - Macros to configure the \b drive \b strength:
            - \b GPIO_CFG_DRV_STR_LOW               : Configures the drive strength to low.
            - \b GPIO_CFG_DRV_STR_HIGH              : Configures the drive strength to high.

Usage example:
gpio_config(XPIN_7, GPIO_CFG_INPUT | GPIO_CFG_PULL_UP_EN | GPIO_CFG_SLEW_RATE_EN | GPIO_CFG_DRV_STR_LOW);
Warning
It is recommended not to use these macros, they are used by the XBee Project Smart Editor of the XBee extensions.

Function Documentation

int gpio_config ( xpin_t  pin,
uint8_t  cfg 
)

Configures the selected pin as a standard GPIO.

Parameters
[in]pinthe XBee pin to configure.
[in]cfga byte containing the configuration masks for the GPIO. See the Standard GPIO Macros for more information.
Return values
0on success
EINVALinvalid xpin_t parameter (not standard GPIO capable pin).
void gpio_config_dir ( xpin_t  pin,
uint8_t  dir 
)

Configures pin as input or output.

Parameters
[in]pinthe XBee pin to configure.
[in]dirpin data direction, defined macros may be used.
bool_t gpio_get ( xpin_t  pin)

Gets the value of the specified pin.

Parameters
[in]pinthe XBee pin to get the value from.
Return values
bool_t1 if the pin is in high level, 0 if it is in low level.
void gpio_set ( xpin_t  pin,
bool_t  val 
)

Sets the specified pin in high or low level. Notice the XBee pin must be configured as output to be able to set it.

Parameters
[in]pinthe XBee pin to set.
[in]val1 to set the pin in high level, 0 to set it in low level.
Return values
None
void gpio_toggle ( xpin_t  pin)

Inverts the value of a pin.

Parameters
[in]pinthe XBee pin to toggle.
Return values
None