Loading...
Searching...
No Matches
furi_hal_subghz.h File Reference

SubGhz HAL API. More...

#include <lib/subghz/devices/preset.h>
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include <toolbox/level_duration.h>
#include <furi_hal_gpio.h>

Go to the source code of this file.

Macros

#define FURI_HAL_SUBGHZ_ASYNC_TX_BUFFER_FULL   (256u)
 Various subghz defines.
 
#define FURI_HAL_SUBGHZ_ASYNC_TX_BUFFER_HALF   (FURI_HAL_SUBGHZ_ASYNC_TX_BUFFER_FULL / 2)
 
#define FURI_HAL_SUBGHZ_ASYNC_TX_GUARD_TIME   (999u)
 

Typedefs

typedef void(* FuriHalSubGhzCaptureCallback) (bool level, uint32_t duration, void *context)
 Signal Timings Capture callback.
 
typedef LevelDuration(* FuriHalSubGhzAsyncTxCallback) (void *context)
 Async TX callback type.
 

Enumerations

enum  FuriHalSubGhzPath { FuriHalSubGhzPathIsolate , FuriHalSubGhzPath433 , FuriHalSubGhzPath315 , FuriHalSubGhzPath868 }
 Switchable Radio Paths. More...
 

Functions

void furi_hal_subghz_set_async_mirror_pin (const GpioPin *pin)
 
const GpioPinfuri_hal_subghz_get_data_gpio (void)
 Get data GPIO.
 
void furi_hal_subghz_init (void)
 Initialize and switch to power save mode Used by internal API-HAL initialization routine Can be used to reinitialize device to safe state and send it to sleep.
 
void furi_hal_subghz_sleep (void)
 Send device to sleep mode.
 
void furi_hal_subghz_dump_state (void)
 Dump info to stdout.
 
void furi_hal_subghz_load_custom_preset (const uint8_t *preset_data)
 Load custom registers from preset.
 
void furi_hal_subghz_load_registers (const uint8_t *data)
 Load registers.
 
void furi_hal_subghz_load_patable (const uint8_t data[8])
 Load PATABLE.
 
void furi_hal_subghz_write_packet (const uint8_t *data, uint8_t size)
 Write packet to FIFO.
 
bool furi_hal_subghz_rx_pipe_not_empty (void)
 Check if receive pipe is not empty.
 
bool furi_hal_subghz_is_rx_data_crc_valid (void)
 Check if received data crc is valid.
 
void furi_hal_subghz_read_packet (uint8_t *data, uint8_t *size)
 Read packet from FIFO.
 
void furi_hal_subghz_flush_rx (void)
 Flush rx FIFO buffer.
 
void furi_hal_subghz_flush_tx (void)
 Flush tx FIFO buffer.
 
void furi_hal_subghz_shutdown (void)
 Shutdown Issue SPWD command.
 
void furi_hal_subghz_reset (void)
 Reset Issue reset command.
 
void furi_hal_subghz_idle (void)
 Switch to Idle.
 
void furi_hal_subghz_rx (void)
 Switch to Receive.
 
bool furi_hal_subghz_tx (void)
 Switch to Transmit.
 
float furi_hal_subghz_get_rssi (void)
 Get RSSI value in dBm.
 
uint8_t furi_hal_subghz_get_lqi (void)
 Get LQI.
 
bool furi_hal_subghz_is_frequency_valid (uint32_t value)
 Check if frequency is in valid range.
 
uint32_t furi_hal_subghz_set_frequency_and_path (uint32_t value)
 Set frequency and path This function automatically selects antenna matching network.
 
uint32_t furi_hal_subghz_set_frequency (uint32_t value)
 Set frequency.
 
void furi_hal_subghz_set_path (FuriHalSubGhzPath path)
 Set path.
 
void furi_hal_subghz_start_async_rx (FuriHalSubGhzCaptureCallback callback, void *context)
 Enable signal timings capture Initializes GPIO and TIM2 for timings capture.
 
void furi_hal_subghz_stop_async_rx (void)
 Disable signal timings capture Resets GPIO and TIM2.
 
bool furi_hal_subghz_start_async_tx (FuriHalSubGhzAsyncTxCallback callback, void *context)
 Start async TX Initializes GPIO, TIM2 and DMA1 for signal output.
 
bool furi_hal_subghz_is_async_tx_complete (void)
 Wait for async transmission to complete.
 
void furi_hal_subghz_stop_async_tx (void)
 Stop async transmission and cleanup resources Resets GPIO, TIM2, and DMA1.
 

Detailed Description

SubGhz HAL API.

Typedef Documentation

◆ FuriHalSubGhzAsyncTxCallback

typedef LevelDuration(* FuriHalSubGhzAsyncTxCallback) (void *context)

Async TX callback type.

Parameters
contextcallback context
Returns
LevelDuration

Enumeration Type Documentation

◆ FuriHalSubGhzPath

Switchable Radio Paths.

Enumerator
FuriHalSubGhzPathIsolate 

Isolate Radio from antenna.

FuriHalSubGhzPath433 

Center Frequency: 433MHz.

Path 1: SW1RF1-SW2RF2, LCLCL

FuriHalSubGhzPath315 

Center Frequency: 315MHz.

Path 2: SW1RF2-SW2RF1, LCLCLCL

FuriHalSubGhzPath868 

Center Frequency: 868MHz.

Path 3: SW1RF3-SW2RF3, LCLC

Function Documentation

◆ furi_hal_subghz_get_data_gpio()

const GpioPin * furi_hal_subghz_get_data_gpio ( void )

Get data GPIO.

Returns
pointer to the gpio pin structure

◆ furi_hal_subghz_get_lqi()

uint8_t furi_hal_subghz_get_lqi ( void )

Get LQI.

Returns
LQI value

◆ furi_hal_subghz_get_rssi()

float furi_hal_subghz_get_rssi ( void )

Get RSSI value in dBm.

Returns
RSSI value

◆ furi_hal_subghz_is_async_tx_complete()

bool furi_hal_subghz_is_async_tx_complete ( void )

Wait for async transmission to complete.

Returns
true if TX complete

◆ furi_hal_subghz_is_frequency_valid()

bool furi_hal_subghz_is_frequency_valid ( uint32_t value)

Check if frequency is in valid range.

Parameters
valuefrequency in Hz
Returns
true if frequency is valid, otherwise false

◆ furi_hal_subghz_is_rx_data_crc_valid()

bool furi_hal_subghz_is_rx_data_crc_valid ( void )

Check if received data crc is valid.

Returns
true if valid

◆ furi_hal_subghz_load_custom_preset()

void furi_hal_subghz_load_custom_preset ( const uint8_t * preset_data)

Load custom registers from preset.

Parameters
preset_dataregisters to load

◆ furi_hal_subghz_load_patable()

void furi_hal_subghz_load_patable ( const uint8_t data[8])

Load PATABLE.

Parameters
data8 uint8_t values

◆ furi_hal_subghz_load_registers()

void furi_hal_subghz_load_registers ( const uint8_t * data)

Load registers.

Parameters
dataRegisters data

◆ furi_hal_subghz_read_packet()

void furi_hal_subghz_read_packet ( uint8_t * data,
uint8_t * size )

Read packet from FIFO.

Parameters
datapointer
sizesize

◆ furi_hal_subghz_reset()

void furi_hal_subghz_reset ( void )

Reset Issue reset command.

Warning
registers content will be lost

◆ furi_hal_subghz_rx_pipe_not_empty()

bool furi_hal_subghz_rx_pipe_not_empty ( void )

Check if receive pipe is not empty.

Returns
true if not empty

◆ furi_hal_subghz_set_frequency()

uint32_t furi_hal_subghz_set_frequency ( uint32_t value)

Set frequency.

Parameters
valuefrequency in Hz
Returns
real frequency in Hz

◆ furi_hal_subghz_set_frequency_and_path()

uint32_t furi_hal_subghz_set_frequency_and_path ( uint32_t value)

Set frequency and path This function automatically selects antenna matching network.

Parameters
valuefrequency in Hz
Returns
real frequency in Hz

◆ furi_hal_subghz_set_path()

void furi_hal_subghz_set_path ( FuriHalSubGhzPath path)

Set path.

Parameters
pathpath to use

◆ furi_hal_subghz_shutdown()

void furi_hal_subghz_shutdown ( void )

Shutdown Issue SPWD command.

Warning
registers content will be lost

◆ furi_hal_subghz_start_async_rx()

void furi_hal_subghz_start_async_rx ( FuriHalSubGhzCaptureCallback callback,
void * context )

Enable signal timings capture Initializes GPIO and TIM2 for timings capture.

Parameters
callbackFuriHalSubGhzCaptureCallback
contextcallback context

◆ furi_hal_subghz_start_async_tx()

bool furi_hal_subghz_start_async_tx ( FuriHalSubGhzAsyncTxCallback callback,
void * context )

Start async TX Initializes GPIO, TIM2 and DMA1 for signal output.

Parameters
callbackFuriHalSubGhzAsyncTxCallback
contextcallback context
Returns
true if the transfer is allowed by belonging to the region

◆ furi_hal_subghz_tx()

bool furi_hal_subghz_tx ( void )

Switch to Transmit.

Returns
true if the transfer is allowed by belonging to the region

◆ furi_hal_subghz_write_packet()

void furi_hal_subghz_write_packet ( const uint8_t * data,
uint8_t size )

Write packet to FIFO.

Parameters
databytes array
sizesize