General-Purpose Input-Output#


Introduction#

The GPIO (General Purpose Input/Output) driver provides a comprehensive set of functions to configure and control the GPIO pins. The GPIO pins can be used for various purposes such as reading digital signals, controlling external devices, generating interrupts, etc. The GPIO driver simplifies the process of interacting with GPIO pins, making it easier to integrate GPIO functionality into the application.


Configuration#

  • To configure the GPIO driver, identify the GPIO instance and pins you want to configure. Set the direction of each pin as either input or output. Then, if needed, set the drive strength for the pins to ensure they can handle the required current. Set the GPIO mux/mode and pad selection, if needed. Configure any interrupt settings, such as trigger type (level or edge) and interrupt polarity (high or low). If interrupts are used, register the appropriate callback functions to handle them.

  • Additionally, make sure to enable the GPIO clock for the selected instance to ensure the GPIO peripheral operates correctly.

  • These steps are necessary for the GPIO pins to function correctly and trigger interrupts as required by the application. The respective APIs for the same functionality will change depending on the GPIO in use (i.e., Ultra Ultra Low Power (UULP), Ultra Low Power (ULP), or High Power (HP)).


Usage#

  • For UULP GPIOs, common functions include:

  1. sl_gpio_driver_configure_interrupt

  2. sl_gpio_driver_toggle_pin

  3. sl_gpio_driver_get_pin

  4. sl_gpio_driver_clear_pin

  5. sl_gpio_driver_set_pin

  6. sl_gpio_set_configuration

  • For ULP GPIOs, some of the common functions include:

  1. sl_gpio_driver_configure_interrupt

  2. sl_gpio_driver_toggle_pin

  3. sl_gpio_driver_get_pin

  4. sl_gpio_driver_clear_pin

  5. sl_gpio_driver_set_pin

  6. sl_gpio_set_configuration

  • For HP GPIOs, some of the common functions include:

  1. sl_gpio_set_configuration

  2. sl_gpio_driver_set_pin

  3. sl_gpio_driver_clear_pin

  4. sl_gpio_driver_get_pin

  5. sl_gpio_driver_toggle_pin

  6. sl_gpio_driver_configure_interrupt

  • There is also an alternate API for configuring GPIO pin straight forward (without configuring mode, direction, pad, clock, and so on, using separate APIs), by providing information to structure members. See sl_gpio_set_configuration.

  • Other APIs can be referred to in the API Documentation.

Modules#

sl_gpio_t

sl_si91x_gpio_pin_config_t

Enumerations#

enum
UULP_GPIO_INTERRUPT_0 = 0
UULP_GPIO_INTERRUPT_1 = 1
UULP_GPIO_INTERRUPT_2 = 2
UULP_GPIO_INTERRUPT_3 = 3
UULP_GPIO_INTERRUPT_4 = 4
}

UULP GPIO pin/interrupt number.

enum
UULP_GPIO_INTERRUPT_0_BIT = BIT(0)
UULP_GPIO_INTERRUPT_1_BIT = BIT(1)
UULP_GPIO_INTERRUPT_2_BIT = BIT(2)
UULP_GPIO_INTERRUPT_3_BIT = BIT(3)
UULP_GPIO_INTERRUPT_4_BIT = BIT(4)
}

UULP GPIO interrupt bit position.

Typedefs#

typedef void(*
sl_gpio_irq_callback_t)(uint32_t flag)

GPIO interrupt callback function pointer.

Functions#

STATIC __INLINE sl_status_t

Clears one or more pending GPIO interrupts.

sl_status_t
sl_gpio_driver_configure_interrupt(sl_gpio_t *gpio, uint32_t int_no, sl_gpio_interrupt_flag_t flags, sl_gpio_irq_callback_t gpio_callback, uint32_t *avl_intr_no)

Configures the GPIO pin interrupt.

sl_status_t
sl_gpio_configure_group_interrupt(sl_si91x_gpio_group_interrupt_config_t *configuration, sl_gpio_irq_callback_t gpio_callback)

Configures the GPIO group interrupts for HP and ULP instances.

sl_status_t
sl_gpio_driver_set_pin_mode(sl_gpio_t *gpio, sl_gpio_mode_t mode, uint32_t output_value)

Sets the pin mode for a GPIO pin in HP (or) ULP instance.

sl_status_t
sl_gpio_driver_get_pin_mode(sl_gpio_t *gpio, sl_gpio_mode_t *mode)

Gets the pin mode (alternate function) of a GPIO for either HP instance (or) ULP instance as per the port number.

sl_status_t

Initializes the GPIO driver.

sl_status_t

De-Initializes the GPIO driver.

sl_status_t
sl_gpio_driver_unregister(sl_si91x_gpio_instances_t gpio_instance, sl_si91x_gpio_intr_t gpio_intr, uint8_t flag)

Unregisters GPIO driver.

sl_status_t

Validate if the given pin is configured as SOC peripheral on ULP GPIO.

STATIC __INLINE sl_status_t
sl_gpio_validation(sl_gpio_t *gpio)

Validates the port and pin of a GPIO.

STATIC __INLINE sl_status_t
sl_gpio_driver_set_pin(sl_gpio_t *gpio)

Sets a single pin in the GPIO configuration register to 1.

STATIC __INLINE sl_status_t
sl_gpio_driver_clear_pin(sl_gpio_t *gpio)

Clears a single pin in the GPIO configuration register.

STATIC __INLINE sl_status_t
sl_gpio_driver_toggle_pin(sl_gpio_t *gpio)

Toggles a single pin in the GPIO port register.

STATIC __INLINE sl_status_t
sl_gpio_driver_get_pin(sl_gpio_t *gpio, uint8_t *pin_value)

Reads the pin value for a single pin in a GPIO port.

STATIC __INLINE sl_status_t
sl_gpio_driver_set_port(sl_gpio_port_t port, uint32_t pins)

Sets the bits of the GPIO data out register.

STATIC __INLINE sl_status_t
sl_gpio_driver_clear_port(sl_gpio_port_t port, uint32_t pins)

Sets the bits in the configuration register for a port to 0.

STATIC __INLINE sl_status_t
sl_gpio_driver_get_port_output(sl_gpio_port_t port, uint32_t *port_value)

Gets the current setting for a GPIO configuration register.

STATIC __INLINE uint8_t

Gets the current setting for a pin in a GPIO configuration register.

STATIC __INLINE sl_status_t
sl_gpio_driver_set_port_output_value(sl_gpio_port_t port, uint32_t val, uint32_t mask)

Sets the GPIO port configuration register.

STATIC __INLINE sl_status_t
sl_gpio_driver_set_slew_rate(sl_gpio_port_t port, uint32_t slewrate, uint32_t slewrate_alt)

Sets the slewrate for pins on an HP instance GPIO port.

STATIC __INLINE uint32_t
sl_gpio_driver_get_port_input(sl_gpio_port_t port)

Reads the port value for GPIO.

STATIC __INLINE sl_status_t
sl_gpio_driver_toggle_port_output(sl_gpio_port_t port, uint32_t pins)

Toggles the selected pin values in the GPIO port register.

STATIC __INLINE sl_status_t

Enables the selected GPIO pin interrupt with the configured interrupt type (Level or Edge).

STATIC __INLINE sl_status_t

Disables the selected GPIO pin interrupt with the configured interrupt type (Level or Edge).

STATIC __INLINE sl_status_t

Sets the selected GPIO pin interrupt with the configured interrupt type (Level or Edge).

STATIC __INLINE uint32_t

Gets the pending GPIO interrupts.

STATIC __INLINE uint32_t

Gets the enabled GPIO interrupts.

STATIC __INLINE uint32_t

Gets the enabled and pending GPIO interrupt flags.

sl_status_t
sl_gpio_set_configuration(sl_si91x_gpio_pin_config_t pin_config)

Configuration of the GPIO based on port and pin.

sl_status_t
sl_si91x_gpio_driver_set_pin_direction(uint8_t port, uint8_t pin, sl_si91x_gpio_direction_t direction)

Set the direction for a GPIO pin.

uint8_t
sl_si91x_gpio_driver_get_pin_direction(uint8_t port, uint8_t pin)

Get the direction of a selected GPIO pin.

sl_status_t

Enable the receiver enable bit in the PAD configuration register for reading the GPIO pin status.

sl_status_t

Disable the receiver enable bit in the PAD configuration register.

sl_status_t

Enable the pad selection bit in the PAD selection register.

sl_status_t

Enable the host pad selection bit in the PAD selection register.

sl_status_t
sl_si91x_gpio_driver_select_pad_driver_strength(uint8_t gpio_num, sl_si91x_gpio_driver_strength_select_t strength)

Select the drive strength for an HP instance GPIO pin.

sl_status_t
sl_si91x_gpio_driver_select_pad_driver_disable_state(uint8_t gpio_num, sl_si91x_gpio_driver_disable_state_t disable_state)

Select the configuration of pull-up, pull-down, or repeater functionality for GPIO pins in the High-Power (HP) instance.

sl_status_t
sl_si91x_gpio_driver_select_group_interrupt_and_or(uint8_t port, sl_si91x_group_interrupt_t group_interrupt, sl_si91x_gpio_and_or_t and_or)

Select AND/OR type of the group interrupt.

sl_status_t
sl_si91x_gpio_driver_clear_group_interrupt(sl_si91x_group_interrupt_t group_interrupt)

Clear the selected group interrupt status value.

uint32_t
sl_si91x_gpio_driver_get_group_interrupt_status(uint8_t port, sl_si91x_group_interrupt_t group_interrupt)

Get the current status of the selected group interrupt.

sl_status_t
sl_si91x_gpio_driver_select_group_interrupt_wakeup(uint8_t port, sl_si91x_group_interrupt_t group_interrupt, sl_si91x_gpio_wakeup_t flags)

Configure the group interrupt as a wake-up source across sleep wakeups.

sl_status_t
sl_si91x_gpio_driver_configure_group_interrupt(sl_si91x_gpio_group_interrupt_config_t *configuration, sl_gpio_irq_callback_t gpio_callback)

Configure the MCU HP instance group interrupts with trigger type (level/edge), polarity (high/low), interrupt type (and/or) and register the callback function for interrupts.

uint8_t
sl_si91x_gpio_driver_get_group_interrupt_polarity(sl_si91x_group_interrupt_t group_interrupt, uint8_t port, uint8_t pin)

Get the configured polarity of group interrupt.

sl_status_t
sl_si91x_gpio_driver_set_group_interrupt_polarity(sl_si91x_group_interrupt_t group_interrupt, uint8_t port, uint8_t pin, sl_si91x_gpio_polarity_t polarity)

Configure the polarity to a selected group interrupt which decides the active value of the pin to be considered for group interrupt generation.

uint8_t
sl_si91x_gpio_driver_get_group_interrupt_level_edge(uint8_t port, sl_si91x_group_interrupt_t group_interrupt)

Get the configured level/edge event for the selected group interrupt.

sl_status_t
sl_si91x_gpio_driver_set_group_interrupt_level_edge(uint8_t port, sl_si91x_group_interrupt_t group_interrupt, sl_si91x_gpio_level_edge_t level_edge)

Set the level/edge event for the selected group interrupt.

sl_status_t
sl_si91x_gpio_driver_unmask_group_interrupt(uint8_t port, sl_si91x_group_interrupt_t group_interrupt)

Unmask the selected group interrupt to enable interrupt clearing upon generation.

sl_status_t
sl_si91x_gpio_driver_mask_group_interrupt(uint8_t port, sl_si91x_group_interrupt_t group_interrupt)

Mask the selected group interrupt.

sl_status_t
sl_si91x_gpio_driver_disable_clock(sl_si91x_gpio_select_clock_t clock)

Disable the clock for either the HP or ULP instance of the GPIO Peripheral.

sl_status_t
sl_si91x_gpio_driver_enable_clock(sl_si91x_gpio_select_clock_t clock)

Enable the clock for either the HP or ULP instance of the GPIO peripheral.

sl_status_t
sl_si91x_gpio_driver_enable_group_interrupt(sl_si91x_group_interrupt_t group_interrupt, uint8_t port, uint8_t pin)

Enable the selected group interrupts for either the HP or ULP instance of the GPIO peripheral.

sl_status_t
sl_si91x_gpio_driver_disable_group_interrupt(sl_si91x_group_interrupt_t group_interrupt, uint8_t port, uint8_t pin)

Disable the selected group interrupts for either the HP or ULP instance of the GPIO peripheral.

sl_status_t
sl_si91x_gpio_driver_select_ulp_pad_slew_rate(uint8_t gpio_num, sl_si91x_gpio_slew_rate_t slew_rate)

Select the slew rate for the ULP instance of the GPIO peripheral.

sl_status_t
sl_si91x_gpio_driver_select_ulp_pad_driver_strength(uint8_t gpio_num, sl_si91x_gpio_driver_strength_select_t strength)

Select the drive strength for the ULP instance of the GPIO peripheral.

sl_status_t
sl_si91x_gpio_driver_select_ulp_pad_driver_disable_state(uint8_t gpio_num, sl_si91x_gpio_driver_disable_state_t disable_state)

Select the configuration of pull-up, pull-down, or repeater functionality for GPIO pins in the Ultra-Low-Power (ULP) instance.

sl_status_t

Disable the receiver enable bit for the ULP instance of the GPIO peripheral.

sl_status_t

Enable the receiver enable bit for the ULP instance of the GPIO peripheral.

sl_status_t
sl_si91x_gpio_driver_configure_ulp_pin_interrupt(uint8_t int_no, sl_si91x_gpio_interrupt_config_flag_t flags, sl_si91x_gpio_pin_ulp_t pin, sl_gpio_irq_callback_t gpio_callback)

Configure the MCU ULP instance pin interrupts with the trigger type (level/edge) and register the callback function for interrupts.

sl_status_t
sl_si91x_gpio_driver_set_uulp_npss_pin_mux(uint8_t pin, sl_si91x_uulp_npss_mode_t mode)

Set the UULP GPIO pin MUX (mode) to the selected mode.

sl_status_t
sl_si91x_gpio_driver_select_uulp_npss_receiver(uint8_t pin, sl_si91x_gpio_receiver_t receiver)

Enable/disable the UULP GPIO Input Buffer.

sl_status_t
sl_si91x_gpio_driver_set_uulp_npss_direction(uint8_t pin, sl_si91x_gpio_direction_t direction)

Set the direction for the selected UULP GPIO.

uint8_t

Get the direction of the selected UULP GPIO.

sl_status_t
sl_si91x_gpio_driver_set_uulp_npss_pin_value(uint8_t pin, sl_si91x_gpio_pin_value_t pin_value)

Control(set or clear) the UULP GPIO pin value.

uint8_t

Read the status of the selected UULP GPIO pin value.

sl_status_t
sl_si91x_gpio_driver_select_uulp_npss_polarity(uint8_t pin, sl_si91x_gpio_polarity_t polarity)

Select the UULP GPIO polarity for generating the interrupt.

sl_status_t

Set the UULP GPIO interrupt as a wake-up source across sleep wakeups.

sl_status_t

Clear the UULP UULP GPIO Interrupt as a wake up source.

sl_status_t

Mask the selected UULP GPIO interrupt.

sl_status_t

Unmask the selected UULP GPIO interrupt.

sl_status_t
sl_si91x_gpio_driver_clear_uulp_interrupt(uint8_t npssgpio_interrupt)

Clear the selected UULP GPIO interrupt.

sl_status_t

Mask the selected UULP GPIO interrupt.

sl_status_t

Unmask the selected UULP GPIO interrupt.

sl_status_t

Clear the selected UULP GPIO interrupt.

uint8_t

Get the current status of all the UULP GPIO interrupt status.

uint32_t

Get the selected ULP instance GPIO pin interrupt status.

sl_status_t

Clear the selected ULP instance GPIO pin interrupts.

sl_status_t
sl_si91x_gpio_driver_clear_ulp_group_interrupt(sl_si91x_group_interrupt_t group_interrupt)

Clear the selected ULP instance group interrupt.

sl_status_t
sl_si91x_gpio_driver_configure_uulp_interrupt(sl_si91x_gpio_interrupt_config_flag_t flags, uint8_t npssgpio_interrupt, sl_gpio_irq_callback_t gpio_callback)

Configure the UULP GPIO pin interrupt with interrupt type level or edge and registers callback function for interrupts.

sl_status_t
sl_si91x_gpio_driver_configure_ulp_group_interrupt(sl_si91x_gpio_group_interrupt_config_t *configuration, sl_gpio_irq_callback_t gpio_callback)

Configure the MCU ULP instance group interrupts with trigger type (level/edge), polarity (high/low), interrupt type (and/or) and register the callback function for interrupts.

sl_status_t

Toggle the selected UULP pin status.

sl_status_t

Configure the UULP GPIO pin mode, receiver enable, direction and polarity settings.

sl_si91x_gpio_version_t

Get the release, SQA, and development version numbers of the GPIO peripheral.

sl_status_t
sl_si91x_gpio_driver_set_soc_peri_on_ulp_pin_mode(sl_gpio_t *gpio, sl_gpio_mode_t mode)

To configure ULP GPIOs in SOC (HP) Mode.

sl_status_t
sl_si91x_gpio_driver_set_ulp_peri_on_soc_pin_mode(sl_gpio_t *gpio, sl_gpio_mode_t mode)

To configure SOC (HP) GPIOs in ULP Mode.

Macros#

#define
GPIO_MAX_OUTPUT_VALUE 1

GPIO output maximum value.

#define
MAX_GROUP_INT 2

Maximum number of group interrupts.

#define
GPIO_PORT_MAX_VALUE 5

Maximum number of GPIO ports.

#define
MAX_UULP_INT 5

Maximum number of UULP interrupts.

#define
ULP_MAX_MODE 10

Maximum ULP mode.

#define
GPIO_MAX_INTR_VALUE 8

Maximum number of M4 GPIO pin interrupts.

#define
PORTD_PIN_MAX_VALUE 9

Port D maximum(0-9) number of GPIO pins.

#define
ULP_PIN_MAX_VALUE 11

Port E maximum(0-11) number of GPIO pins.

#define
UULP_PIN_MAX_VALUE 5

Port F maximum(0-4) number of GPIO pins.

#define
MAX_ULP_INTR 8

Maximum number of ULP interrupts.

#define
MAX_MODE 15

Maximum M4 GPIO mode.

#define
PORTA_PIN_MAX_VALUE 57

GPIO pin maximum(0-63) value for SL_GPIO_PORT_A of HP instance.

#define
PORT_PIN_MAX_VALUE 15

GPIO pin maximum(0-15) value for SL_GPIO_PORT_B, SL_GPIO_PORT_C of HP instance.

#define
GPIO_FLAGS_MAX_VALUE 0x0F

GPIO flags maximum value.

#define
PAD_SELECT_9 9

GPIO PAD selection number.

#define
UULP_PORT 5

Refers to port for UULP instance.

#define
GPIO_MAX_PORT_PINS 0xFFFF

Refers to maximum no. of pins port can support.

Enumeration Documentation#

sl_si91x_uulp_gpio_interrupt_t#

sl_si91x_uulp_gpio_interrupt_t

UULP GPIO pin/interrupt number.

Enumerator
UULP_GPIO_INTERRUPT_0
UULP_GPIO_INTERRUPT_1

UULP GPIO 0 pin/interrupt number.

UULP_GPIO_INTERRUPT_2

UULP GPIO 1 pin/interrupt number.

UULP_GPIO_INTERRUPT_3

UULP GPIO 2 pin/interrupt number.

UULP_GPIO_INTERRUPT_4

UULP GPIO 3 pin/interrupt number.


sl_si91x_uulp_gpio_interrupt_bit_t#

sl_si91x_uulp_gpio_interrupt_bit_t

UULP GPIO interrupt bit position.

Note

  • The APIs which uses this enum is deprecated, new APIs use sl_si91x_uulp_gpio_interrupt_t instead

Enumerator
UULP_GPIO_INTERRUPT_0_BIT
UULP_GPIO_INTERRUPT_1_BIT

UULP GPIO 0 interrupt bit position.

UULP_GPIO_INTERRUPT_2_BIT

UULP GPIO 1 interrupt bit position.

UULP_GPIO_INTERRUPT_3_BIT

UULP GPIO 2 interrupt bit position.

UULP_GPIO_INTERRUPT_4_BIT

UULP GPIO 3 interrupt bit position.


Typedef Documentation#

sl_gpio_irq_callback_t#

typedef void(* sl_gpio_irq_callback_t) (uint32_t flag) )(uint32_t flag)

GPIO interrupt callback function pointer.


Function Documentation#

sl_gpio_driver_clear_interrupts#

STATIC __INLINE sl_status_t sl_gpio_driver_clear_interrupts (uint32_t flags)

Clears one or more pending GPIO interrupts.

Parameters
TypeDirectionArgument NameDescription
uint32_t[in]flags

Bitwise logic OR of GPIO interrupt sources to clear.

This function clears the specified GPIO interrupt sources. The flags parameter is a bitwise OR of the interrupt sources to be cleared.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_gpio_driver_configure_interrupt#

sl_status_t sl_gpio_driver_configure_interrupt (sl_gpio_t * gpio, uint32_t int_no, sl_gpio_interrupt_flag_t flags, sl_gpio_irq_callback_t gpio_callback, uint32_t * avl_intr_no)

Configures the GPIO pin interrupt.

Parameters
TypeDirectionArgument NameDescription
sl_gpio_t *[in]gpio

Pointer to the structure of type sl_gpio_t.

uint32_t[in]int_no

Specifies the interrupt number to trigger,

  • For High Performance (HP) GPIO ports: Valid values are (0-7). All 8 interrupts can be used simultaneously.

  • For Ultra-Low Power (ULP) GPIO port: Valid values are (0-7). (0-7) interrupts can be configured simultaneously, but only one interrupt is served at a time.

  • For Ultra-Ultra Low Power (UULP) GPIO port: Valid values are (0-4). (0-4) interrupts can be configured simultaneously, but only one interrupt is served at a time.

sl_gpio_interrupt_flag_t[in]flags

Interrupt configuration flags of type sl_gpio_interrupt_flag_t.

sl_gpio_irq_callback_t[in]gpio_callback

IRQ callback function pointer of type sl_gpio_irq_callback_t.

uint32_t *[out]avl_intr_no

Pointer to the available interrupt number. This parameter is currently unused and will be ignored.

This function sets up a GPIO pin to trigger an interrupt. The gpio parameter is a pointer to a structure of type sl_gpio_t, which contains the GPIO configuration. The int_no parameter specifies the interrupt number to trigger (ranging from 0 to 7). The flags parameter contains the interrupt configuration flags of type sl_gpio_interrupt_flag_t. The gpio_callback parameter is a pointer to the IRQ callback function of type sl_gpio_irq_callback_t. The avl_intr_no parameter is an output pointer to the available interrupt number.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_BUSY - Interrupt is busy and cannot carry out the requested operation.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER - The parameter is a null pointer.

For more information on status codes, refer to SL STATUS DOCUMENTATION.

Note

  • Ensure that the GPIO clock is enabled and the pin is properly configured before calling this function.


sl_gpio_configure_group_interrupt#

sl_status_t sl_gpio_configure_group_interrupt (sl_si91x_gpio_group_interrupt_config_t * configuration, sl_gpio_irq_callback_t gpio_callback)

Configures the GPIO group interrupts for HP and ULP instances.

Parameters
TypeDirectionArgument NameDescription
sl_si91x_gpio_group_interrupt_config_t *[in]configuration

Pointer to the structure of type sl_si91x_gpio_group_interrupt_config_t

sl_gpio_irq_callback_t[in]gpio_callback

IRQ callback function pointer of type sl_gpio_irq_callback_t.

This function sets up group interrupts for GPIO pins in both High Performance (HP) and Ultra Low Power (ULP) instances. The configuration parameter is a pointer to a structure of type sl_si91x_gpio_group_interrupt_config_t, which contains the GPIO group interrupt configuration. The gpio_callback parameter is a pointer to the IRQ callback function of type sl_gpio_irq_callback_t.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_BUSY - Interrupt is busy and cannot carry out the requested operation.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER - The parameter is a null pointer.

For more information on status codes, refer to SL STATUS DOCUMENTATION.

Note

  • Ensure that the GPIO clock is enabled and the pins are properly configured before calling this function.


sl_gpio_driver_set_pin_mode#

sl_status_t sl_gpio_driver_set_pin_mode (sl_gpio_t * gpio, sl_gpio_mode_t mode, uint32_t output_value)

Sets the pin mode for a GPIO pin in HP (or) ULP instance.

Parameters
TypeDirectionArgument NameDescription
sl_gpio_t *[in]gpio

Pointer to the structure of type sl_gpio_t. Refer to the table below for a description of each port and pins available.

GPIO Instance

GPIO Port

GPIO Pin Number

SL_GPIO_PORT_A

(0-15)

HP (High Power) GPIO Instance

SL_GPIO_PORT_B

(16-31)

SL_GPIO_PORT_C

(32-47)

SL_GPIO_PORT_D

(48-57)

------------------------------------------—

--------------------—

----------------—

ULP (Ultra Low Power) GPIO Instance

SL_GPIO_ULP_PORT

(0-11)

------------------------------------------—

--------------------—

----------------—

UULP (Ultra Ultra Low Power) GPIO Instance

SL_GPIO_UULP_PORT

(0-3)

------------------------------------------—

--------------------—

----------------—

PORT_A can also be a single port to access all GPIO (0-57) pins available in the HP domain, instead of using PORT B, C, D. Pins (57-63) are reserved.

sl_gpio_mode_t[in]mode

The desired pin mode.

uint32_t[in]output_value

A value to set for the pin in the GPIO register. The GPIO setting is important for some input mode configurations.

By default, mode-0 is set, and the GPIO pin acts as a normal GPIO. If a GPIO pin needs to be used for some alternate modes, the respective mode should be selected. For more information about modes present for different instances, refer to the PIN MUX section in the HRM.

Use the corresponding pad receiver API for the corresponding GPIO instance.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER - The parameter is a null pointer.

For more information on status codes, refer to SL STATUS DOCUMENTATION.

Note

  • Ensure that the GPIO clock is enabled and the pin is properly configured before calling this function.


sl_gpio_driver_get_pin_mode#

sl_status_t sl_gpio_driver_get_pin_mode (sl_gpio_t * gpio, sl_gpio_mode_t * mode)

Gets the pin mode (alternate function) of a GPIO for either HP instance (or) ULP instance as per the port number.

Parameters
TypeDirectionArgument NameDescription
sl_gpio_t *[in]gpio

Pointer to the structure of type sl_gpio_t.

sl_gpio_mode_t *[out]mode

Pointer to a variable where the current pin mode will be stored.

This function retrieves the current pin mode (alternate function) of a specified GPIO pin. The gpio parameter is a pointer to a structure of type sl_gpio_t, which contains the GPIO configuration. The mode parameter is an output parameter that will hold the current pin mode after the function executes.

Use the corresponding pad receiver API for the corresponding GPIO instance.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER - The parameter is a null pointer.

For more information on status codes, refer to SL STATUS DOCUMENTATION.

Note

  • Ensure that the GPIO clock is enabled and the pin is properly configured before calling this function.


sl_gpio_driver_init#

sl_status_t sl_gpio_driver_init (void )

Initializes the GPIO driver.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This function initializes the GPIO driver by clearing all the interrupts for High Performance (HP), Ultra Low Power (ULP), and NPSS instances. It also sets all callback function pointers to NULL.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

For more information on status codes, refer to SL STATUS DOCUMENTATION.

Note

  • This function should be called before any other GPIO driver functions to ensure proper initialization.


sl_gpio_driver_deinit#

sl_status_t sl_gpio_driver_deinit (void )

De-Initializes the GPIO driver.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This function de-initializes the GPIO driver by disabling the clocks for both High Performance (HP), Ultra Low Power (ULP) and Ultra Ulta Low Power (UULP) instances. It also sets all callback function pointers to NULL.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

For more information on status codes, refer to SL STATUS DOCUMENTATION.

Note

  • This function should be called to properly clean up the GPIO driver before the application exits or when the GPIO driver is no longer needed.


sl_gpio_driver_unregister#

sl_status_t sl_gpio_driver_unregister (sl_si91x_gpio_instances_t gpio_instance, sl_si91x_gpio_intr_t gpio_intr, uint8_t flag)

Unregisters GPIO driver.

Parameters
TypeDirectionArgument NameDescription
sl_si91x_gpio_instances_t[in]gpio_instance

Instances of type sl_si91x_gpio_instances_t.

sl_si91x_gpio_intr_t[in]gpio_intr

GPIO interrupts of type sl_si91x_gpio_intr_t.

uint8_t[in]flag

GPIO interrupt flag. Maximum range is 8.

This function unregisters the GPIO driver for a specified GPIO instance and interrupt. The gpio_instance parameter specifies the GPIO instance of type sl_si91x_gpio_instances_t. The gpio_intr parameter specifies the GPIO interrupt of type sl_si91x_gpio_intr_t. The flag parameter specifies the GPIO interrupt flag, with a maximum range of 8.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.

Note

  • Ensure that the GPIO instance and interrupt are properly configured before calling this function.


sl_si91x_gpio_validate_soc_peri_on_ulp_gpio#

sl_status_t sl_si91x_gpio_validate_soc_peri_on_ulp_gpio (uint8_t pin)

Validate if the given pin is configured as SOC peripheral on ULP GPIO.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]pin

The pin number to validate.

This function checks if the given pin is configured as a SOC Peripheral on ULP GPIO by examining the soc_peri_on_ulp_gpio_status bit corresponding to the pin number.

Returns

  • Returns the status of the validation.

    • SL_STATUS_OK: The pin is valid and configured as a ULP pin.

    • SL_STATUS_INVALID_PARAMETER: The pin is not configured as a ULP pin.


sl_gpio_validation#

STATIC __INLINE sl_status_t sl_gpio_validation (sl_gpio_t * gpio)

Validates the port and pin of a GPIO.

Parameters
TypeDirectionArgument NameDescription
sl_gpio_t *[in]gpio

Pointer to the structure of type sl_gpio_t.

This function checks whether the specified port and pin in the GPIO structure are valid. The gpio parameter is a pointer to a structure of type sl_gpio_t, which contains the GPIO configuration.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.

Note

  • Ensure that the gpio structure is properly initialized before calling this function.


sl_gpio_driver_set_pin#

STATIC __INLINE sl_status_t sl_gpio_driver_set_pin (sl_gpio_t * gpio)

Sets a single pin in the GPIO configuration register to 1.

Parameters
TypeDirectionArgument NameDescription
sl_gpio_t *[in]gpio

Pointer to the structure of type sl_gpio_t.

This function sets a specified GPIO pin to 1 in the GPIO configuration register. The gpio parameter is a pointer to a structure of type sl_gpio_t, which contains the GPIO configuration.

Use the corresponding pad receiver API for the corresponding GPIO instance.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER - The parameter is a null pointer.

For more information on status codes, refer to SL STATUS DOCUMENTATION.

Note

  • Ensure that the GPIO clock is enabled and the pin is properly configured before calling this function.


sl_gpio_driver_clear_pin#

STATIC __INLINE sl_status_t sl_gpio_driver_clear_pin (sl_gpio_t * gpio)

Clears a single pin in the GPIO configuration register.

Parameters
TypeDirectionArgument NameDescription
sl_gpio_t *[in]gpio

Pointer to the structure of type sl_gpio_t.

This function clears (sets to 0) a specified GPIO pin in the GPIO configuration register. The gpio parameter is a pointer to a structure of type sl_gpio_t, which contains the GPIO configuration.

Use the corresponding pad receiver API for the corresponding GPIO instance.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER - The parameter is a null pointer.

For more information on status codes, refer to SL STATUS DOCUMENTATION.

Note

  • Ensure that the GPIO clock is enabled and the pin is properly configured before calling this function.


sl_gpio_driver_toggle_pin#

STATIC __INLINE sl_status_t sl_gpio_driver_toggle_pin (sl_gpio_t * gpio)

Toggles a single pin in the GPIO port register.

Parameters
TypeDirectionArgument NameDescription
sl_gpio_t *[in]gpio

Pointer to the structure of type sl_gpio_t.

This function toggles the state of a specified GPIO pin in the GPIO port register. The gpio parameter is a pointer to a structure of type sl_gpio_t, which contains the GPIO configuration.

Use the corresponding pad receiver API for the corresponding GPIO instance.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER - The parameter is a null pointer.

For more information on status codes, refer to SL STATUS DOCUMENTATION.

Note

  • Ensure that the GPIO clock is enabled and the pin is properly configured before calling this function.


sl_gpio_driver_get_pin#

STATIC __INLINE sl_status_t sl_gpio_driver_get_pin (sl_gpio_t * gpio, uint8_t * pin_value)

Reads the pin value for a single pin in a GPIO port.

Parameters
TypeDirectionArgument NameDescription
sl_gpio_t *[in]gpio

Pointer to the structure of type sl_gpio_t.

uint8_t *[out]pin_value

Pointer to a variable where the GPIO pin value will be stored.

This function reads the value of a specified GPIO pin. The gpio parameter is a pointer to a structure of type sl_gpio_t, which contains the GPIO configuration. The pin_value parameter is an output parameter that will hold the value of the GPIO pin after the function executes.

Use the corresponding pad receiver API for the corresponding GPIO instance.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER - The parameter is a null pointer.

For more information on status codes, refer to SL STATUS DOCUMENTATION.

Note

  • Ensure that the GPIO clock is enabled and the pin is properly configured before calling this function.


sl_gpio_driver_set_port#

STATIC __INLINE sl_status_t sl_gpio_driver_set_port (sl_gpio_port_t port, uint32_t pins)

Sets the bits of the GPIO data out register.

Parameters
TypeDirectionArgument NameDescription
sl_gpio_port_t[in]port

The port to associate with the pin.

  • HP instance: PORT A, B, C, D

  • ULP instance: PORT 4

uint32_t[in]pins

The GPIO pins in the port that are set to 1 (0 to 65535 in decimal or 0xFFFF in hex). If we want to set pins (maximum of 0-15 pins) in a port, it can set all pins at a time.

This function sets the specified GPIO pins to 1 in the GPIO data out register for a given port. The port parameter specifies the port to associate with the pin. The pins parameter specifies the GPIO pins in the port that are set to 1. The pins can be specified as a value between 0 and 65535 in decimal (or 0xFFFF in hex), allowing up to 16 pins (0-15) to be set at a time.

Use the corresponding pad receiver API for the corresponding GPIO instance.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.

Note

  • Ensure that the GPIO clock is enabled and the pins are properly configured before calling this function.


sl_gpio_driver_clear_port#

STATIC __INLINE sl_status_t sl_gpio_driver_clear_port (sl_gpio_port_t port, uint32_t pins)

Sets the bits in the configuration register for a port to 0.

Parameters
TypeDirectionArgument NameDescription
sl_gpio_port_t[in]port

The port to associate with the pin.

  • HP instance: PORT A, B, C, D

  • ULP instance: PORT 4

uint32_t[in]pins

The GPIO pins in the port that are set to 0 (0 to 65535 in decimal or 0xFFFF in hex). If we want to clear pins (maximum of 0-15 pins) in a port, it can clear all pins at a time.

This function clears (sets to 0) the specified GPIO pins in the configuration register for a given port. The port parameter specifies the port to associate with the pin. The pins parameter specifies the GPIO pins in the port that are set to 0. The pins can be specified as a value between 1 and 65535 in decimal (or 0xFFFF in hex), allowing up to 16 pins (0-15) to be cleared at a time.

Use the corresponding pad receiver API for the corresponding GPIO instance.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.

Note

  • Ensure that the GPIO clock is enabled and the pins are properly configured before calling this function.


sl_gpio_driver_get_port_output#

STATIC __INLINE sl_status_t sl_gpio_driver_get_port_output (sl_gpio_port_t port, uint32_t * port_value)

Gets the current setting for a GPIO configuration register.

Parameters
TypeDirectionArgument NameDescription
sl_gpio_port_t[in]port

The port to associate with the pin.

  • HP instance: PORT A, B, C, D

  • ULP instance: PORT 4

uint32_t *[out]port_value

Pointer to a variable where the GPIO port value will be stored.

This function retrieves the current configuration settings for a specified GPIO port. The port parameter specifies the port to associate with the pin. The port_value parameter is an output parameter that will hold the current value of the GPIO port configuration register after the function executes.

Use the corresponding pad receiver API for the corresponding GPIO instance.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.

Note

  • Ensure that the GPIO clock is enabled and the pins are properly configured before calling this function.


sl_gpio_driver_get_pin_output#

STATIC __INLINE uint8_t sl_gpio_driver_get_pin_output (sl_gpio_t * gpio)

Gets the current setting for a pin in a GPIO configuration register.

Parameters
TypeDirectionArgument NameDescription
sl_gpio_t *[in]gpio

Pointer to the structure of type sl_gpio_t.

This function retrieves the current value of a specified GPIO pin. The gpio parameter is a pointer to a structure of type sl_gpio_t, which contains the GPIO configuration.

Use the corresponding pad receiver API for the corresponding GPIO instance.

Returns

  • The GPIO pin value:

    • '0' - Low

    • '1' - High


sl_gpio_driver_set_port_output_value#

STATIC __INLINE sl_status_t sl_gpio_driver_set_port_output_value (sl_gpio_port_t port, uint32_t val, uint32_t mask)

Sets the GPIO port configuration register.

Parameters
TypeDirectionArgument NameDescription
sl_gpio_port_t[in]port

The port to associate with the pin.

  • HP instance: PORT A, B, C, D

  • ULP instance: PORT 4

uint32_t[in]val

Value to write to the port configuration register.

uint32_t[in]mask

Mask indicating which bits to modify.

This function sets the specified bits in the GPIO port configuration register for a given port. The port parameter specifies the port to associate with the pin. The val parameter specifies the value to write to the port configuration register. The mask parameter indicates which bits to modify.

Use the corresponding pad receiver API for the corresponding GPIO instance.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_gpio_driver_set_slew_rate#

STATIC __INLINE sl_status_t sl_gpio_driver_set_slew_rate (sl_gpio_port_t port, uint32_t slewrate, uint32_t slewrate_alt)

Sets the slewrate for pins on an HP instance GPIO port.

Parameters
TypeDirectionArgument NameDescription
sl_gpio_port_t[in]port

The GPIO port to configure.

uint32_t[in]slewrate

The slewrate to configure for the pins on this GPIO port.

uint32_t[in]slewrate_alt

The slewrate to configure for the pins using alternate modes on this GPIO port.

This function configures the slewrate for the pins on a specified HP instance GPIO port. The port parameter specifies the GPIO port to configure. The slewrate parameter specifies the slewrate for the pins on this GPIO port. The slewrate_alt parameter specifies the slewrate for the pins using alternate modes on this GPIO port.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_gpio_driver_get_port_input#

STATIC __INLINE uint32_t sl_gpio_driver_get_port_input (sl_gpio_port_t port)

Reads the port value for GPIO.

Parameters
TypeDirectionArgument NameDescription
sl_gpio_port_t[in]port

The port to associate with the pin.

  • HP instance: PORT A, B, C, D

  • ULP instance: PORT 4

This function reads the value of a specified GPIO port. The port parameter specifies the port to associate with the pin.

Use the corresponding pad receiver API for the corresponding GPIO instance.

Returns

  • The GPIO pin value:

    • '0' - Low

    • '1' - High


sl_gpio_driver_toggle_port_output#

STATIC __INLINE sl_status_t sl_gpio_driver_toggle_port_output (sl_gpio_port_t port, uint32_t pins)

Toggles the selected pin values in the GPIO port register.

Parameters
TypeDirectionArgument NameDescription
sl_gpio_port_t[in]port

The port to associate with the pin.

  • HP instance: PORT A, B, C, D

  • ULP instance: PORT 4

uint32_t[in]pins

Port pins to toggle. Ranges from 0 to 65535 in decimal (or 0xFFFF in hex).

This function toggles the specified GPIO pins in the port register. The port parameter specifies the port to associate with the pin. The pins parameter specifies the port pins to toggle, ranging from 0 to 65535 in decimal (or 0xFFFF in hex).

Use the corresponding pad receiver API for the corresponding GPIO instance.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_gpio_driver_enable_interrupts#

STATIC __INLINE sl_status_t sl_gpio_driver_enable_interrupts (uint32_t flags)

Enables the selected GPIO pin interrupt with the configured interrupt type (Level or Edge).

Parameters
TypeDirectionArgument NameDescription
uint32_t[in]flags

GPIO interrupt sources to enable.

This function enables the interrupt for the selected GPIO pin with the specified interrupt type, which can be either level-triggered or edge-triggered. The flags parameter specifies the GPIO interrupt sources to enable.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_gpio_driver_disable_interrupts#

STATIC __INLINE sl_status_t sl_gpio_driver_disable_interrupts (uint32_t flags)

Disables the selected GPIO pin interrupt with the configured interrupt type (Level or Edge).

Parameters
TypeDirectionArgument NameDescription
uint32_t[in]flags

- GPIO interrupt sources to disable.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_gpio_driver_set_interrupts#

STATIC __INLINE sl_status_t sl_gpio_driver_set_interrupts (uint32_t flags)

Sets the selected GPIO pin interrupt with the configured interrupt type (Level or Edge).

Parameters
TypeDirectionArgument NameDescription
uint32_t[in]flags

GPIO interrupt sources to set to pending.

This function sets the interrupt for the selected GPIO pin with the specified interrupt type, which can be either level-triggered or edge-triggered. The flags parameter specifies the GPIO interrupt sources to set to pending.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_gpio_driver_get_pending_interrupts#

STATIC __INLINE uint32_t sl_gpio_driver_get_pending_interrupts (void )

Gets the pending GPIO interrupts.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This function retrieves the numbers of the GPIO pins that have pending interrupts.

Returns

  • Pending GPIO pin interrupt numbers.


sl_gpio_driver_get_enabled_interrupts#

STATIC __INLINE uint32_t sl_gpio_driver_get_enabled_interrupts (void )

Gets the enabled GPIO interrupts.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This function retrieves the numbers of the GPIO pins that have enabled interrupts.

Returns

  • Enabled GPIO pin interrupt numbers.


sl_gpio_driver_get_enabled_pending_interrupts#

STATIC __INLINE uint32_t sl_gpio_driver_get_enabled_pending_interrupts (void )

Gets the enabled and pending GPIO interrupt flags.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This function retrieves the flags for the enabled and pending GPIO interrupts.

Returns

  • Flags indicating the enabled and pending GPIO interrupts.


sl_gpio_set_configuration#

sl_status_t sl_gpio_set_configuration (sl_si91x_gpio_pin_config_t pin_config)

Configuration of the GPIO based on port and pin.

Parameters
TypeDirectionArgument NameDescription
sl_si91x_gpio_pin_config_t[in]pin_config

- Structure containing the configuration information.

Port A,B,C,D are considered for HP instance, ULP PORT is considered for ULP instance UULP PORT is considered for UULP instance. The configuration of GPIO pin like which GPIO pin and port are to be passed through the structure. By default mode is taken as mode0, which is normal GPIO selection. Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_set_pin_direction#

sl_status_t sl_si91x_gpio_driver_set_pin_direction (uint8_t port, uint8_t pin, sl_si91x_gpio_direction_t direction)

Set the direction for a GPIO pin.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]port

- The port to associate with the pin. HP instance - PORT A,B,C,D ULP instance - ULP PORT

uint8_t[in]pin

- The pin number on the port. HP instance has total 57 GPIO pins. Port A, B, C has 16 pins each. Port D has 9 pins. ULP instance has total 12 pins.

sl_si91x_gpio_direction_t[in]direction

- Pin direction of type sl_si91x_gpio_direction_t (Direction of the GPIO pin enum).

  • '0' - Output

  • '1' - Input

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_get_pin_direction#

uint8_t sl_si91x_gpio_driver_get_pin_direction (uint8_t port, uint8_t pin)

Get the direction of a selected GPIO pin.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]port

- The port to associate with the pin. HP instance - PORT A,B,C,D ULP instance - ULP PORT

uint8_t[in]pin

- The pin number on the port. HP instance has total 57 GPIO pins. Port A, B, C has 16 pins each. Port D has 9 pins. ULP instance has total 12 pins.

Returns

  • Returns the direction of the pin.

    • '0' - Output

    • '1' - Input


sl_si91x_gpio_driver_enable_pad_receiver#

sl_status_t sl_si91x_gpio_driver_enable_pad_receiver (uint8_t gpio_num)

Enable the receiver enable bit in the PAD configuration register for reading the GPIO pin status.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]gpio_num

- GPIO pin number to be use.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_disable_pad_receiver#

sl_status_t sl_si91x_gpio_driver_disable_pad_receiver (uint8_t gpio_num)

Disable the receiver enable bit in the PAD configuration register.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]gpio_num

- GPIO pin number to be use.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_enable_pad_selection#

sl_status_t sl_si91x_gpio_driver_enable_pad_selection (uint8_t gpio_padnum)

Enable the pad selection bit in the PAD selection register.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]gpio_padnum

- PAD number to be used.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_enable_host_pad_selection#

sl_status_t sl_si91x_gpio_driver_enable_host_pad_selection (uint8_t gpio_num)

Enable the host pad selection bit in the PAD selection register.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]gpio_num

- GPIO pin number(25-30) to be used.

GPIO pin number(25 to 30) are valid for HOST PAD selection, referring to SL_GPIO_PORT_B, pins 9 to 14.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_select_pad_driver_strength#

sl_status_t sl_si91x_gpio_driver_select_pad_driver_strength (uint8_t gpio_num, sl_si91x_gpio_driver_strength_select_t strength)

Select the drive strength for an HP instance GPIO pin.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]gpio_num

- GPIO pin number to be use.

sl_si91x_gpio_driver_strength_select_t[in]strength

- Drive strength selector(E1,E2) of type sl_si91x_gpio_driver_strength_select_t (GPIO driver strength select). Possible values are

  • 0, for two_milli_amps (E1=0,E2=0)

  • 1, for four_milli_amps (E1=0,E2=1)

  • 2, for eight_milli_amps (E1=1,E2=0)

  • 3, for twelve_milli_amps(E1=1,E2=1)

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argumen.t For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_select_pad_driver_disable_state#

sl_status_t sl_si91x_gpio_driver_select_pad_driver_disable_state (uint8_t gpio_num, sl_si91x_gpio_driver_disable_state_t disable_state)

Select the configuration of pull-up, pull-down, or repeater functionality for GPIO pins in the High-Power (HP) instance.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]gpio_num

- GPIO pin number to be use.

sl_si91x_gpio_driver_disable_state_t[in]disable_state

- Driver disable state of type sl_si91x_gpio_driver_disable_state_t. Possible values are

  • 0, for HiZ (P1=0,P2=0)

  • 1, for Pull-up (P1=0,P2=1)

  • 2, for Pull-down (P1=1,P2=0)

  • 3, for Repeater (P1=1,P2=1)

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_select_group_interrupt_and_or#

sl_status_t sl_si91x_gpio_driver_select_group_interrupt_and_or (uint8_t port, sl_si91x_group_interrupt_t group_interrupt, sl_si91x_gpio_and_or_t and_or)

Select AND/OR type of the group interrupt.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]port

- The port to associate with the pin. HP instance - PORT A,B,C,D ULP instance - ULP PORT

sl_si91x_group_interrupt_t[in]group_interrupt

- Group interrupt number of type sl_si91x_group_interrupt_t (GPIO group interrupts).

sl_si91x_gpio_and_or_t[in]and_or

- AND/OR of GPIO group interrupts of type sl_si91x_gpio_and_or_t (AND/OR of the GPIO group interrupt).

  • '0' - AND

  • '1' - OR

If multiple interrupts on same port (or) different are to be generated, then use this API. Example: Consider port A: pin 2,3 and port D: pin 1,2 for interrupt generation. Choose OR, any of the selected pin condition triggers the group interrupt generation Choose AND, all the selected pin conditions should match to trigger group interrupt generation

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_clear_group_interrupt#

sl_status_t sl_si91x_gpio_driver_clear_group_interrupt (sl_si91x_group_interrupt_t group_interrupt)

Clear the selected group interrupt status value.

Parameters
TypeDirectionArgument NameDescription
sl_si91x_group_interrupt_t[in]group_interrupt

- Group interrupt number of type sl_si91x_group_interrupt_t (GPIO group interrupts).

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_get_group_interrupt_status#

uint32_t sl_si91x_gpio_driver_get_group_interrupt_status (uint8_t port, sl_si91x_group_interrupt_t group_interrupt)

Get the current status of the selected group interrupt.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]port

- The port to associate with the pin. HP instance - PORT A,B,C,D ULP instance - ULP PORT

sl_si91x_group_interrupt_t[in]group_interrupt

- Group interrupt number of type (0 to 1) sl_si91x_group_interrupt_t (GPIO group interrupts).

Returns

  • Returns the group interrupt status register:

    • 1, when interrupt is enabled

    • 0, when interrupt is disabled


sl_si91x_gpio_driver_select_group_interrupt_wakeup#

sl_status_t sl_si91x_gpio_driver_select_group_interrupt_wakeup (uint8_t port, sl_si91x_group_interrupt_t group_interrupt, sl_si91x_gpio_wakeup_t flags)

Configure the group interrupt as a wake-up source across sleep wakeups.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]port

- The port to associate with the pin. HP instance - PORT A,B,C,D ULP instance - ULP PORT

sl_si91x_group_interrupt_t[in]group_interrupt

- Group interrupt number of type sl_si91x_group_interrupt_t (GPIO group interrupts).

sl_si91x_gpio_wakeup_t[in]flags

- GPIO group interrupt wake up flag of type sl_si91x_gpio_wakeup_t (GPIO group interrupt wakeup flag).

  • '1' - enable

  • '0' - disable

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_configure_group_interrupt#

sl_status_t sl_si91x_gpio_driver_configure_group_interrupt (sl_si91x_gpio_group_interrupt_config_t * configuration, sl_gpio_irq_callback_t gpio_callback)

Configure the MCU HP instance group interrupts with trigger type (level/edge), polarity (high/low), interrupt type (and/or) and register the callback function for interrupts.

Parameters
TypeDirectionArgument NameDescription
sl_si91x_gpio_group_interrupt_config_t *[in]configuration

- configuration pointer to sl_si91x_gpio_group_interrupt_config_t structure

sl_gpio_irq_callback_t[in]gpio_callback

- IRQ function pointer

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_NULL_POINTER - The parameter is a null pointer.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_get_group_interrupt_polarity#

uint8_t sl_si91x_gpio_driver_get_group_interrupt_polarity (sl_si91x_group_interrupt_t group_interrupt, uint8_t port, uint8_t pin)

Get the configured polarity of group interrupt.

Parameters
TypeDirectionArgument NameDescription
sl_si91x_group_interrupt_t[in]group_interrupt

- GPIO group interrupt number of type sl_si91x_group_interrupt_t (GPIO group interrupts).

uint8_t[in]port

- The port to associate with the pin. HP instance - PORT A,B,C,D ULP instance - ULP PORT

uint8_t[in]pin

- The pin number on the port. HP instance has total 57 GPIO pins. Port 0, 1, 2 has 16 pins each. Port 3 has 9 pins. ULP instance has total 12 pins.

Returns

  • Returns group interrupt polarity:

    • 1, when GPIO pin status is HIGH

    • 0, when GPIO pin status is LOW


sl_si91x_gpio_driver_set_group_interrupt_polarity#

sl_status_t sl_si91x_gpio_driver_set_group_interrupt_polarity (sl_si91x_group_interrupt_t group_interrupt, uint8_t port, uint8_t pin, sl_si91x_gpio_polarity_t polarity)

Configure the polarity to a selected group interrupt which decides the active value of the pin to be considered for group interrupt generation.

Parameters
TypeDirectionArgument NameDescription
sl_si91x_group_interrupt_t[in]group_interrupt

- GPIO group interrupt number of type sl_si91x_group_interrupt_t (GPIO group interrupts).

uint8_t[in]port

- The port to associate with the pin. HP instance - PORT A,B,C,D ULP instance - ULP PORT

uint8_t[in]pin

- The pin number on the port. HP instance has total 57 GPIO pins. Port A, B, C has 16 pins each. Port D has 9 pins. ULP instance has total 12 pins.

sl_si91x_gpio_polarity_t[in]polarity

- polarity of GPIO group interrupt of type sl_si91x_gpio_polarity_t (GPIO polarity enum)

  • 1, group interrupt gets generated when GPIO pin status is '1'

  • 0, group interrupt gets generated when GPIO pin status is '0'

'0' – group interrupt gets generated when gpio input pin status is LOW '1' – group interrupt gets generated when gpio input pin status is HIGH

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_get_group_interrupt_level_edge#

uint8_t sl_si91x_gpio_driver_get_group_interrupt_level_edge (uint8_t port, sl_si91x_group_interrupt_t group_interrupt)

Get the configured level/edge event for the selected group interrupt.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]port

- The port to associate with the pin. HP instance - PORT A,B,C,D ULP instance - ULP PORT

sl_si91x_group_interrupt_t[in]group_interrupt

- GPIO group interrupt number of type sl_si91x_group_interrupt_t (GPIO group interrupts).

Returns

  • Returns group interrupt level_edge:

    • 1, for Edge

    • 0, for Level


sl_si91x_gpio_driver_set_group_interrupt_level_edge#

sl_status_t sl_si91x_gpio_driver_set_group_interrupt_level_edge (uint8_t port, sl_si91x_group_interrupt_t group_interrupt, sl_si91x_gpio_level_edge_t level_edge)

Set the level/edge event for the selected group interrupt.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]port

- The port to associate with the pin.

  • HP instance - PORT A,B,C,D

  • ULP instance - ULP PORT

sl_si91x_group_interrupt_t[in]group_interrupt

- GPIO group interrupt number of type sl_si91x_group_interrupt_t (GPIO group interrupts).

sl_si91x_gpio_level_edge_t[in]level_edge

- GPIO level edge group interrupt of type sl_si91x_gpio_level_edge_t (GPIO level edge select):

  • 1, for Edge

  • 0, for Level

'1' Triggers interrupt generation when configured edge is detected on pin. '0' Triggers interrupt generation when configured level is detected on pin.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_unmask_group_interrupt#

sl_status_t sl_si91x_gpio_driver_unmask_group_interrupt (uint8_t port, sl_si91x_group_interrupt_t group_interrupt)

Unmask the selected group interrupt to enable interrupt clearing upon generation.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]port

- The port to associate with the pin. HP instance - PORT A,B,C,D ULP instance - ULP PORT

sl_si91x_group_interrupt_t[in]group_interrupt

- GPIO group interrupt number of type sl_si91x_group_interrupt_t (GPIO group interrupts).

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_mask_group_interrupt#

sl_status_t sl_si91x_gpio_driver_mask_group_interrupt (uint8_t port, sl_si91x_group_interrupt_t group_interrupt)

Mask the selected group interrupt.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]port

- The port to associate with the pin.

  • HP instance - PORT A,B,C,D

  • ULP instance - ULP PORT

sl_si91x_group_interrupt_t[in]group_interrupt

- GPIO group interrupt number of type sl_si91x_group_interrupt_t (GPIO group interrupts)

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_disable_clock#

sl_status_t sl_si91x_gpio_driver_disable_clock (sl_si91x_gpio_select_clock_t clock)

Disable the clock for either the HP or ULP instance of the GPIO Peripheral.

Parameters
TypeDirectionArgument NameDescription
sl_si91x_gpio_select_clock_t[in]clock

- Selects M4 clock or ULP clock of type sl_si91x_gpio_select_clock_t (HP/ULP GPIO clock select)

  • 0, for M4 GPIO CLK

  • 1, for ULP GPIO CLK

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_enable_clock#

sl_status_t sl_si91x_gpio_driver_enable_clock (sl_si91x_gpio_select_clock_t clock)

Enable the clock for either the HP or ULP instance of the GPIO peripheral.

Parameters
TypeDirectionArgument NameDescription
sl_si91x_gpio_select_clock_t[in]clock

- Selects M4 clock or ULP clock of type sl_si91x_gpio_select_clock_t (HP/ULP GPIO clock select):

  • 0, for M4 GPIO CLK

  • 1, for ULP GPIO CLK

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_enable_group_interrupt#

sl_status_t sl_si91x_gpio_driver_enable_group_interrupt (sl_si91x_group_interrupt_t group_interrupt, uint8_t port, uint8_t pin)

Enable the selected group interrupts for either the HP or ULP instance of the GPIO peripheral.

Parameters
TypeDirectionArgument NameDescription
sl_si91x_group_interrupt_t[in]group_interrupt

- GPIO group interrupt number of type sl_si91x_group_interrupt_t (GPIO group interrupts).

uint8_t[in]port

- The port to associate with the pin.

  • HP instance - PORT A,B,C,D

  • ULP instance - ULP PORT

uint8_t[in]pin

- The pin number on the port. HP instance has total 57 GPIO pins. Port A, B, C has 16 pins each. Port D has 9 pins. ULP instance has total 12 pins.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.


sl_si91x_gpio_driver_disable_group_interrupt#

sl_status_t sl_si91x_gpio_driver_disable_group_interrupt (sl_si91x_group_interrupt_t group_interrupt, uint8_t port, uint8_t pin)

Disable the selected group interrupts for either the HP or ULP instance of the GPIO peripheral.

Parameters
TypeDirectionArgument NameDescription
sl_si91x_group_interrupt_t[in]group_interrupt

- GPIO group interrupt number of type sl_si91x_group_interrupt_t (GPIO group interrupts)

uint8_t[in]port

- The port to associate with the pin. HP instance - PORT A,B,C,D ULP instance - ULP PORT

uint8_t[in]pin

- The pin number on the port. HP instance has total 57 GPIO pins. Port A, B, C has 16 pins each. Port D has 9 pins. ULP instance has total 12 pins.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_select_ulp_pad_slew_rate#

sl_status_t sl_si91x_gpio_driver_select_ulp_pad_slew_rate (uint8_t gpio_num, sl_si91x_gpio_slew_rate_t slew_rate)

Select the slew rate for the ULP instance of the GPIO peripheral.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]gpio_num

- GPIO pin number to be use.

sl_si91x_gpio_slew_rate_t[in]slew_rate

- Slew rate of type sl_si91x_gpio_slew_rate_t (GPIO slew rate select):

  • '0' - Slow

  • '1' - Fast

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_select_ulp_pad_driver_strength#

sl_status_t sl_si91x_gpio_driver_select_ulp_pad_driver_strength (uint8_t gpio_num, sl_si91x_gpio_driver_strength_select_t strength)

Select the drive strength for the ULP instance of the GPIO peripheral.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]gpio_num

- GPIO pin number to be use.

sl_si91x_gpio_driver_strength_select_t[in]strength

- Drive strength selector(E1,E2) of type sl_si91x_gpio_driver_strength_select_t (GPIO driver strength select):

  • 0, for two_milli_amps (E1=0,E2=0)

  • 1, for four_milli_amps (E1=0,E2=1)

  • 2, for eight_milli_amps (E1=1,E2=0)

  • 3, for twelve_milli_amps(E1=1,E2=1)

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_select_ulp_pad_driver_disable_state#

sl_status_t sl_si91x_gpio_driver_select_ulp_pad_driver_disable_state (uint8_t gpio_num, sl_si91x_gpio_driver_disable_state_t disable_state)

Select the configuration of pull-up, pull-down, or repeater functionality for GPIO pins in the Ultra-Low-Power (ULP) instance.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]gpio_num

- GPIO pin number to be use.

sl_si91x_gpio_driver_disable_state_t[in]disable_state

- Driver disable state of type sl_si91x_gpio_driver_disable_state_t:

  • 0, for HiZ (P1=0,P2=0)

  • 1, for Pull up (P1=0,P2=1)

  • 2, for Pull down (P1=1,P2=0)

  • 3, for Repeater (P1=1,P2=1)

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_disable_ulp_pad_receiver#

sl_status_t sl_si91x_gpio_driver_disable_ulp_pad_receiver (uint8_t gpio_num)

Disable the receiver enable bit for the ULP instance of the GPIO peripheral.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]gpio_num

- GPIO pin number to be used.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_enable_ulp_pad_receiver#

sl_status_t sl_si91x_gpio_driver_enable_ulp_pad_receiver (uint8_t gpio_num)

Enable the receiver enable bit for the ULP instance of the GPIO peripheral.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]gpio_num

- GPIO pin number to be used.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_configure_ulp_pin_interrupt#

sl_status_t sl_si91x_gpio_driver_configure_ulp_pin_interrupt (uint8_t int_no, sl_si91x_gpio_interrupt_config_flag_t flags, sl_si91x_gpio_pin_ulp_t pin, sl_gpio_irq_callback_t gpio_callback)

Configure the MCU ULP instance pin interrupts with the trigger type (level/edge) and register the callback function for interrupts.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]int_no

- The interrupt number to trigger.

sl_si91x_gpio_interrupt_config_flag_t[in]flags

- Interrupt configuration flags of type sl_si91x_gpio_interrupt_config_flag_t (GPIO Interrupt Configurations).

sl_si91x_gpio_pin_ulp_t[in]pin

- GPIO pin number (0 to 11).

sl_gpio_irq_callback_t[in]gpio_callback

- IRQ function pointer.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER - The parameter is null pointer.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_set_uulp_npss_pin_mux#

sl_status_t sl_si91x_gpio_driver_set_uulp_npss_pin_mux (uint8_t pin, sl_si91x_uulp_npss_mode_t mode)

Set the UULP GPIO pin MUX (mode) to the selected mode.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]pin

- UULP GPIO pin number (0...4) of type sl_si91x_uulp_npss_mode_t (UULP GPIO PIN MUX).

sl_si91x_uulp_npss_mode_t[in]mode

- UULP GPIO MUX value (0 to 10).

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_select_uulp_npss_receiver#

sl_status_t sl_si91x_gpio_driver_select_uulp_npss_receiver (uint8_t pin, sl_si91x_gpio_receiver_t receiver)

Enable/disable the UULP GPIO Input Buffer.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]pin

- UULP GPIO pin number (0...4).

sl_si91x_gpio_receiver_t[in]receiver

- Enable/disable UULP GPIO receiver of type sl_si91x_gpio_receiver_t (UULP GPIO input buffer).

  • '1' - Enable

  • '0' - Disable

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_set_uulp_npss_direction#

sl_status_t sl_si91x_gpio_driver_set_uulp_npss_direction (uint8_t pin, sl_si91x_gpio_direction_t direction)

Set the direction for the selected UULP GPIO.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]pin

- UULP GPIO pin number (0...4).

sl_si91x_gpio_direction_t[in]direction

- Direction value (Input / Output) of type sl_si91x_gpio_direction_t (Direction of the GPIO pin enum):

  • '1' - Input Direction

  • '0' - Output Direction

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_get_uulp_npss_direction#

uint8_t sl_si91x_gpio_driver_get_uulp_npss_direction (uint8_t pin)

Get the direction of the selected UULP GPIO.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]pin

- UULP GPIO pin number (0...4).

Returns

  • Returns the GPIO pin direction:

    • 1, Input Direction

    • 0, Output Direction


sl_si91x_gpio_driver_set_uulp_npss_pin_value#

sl_status_t sl_si91x_gpio_driver_set_uulp_npss_pin_value (uint8_t pin, sl_si91x_gpio_pin_value_t pin_value)

Control(set or clear) the UULP GPIO pin value.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]pin

- UULP GPIO pin number (0...4) of type sl_si91x_gpio_pin_value_t (GPIO pin set/clear).

sl_si91x_gpio_pin_value_t[in]pin_value

- UULP GPIO pin value:

  • '0' - Output

  • '1' - Input

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_get_uulp_npss_pin#

uint8_t sl_si91x_gpio_driver_get_uulp_npss_pin (uint8_t pin)

Read the status of the selected UULP GPIO pin value.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]pin

- UULP GPIO pin number (0...4).

Returns

  • Returns the pin logical state of pin:

    • '0' - Output

    • '1' - Input


sl_si91x_gpio_driver_select_uulp_npss_polarity#

sl_status_t sl_si91x_gpio_driver_select_uulp_npss_polarity (uint8_t pin, sl_si91x_gpio_polarity_t polarity)

Select the UULP GPIO polarity for generating the interrupt.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]pin

- UULP GPIO pin number (0...4).

sl_si91x_gpio_polarity_t[in]polarity

- GPIO polarity sl_si91x_gpio_polarity_t (GPIO polarity enum):

  • '1' - High

  • '0' - Low

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_set_uulp_npss_wakeup_interrupt#

sl_status_t sl_si91x_gpio_driver_set_uulp_npss_wakeup_interrupt (uint8_t npssgpio_interrupt)

Set the UULP GPIO interrupt as a wake-up source across sleep wakeups.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]npssgpio_interrupt

- Interrupt number of the UULP GPIO interrupt to be set. sl_si91x_uulp_gpio_interrupt_t

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_clear_uulp_npss_wakeup_interrupt#

sl_status_t sl_si91x_gpio_driver_clear_uulp_npss_wakeup_interrupt (uint8_t npssgpio_interrupt)

Clear the UULP UULP GPIO Interrupt as a wake up source.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]npssgpio_interrupt

- Interrupt number of the UULP GPIO interrupt to be cleared. sl_si91x_uulp_gpio_interrupt_t

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_mask_uulp_npss_interrupt#

sl_status_t sl_si91x_gpio_driver_mask_uulp_npss_interrupt (uint8_t npssgpio_interrupt)

Mask the selected UULP GPIO interrupt.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]npssgpio_interrupt

- Bit position of the UULP GPIO interrupt to be masked. sl_si91x_uulp_gpio_interrupt_bit_t

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

Note

  • This function is deprecated and should be replaced with sl_si91x_gpio_driver_mask_set_uulp_npss_interrupt.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_unmask_uulp_npss_interrupt#

sl_status_t sl_si91x_gpio_driver_unmask_uulp_npss_interrupt (uint8_t npssgpio_interrupt)

Unmask the selected UULP GPIO interrupt.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]npssgpio_interrupt

- Bit position of the UULP GPIO interrupt to be unmasked. sl_si91x_uulp_gpio_interrupt_bit_t

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

Note

  • This function is deprecated and should be replaced with sl_si91x_gpio_driver_mask_clear_uulp_npss_interrupt.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_clear_uulp_interrupt#

sl_status_t sl_si91x_gpio_driver_clear_uulp_interrupt (uint8_t npssgpio_interrupt)

Clear the selected UULP GPIO interrupt.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]npssgpio_interrupt

- Bit position of the UULP GPIO interrupt to be cleared. sl_si91x_uulp_gpio_interrupt_bit_t

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

Note

  • This function is deprecated and should be replaced with sl_si91x_gpio_driver_clear_uulp_npss_interrupt.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_mask_set_uulp_npss_interrupt#

sl_status_t sl_si91x_gpio_driver_mask_set_uulp_npss_interrupt (uint8_t npssgpio_interrupt)

Mask the selected UULP GPIO interrupt.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]npssgpio_interrupt

- UULP GPIO pin number (0 to 4) to be masked sl_si91x_uulp_gpio_interrupt_t

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_mask_clear_uulp_npss_interrupt#

sl_status_t sl_si91x_gpio_driver_mask_clear_uulp_npss_interrupt (uint8_t npssgpio_interrupt)

Unmask the selected UULP GPIO interrupt.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]npssgpio_interrupt

- UULP GPIO pin number (0 to 4) to be unmasked sl_si91x_uulp_gpio_interrupt_t

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_clear_uulp_npss_interrupt#

sl_status_t sl_si91x_gpio_driver_clear_uulp_npss_interrupt (uint8_t npssgpio_interrupt)

Clear the selected UULP GPIO interrupt.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]npssgpio_interrupt

- UULP GPIO pin number (0 to 4) to be cleared sl_si91x_uulp_gpio_interrupt_t

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_get_uulp_interrupt_status#

uint8_t sl_si91x_gpio_driver_get_uulp_interrupt_status (void )

Get the current status of all the UULP GPIO interrupt status.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Returns

  • Returns the UULP INTR status:

    • 1, interrupt has been raised.

    • 0, interrupt is masked or not raised.


sl_si91x_gpio_driver_get_ulp_interrupt_status#

uint32_t sl_si91x_gpio_driver_get_ulp_interrupt_status (uint32_t flags)

Get the selected ULP instance GPIO pin interrupt status.

Parameters
TypeDirectionArgument NameDescription
uint32_t[in]flags

- ULP GPIO interrupt sources status.

Returns

  • Returns the ULP INTR status: 1, interrupt has been raised 0, interrupt is masked or not raised


sl_si91x_gpio_driver_clear_ulp_interrupt#

sl_status_t sl_si91x_gpio_driver_clear_ulp_interrupt (uint32_t flags)

Clear the selected ULP instance GPIO pin interrupts.

Parameters
TypeDirectionArgument NameDescription
uint32_t[in]flags

- ULP GPIO interrupt sources to clear.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_clear_ulp_group_interrupt#

sl_status_t sl_si91x_gpio_driver_clear_ulp_group_interrupt (sl_si91x_group_interrupt_t group_interrupt)

Clear the selected ULP instance group interrupt.

Parameters
TypeDirectionArgument NameDescription
sl_si91x_group_interrupt_t[in]group_interrupt

- Group interrupt number of type sl_si91x_group_interrupt_t (GPIO group interrupts).

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_configure_uulp_interrupt#

sl_status_t sl_si91x_gpio_driver_configure_uulp_interrupt (sl_si91x_gpio_interrupt_config_flag_t flags, uint8_t npssgpio_interrupt, sl_gpio_irq_callback_t gpio_callback)

Configure the UULP GPIO pin interrupt with interrupt type level or edge and registers callback function for interrupts.

Parameters
TypeDirectionArgument NameDescription
sl_si91x_gpio_interrupt_config_flag_t[in]flags

- Interrupt configuration flags of type sl_si91x_gpio_interrupt_config_flag_t (GPIO Interrupt Configurations structure).

uint8_t[in]npssgpio_interrupt

- Interrupt number of the UULP GPIO interrupt to be configured. sl_si91x_uulp_gpio_interrupt_t

sl_gpio_irq_callback_t[in]gpio_callback

- IRQ function pointer.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

    • SL_STATUS_NULL_POINTER - The parameter is null pointer.

For more information on status codes, refer to SL STATUS DOCUMENTATION. Note

  • : The UULP GPIO interrupt pin number is transformed into a bit mask by shifting a single bit to the left by the specified pin number.


sl_si91x_gpio_driver_configure_ulp_group_interrupt#

sl_status_t sl_si91x_gpio_driver_configure_ulp_group_interrupt (sl_si91x_gpio_group_interrupt_config_t * configuration, sl_gpio_irq_callback_t gpio_callback)

Configure the MCU ULP instance group interrupts with trigger type (level/edge), polarity (high/low), interrupt type (and/or) and register the callback function for interrupts.

Parameters
TypeDirectionArgument NameDescription
sl_si91x_gpio_group_interrupt_config_t *[in]configuration

- Configuration pointer to sl_si91x_gpio_group_interrupt_config_t structure.

sl_gpio_irq_callback_t[in]gpio_callback

- IRQ function pointer.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_NULL_POINTER - The parameter is a null pointer.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_toggle_uulp_npss_pin#

sl_status_t sl_si91x_gpio_driver_toggle_uulp_npss_pin (uint8_t pin)

Toggle the selected UULP pin status.

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]pin

- UULP pin number to toggle

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_INVALID_PARAMETER - The parameter is an invalid argument.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_set_uulp_pad_configuration#

sl_status_t sl_si91x_gpio_driver_set_uulp_pad_configuration (uulp_pad_config_t * pad_config)

Configure the UULP GPIO pin mode, receiver enable, direction and polarity settings.

Parameters
TypeDirectionArgument NameDescription
uulp_pad_config_t *[in]pad_config

: PAD configuration pointer to uulp_pad_config_t structure

Returns

  • Status code indicating the result:

    • SL_STATUS_OK - Success.

    • SL_STATUS_NULL_POINTER - The parameter is a null pointer.

For more information on status codes, refer to SL STATUS DOCUMENTATION.


sl_si91x_gpio_driver_get_version#

sl_si91x_gpio_version_t sl_si91x_gpio_driver_get_version (void )

Get the release, SQA, and development version numbers of the GPIO peripheral.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Returns

  • Returns structure of type sl_si91x_gpio_vversion_t (the structure to hold the versions of peripheral API).


sl_si91x_gpio_driver_set_soc_peri_on_ulp_pin_mode#

sl_status_t sl_si91x_gpio_driver_set_soc_peri_on_ulp_pin_mode (sl_gpio_t * gpio, sl_gpio_mode_t mode)

To configure ULP GPIOs in SOC (HP) Mode.

Parameters
TypeDirectionArgument NameDescription
sl_gpio_t *[in]gpio

- Pointer to the GPIO structure representing the pin. This structure contains the necessary information to identify the pin. User has to pass SL_GPIO_ULP_PORT and pin range between (0-11). It converts the corresponding SOC GPIO on the ULP Pin

sl_gpio_mode_t[in]mode

- The mode to set for the GPIO pin. This parameter is of type sl_gpio_mode_t, which defines the possible modes a GPIO pin can be configured to.

  • For ULP GPIOs in SOC (HP) Mode, provide the ULP GPIOs and the desired pin mode for the SOC (HP) pin. The corresponding HP GPIO will be configured.

Returns

  • Status code indicating the result of the operation:

    • SL_STATUS_OK: The operation was successful.

    • SL_STATUS_INVALID_PARAMETER: One or more parameters are invalid.


sl_si91x_gpio_driver_set_ulp_peri_on_soc_pin_mode#

sl_status_t sl_si91x_gpio_driver_set_ulp_peri_on_soc_pin_mode (sl_gpio_t * gpio, sl_gpio_mode_t mode)

To configure SOC (HP) GPIOs in ULP Mode.

Parameters
TypeDirectionArgument NameDescription
sl_gpio_t *[in]gpio

- Pointer to the GPIO structure representing the pin. This structure contains the necessary information to identify the pin. User has to pass SL_GPIO_PORT_A and pin number less than 57. It converts the corresponding ULP_GPIO on the SOC Pin.

sl_gpio_mode_t[in]mode

- The mode to set for the GPIO pin. This parameter is of type sl_gpio_mode_t, which defines the possible modes a GPIO pin can be configured to.

  • For SOC (HP) GPIOs in ULP Mode, provide the HP GPIOs and the desired pin mode for the ULP pin. The corresponding ULP GPIO will be configured.

Returns

  • Status code indicating the result of the operation:

    • SL_STATUS_OK: The operation was successful.

    • SL_STATUS_INVALID_PARAMETER: One or more parameters are invalid.