flipperzero-firmware/lib/subghz/subghz_tx_rx_worker.h
Skorpionm b912cc7991
SubGhz: sending / receiving messages via subghz (#851)
* SubGhz: add worker subghz_txrx
* SubGhz: added support for transferring Russian characters and support for backspace in CLI subghz_txrx
* SubGhz: refactoring subghz_txrx_worker, added a callback for accepting data in an empty one RX buffer
* SubGhz: fix conflict
* SubGhz: fix syntax errors
* Cli: document string_move usage and its behavior
* FuriHal: update subghz api and documentation. Subghz: move chat to subghz cli subcommand.
* Subghz: update text in chat cli

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-12-01 18:44:39 +03:00

82 lines
2.1 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#include <furi-hal.h>
typedef void (*SubGhzTxRxWorkerCallbackHaveRead)(void* context);
typedef struct SubGhzTxRxWorker SubGhzTxRxWorker;
typedef enum {
SubGhzTxRxWorkerStatusIDLE,
SubGhzTxRxWorkerStatusTx,
SubGhzTxRxWorkerStatusRx,
} SubGhzTxRxWorkerStatus;
/** SubGhzTxRxWorker, add data to transfer
*
* @param instance SubGhzTxRxWorker instance
* @param data *data
* @param size data size
* @return bool true if ok
*/
bool subghz_tx_rx_worker_write(SubGhzTxRxWorker* instance, uint8_t* data, size_t size);
/** SubGhzTxRxWorker, get available data
*
* @param instance SubGhzTxRxWorker instance
* @return size_t data size
*/
size_t subghz_tx_rx_worker_available(SubGhzTxRxWorker* instance);
/** SubGhzTxRxWorker, read data
*
* @param instance SubGhzTxRxWorker instance
* @param data *data
* @param size max data size, which can be read
* @return size_t data size, how much is actually read
*/
size_t subghz_tx_rx_worker_read(SubGhzTxRxWorker* instance, uint8_t* data, size_t size);
/** Сallback SubGhzTxRxWorker when there is data to read in an empty buffer
*
* @param instance SubGhzTxRxWorker instance
* @param callback SubGhzTxRxWorkerCallbackHaveRead callback
* @param context
*/
void subghz_tx_rx_worker_set_callback_have_read(
SubGhzTxRxWorker* instance,
SubGhzTxRxWorkerCallbackHaveRead callback,
void* context);
/** Allocate SubGhzTxRxWorker
*
* @return SubGhzTxRxWorker*
*/
SubGhzTxRxWorker* subghz_tx_rx_worker_alloc();
/** Free SubGhzTxRxWorker
*
* @param instance SubGhzTxRxWorker instance
*/
void subghz_tx_rx_worker_free(SubGhzTxRxWorker* instance);
/** Start SubGhzTxRxWorker
*
* @param instance SubGhzTxRxWorker instance
* @return bool - true if ok
*/
bool subghz_tx_rx_worker_start(SubGhzTxRxWorker* instance, uint32_t frequency);
/** Stop SubGhzTxRxWorker
*
* @param instance SubGhzTxRxWorker instance
*/
void subghz_tx_rx_worker_stop(SubGhzTxRxWorker* instance);
/** Check if worker is running
*
* @param instance SubGhzTxRxWorker instance
* @return bool - true if running
*/
bool subghz_tx_rx_worker_is_running(SubGhzTxRxWorker* instance);