ADuCM4x50 Device Drivers API Reference Manual  Release 4.0.0.0
GPIO Driver

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...
 

Detailed Description

GPIO port and pin identifiers.

Note
The application must include drivers/gpio/adi_gpio.h to use this driver

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
      }
    

Macro Definition Documentation

◆ ADI_GPIO_MEMORY_SIZE

#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.

◆ ADI_GPIO_PIN_0

#define ADI_GPIO_PIN_0   ((ADI_GPIO_DATA)(0x0001))

Pin 0

Definition at line 97 of file adi_gpio.h.

◆ ADI_GPIO_PIN_1

#define ADI_GPIO_PIN_1   ((ADI_GPIO_DATA)(0x0002))

Pin 1

Definition at line 98 of file adi_gpio.h.

◆ ADI_GPIO_PIN_2

#define ADI_GPIO_PIN_2   ((ADI_GPIO_DATA)(0x0004))

Pin 2

Definition at line 99 of file adi_gpio.h.

◆ ADI_GPIO_PIN_3

#define ADI_GPIO_PIN_3   ((ADI_GPIO_DATA)(0x0008))

Pin 3

Definition at line 100 of file adi_gpio.h.

◆ ADI_GPIO_PIN_4

#define ADI_GPIO_PIN_4   ((ADI_GPIO_DATA)(0x0010))

Pin 4

Definition at line 101 of file adi_gpio.h.

◆ ADI_GPIO_PIN_5

#define ADI_GPIO_PIN_5   ((ADI_GPIO_DATA)(0x0020))

Pin 5

Definition at line 102 of file adi_gpio.h.

◆ ADI_GPIO_PIN_6

#define ADI_GPIO_PIN_6   ((ADI_GPIO_DATA)(0x0040))

Pin 6

Definition at line 103 of file adi_gpio.h.

◆ ADI_GPIO_PIN_7

#define ADI_GPIO_PIN_7   ((ADI_GPIO_DATA)(0x0080))

Pin 7

Definition at line 104 of file adi_gpio.h.

◆ ADI_GPIO_PIN_8

#define ADI_GPIO_PIN_8   ((ADI_GPIO_DATA)(0x0100))

Pin 8

Definition at line 105 of file adi_gpio.h.

◆ ADI_GPIO_PIN_9

#define ADI_GPIO_PIN_9   ((ADI_GPIO_DATA)(0x0200))

Pin 9

Definition at line 106 of file adi_gpio.h.

◆ ADI_GPIO_PIN_10

#define ADI_GPIO_PIN_10   ((ADI_GPIO_DATA)(0x0400))

Pin 10

Definition at line 107 of file adi_gpio.h.

◆ ADI_GPIO_PIN_11

#define ADI_GPIO_PIN_11   ((ADI_GPIO_DATA)(0x0800))

Pin 11

Definition at line 108 of file adi_gpio.h.

◆ ADI_GPIO_PIN_12

#define ADI_GPIO_PIN_12   ((ADI_GPIO_DATA)(0x1000))

Pin 12

Definition at line 109 of file adi_gpio.h.

◆ ADI_GPIO_PIN_13

#define ADI_GPIO_PIN_13   ((ADI_GPIO_DATA)(0x2000))

Pin 13

Definition at line 110 of file adi_gpio.h.

◆ ADI_GPIO_PIN_14

#define ADI_GPIO_PIN_14   ((ADI_GPIO_DATA)(0x4000))

Pin 14

Definition at line 111 of file adi_gpio.h.

◆ ADI_GPIO_PIN_15

#define ADI_GPIO_PIN_15   ((ADI_GPIO_DATA)(0x8000))

Pin 15

Definition at line 112 of file adi_gpio.h.

◆ ADI_GPIO_PORT0_PIN_AVL

#define ADI_GPIO_PORT0_PIN_AVL   (0xFFFFu)

Port 0 pin mask (16 pins)

Definition at line 115 of file adi_gpio.h.

◆ ADI_GPIO_PORT1_PIN_AVL

#define ADI_GPIO_PORT1_PIN_AVL   (0xFFFFu)

Port 1 pin mask (16 pins)

Definition at line 116 of file adi_gpio.h.

◆ ADI_GPIO_PORT2_PIN_AVL

#define ADI_GPIO_PORT2_PIN_AVL   (0xFFFFu)

Port 2 pin mask (16 pins)

Definition at line 117 of file adi_gpio.h.

◆ ADI_GPIO_PORT3_PIN_AVL

#define ADI_GPIO_PORT3_PIN_AVL   (0x000Fu)

Port 2 pin mask (4 pins)

Definition at line 120 of file adi_gpio.h.

Typedef Documentation

◆ ADI_GPIO_DATA

typedef uint16_t ADI_GPIO_DATA

pin data reg type

Definition at line 49 of file adi_gpio.h.

Enumeration Type Documentation

◆ ADI_GPIO_RESULT

GPIO API function return codes

Enumerator
ADI_GPIO_SUCCESS 

No error detected.

ADI_GPIO_FAILURE 

The API call failed.

ADI_GPIO_ALREADY_INITIALIZED 

GPIO device has already been initialized.

ADI_GPIO_NOT_INITIALIZED 

GPIO device has not yet been initialized.

ADI_GPIO_NULL_PARAMETER 

The given pointer is pointing to NULL.

ADI_GPIO_INVALID_MEMORY_SIZE 

The given memory is not sufficient to operate the driver.

ADI_GPIO_INVALID_PINS 

Invalid pin combination.

ADI_GPIO_INVALID_INTERRUPT 

Invalid interrupt number.

ADI_GPIO_INVALID_TRIGGER 

Invalid trigger condition.

ADI_GPIO_INVALID_PORT 

Invalid port number.

Definition at line 53 of file adi_gpio.h.

◆ ADI_GPIO_IRQ_TRIGGER_CONDITION

GPIO trigger condition enumerations

Enumerator
ADI_GPIO_IRQ_RISING_EDGE 

Trigger an interrupt on a rising edge.

ADI_GPIO_IRQ_FALLING_EDGE 

Trigger an interrupt on a falling edge.

ADI_GPIO_IRQ_EITHER_EDGE 

Trigger an interrupt on either edge.

ADI_GPIO_IRQ_HIGH_LEVEL 

Trigger an interrupt on a high level.

ADI_GPIO_IRQ_LOW_LEVEL 

Trigger an interrupt on a low level.

Definition at line 70 of file adi_gpio.h.

◆ 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.

◆ 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.

Function Documentation

◆ adi_gpio_Init()

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.

Parameters
[in]pMemoryPointer to the memory required for the driver to operate. The size of the memory should be at least ADI_GPIO_MEMORY_SIZE bytes.
[in]MemorySizeSize of the memory (in bytes) passed in pMemory parameter.
Returns
Status
  • ADI_GPIO_SUCCESS If successfully initialized the GPIO driver.
  • ADI_GPIO_NULL_PARAMETER [D] If the given pointer to the driver memory is pointing to NULL.
  • ADI_GPIO_INVALID_MEMORY_SIZE [D] If the given memory size is not sufficient to operate the driver.
Note
This function clears memory reserved for managing the callback function when it is called for the first time. It is expected from user to call "adi_gpio_UnInit" function when the GPIO service is no longer required.
See also
adi_gpio_UnInit

Definition at line 138 of file adi_gpio.c.

◆ adi_gpio_UnInit()

ADI_GPIO_RESULT adi_gpio_UnInit ( void  )

Un-initialize the GPIO driver.

Terminates the GPIO functions, leaving everything unchanged.

Returns
Status
See also
adi_gpio_Init

Definition at line 192 of file adi_gpio.c.

◆ adi_gpio_RegisterCallback()

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:

  • application-provided callback parameter (pCBParam),
  • The GPIO Port,
  • The GPIO Pins.
Parameters
[in]eIrqThe interrupt for which the callback is being registered.
[in]pfCallbackPointer to the callback function. This can be passed as NULL to unregister the callback.
[in]pCBParamCallback parameter which will be passed back to the application when the callback is called..
Returns
Status
See also
adi_gpio_SetGroupInterruptPolarity

Definition at line 1126 of file adi_gpio.c.

◆ adi_gpio_SetGroupInterruptPins()

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.

Parameters
[in]PortGPIO port number to be operated on.
[in]eIrqInterrupt (Group A/B) to which the pin(s) are to be grouped.
[in]PinsThe 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.
Returns
Status
See also
adi_gpio_RegisterCallback
adi_gpio_SetGroupInterruptPolarity

Definition at line 235 of file adi_gpio.c.

◆ adi_gpio_GetGroupInterruptPins()

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.

Parameters
[in]PortIdentifies the GPIO port to be operated on.
[in]eIrqIdentifies the Group A/B interrupt to query.
[out]pValueReturned Pin state for GPIO port pins.
Returns
Status
See also
adi_gpio_SetGroupInterruptPins
adi_gpio_SetGroupInterruptPolarity
adi_gpio_GetGroupInterruptPolarity

Definition at line 293 of file adi_gpio.c.

◆ adi_gpio_SetGroupInterruptPolarity()

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.

Parameters
[in]PortGPIO port number to be operated on.
[in]PinsPins whose polarity to be set.
Returns
Status
See also
adi_gpio_RegisterCallback
adi_gpio_SetGroupInterruptPins
adi_gpio_GetGroupInterruptPolarity
adi_gpio_GroupInterruptPolarityEnable

Definition at line 357 of file adi_gpio.c.

◆ adi_gpio_GetGroupInterruptPolarity()

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.

Parameters
[in]PortIdentifies the GPIO port to be operated on
[out]pValueReturned Interrupt polarity for GPIO port pins.
Returns
Status
See also
adi_gpio_RegisterCallback
adi_gpio_SetGroupInterruptPins
adi_gpio_GetGroupInterruptPins
adi_gpio_SetGroupInterruptPolarity
adi_gpio_GroupInterruptPolarityEnable

Definition at line 402 of file adi_gpio.c.

◆ adi_gpio_GroupInterruptPolarityEnable()

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:

  • if the boolean flag is false then Pin interrupt is generated for high-to-low transitions
  • if the boolean flag is true then Pin interrupt is generated for low-to-high transitions
Parameters
[in]PortGPIO port number to be operated on.
[in]PinsPins whose polarity to be set/cleared.
[in]bLowToHighBoolean that defines if interrupts are generated on the rising or falling edge:
  • false : Pin interrupt is generated for high-to-low transitions,
  • true : Pin interrupt is generated for low-to-high transitions.
Returns
Status
See also
adi_gpio_SetGroupInterruptPolarity
adi_gpio_GetGroupInterruptPolarity

Definition at line 452 of file adi_gpio.c.

◆ adi_gpio_OutputEnable()

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.

Parameters
[in]PortThe GPIO port to be configured.
[in]PinsOne 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]bFlagBoolean value describing the action to be taken
  • true enables the output driver
  • false disables the output driver
Returns
Status
See also
adi_gpio_GetOutputEnable

Definition at line 515 of file adi_gpio.c.

◆ adi_gpio_GetOutputEnable()

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.

Parameters
[in]PortIdentifies the GPIO port to be sensed (ADI_GPIO_PORTx)
[out]pValueThe passed pValue parameter is written with a packed value containing the status of all the GPIO pins on the given port.
Returns
Status
See also
adi_gpio_OutputEnable

Definition at line 630 of file adi_gpio.c.

◆ adi_gpio_InputEnable()

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.

Parameters
[in]PortThe GPIO port to be configured.
[in]PinsOne 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]bFlagBoolean value describing the action to be taken
  • true enables the input driver
  • false disables the input driver
Returns
Status

Definition at line 578 of file adi_gpio.c.

Referenced by adi_pwr_EnableClockSource().

◆ adi_gpio_PullUpEnable()

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.

Parameters
[in]PortThe GPIO port to be configured.
[in]PinsOne 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]bFlagBoolean value describing the action to be taken
  • true enables the pull-up
  • false disables the pull-up
Returns
Status

Definition at line 682 of file adi_gpio.c.

Referenced by adi_pwr_EnableClockSource().

◆ adi_gpio_DriveStrengthEnable()

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.

Parameters
[in]PortThe GPIO port to be configured.
[in]PinsOne 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]bFlagBoolean value describing the action to be taken
  • true enables drive strength doubling.
  • false disables drive strength doubling (the power-on default).
Returns
Status

Definition at line 742 of file adi_gpio.c.

◆ adi_gpio_SetHigh()

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.

Parameters
[in]PortGPIO port whose pins need to be set to logical high level.
[in]PinsOne 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.
Returns
Status
See also
adi_gpio_SetLow, adi_gpio_Toggle, adi_gpio_SetData, adi_gpio_GetOutputData

Definition at line 801 of file adi_gpio.c.

◆ adi_gpio_SetLow()

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.

Parameters
[in]PortThe GPIO port whose pins need to be set to logical low level.
[in]PinsOne 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.
Returns
Status
See also
adi_gpio_SetHigh, adi_gpio_Toggle, adi_gpio_SetData, adi_gpio_GetData, adi_gpio_GetOutputData

Definition at line 853 of file adi_gpio.c.

◆ adi_gpio_Toggle()

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.

Parameters
[in]PortThe GPIO port whose pins to be toggled.
[in]PinsThe 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.
Returns
Status
See also
adi_gpio_SetHigh, adi_gpio_SetLow, adi_gpio_SetData, adi_gpio_GetData, adi_gpio_GetOutputData

Definition at line 908 of file adi_gpio.c.

◆ adi_gpio_SetData()

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.

Parameters
[in]PortThe GPIO port whose pins logic level to be set.
[in]PinsThe 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.
Returns
Status
See also
adi_gpio_SetHigh, adi_gpio_SetLow, adi_gpio_Toggle, adi_gpio_GetData, adi_gpio_GetOutputData

Definition at line 958 of file adi_gpio.c.

◆ adi_gpio_GetData()

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.

Parameters
[in]PortThe GPIO port whose input level to be sensed.
[in]PinsThe 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]pValueThe 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
    }
Returns
Status
See also
adi_gpio_SetHigh, adi_gpio_SetLow, adi_gpio_Toggle, adi_gpio_SetData, adi_gpio_GetOutputData

Definition at line 1029 of file adi_gpio.c.

◆ adi_gpio_GetOutputData()

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

Parameters
[in]PortIdentifies the GPIO port to be read (ADI_GPIO_PORTx)
[out]pValueThe passed pValue parameter is written with a packed value containing the status of all the GPIO pins on the given port.
Returns
Status
See also
adi_gpio_SetHigh, adi_gpio_SetLow, adi_gpio_Toggle, adi_gpio_SetData
adi_gpio_GetData

Definition at line 1072 of file adi_gpio.c.