Solaris Software
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"
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 */
26typedef struct
27{
28 volatile spp_bool_t *p_flag; /**< Flag set by the ISR on interrupt. */
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 */
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 */
59
60#endif /* SPP_HAL_GPIO_H */
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_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
Standard return-value type used across all SPP modules.
SPP_RetVal_t
Unified return type for all SPP API functions.
Definition returnTypes.h:24
Context passed to the GPIO ISR handler.
Definition gpio.h:27
volatile spp_bool_t * p_flag
Definition gpio.h:28
Portable integer types and SPI/storage configuration types for SPP.
uint32_t spp_uint32_t
Definition types.h:31
bool spp_bool_t
Definition types.h:36