ADuCM4x50 Device Drivers API Reference Manual
Release 4.0.0.0
|
GPIO port and pin identifiers. More...
Macros | |
#define | ADI_GPIO_MEMORY_SIZE (16u) |
#define | ADI_GPIO_PIN_0 ((ADI_GPIO_DATA)(0x0001)) |
#define | ADI_GPIO_PIN_1 ((ADI_GPIO_DATA)(0x0002)) |
#define | ADI_GPIO_PIN_2 ((ADI_GPIO_DATA)(0x0004)) |
#define | ADI_GPIO_PIN_3 ((ADI_GPIO_DATA)(0x0008)) |
#define | ADI_GPIO_PIN_4 ((ADI_GPIO_DATA)(0x0010)) |
#define | ADI_GPIO_PIN_5 ((ADI_GPIO_DATA)(0x0020)) |
#define | ADI_GPIO_PIN_6 ((ADI_GPIO_DATA)(0x0040)) |
#define | ADI_GPIO_PIN_7 ((ADI_GPIO_DATA)(0x0080)) |
#define | ADI_GPIO_PIN_8 ((ADI_GPIO_DATA)(0x0100)) |
#define | ADI_GPIO_PIN_9 ((ADI_GPIO_DATA)(0x0200)) |
#define | ADI_GPIO_PIN_10 ((ADI_GPIO_DATA)(0x0400)) |
#define | ADI_GPIO_PIN_11 ((ADI_GPIO_DATA)(0x0800)) |
#define | ADI_GPIO_PIN_12 ((ADI_GPIO_DATA)(0x1000)) |
#define | ADI_GPIO_PIN_13 ((ADI_GPIO_DATA)(0x2000)) |
#define | ADI_GPIO_PIN_14 ((ADI_GPIO_DATA)(0x4000)) |
#define | ADI_GPIO_PIN_15 ((ADI_GPIO_DATA)(0x8000)) |
#define | ADI_GPIO_PORT0_PIN_AVL (0xFFFFu) |
#define | ADI_GPIO_PORT1_PIN_AVL (0xFFFFu) |
#define | ADI_GPIO_PORT2_PIN_AVL (0xFFFFu) |
#define | ADI_GPIO_PORT3_PIN_AVL (0x000Fu) |
Typedefs | |
typedef uint16_t | ADI_GPIO_DATA |
Enumerations | |
enum | ADI_GPIO_RESULT { ADI_GPIO_SUCCESS = 0, ADI_GPIO_FAILURE, ADI_GPIO_ALREADY_INITIALIZED, ADI_GPIO_NOT_INITIALIZED, ADI_GPIO_NULL_PARAMETER, ADI_GPIO_INVALID_MEMORY_SIZE, ADI_GPIO_INVALID_PINS, ADI_GPIO_INVALID_INTERRUPT, ADI_GPIO_INVALID_TRIGGER, ADI_GPIO_INVALID_PORT } |
enum | ADI_GPIO_IRQ_TRIGGER_CONDITION { ADI_GPIO_IRQ_RISING_EDGE =(0x0), ADI_GPIO_IRQ_FALLING_EDGE =(0x1), ADI_GPIO_IRQ_EITHER_EDGE =(0x2), ADI_GPIO_IRQ_HIGH_LEVEL =(0x3), ADI_GPIO_IRQ_LOW_LEVEL =(0x4) } |
enum | ADI_GPIO_IRQ { ADI_GPIO_INTA_IRQ = SYS_GPIO_INTA_IRQn, ADI_GPIO_INTB_IRQ = SYS_GPIO_INTB_IRQn } |
enum | ADI_GPIO_PORT { ADI_GPIO_PORT0, ADI_GPIO_PORT1, ADI_GPIO_PORT2, ADI_GPIO_PORT3, ADI_GPIO_NUM_PORTS } |
Functions | |
ADI_GPIO_RESULT | adi_gpio_Init (void *const pMemory, uint32_t const MemorySize) |
Initializes the GPIO functions. More... | |
ADI_GPIO_RESULT | adi_gpio_UnInit (void) |
Un-initialize the GPIO driver. More... | |
ADI_GPIO_RESULT | adi_gpio_RegisterCallback (const ADI_GPIO_IRQ eIrq, ADI_CALLBACK const pfCallback, void *const pCBParam) |
Register or unregister an application callback function for group (A/B) interrupts. More... | |
ADI_GPIO_RESULT | adi_gpio_SetGroupInterruptPins (const ADI_GPIO_PORT Port, const ADI_GPIO_IRQ eIrq, const ADI_GPIO_DATA Pins) |
Group the pins for the given group interrupt. More... | |
ADI_GPIO_RESULT | adi_gpio_GetGroupInterruptPins (const ADI_GPIO_PORT Port, const ADI_GPIO_IRQ eIrq, ADI_GPIO_DATA *const pValue) |
Get a port's pin interrupt Group A/B mask register. More... | |
ADI_GPIO_RESULT | adi_gpio_SetGroupInterruptPolarity (const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins) |
Set/clear the interrupt polarity for the given pins. More... | |
ADI_GPIO_RESULT | adi_gpio_GetGroupInterruptPolarity (const ADI_GPIO_PORT Port, ADI_GPIO_DATA *const pValue) |
Get a port's pin interrupt polarity register. More... | |
ADI_GPIO_RESULT | adi_gpio_GroupInterruptPolarityEnable (const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins, const bool bLowToHigh) |
Determine if the interrupts are generated on the rising or falling edge of the corresponding GPIO pin. More... | |
ADI_GPIO_RESULT | adi_gpio_OutputEnable (const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins, const bool bFlag) |
Enables/Disables the Output Drivers for GPIO Pin(s) More... | |
ADI_GPIO_RESULT | adi_gpio_GetOutputEnable (const ADI_GPIO_PORT Port, ADI_GPIO_DATA *const pValue) |
Gets the Output Driver Status for GPIO Pin(s) More... | |
ADI_GPIO_RESULT | adi_gpio_InputEnable (const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins, const bool bFlag) |
Enables/Disables the Input Drivers for GPIO Pin(s) More... | |
ADI_GPIO_RESULT | adi_gpio_PullUpEnable (const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins, const bool bFlag) |
Enables/Disables the Pull-Up for GPIO Pin(s) More... | |
ADI_GPIO_RESULT | adi_gpio_DriveStrengthEnable (const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins, const bool bFlag) |
Enables/Disables increased Drive Strength capability for GPIO Pin(s) More... | |
ADI_GPIO_RESULT | adi_gpio_SetHigh (const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins) |
Sets the Given GPIO pin(s) to a Logical High Level. More... | |
ADI_GPIO_RESULT | adi_gpio_SetLow (const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins) |
Sets the Given GPIO pin(s) to a Logical Low Level. More... | |
ADI_GPIO_RESULT | adi_gpio_Toggle (const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins) |
Toggles the Logical Level of the Given GPIO pin(s) More... | |
ADI_GPIO_RESULT | adi_gpio_SetData (const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins) |
Sets the logic level of all GPIO pins on the given port to a given logic level. More... | |
ADI_GPIO_RESULT | adi_gpio_GetData (const ADI_GPIO_PORT Port, const ADI_GPIO_DATA Pins, uint16_t *const pValue) |
Gets/Senses the input level of all GPIO Pins on the given port. More... | |
ADI_GPIO_RESULT | adi_gpio_GetOutputData (const ADI_GPIO_PORT Port, ADI_GPIO_DATA *const pValue) |
Gets the Output Level of all GPIO Pins on a given port. More... | |
GPIO port and pin identifiers.
The documented macros can be passed to the following functions:
To control a single GPIO, these macros can be passed to the functions one at a time. For example, to set the GPIO on port 2, pin 4 to a logical high level, the following is used:
adi_gpio_SetHigh(ADI_GPIO_PORT2, ADI_GPIO_PIN_4)
Multiple GPIOs, so long as they reside on the same port, can be controlled simultaneously. These macros can be OR-ed together and passed to the functions. For example, to set the GPIOs on port 2, pins 3, 4 and 7 to a logical low level, the following is used:
adi_gpio_SetLow(ADI_GPIO_PORT2, ADI_GPIO_PIN_3 | ADI_GPIO_PIN_4 | ADI_GPIO_PIN_7)
For the sensing, or adi_gpio_Getxxx, functions, the passed pValue parameter is written with a packed value containing the status of the requested GPIO pins on the given port.
If information is required for a single pin, return value can be directly used For example to see if pin 4 on port 2 has the pull up enabled, the following is used: adi_gpio_GetData(ADI_GPIO_PORT2, ADI_GPIO_PIN_4, &pValue) pValue will contain the required information.
If information is required for multiple pins, following method is required:
adi_gpio_GetData(ADI_GPIO_PORT2, (ADI_GPIO_PIN_3 | ADI_GPIO_PIN_4 | ADI_GPIO_PIN_7), &pValue)
To test if pin 4 on port 2 has pull up enabled, the following is used:
if (pValue & ADI_GPIO_PIN_4) { the pull up is enabled for pin 4 on port 2 } else { the pull up is disabled for pin 4 on port 2 }
#define ADI_GPIO_MEMORY_SIZE (16u) |
Amount of memory(in bytes) required by the GPIO device driver for its operation. This memory is completely owned by the driver till the end of the operation.
Definition at line 46 of file adi_gpio.h.
#define ADI_GPIO_PIN_0 ((ADI_GPIO_DATA)(0x0001)) |
Pin 0
Definition at line 97 of file adi_gpio.h.
#define ADI_GPIO_PIN_1 ((ADI_GPIO_DATA)(0x0002)) |
Pin 1
Definition at line 98 of file adi_gpio.h.
#define ADI_GPIO_PIN_2 ((ADI_GPIO_DATA)(0x0004)) |
Pin 2
Definition at line 99 of file adi_gpio.h.
#define ADI_GPIO_PIN_3 ((ADI_GPIO_DATA)(0x0008)) |
Pin 3
Definition at line 100 of file adi_gpio.h.
#define ADI_GPIO_PIN_4 ((ADI_GPIO_DATA)(0x0010)) |
Pin 4
Definition at line 101 of file adi_gpio.h.
#define ADI_GPIO_PIN_5 ((ADI_GPIO_DATA)(0x0020)) |
Pin 5
Definition at line 102 of file adi_gpio.h.
#define ADI_GPIO_PIN_6 ((ADI_GPIO_DATA)(0x0040)) |
Pin 6
Definition at line 103 of file adi_gpio.h.
#define ADI_GPIO_PIN_7 ((ADI_GPIO_DATA)(0x0080)) |
Pin 7
Definition at line 104 of file adi_gpio.h.
#define ADI_GPIO_PIN_8 ((ADI_GPIO_DATA)(0x0100)) |
Pin 8
Definition at line 105 of file adi_gpio.h.
#define ADI_GPIO_PIN_9 ((ADI_GPIO_DATA)(0x0200)) |
Pin 9
Definition at line 106 of file adi_gpio.h.
#define ADI_GPIO_PIN_10 ((ADI_GPIO_DATA)(0x0400)) |
Pin 10
Definition at line 107 of file adi_gpio.h.
#define ADI_GPIO_PIN_11 ((ADI_GPIO_DATA)(0x0800)) |
Pin 11
Definition at line 108 of file adi_gpio.h.
#define ADI_GPIO_PIN_12 ((ADI_GPIO_DATA)(0x1000)) |
Pin 12
Definition at line 109 of file adi_gpio.h.
#define ADI_GPIO_PIN_13 ((ADI_GPIO_DATA)(0x2000)) |
Pin 13
Definition at line 110 of file adi_gpio.h.
#define ADI_GPIO_PIN_14 ((ADI_GPIO_DATA)(0x4000)) |
Pin 14
Definition at line 111 of file adi_gpio.h.
#define ADI_GPIO_PIN_15 ((ADI_GPIO_DATA)(0x8000)) |
Pin 15
Definition at line 112 of file adi_gpio.h.
#define ADI_GPIO_PORT0_PIN_AVL (0xFFFFu) |
Port 0 pin mask (16 pins)
Definition at line 115 of file adi_gpio.h.
#define ADI_GPIO_PORT1_PIN_AVL (0xFFFFu) |
Port 1 pin mask (16 pins)
Definition at line 116 of file adi_gpio.h.
#define ADI_GPIO_PORT2_PIN_AVL (0xFFFFu) |
Port 2 pin mask (16 pins)
Definition at line 117 of file adi_gpio.h.
#define ADI_GPIO_PORT3_PIN_AVL (0x000Fu) |
Port 2 pin mask (4 pins)
Definition at line 120 of file adi_gpio.h.
typedef uint16_t ADI_GPIO_DATA |
pin data reg type
Definition at line 49 of file adi_gpio.h.
enum ADI_GPIO_RESULT |
GPIO API function return codes
Definition at line 53 of file adi_gpio.h.
GPIO trigger condition enumerations
Definition at line 70 of file adi_gpio.h.
enum ADI_GPIO_IRQ |
GPIO IRQ enumeration
Enumerator | |
---|---|
ADI_GPIO_INTA_IRQ | GPIO Group Interrupt A. |
ADI_GPIO_INTB_IRQ | GPIO Group Interrupt B. |
Definition at line 79 of file adi_gpio.h.
enum ADI_GPIO_PORT |
GPIO port enumerations
Enumerator | |
---|---|
ADI_GPIO_PORT0 | Port 0 |
ADI_GPIO_PORT1 | Port 1 |
ADI_GPIO_PORT2 | Port 2 |
ADI_GPIO_PORT3 | Port 3 |
ADI_GPIO_NUM_PORTS | maximum number of ports |
Definition at line 86 of file adi_gpio.h.
ADI_GPIO_RESULT adi_gpio_Init | ( | void *const | pMemory, |
uint32_t const | MemorySize | ||
) |
Initializes the GPIO functions.
This function initializes the GPIO driver. This function should be called before calling any of the GPIO driver APIs.
[in] | pMemory | Pointer to the memory required for the driver to operate. The size of the memory should be at least ADI_GPIO_MEMORY_SIZE bytes. |
[in] | MemorySize | Size of the memory (in bytes) passed in pMemory parameter. |
Definition at line 138 of file adi_gpio.c.
ADI_GPIO_RESULT adi_gpio_UnInit | ( | void | ) |
Un-initialize the GPIO driver.
Terminates the GPIO functions, leaving everything unchanged.
Definition at line 192 of file adi_gpio.c.
ADI_GPIO_RESULT adi_gpio_RegisterCallback | ( | const ADI_GPIO_IRQ | eIrq, |
ADI_CALLBACK const | pfCallback, | ||
void *const | pCBParam | ||
) |
Register or unregister an application callback function for group (A/B) interrupts.
Applications may register a callback function that will be called when a GPIO group (A/B) interrupt occurs.
The driver dispatches calls to registered callback functions when the properly configured pin(s) latches an external interrupt input on the GPIO pin(s). The callback is dispatched with the following parameters, respectively:
[in] | eIrq | The interrupt for which the callback is being registered. |
[in] | pfCallback | Pointer to the callback function. This can be passed as NULL to unregister the callback. |
[in] | pCBParam | Callback parameter which will be passed back to the application when the callback is called.. |
Definition at line 1126 of file adi_gpio.c.
ADI_GPIO_RESULT adi_gpio_SetGroupInterruptPins | ( | const ADI_GPIO_PORT | Port, |
const ADI_GPIO_IRQ | eIrq, | ||
const ADI_GPIO_DATA | Pins | ||
) |
Group the pins for the given group interrupt.
Group the given pins for the Group A/B interrupt. Applications can register/unregister a callback using the adi_gpio_RegisterCallback API to get a notification when the group interrupt occurs.
[in] | Port | GPIO port number to be operated on. |
[in] | eIrq | Interrupt (Group A/B) to which the pin(s) are to be grouped. |
[in] | Pins | The GPIO pins which needs to be grouped. Pin bits that are set enable the interrupt for the group A/B. Pin bits that are clear disable the interrupt for the group A/B. |
Definition at line 235 of file adi_gpio.c.
ADI_GPIO_RESULT adi_gpio_GetGroupInterruptPins | ( | const ADI_GPIO_PORT | Port, |
const ADI_GPIO_IRQ | eIrq, | ||
ADI_GPIO_DATA *const | pValue | ||
) |
Get a port's pin interrupt Group A/B mask register.
Returns a GPIO port GPIO Group A/B mask register.
[in] | Port | Identifies the GPIO port to be operated on. |
[in] | eIrq | Identifies the Group A/B interrupt to query. |
[out] | pValue | Returned Pin state for GPIO port pins. |
Definition at line 293 of file adi_gpio.c.
ADI_GPIO_RESULT adi_gpio_SetGroupInterruptPolarity | ( | const ADI_GPIO_PORT | Port, |
const ADI_GPIO_DATA | Pins | ||
) |
Set/clear the interrupt polarity for the given pins.
Sets/clears the interrupt polarity for the given pins for the given port. When the corresponding bit is set an interrupt is generated when the pin transitions from low-to-high. When the corresponding bit is cleared an interrupt is generated when the pin transitions from high-to-low.
[in] | Port | GPIO port number to be operated on. |
[in] | Pins | Pins whose polarity to be set. |
Definition at line 357 of file adi_gpio.c.
ADI_GPIO_RESULT adi_gpio_GetGroupInterruptPolarity | ( | const ADI_GPIO_PORT | Port, |
ADI_GPIO_DATA *const | pValue | ||
) |
Get a port's pin interrupt polarity register.
Read a GPIO pin interrupt polarity register. Set bits configure interrupt capture on low-to-high transitions, clear bits configure interrupt capture on high-to-low transitions.
[in] | Port | Identifies the GPIO port to be operated on |
[out] | pValue | Returned Interrupt polarity for GPIO port pins. |
Definition at line 402 of file adi_gpio.c.
ADI_GPIO_RESULT adi_gpio_GroupInterruptPolarityEnable | ( | const ADI_GPIO_PORT | Port, |
const ADI_GPIO_DATA | Pins, | ||
const bool | bLowToHigh | ||
) |
Determine if the interrupts are generated on the rising or falling edge of the corresponding GPIO pin.
Determines if the interrupts are generated on the rising or falling edge of the corresponding GPIO pin. Bits set in the pins input are the only ones affected:
[in] | Port | GPIO port number to be operated on. |
[in] | Pins | Pins whose polarity to be set/cleared. |
[in] | bLowToHigh | Boolean that defines if interrupts are generated on the rising or falling edge:
|
Definition at line 452 of file adi_gpio.c.
ADI_GPIO_RESULT adi_gpio_OutputEnable | ( | const ADI_GPIO_PORT | Port, |
const ADI_GPIO_DATA | Pins, | ||
const bool | bFlag | ||
) |
Enables/Disables the Output Drivers for GPIO Pin(s)
Enables/disables the output drivers for the given GPIO pin(s) on the given port.
[in] | Port | The GPIO port to be configured. |
[in] | Pins | One or more GPIO pins to be configured. GPIO pins can be passed one at a time or in combination. To configure a single GPIO pin, a single GPIO value is passed for this parameter. For example, ADI_GPIO_PIN_4. Alternatively, multiple GPIO pins can be configured simultaneously by OR-ing together GPIO pin values and passing the resulting value for this parameter. For example, ADI_GPIO_PIN_0 | ADI_GPIO_PIN_5 | ADI_GPIO_PIN_6. |
[in] | bFlag | Boolean value describing the action to be taken
|
Definition at line 515 of file adi_gpio.c.
ADI_GPIO_RESULT adi_gpio_GetOutputEnable | ( | const ADI_GPIO_PORT | Port, |
ADI_GPIO_DATA *const | pValue | ||
) |
Gets the Output Driver Status for GPIO Pin(s)
Gets the output driver status for the GPIO pins on the given port.
[in] | Port | Identifies the GPIO port to be sensed (ADI_GPIO_PORTx) |
[out] | pValue | The passed pValue parameter is written with a packed value containing the status of all the GPIO pins on the given port. |
Definition at line 630 of file adi_gpio.c.
ADI_GPIO_RESULT adi_gpio_InputEnable | ( | const ADI_GPIO_PORT | Port, |
const ADI_GPIO_DATA | Pins, | ||
const bool | bFlag | ||
) |
Enables/Disables the Input Drivers for GPIO Pin(s)
Enables/disables the input drivers for the given GPIO pin(s) on the given port.
[in] | Port | The GPIO port to be configured. |
[in] | Pins | One or more GPIO pins to be configured. GPIO pins can be passed one at a time or in combination. To configure a single GPIO pin, a single GPIO value is passed for this parameter. For example, ADI_GPIO_PIN_4. Alternatively, multiple GPIO pins can be configured simultaneously by OR-ing together GPIO pin values and passing the resulting value for this parameter. For example, ADI_GPIO_PIN_0 | ADI_GPIO_PIN_5 | ADI_GPIO_PIN_6. |
[in] | bFlag | Boolean value describing the action to be taken
|
Definition at line 578 of file adi_gpio.c.
Referenced by adi_pwr_EnableClockSource().
ADI_GPIO_RESULT adi_gpio_PullUpEnable | ( | const ADI_GPIO_PORT | Port, |
const ADI_GPIO_DATA | Pins, | ||
const bool | bFlag | ||
) |
Enables/Disables the Pull-Up for GPIO Pin(s)
Enables/disables the internal pull-up for the given GPIO pin(s) on the given port. API simply enables/disables whatever the hard-wired pulls (up/down) are.
[in] | Port | The GPIO port to be configured. |
[in] | Pins | One or more GPIO pins to be configured. GPIO pins can be passed one at a time or in combination. To configure a single GPIO pin, a single GPIO value is passed for this parameter. For example, ADI_GPIO_PIN_4. Alternatively, multiple GPIO pins can be configured simultaneously by OR-ing together GPIO pin values and passing the resulting value for this parameter. For example, ADI_GPIO_PIN_0 | ADI_GPIO_PIN_5 | ADI_GPIO_PIN_6. |
[in] | bFlag | Boolean value describing the action to be taken
|
Definition at line 682 of file adi_gpio.c.
Referenced by adi_pwr_EnableClockSource().
ADI_GPIO_RESULT adi_gpio_DriveStrengthEnable | ( | const ADI_GPIO_PORT | Port, |
const ADI_GPIO_DATA | Pins, | ||
const bool | bFlag | ||
) |
Enables/Disables increased Drive Strength capability for GPIO Pin(s)
The default current sink/source drive strength multiplier is reset to unity at power-on reset. Calling this API with bFlag==True sets the drive strength multiplier to twice the default.
[in] | Port | The GPIO port to be configured. |
[in] | Pins | One or more GPIO pins to be configured. GPIO pins can be passed one at a time or in combination. To configure a single GPIO pin, a single GPIO value is passed for this parameter. For example, ADI_GPIO_PIN_4. Alternatively, multiple GPIO pins can be configured simultaneously by OR-ing together GPIO pin values and passing the resulting value for this parameter. For example, ADI_GPIO_PIN_0 | ADI_GPIO_PIN_5 | ADI_GPIO_PIN_6. |
[in] | bFlag | Boolean value describing the action to be taken
|
Definition at line 742 of file adi_gpio.c.
ADI_GPIO_RESULT adi_gpio_SetHigh | ( | const ADI_GPIO_PORT | Port, |
const ADI_GPIO_DATA | Pins | ||
) |
Sets the Given GPIO pin(s) to a Logical High Level.
Sets the given GPIO pin(s) on the given port to a logical high level.
[in] | Port | GPIO port whose pins need to be set to logical high level. |
[in] | Pins | One or more GPIO pins to be set to logical high. GPIO pins can be passed one at a time or in combination. To configure a single GPIO pin, a single GPIO value is passed for this parameter. For example, ADI_GPIO_PIN_4. Alternatively, multiple GPIO pins can be configured simultaneously by OR-ing together GPIO pin values and passing the resulting value for this parameter. For example, ADI_GPIO_PIN_0 | ADI_GPIO_PIN_5 | ADI_GPIO_PIN_6. |
Definition at line 801 of file adi_gpio.c.
ADI_GPIO_RESULT adi_gpio_SetLow | ( | const ADI_GPIO_PORT | Port, |
const ADI_GPIO_DATA | Pins | ||
) |
Sets the Given GPIO pin(s) to a Logical Low Level.
Sets the given GPIO pin(s) on the given port to a logical low level.
[in] | Port | The GPIO port whose pins need to be set to logical low level. |
[in] | Pins | One or more GPIO pins to be whose logic level to be set. GPIO pins can be passed one at a time or in combination. To configure a single GPIO pin, a single GPIO value is passed for this parameter. For example, ADI_GPIO_PIN_4. Alternatively, multiple GPIO pins can be configured simultaneously by OR-ing together GPIO pin values and passing the resulting value for this parameter. For example, ADI_GPIO_PIN_0 | ADI_GPIO_PIN_5 | ADI_GPIO_PIN_6. |
Definition at line 853 of file adi_gpio.c.
ADI_GPIO_RESULT adi_gpio_Toggle | ( | const ADI_GPIO_PORT | Port, |
const ADI_GPIO_DATA | Pins | ||
) |
Toggles the Logical Level of the Given GPIO pin(s)
Toggles the logical level of the given GPIO pin(s) on the given port. If a given GPIO pin is at a logical low level, this function will change the level to a logical high value. If a given GPIO pin is at a logical high level, this function will change the level to a logical low value.
[in] | Port | The GPIO port whose pins to be toggled. |
[in] | Pins | The GPIO pins whose logic level to be toggled. GPIO pins can be passed one at a time or in combination. To configure a single GPIO pin, a single GPIO value is passed for this parameter. For example, ADI_GPIO_PIN_4. Alternatively, multiple GPIO pins can be configured simultaneously by OR-ing together GPIO pin values and passing the resulting value for this parameter. For example, ADI_GPIO_PIN_0 | ADI_GPIO_PIN_5 | ADI_GPIO_PIN_6. |
Definition at line 908 of file adi_gpio.c.
ADI_GPIO_RESULT adi_gpio_SetData | ( | const ADI_GPIO_PORT | Port, |
const ADI_GPIO_DATA | Pins | ||
) |
Sets the logic level of all GPIO pins on the given port to a given logic level.
Sets the logic level of all the GPIO pins on the given port to the given value.
[in] | Port | The GPIO port whose pins logic level to be set. |
[in] | Pins | The GPIO pins whose logic level to be set high. All other GPIO pins on the port will be set to a logical low level. For example, to set pins 0 and 1 to a logical high level and all other pins to a logical low level, this parameter should be passed as ADI_GPIO_PIN_0 | ADI_GPIO_PIN_1. |
Definition at line 958 of file adi_gpio.c.
ADI_GPIO_RESULT adi_gpio_GetData | ( | const ADI_GPIO_PORT | Port, |
const ADI_GPIO_DATA | Pins, | ||
uint16_t *const | pValue | ||
) |
Gets/Senses the input level of all GPIO Pins on the given port.
Gets the level of all GPIO input pins on the given port.
[in] | Port | The GPIO port whose input level to be sensed. |
[in] | Pins | The GPIO pins to be sensed. To sense a single GPIO pin, a single GPIO value is passed for this parameter. For example, ADI_GPIO_PIN_4. Alternatively, multiple GPIO pins can be configured simultaneously by OR-ing together GPIO pin values and passing the resulting value for this parameter. For example, ADI_GPIO_PIN_0 | ADI_GPIO_PIN_5 | ADI_GPIO_PIN_6. |
[out] | pValue | The passed pValue parameter is written with a packed value containing the status of all the requested GPIO pins on the given port. |
To get the status of a single GPIO pin, return value can be directly used. For example to see if pin 4 on port 2 is a logical high level, the following is used:
adi_gpio_GetData(ADI_GPIO_PORT2, ADI_GPIO_PIN_4, &pValue)
pValue will contain the required information.
If information is required for multiple pins, following method is required:
adi_gpio_GetData(ADI_GPIO_PORT2, (ADI_GPIO_PIN_3 | ADI_GPIO_PIN_4 | ADI_GPIO_PIN_7), &pValue)
To test if pin 4 on port 2 is a logical high level, the following is used:
if (pValue & ADI_GPIO_PIN_4) { pin 4 on port 2 is a logical high value } else { pin 4 on port 2 is a logical low value }
Definition at line 1029 of file adi_gpio.c.
ADI_GPIO_RESULT adi_gpio_GetOutputData | ( | const ADI_GPIO_PORT | Port, |
ADI_GPIO_DATA *const | pValue | ||
) |
Gets the Output Level of all GPIO Pins on a given port.
Gets the level of all GPIO output pins on the given port
[in] | Port | Identifies the GPIO port to be read (ADI_GPIO_PORTx) |
[out] | pValue | The passed pValue parameter is written with a packed value containing the status of all the GPIO pins on the given port. |
Definition at line 1072 of file adi_gpio.c.