Solaris Software
Toggle main menu visibility
Loading...
Searching...
No Matches
gpio.h
Go to the documentation of this file.
1
/**
2
* @file gpio.h
3
* @brief SPP GPIO HAL API — dispatches through the registered HAL port.
4
*
5
* Naming conventions used in this file:
6
* - Public functions: SPP_HAL_gpio*()
7
* - Pointer parameters: p_*
8
*/
9
10
#ifndef SPP_HAL_GPIO_H
11
#define SPP_HAL_GPIO_H
12
13
#include "
spp/core/types.h
"
14
#include "
spp/core/returnTypes.h
"
15
16
/* ----------------------------------------------------------------
17
* ISR context
18
* ---------------------------------------------------------------- */
19
20
/**
21
* @brief Context passed to the GPIO ISR handler.
22
*
23
* The ISR sets @c *p_flag to @c SPP_TRUE when the interrupt fires.
24
* The application superloop polls this flag to detect the event.
25
*/
26
typedef
struct
27
{
28
volatile
spp_bool_t
*
p_flag
;
/**< Flag set by the ISR on interrupt. */
29
}
SPP_GpioIsrCtx_t
;
30
31
/* ----------------------------------------------------------------
32
* Public API
33
* ---------------------------------------------------------------- */
34
35
/**
36
* @brief Configure a GPIO pin as an interrupt input.
37
*
38
* @param[in] pin GPIO pin number.
39
* @param[in] intrType Platform-specific interrupt trigger type value.
40
* @param[in] pull Pull resistor: 0 = none, 1 = pull-up, 2 = pull-down.
41
*
42
* @return K_SPP_OK on success.
43
*/
44
SPP_RetVal_t
SPP_HAL_GPIO_configInterrupt
(
spp_uint32_t
pin,
spp_uint32_t
intrType,
45
spp_uint32_t
pull);
46
47
/**
48
* @brief Register an ISR handler for a GPIO pin.
49
*
50
* The ISR sets @c *p_isrCtx->p_flag to @c SPP_TRUE whenever the configured
51
* interrupt fires.
52
*
53
* @param[in] pin GPIO pin number.
54
* @param[in] p_isrCtx Pointer to a @ref SPP_GpioIsrCtx_t for this pin.
55
*
56
* @return K_SPP_OK on success.
57
*/
58
SPP_RetVal_t
SPP_HAL_GPIO_registerIsr
(
spp_uint32_t
pin,
void
*p_isrCtx);
59
60
#endif
/* SPP_HAL_GPIO_H */
SPP_HAL_GPIO_registerIsr
SPP_RetVal_t SPP_HAL_GPIO_registerIsr(spp_uint32_t pin, void *p_isrCtx)
Register an ISR handler for a GPIO pin.
Definition
gpio.c:39
SPP_HAL_GPIO_configInterrupt
SPP_RetVal_t SPP_HAL_GPIO_configInterrupt(spp_uint32_t pin, spp_uint32_t intrType, spp_uint32_t pull)
Configure a GPIO pin as an interrupt input.
Definition
gpio.c:19
returnTypes.h
Standard return-value type used across all SPP modules.
SPP_RetVal_t
SPP_RetVal_t
Unified return type for all SPP API functions.
Definition
returnTypes.h:24
SPP_GpioIsrCtx_t
Context passed to the GPIO ISR handler.
Definition
gpio.h:27
SPP_GpioIsrCtx_t::p_flag
volatile spp_bool_t * p_flag
Definition
gpio.h:28
types.h
Portable integer types and SPI/storage configuration types for SPP.
spp_uint32_t
uint32_t spp_uint32_t
Definition
types.h:31
spp_bool_t
bool spp_bool_t
Definition
types.h:36
solaris-v2
spp
hal
gpio
gpio.h
Generated by
1.18.0