Loading...
Searching...
No Matches
furi_hal_subghz.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <lib/subghz/devices/preset.h>
9
10#include <stdbool.h>
11#include <stdint.h>
12#include <stddef.h>
13#include <toolbox/level_duration.h>
14#include <furi_hal_gpio.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
21#define FURI_HAL_SUBGHZ_ASYNC_TX_BUFFER_FULL (256u)
22#define FURI_HAL_SUBGHZ_ASYNC_TX_BUFFER_HALF (FURI_HAL_SUBGHZ_ASYNC_TX_BUFFER_FULL / 2)
23#define FURI_HAL_SUBGHZ_ASYNC_TX_GUARD_TIME (999u)
24
32
33/* Mirror RX/TX async modulation signal to specified pin
34 *
35 * @warning Configures pin to output mode. Make sure it is not connected
36 * directly to power or ground.
37 *
38 * @param[in] pin pointer to the gpio pin structure or NULL to disable
39 */
40void furi_hal_subghz_set_async_mirror_pin(const GpioPin* pin);
41
47
52void furi_hal_subghz_init(void);
53
56void furi_hal_subghz_sleep(void);
57
61
66void furi_hal_subghz_load_custom_preset(const uint8_t* preset_data);
67
72void furi_hal_subghz_load_registers(const uint8_t* data);
73
78void furi_hal_subghz_load_patable(const uint8_t data[8]);
79
85void furi_hal_subghz_write_packet(const uint8_t* data, uint8_t size);
86
92
98
104void furi_hal_subghz_read_packet(uint8_t* data, uint8_t* size);
105
108void furi_hal_subghz_flush_rx(void);
109
112void furi_hal_subghz_flush_tx(void);
113
117void furi_hal_subghz_shutdown(void);
118
122void furi_hal_subghz_reset(void);
123
126void furi_hal_subghz_idle(void);
127
130void furi_hal_subghz_rx(void);
131
136bool furi_hal_subghz_tx(void);
137
142float furi_hal_subghz_get_rssi(void);
143
148uint8_t furi_hal_subghz_get_lqi(void);
149
156bool furi_hal_subghz_is_frequency_valid(uint32_t value);
157
165uint32_t furi_hal_subghz_set_frequency_and_path(uint32_t value);
166
173uint32_t furi_hal_subghz_set_frequency(uint32_t value);
174
180
181/* High Level API */
182
184typedef void (*FuriHalSubGhzCaptureCallback)(bool level, uint32_t duration, void* context);
185
192
196
202
211
217
221
222#ifdef __cplusplus
223}
224#endif
const GpioPin * furi_hal_subghz_get_data_gpio(void)
Get data GPIO.
Definition furi_hal_subghz.c:65
void furi_hal_subghz_write_packet(const uint8_t *data, uint8_t size)
Write packet to FIFO.
Definition furi_hal_subghz.c:215
void furi_hal_subghz_sleep(void)
Send device to sleep mode.
Definition furi_hal_subghz.c:138
void furi_hal_subghz_dump_state(void)
Dump info to stdout.
Definition furi_hal_subghz.c:153
void furi_hal_subghz_flush_rx(void)
Flush rx FIFO buffer.
Definition furi_hal_subghz.c:226
bool furi_hal_subghz_is_frequency_valid(uint32_t value)
Check if frequency is in valid range.
Definition furi_hal_subghz.c:338
void furi_hal_subghz_rx(void)
Switch to Receive.
Definition furi_hal_subghz.c:297
void furi_hal_subghz_load_custom_preset(const uint8_t *preset_data)
Load custom registers from preset.
Definition furi_hal_subghz.c:162
void furi_hal_subghz_stop_async_tx(void)
Stop async transmission and cleanup resources Resets GPIO, TIM2, and DMA1.
Definition furi_hal_subghz.c:795
void furi_hal_subghz_start_async_rx(FuriHalSubGhzCaptureCallback callback, void *context)
Enable signal timings capture Initializes GPIO and TIM2 for timings capture.
Definition furi_hal_subghz.c:460
float furi_hal_subghz_get_rssi(void)
Get RSSI value in dBm.
Definition furi_hal_subghz.c:315
uint8_t furi_hal_subghz_get_lqi(void)
Get LQI.
Definition furi_hal_subghz.c:330
bool furi_hal_subghz_rx_pipe_not_empty(void)
Check if receive pipe is not empty.
Definition furi_hal_subghz.c:238
bool furi_hal_subghz_is_async_tx_complete(void)
Wait for async transmission to complete.
Definition furi_hal_subghz.c:791
uint32_t furi_hal_subghz_set_frequency(uint32_t value)
Set frequency.
Definition furi_hal_subghz.c:362
void furi_hal_subghz_load_registers(const uint8_t *data)
Load registers.
Definition furi_hal_subghz.c:194
void furi_hal_subghz_flush_tx(void)
Flush tx FIFO buffer.
Definition furi_hal_subghz.c:232
bool furi_hal_subghz_start_async_tx(FuriHalSubGhzAsyncTxCallback callback, void *context)
Start async TX Initializes GPIO, TIM2 and DMA1 for signal output.
Definition furi_hal_subghz.c:687
bool furi_hal_subghz_tx(void)
Switch to Transmit.
Definition furi_hal_subghz.c:305
void furi_hal_subghz_shutdown(void)
Shutdown Issue SPWD command.
Definition furi_hal_subghz.c:272
FuriHalSubGhzPath
Switchable Radio Paths.
Definition furi_hal_subghz.h:26
@ FuriHalSubGhzPath868
Center Frequency: 868MHz.
Definition furi_hal_subghz.h:30
@ FuriHalSubGhzPathIsolate
Isolate Radio from antenna.
Definition furi_hal_subghz.h:27
@ FuriHalSubGhzPath433
Center Frequency: 433MHz.
Definition furi_hal_subghz.h:28
@ FuriHalSubGhzPath315
Center Frequency: 315MHz.
Definition furi_hal_subghz.h:29
void furi_hal_subghz_stop_async_rx(void)
Disable signal timings capture Resets GPIO and TIM2.
Definition furi_hal_subghz.c:529
bool furi_hal_subghz_is_rx_data_crc_valid(void)
Check if received data crc is valid.
Definition furi_hal_subghz.c:251
void furi_hal_subghz_init(void)
Initialize and switch to power save mode Used by internal API-HAL initialization routine Can be used ...
Definition furi_hal_subghz.c:69
void furi_hal_subghz_reset(void)
Reset Issue reset command.
Definition furi_hal_subghz.c:279
LevelDuration(* FuriHalSubGhzAsyncTxCallback)(void *context)
Async TX callback type.
Definition furi_hal_subghz.h:201
void furi_hal_subghz_load_patable(const uint8_t data[8])
Load PATABLE.
Definition furi_hal_subghz.c:207
void furi_hal_subghz_set_path(FuriHalSubGhzPath path)
Set path.
Definition furi_hal_subghz.c:379
void(* FuriHalSubGhzCaptureCallback)(bool level, uint32_t duration, void *context)
Signal Timings Capture callback.
Definition furi_hal_subghz.h:184
void furi_hal_subghz_idle(void)
Switch to Idle.
Definition furi_hal_subghz.c:289
void furi_hal_subghz_read_packet(uint8_t *data, uint8_t *size)
Read packet from FIFO.
Definition furi_hal_subghz.c:263
uint32_t furi_hal_subghz_set_frequency_and_path(uint32_t value)
Set frequency and path This function automatically selects antenna matching network.
Definition furi_hal_subghz.c:348
Gpio structure.
Definition furi_hal_gpio.h:161
Definition level_duration.h:15