BSB Developer Docs
Loading...
Searching...
No Matches
furi_hal_gpio.h File Reference

GPIO HAL library for Si917. More...

#include <furi.h>

Go to the source code of this file.

Data Structures

struct  GpioPin
 Gpio structure. More...
 

Typedefs

typedef void(* GpioExtiCallback) (void *ctx)
 Interrupt callback prototype.
 

Enumerations

enum  GpioMode { GpioModeInput , GpioModeOutputPushPull , GpioModeOutputOpenDrain }
 Gpio modes.
 
enum  GpioPull { GpioPullNo , GpioPullUp , GpioPullDown }
 Gpio pull modes.
 
enum  GpioSpeed { GpioSpeedLow , GpioSpeedHigh }
 Gpio speed modes.
 
enum  GpioAltFn {
  GpioAltFnUnused = 0 , GpioAltFn1 = 1 , GpioAltFn2USART0_CLK = 2 , GpioAltFn2USART0_RTS = 2 ,
  GpioAltFn2USART0_TX = 2 , GpioAltFn2USART0_RX = 2 , GpioAltFn2USART0_CTS = 2 , GpioAltFn3ULP_UART_RX = 3 ,
  GpioAltFn3ULP_UART_TX = 3 , GpioAltFn3QEI_PHA = 3 , GpioAltFn3QEI_PHB = 3 , GpioAltFn4 = 4 ,
  GpioAltFn5 = 5 , GpioAltFn6SOCPERH_ON_ULP_GPIO_8 = 6 , GpioAltFn6SOCPERH_ON_ULP_GPIO_9 = 6 , GpioAltFn6SOCPERH_ON_ULP_GPIO_10 = 6 ,
  GpioAltFn6SOCPERH_ON_ULP_GPIO_11 = 6 , GpioAltFn6UART1_RX = 6 , GpioAltFn7 = 7 , GpioAltFn8 = 8 ,
  GpioAltFn9ULPPERH_ON_SOC_GPIO_2 = 9 , GpioAltFn9ULPPERH_ON_SOC_GPIO_3 = 9 , GpioAltFn9UART1_TX = 9 , GpioAltFn10 = 10 ,
  GpioAltFn10PWM_0H = 10 , GpioAltFn10PWM_2H = 10 , GpioAltFn10PWM_3H = 10 , GpioAltFn11 = 11 ,
  GpioAltFn12 = 12 , GpioAltFn13 = 13 , GpioAltFn14 = 14 , GpioAltFn15 = 15
}
 Gpio alternate functions. More...
 
enum  GpioType { GpioTypeHp , GpioTypeUlp , GpioTypeUulp }
 
enum  GpioCondition { GpioConditionRise , GpioConditionFall , GpioConditionRiseFall }
 

Functions

void furi_hal_gpio_init_simple (const GpioPin *gpio, const GpioMode mode)
 GPIO initialization function, simple version.
 
void furi_hal_gpio_init (const GpioPin *gpio, const GpioMode mode, const GpioPull pull, const GpioSpeed speed)
 GPIO initialization function, normal version.
 
void furi_hal_gpio_init_ex (const GpioPin *gpio, const GpioMode mode, const GpioPull pull, const GpioSpeed speed, const GpioAltFn alt_fn)
 GPIO initialization function, extended version.
 
void furi_hal_gpio_enable_ulp_on_hp (const GpioPin *ulp_gpio, const GpioAltFn alt_fn)
 Enable ULP to HP GPIO multiplexer.
 
void furi_hal_gpio_add_int_callback (const GpioPin *gpio, const GpioCondition cond, GpioExtiCallback cb, void *ctx)
 Add and enable interrupt.
 
void furi_hal_gpio_enable_int_callback (const GpioPin *gpio)
 Enable interrupt.
 
void furi_hal_gpio_disable_int_callback (const GpioPin *gpio)
 Disable interrupt.
 
void furi_hal_gpio_remove_int_callback (const GpioPin *gpio)
 Remove interrupt.
 
void furi_hal_gpio_write (const GpioPin *gpio, const bool state)
 GPIO write pin.
 
void furi_hal_gpio_write_open_drain (const GpioPin *gpio, const bool state)
 GPIO write pin, open drain mode.
 
bool furi_hal_gpio_read (const GpioPin *gpio)
 GPIO read pin.
 

Detailed Description

GPIO HAL library for Si917.

Note
If a pin is configured as open drain output, use furi_hal_gpio_write_open_drain() instead of furi_hal_gpio_write()

Enumeration Type Documentation

◆ GpioAltFn

enum GpioAltFn

Gpio alternate functions.

Enumerator
GpioAltFn2USART0_CLK 

USART0_CLK on GPIO_52.

GpioAltFn2USART0_TX 

USART0_RTS on GPIO_53.

USART0_TX on GPIO_54

GpioAltFn2USART0_RX 

USART0_RX on GPIO_55.

GpioAltFn3ULP_UART_RX 

USART0_CTS on GPIO_56.

ULP_UART_RX on ULP_GPIO_2

GpioAltFn3ULP_UART_TX 

ULP_UART_TX on ULP_GPIO_3 (via mux only)

GpioAltFn3QEI_PHA 

QEI via SOCPERH_ON_ULP_GPIO_9.

GpioAltFn3QEI_PHB 

QEI via SOCPERH_ON_ULP_GPIO_10.

GpioAltFn6SOCPERH_ON_ULP_GPIO_8 

Multiplexed HP Peripheral on ULP_GPIO_8.

GpioAltFn6SOCPERH_ON_ULP_GPIO_9 

Multiplexed HP Peripheral on ULP_GPIO_9.

GpioAltFn6SOCPERH_ON_ULP_GPIO_10 

Multiplexed HP Peripheral on ULP_GPIO_10.

GpioAltFn6SOCPERH_ON_ULP_GPIO_11 

Multiplexed HP Peripheral on ULP_GPIO_11.

GpioAltFn6UART1_RX 

UART1_RX via SOCPERH_ON_ULP_GPIO_8.

GpioAltFn9ULPPERH_ON_SOC_GPIO_2 

Multiplexed ULP Peripheral on GPIO_8.

GpioAltFn9ULPPERH_ON_SOC_GPIO_3 

Multiplexed ULP Peripheral on GPIO_9.

GpioAltFn9UART1_TX 

UART1_TX via SOCPERH_ON_ULP_GPIO_11.

GpioAltFn10PWM_0H 

PWM_0H on GPIO_7.

GpioAltFn10PWM_2H 

PWM_2H on GPIO_11.

GpioAltFn10PWM_3H 

PWM_3H on GPIO_15.

Function Documentation

◆ furi_hal_gpio_add_int_callback()

void furi_hal_gpio_add_int_callback ( const GpioPin * gpio,
const GpioCondition cond,
GpioExtiCallback cb,
void * ctx )

Add and enable interrupt.

Parameters
gpioGpioPin
condGpioCondition for triggering the interrupt
cbGpioExtiCallback
ctxcontext for callback

◆ furi_hal_gpio_disable_int_callback()

void furi_hal_gpio_disable_int_callback ( const GpioPin * gpio)

Disable interrupt.

Parameters
gpioGpioPin

◆ furi_hal_gpio_enable_int_callback()

void furi_hal_gpio_enable_int_callback ( const GpioPin * gpio)

Enable interrupt.

Parameters
gpioGpioPin

◆ furi_hal_gpio_enable_ulp_on_hp()

void furi_hal_gpio_enable_ulp_on_hp ( const GpioPin * ulp_gpio,
const GpioAltFn alt_fn )

Enable ULP to HP GPIO multiplexer.

Parameters
ulp_gpioGpioPin (must belong to ULP domain)
alt_fnGpioAltFn

◆ furi_hal_gpio_init()

void furi_hal_gpio_init ( const GpioPin * gpio,
const GpioMode mode,
const GpioPull pull,
const GpioSpeed speed )

GPIO initialization function, normal version.

Parameters
gpioGpioPin
modeGpioMode
pullGpioPull
speedGpioSpeed

◆ furi_hal_gpio_init_ex()

void furi_hal_gpio_init_ex ( const GpioPin * gpio,
const GpioMode mode,
const GpioPull pull,
const GpioSpeed speed,
const GpioAltFn alt_fn )

GPIO initialization function, extended version.

Parameters
gpioGpioPin
modeGpioMode
pullGpioPull
speedGpioSpeed
alt_fnGpioAltFn

◆ furi_hal_gpio_init_simple()

void furi_hal_gpio_init_simple ( const GpioPin * gpio,
const GpioMode mode )

GPIO initialization function, simple version.

Parameters
gpioGpioPin
modeGpioMode

◆ furi_hal_gpio_read()

bool furi_hal_gpio_read ( const GpioPin * gpio)

GPIO read pin.

Parameters
gpioGpioPin
Returns
true / false

◆ furi_hal_gpio_remove_int_callback()

void furi_hal_gpio_remove_int_callback ( const GpioPin * gpio)

Remove interrupt.

Parameters
gpioGpioPin

◆ furi_hal_gpio_write()

void furi_hal_gpio_write ( const GpioPin * gpio,
const bool state )

GPIO write pin.

Parameters
gpioGpioPin
statetrue / false

◆ furi_hal_gpio_write_open_drain()

void furi_hal_gpio_write_open_drain ( const GpioPin * gpio,
const bool state )

GPIO write pin, open drain mode.

Parameters
gpioGpioPin
statetrue / false