caffeine-hal 0.6.6
A Header-Defined Interface c library, it provides the hal layer for the Caffeine framework
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions
cfn_hal_gpio.h File Reference

General Purpose Input/Output (GPIO) HAL API. More...

#include "cfn_hal.h"
#include "cfn_hal_base.h"
#include "cfn_hal_types.h"

Go to the source code of this file.

Data Structures

struct  cfn_hal_gpio_phy_t
 
struct  cfn_hal_gpio_pin_config_t
 
struct  cfn_hal_gpio_pin_handle_t
 Lightweight handle to a specific GPIO pin. Used by other peripherals to reference physical pins. More...
 
struct  cfn_hal_gpio_api_s
 GPIO Virtual Method Table (VMT). More...
 

Macros

#define CFN_HAL_GPIO_PIN_0   CFN_HAL_BIT(0)
 
#define CFN_HAL_GPIO_PIN_1   CFN_HAL_BIT(1)
 
#define CFN_HAL_GPIO_PIN_2   CFN_HAL_BIT(2)
 
#define CFN_HAL_GPIO_PIN_3   CFN_HAL_BIT(3)
 
#define CFN_HAL_GPIO_PIN_4   CFN_HAL_BIT(4)
 
#define CFN_HAL_GPIO_PIN_5   CFN_HAL_BIT(5)
 
#define CFN_HAL_GPIO_PIN_6   CFN_HAL_BIT(6)
 
#define CFN_HAL_GPIO_PIN_7   CFN_HAL_BIT(7)
 
#define CFN_HAL_GPIO_PIN_8   CFN_HAL_BIT(8)
 
#define CFN_HAL_GPIO_PIN_9   CFN_HAL_BIT(9)
 
#define CFN_HAL_GPIO_PIN_10   CFN_HAL_BIT(10)
 
#define CFN_HAL_GPIO_PIN_11   CFN_HAL_BIT(11)
 
#define CFN_HAL_GPIO_PIN_12   CFN_HAL_BIT(12)
 
#define CFN_HAL_GPIO_PIN_13   CFN_HAL_BIT(13)
 
#define CFN_HAL_GPIO_PIN_14   CFN_HAL_BIT(14)
 
#define CFN_HAL_GPIO_PIN_15   CFN_HAL_BIT(15)
 
#define CFN_HAL_GPIO_PIN_16   CFN_HAL_BIT(16)
 
#define CFN_HAL_GPIO_PIN_17   CFN_HAL_BIT(17)
 
#define CFN_HAL_GPIO_PIN_18   CFN_HAL_BIT(18)
 
#define CFN_HAL_GPIO_PIN_19   CFN_HAL_BIT(19)
 
#define CFN_HAL_GPIO_PIN_20   CFN_HAL_BIT(20)
 
#define CFN_HAL_GPIO_PIN_21   CFN_HAL_BIT(21)
 
#define CFN_HAL_GPIO_PIN_22   CFN_HAL_BIT(22)
 
#define CFN_HAL_GPIO_PIN_23   CFN_HAL_BIT(23)
 
#define CFN_HAL_GPIO_PIN_24   CFN_HAL_BIT(24)
 
#define CFN_HAL_GPIO_PIN_25   CFN_HAL_BIT(25)
 
#define CFN_HAL_GPIO_PIN_26   CFN_HAL_BIT(26)
 
#define CFN_HAL_GPIO_PIN_27   CFN_HAL_BIT(27)
 
#define CFN_HAL_GPIO_PIN_28   CFN_HAL_BIT(28)
 
#define CFN_HAL_GPIO_PIN_29   CFN_HAL_BIT(29)
 
#define CFN_HAL_GPIO_PIN_30   CFN_HAL_BIT(30)
 
#define CFN_HAL_GPIO_PIN_31   CFN_HAL_BIT(31)
 

Typedefs

typedef uint32_t cfn_hal_gpio_pin_t
 
typedef struct cfn_hal_gpio_s cfn_hal_gpio_t
 
typedef struct cfn_hal_gpio_api_s cfn_hal_gpio_api_t
 
typedef void(* cfn_hal_gpio_callback_t) (cfn_hal_gpio_t *port, uint32_t event_mask, uint32_t error_mask, void *user_arg)
 GPIO callback signature.
 

Enumerations

enum  cfn_hal_gpio_event_t { CFN_HAL_GPIO_EVENT_NONE = 0 , CFN_HAL_GPIO_EVENT_RISING = CFN_HAL_BIT(0) , CFN_HAL_GPIO_EVENT_FALLING = CFN_HAL_BIT(1) }
 GPIO nominal event flags. More...
 
enum  cfn_hal_gpio_error_t { CFN_HAL_GPIO_ERROR_NONE = 0 , CFN_HAL_GPIO_ERROR_GENERAL = CFN_HAL_BIT(0) }
 GPIO exception error flags. More...
 
enum  cfn_hal_gpio_state_t { CFN_HAL_GPIO_STATE_LOW = 0 , CFN_HAL_GPIO_STATE_HIGH , CFN_HAL_GPIO_STATE_MAX }
 
enum  cfn_hal_gpio_config_mode_t {
  CFN_HAL_GPIO_CONFIG_MODE_ANALOG , CFN_HAL_GPIO_CONFIG_MODE_INPUT , CFN_HAL_GPIO_CONFIG_MODE_OUTPUT_PP , CFN_HAL_GPIO_CONFIG_MODE_OUTPUT_OD ,
  CFN_HAL_GPIO_CONFIG_MODE_ALTERNATE_PP , CFN_HAL_GPIO_CONFIG_MODE_ALTERNATE_OD , CFN_HAL_GPIO_CONFIG_MODE_MAX
}
 
enum  cfn_hal_gpio_config_pull_t { CFN_HAL_GPIO_CONFIG_PULL_NOPULL , CFN_HAL_GPIO_CONFIG_PULL_PULLUP , CFN_HAL_GPIO_CONFIG_PULL_PULLDOWN , CFN_HAL_GPIO_CONFIG_PULL_MAX }
 
enum  cfn_hal_gpio_config_speed_t {
  CFN_HAL_GPIO_CONFIG_SPEED_LOW , CFN_HAL_GPIO_CONFIG_SPEED_MEDIUM , CFN_HAL_GPIO_CONFIG_SPEED_HIGH , CFN_HAL_GPIO_CONFIG_SPEED_VERY_HIGH ,
  CFN_HAL_GPIO_CONFIG_SPEED_MAX
}
 
enum  cfn_hal_gpio_config_strength_t { CFN_HAL_GPIO_CONFIG_STRENGTH_LOW , CFN_HAL_GPIO_CONFIG_STRENGTH_MEDIUM , CFN_HAL_GPIO_CONFIG_STRENGTH_HIGH , CFN_HAL_GPIO_CONFIG_STRENGTH_MAX }
 

Functions

 CFN_HAL_VMT_CHECK (struct cfn_hal_gpio_api_s)
 
 CFN_HAL_CREATE_DRIVER_TYPE (gpio, void, cfn_hal_gpio_api_t, cfn_hal_gpio_phy_t, cfn_hal_gpio_callback_t)
 
CFN_HAL_INLINE void cfn_hal_gpio_populate (cfn_hal_gpio_t *driver, uint32_t peripheral_id, struct cfn_hal_clock_s *clock, void *dependency, const cfn_hal_gpio_api_t *api, const cfn_hal_gpio_phy_t *phy, cfn_hal_gpio_callback_t callback, void *user_arg)
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_pin_config_validate (const cfn_hal_gpio_t *driver, const cfn_hal_gpio_pin_config_t *pin_cfg)
 Validates the GPIO pin configuration.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_init (cfn_hal_gpio_t *driver)
 Initializes the GPIO driver.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_deinit (cfn_hal_gpio_t *driver)
 Deinitializes the GPIO driver.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_callback_register (cfn_hal_gpio_t *driver, const cfn_hal_gpio_callback_t callback, void *user_arg)
 Registers a callback for GPIO events and errors.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_power_state_set (cfn_hal_gpio_t *driver, cfn_hal_power_state_t state)
 Sets the GPIO power state.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_event_enable (cfn_hal_gpio_t *driver, uint32_t event_mask)
 Enables one or more GPIO nominal events.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_event_disable (cfn_hal_gpio_t *driver, uint32_t event_mask)
 Disables one or more GPIO nominal events.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_event_get (cfn_hal_gpio_t *driver, uint32_t *event_mask)
 Retrieves the current GPIO nominal event status.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_error_enable (cfn_hal_gpio_t *driver, uint32_t error_mask)
 Enables one or more GPIO exception errors.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_error_disable (cfn_hal_gpio_t *driver, uint32_t error_mask)
 Disables one or more GPIO exception errors.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_error_get (cfn_hal_gpio_t *driver, uint32_t *error_mask)
 Retrieves the current GPIO exception error status.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_pin_config (cfn_hal_gpio_t *port, const cfn_hal_gpio_pin_config_t *pin_cfg)
 Configures specific pins on the port using a payload structure.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_pin_read (cfn_hal_gpio_t *port, cfn_hal_gpio_pin_t pin, cfn_hal_gpio_state_t *state)
 Reads the logical state of a single GPIO pin.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_pin_write (cfn_hal_gpio_t *port, cfn_hal_gpio_pin_t pin, cfn_hal_gpio_state_t state)
 Writes a logical state to a single GPIO pin.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_pin_toggle (cfn_hal_gpio_t *port, cfn_hal_gpio_pin_t pin)
 Toggles the logical state of a single GPIO pin.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_port_read (cfn_hal_gpio_t *port, uint32_t *port_value)
 Reads the 32-bit raw value of the entire GPIO port.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_port_write (cfn_hal_gpio_t *port, uint32_t pin_mask, uint32_t port_value)
 Atomically writes to multiple pins on the port using a mask.
 
cfn_hal_error_code_t cfn_hal_gpio_construct (cfn_hal_gpio_t *driver, const cfn_hal_gpio_phy_t *phy, struct cfn_hal_clock_s *clock, void *dependency, cfn_hal_gpio_callback_t callback, void *user_arg)
 
cfn_hal_error_code_t cfn_hal_gpio_destruct (cfn_hal_gpio_t *driver)
 

Detailed Description

General Purpose Input/Output (GPIO) HAL API.

Copyright (c) 2026 Hisham Moussa Daou https://www.whileone.me

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Macro Definition Documentation

◆ CFN_HAL_GPIO_PIN_0

#define CFN_HAL_GPIO_PIN_0   CFN_HAL_BIT(0)

◆ CFN_HAL_GPIO_PIN_1

#define CFN_HAL_GPIO_PIN_1   CFN_HAL_BIT(1)

◆ CFN_HAL_GPIO_PIN_10

#define CFN_HAL_GPIO_PIN_10   CFN_HAL_BIT(10)

◆ CFN_HAL_GPIO_PIN_11

#define CFN_HAL_GPIO_PIN_11   CFN_HAL_BIT(11)

◆ CFN_HAL_GPIO_PIN_12

#define CFN_HAL_GPIO_PIN_12   CFN_HAL_BIT(12)

◆ CFN_HAL_GPIO_PIN_13

#define CFN_HAL_GPIO_PIN_13   CFN_HAL_BIT(13)

◆ CFN_HAL_GPIO_PIN_14

#define CFN_HAL_GPIO_PIN_14   CFN_HAL_BIT(14)

◆ CFN_HAL_GPIO_PIN_15

#define CFN_HAL_GPIO_PIN_15   CFN_HAL_BIT(15)

◆ CFN_HAL_GPIO_PIN_16

#define CFN_HAL_GPIO_PIN_16   CFN_HAL_BIT(16)

◆ CFN_HAL_GPIO_PIN_17

#define CFN_HAL_GPIO_PIN_17   CFN_HAL_BIT(17)

◆ CFN_HAL_GPIO_PIN_18

#define CFN_HAL_GPIO_PIN_18   CFN_HAL_BIT(18)

◆ CFN_HAL_GPIO_PIN_19

#define CFN_HAL_GPIO_PIN_19   CFN_HAL_BIT(19)

◆ CFN_HAL_GPIO_PIN_2

#define CFN_HAL_GPIO_PIN_2   CFN_HAL_BIT(2)

◆ CFN_HAL_GPIO_PIN_20

#define CFN_HAL_GPIO_PIN_20   CFN_HAL_BIT(20)

◆ CFN_HAL_GPIO_PIN_21

#define CFN_HAL_GPIO_PIN_21   CFN_HAL_BIT(21)

◆ CFN_HAL_GPIO_PIN_22

#define CFN_HAL_GPIO_PIN_22   CFN_HAL_BIT(22)

◆ CFN_HAL_GPIO_PIN_23

#define CFN_HAL_GPIO_PIN_23   CFN_HAL_BIT(23)

◆ CFN_HAL_GPIO_PIN_24

#define CFN_HAL_GPIO_PIN_24   CFN_HAL_BIT(24)

◆ CFN_HAL_GPIO_PIN_25

#define CFN_HAL_GPIO_PIN_25   CFN_HAL_BIT(25)

◆ CFN_HAL_GPIO_PIN_26

#define CFN_HAL_GPIO_PIN_26   CFN_HAL_BIT(26)

◆ CFN_HAL_GPIO_PIN_27

#define CFN_HAL_GPIO_PIN_27   CFN_HAL_BIT(27)

◆ CFN_HAL_GPIO_PIN_28

#define CFN_HAL_GPIO_PIN_28   CFN_HAL_BIT(28)

◆ CFN_HAL_GPIO_PIN_29

#define CFN_HAL_GPIO_PIN_29   CFN_HAL_BIT(29)

◆ CFN_HAL_GPIO_PIN_3

#define CFN_HAL_GPIO_PIN_3   CFN_HAL_BIT(3)

◆ CFN_HAL_GPIO_PIN_30

#define CFN_HAL_GPIO_PIN_30   CFN_HAL_BIT(30)

◆ CFN_HAL_GPIO_PIN_31

#define CFN_HAL_GPIO_PIN_31   CFN_HAL_BIT(31)

◆ CFN_HAL_GPIO_PIN_4

#define CFN_HAL_GPIO_PIN_4   CFN_HAL_BIT(4)

◆ CFN_HAL_GPIO_PIN_5

#define CFN_HAL_GPIO_PIN_5   CFN_HAL_BIT(5)

◆ CFN_HAL_GPIO_PIN_6

#define CFN_HAL_GPIO_PIN_6   CFN_HAL_BIT(6)

◆ CFN_HAL_GPIO_PIN_7

#define CFN_HAL_GPIO_PIN_7   CFN_HAL_BIT(7)

◆ CFN_HAL_GPIO_PIN_8

#define CFN_HAL_GPIO_PIN_8   CFN_HAL_BIT(8)

◆ CFN_HAL_GPIO_PIN_9

#define CFN_HAL_GPIO_PIN_9   CFN_HAL_BIT(9)

Typedef Documentation

◆ cfn_hal_gpio_api_t

◆ cfn_hal_gpio_callback_t

typedef void(* cfn_hal_gpio_callback_t) (cfn_hal_gpio_t *port, uint32_t event_mask, uint32_t error_mask, void *user_arg)

GPIO callback signature.

Parameters
portPointer to the GPIO port driver instance.
event_maskMask of triggered nominal events.
error_maskMask of triggered exception errors.
user_argUser-defined argument passed during registration.

◆ cfn_hal_gpio_pin_t

typedef uint32_t cfn_hal_gpio_pin_t

◆ cfn_hal_gpio_t

typedef struct cfn_hal_gpio_s cfn_hal_gpio_t

Enumeration Type Documentation

◆ cfn_hal_gpio_config_mode_t

Enumerator
CFN_HAL_GPIO_CONFIG_MODE_ANALOG 
CFN_HAL_GPIO_CONFIG_MODE_INPUT 
CFN_HAL_GPIO_CONFIG_MODE_OUTPUT_PP 
CFN_HAL_GPIO_CONFIG_MODE_OUTPUT_OD 
CFN_HAL_GPIO_CONFIG_MODE_ALTERNATE_PP 
CFN_HAL_GPIO_CONFIG_MODE_ALTERNATE_OD 
CFN_HAL_GPIO_CONFIG_MODE_MAX 

◆ cfn_hal_gpio_config_pull_t

Enumerator
CFN_HAL_GPIO_CONFIG_PULL_NOPULL 
CFN_HAL_GPIO_CONFIG_PULL_PULLUP 
CFN_HAL_GPIO_CONFIG_PULL_PULLDOWN 
CFN_HAL_GPIO_CONFIG_PULL_MAX 

◆ cfn_hal_gpio_config_speed_t

Enumerator
CFN_HAL_GPIO_CONFIG_SPEED_LOW 

GPIO low speed

CFN_HAL_GPIO_CONFIG_SPEED_MEDIUM 

GPIO medium speed

CFN_HAL_GPIO_CONFIG_SPEED_HIGH 

GPIO high speed

CFN_HAL_GPIO_CONFIG_SPEED_VERY_HIGH 

GPIO very high speed

CFN_HAL_GPIO_CONFIG_SPEED_MAX 

◆ cfn_hal_gpio_config_strength_t

Enumerator
CFN_HAL_GPIO_CONFIG_STRENGTH_LOW 

GPIO low strength

CFN_HAL_GPIO_CONFIG_STRENGTH_MEDIUM 

GPIO medium strength

CFN_HAL_GPIO_CONFIG_STRENGTH_HIGH 

GPIO high strength

CFN_HAL_GPIO_CONFIG_STRENGTH_MAX 

◆ cfn_hal_gpio_error_t

GPIO exception error flags.

Enumerator
CFN_HAL_GPIO_ERROR_NONE 
CFN_HAL_GPIO_ERROR_GENERAL 

General GPIO hardware error

◆ cfn_hal_gpio_event_t

GPIO nominal event flags.

Enumerator
CFN_HAL_GPIO_EVENT_NONE 
CFN_HAL_GPIO_EVENT_RISING 

Rising edge detected

CFN_HAL_GPIO_EVENT_FALLING 

Falling edge detected

◆ cfn_hal_gpio_state_t

Enumerator
CFN_HAL_GPIO_STATE_LOW 
CFN_HAL_GPIO_STATE_HIGH 
CFN_HAL_GPIO_STATE_MAX 

Function Documentation

◆ CFN_HAL_CREATE_DRIVER_TYPE()

CFN_HAL_CREATE_DRIVER_TYPE ( gpio  ,
void  ,
cfn_hal_gpio_api_t  ,
cfn_hal_gpio_phy_t  ,
cfn_hal_gpio_callback_t   
)

◆ cfn_hal_gpio_callback_register()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_callback_register ( cfn_hal_gpio_t driver,
const cfn_hal_gpio_callback_t  callback,
void *  user_arg 
)

Registers a callback for GPIO events and errors.

Parameters
driverPointer to the GPIO driver instance.
callbackThe callback function to register.
user_argUser-defined argument passed to the callback.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_gpio_construct()

cfn_hal_error_code_t cfn_hal_gpio_construct ( cfn_hal_gpio_t driver,
const cfn_hal_gpio_phy_t phy,
struct cfn_hal_clock_s *  clock,
void *  dependency,
cfn_hal_gpio_callback_t  callback,
void *  user_arg 
)

◆ cfn_hal_gpio_deinit()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_deinit ( cfn_hal_gpio_t driver)

Deinitializes the GPIO driver.

Parameters
driverPointer to the GPIO driver instance.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_gpio_destruct()

cfn_hal_error_code_t cfn_hal_gpio_destruct ( cfn_hal_gpio_t driver)

◆ cfn_hal_gpio_error_disable()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_error_disable ( cfn_hal_gpio_t driver,
uint32_t  error_mask 
)

Disables one or more GPIO exception errors.

Parameters
driverPointer to the GPIO driver instance.
error_maskMask of errors to disable.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_gpio_error_enable()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_error_enable ( cfn_hal_gpio_t driver,
uint32_t  error_mask 
)

Enables one or more GPIO exception errors.

Parameters
driverPointer to the GPIO driver instance.
error_maskMask of errors to enable.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_gpio_error_get()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_error_get ( cfn_hal_gpio_t driver,
uint32_t *  error_mask 
)

Retrieves the current GPIO exception error status.

Parameters
driverPointer to the GPIO driver instance.
error_mask[out] Pointer to store the error mask.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_gpio_event_disable()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_event_disable ( cfn_hal_gpio_t driver,
uint32_t  event_mask 
)

Disables one or more GPIO nominal events.

Parameters
driverPointer to the GPIO driver instance.
event_maskMask of events to disable.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_gpio_event_enable()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_event_enable ( cfn_hal_gpio_t driver,
uint32_t  event_mask 
)

Enables one or more GPIO nominal events.

Parameters
driverPointer to the GPIO driver instance.
event_maskMask of events to enable.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_gpio_event_get()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_event_get ( cfn_hal_gpio_t driver,
uint32_t *  event_mask 
)

Retrieves the current GPIO nominal event status.

Parameters
driverPointer to the GPIO driver instance.
event_mask[out] Pointer to store the event mask.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_gpio_init()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_init ( cfn_hal_gpio_t driver)

Initializes the GPIO driver.

Parameters
driverPointer to the GPIO driver instance.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_gpio_pin_config()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_pin_config ( cfn_hal_gpio_t port,
const cfn_hal_gpio_pin_config_t pin_cfg 
)

Configures specific pins on the port using a payload structure.

Parameters
portPointer to the GPIO port driver instance.
pin_cfgPointer to the configuration payload containing the pin_mask.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_gpio_pin_config_validate()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_pin_config_validate ( const cfn_hal_gpio_t driver,
const cfn_hal_gpio_pin_config_t pin_cfg 
)

Validates the GPIO pin configuration.

Parameters
driverPointer to the GPIO driver instance.
pin_cfgPointer to the configuration structure.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_gpio_pin_read()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_pin_read ( cfn_hal_gpio_t port,
cfn_hal_gpio_pin_t  pin,
cfn_hal_gpio_state_t state 
)

Reads the logical state of a single GPIO pin.

Parameters
portPointer to the GPIO port driver instance.
pinA single pin identifier (MUST NOT be a bitmask of multiple pins).
state[out] Pointer to store the read state.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_gpio_pin_toggle()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_pin_toggle ( cfn_hal_gpio_t port,
cfn_hal_gpio_pin_t  pin 
)

Toggles the logical state of a single GPIO pin.

Parameters
portPointer to the GPIO port driver instance.
pinA single pin identifier.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_gpio_pin_write()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_pin_write ( cfn_hal_gpio_t port,
cfn_hal_gpio_pin_t  pin,
cfn_hal_gpio_state_t  state 
)

Writes a logical state to a single GPIO pin.

Parameters
portPointer to the GPIO port driver instance.
pinA single pin identifier.
stateThe state value to write.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_gpio_populate()

CFN_HAL_INLINE void cfn_hal_gpio_populate ( cfn_hal_gpio_t driver,
uint32_t  peripheral_id,
struct cfn_hal_clock_s *  clock,
void *  dependency,
const cfn_hal_gpio_api_t api,
const cfn_hal_gpio_phy_t phy,
cfn_hal_gpio_callback_t  callback,
void *  user_arg 
)

◆ cfn_hal_gpio_port_read()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_port_read ( cfn_hal_gpio_t port,
uint32_t *  port_value 
)

Reads the 32-bit raw value of the entire GPIO port.

Parameters
portPointer to the GPIO port driver instance.
port_value[out] Pointer to store the 32-bit port value.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_gpio_port_write()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_port_write ( cfn_hal_gpio_t port,
uint32_t  pin_mask,
uint32_t  port_value 
)

Atomically writes to multiple pins on the port using a mask.

Parameters
portPointer to the GPIO port driver instance.
pin_maskA bitmask of pins to modify.
port_valueThe 32-bit value to apply to the masked pins.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_gpio_power_state_set()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_gpio_power_state_set ( cfn_hal_gpio_t driver,
cfn_hal_power_state_t  state 
)

Sets the GPIO power state.

Parameters
driverPointer to the GPIO driver instance.
stateTarget power state.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ CFN_HAL_VMT_CHECK()

CFN_HAL_VMT_CHECK ( struct cfn_hal_gpio_api_s  )