Loading...
Searching...
No Matches
furi_hal_infrared.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <stdint.h>
9#include <stdbool.h>
10#include <stddef.h>
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16#define INFRARED_MAX_FREQUENCY 56000
17#define INFRARED_MIN_FREQUENCY 10000
18
19typedef enum {
20 FuriHalInfraredTxPinInternal,
21 FuriHalInfraredTxPinExtPA7,
22 FuriHalInfraredTxPinMax,
23} FuriHalInfraredTxPin;
24
30
33 *FuriHalInfraredTxGetDataISRCallback)(void* context, uint32_t* duration, bool* level);
34
41typedef void (*FuriHalInfraredTxSignalSentISRCallback)(void* context);
42
49typedef void (*FuriHalInfraredRxCaptureCallback)(void* ctx, bool level, uint32_t duration);
50
55typedef void (*FuriHalInfraredRxTimeoutCallback)(void* ctx);
56
62
66
74void furi_hal_infrared_async_rx_set_timeout(uint32_t timeout_us);
75
83 void* ctx);
84
94 void* ctx);
95
101
111 void* context);
112
127void furi_hal_infrared_async_tx_start(uint32_t freq, float duty_cycle);
128
135
142
150 void* context);
151
167FuriHalInfraredTxPin furi_hal_infrared_detect_tx_output(void);
168
173void furi_hal_infrared_set_tx_output(FuriHalInfraredTxPin tx_pin);
174
175#ifdef __cplusplus
176}
177#endif
void(* FuriHalInfraredTxSignalSentISRCallback)(void *context)
Callback type called every time signal is sent by DMA to Timer.
Definition furi_hal_infrared.h:41
FuriHalInfraredTxGetDataState(* FuriHalInfraredTxGetDataISRCallback)(void *context, uint32_t *duration, bool *level)
Callback type for providing data to INFRARED DMA TX system.
Definition furi_hal_infrared.h:33
void furi_hal_infrared_async_rx_stop(void)
Deinitialize INFRARED RX interrupt.
Definition furi_hal_infrared.c:202
void furi_hal_infrared_set_tx_output(FuriHalInfraredTxPin tx_pin)
Set which pin will be used to transmit infrared signals.
Definition furi_hal_infrared.c:725
void furi_hal_infrared_async_tx_set_signal_sent_isr_callback(FuriHalInfraredTxSignalSentISRCallback callback, void *context)
Set callback for end of signal transmission.
Definition furi_hal_infrared.c:703
void furi_hal_infrared_async_tx_stop(void)
Stop IR asynchronous transmission and free resources.
Definition furi_hal_infrared.c:683
void furi_hal_infrared_async_tx_start(uint32_t freq, float duty_cycle)
Start IR asynchronous transmission.
Definition furi_hal_infrared.c:616
void furi_hal_infrared_async_rx_set_timeout(uint32_t timeout_us)
Setup hal for receiving silence timeout.
Definition furi_hal_infrared.c:212
void(* FuriHalInfraredRxCaptureCallback)(void *ctx, bool level, uint32_t duration)
Signature of callback function for receiving continuous INFRARED rx signal.
Definition furi_hal_infrared.h:49
FuriHalInfraredTxGetDataState
Definition furi_hal_infrared.h:25
@ FuriHalInfraredTxGetDataStateDone
New data obtained, and this is end of package.
Definition furi_hal_infrared.h:27
@ FuriHalInfraredTxGetDataStateLastDone
New data obtained, and this is end of package and no more data available.
Definition furi_hal_infrared.h:28
@ FuriHalInfraredTxGetDataStateOk
New data obtained.
Definition furi_hal_infrared.h:26
void furi_hal_infrared_async_rx_set_timeout_isr_callback(FuriHalInfraredRxTimeoutCallback callback, void *ctx)
Setup callback for reaching silence timeout on INFRARED port.
Definition furi_hal_infrared.c:230
void furi_hal_infrared_async_rx_set_capture_isr_callback(FuriHalInfraredRxCaptureCallback callback, void *ctx)
Setup callback for previously initialized INFRARED RX interrupt.
Definition furi_hal_infrared.c:223
FuriHalInfraredTxPin furi_hal_infrared_detect_tx_output(void)
Detect which pin has an external IR module connected.
Definition furi_hal_infrared.c:710
bool furi_hal_infrared_is_busy(void)
Check if INFRARED is in use now.
Definition furi_hal_infrared.c:219
void furi_hal_infrared_async_tx_set_data_isr_callback(FuriHalInfraredTxGetDataISRCallback callback, void *context)
Set callback providing new data.
Definition furi_hal_infrared.c:695
void(* FuriHalInfraredRxTimeoutCallback)(void *ctx)
Signature of callback function for reaching silence timeout on INFRARED port.
Definition furi_hal_infrared.h:55
void furi_hal_infrared_async_tx_wait_termination(void)
Wait for end of IR asynchronous transmission and free resources.
Definition furi_hal_infrared.c:672
void furi_hal_infrared_async_rx_start(void)
Initialize INFRARED RX timer to receive interrupts.
Definition furi_hal_infrared.c:153