[FL-1652, FL-1554] IRDA: Continuous transmitting (#636)
* [FL-1652] IRDA: Continuous transmitting * continuous encoding and sending signals by pressing button on menu * fast buttons scrolling in remote menu * bruteforce: stop reading file if progress == 100% * IRDA: .hpp -> .h * [FL-1554] IRDA: xTaskNotify -> osEventsFlagSet * IRDA: some stability fixes * Irda: minor cleanup, api-hal to furi-hal rename. Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -7,11 +7,28 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MAX_TIMINGS_AMOUNT 512
|
||||
|
||||
/** Interface struct of irda worker */
|
||||
typedef struct IrdaWorker IrdaWorker;
|
||||
/** Interface struct of received signal */
|
||||
typedef struct IrdaWorkerSignal IrdaWorkerSignal;
|
||||
|
||||
typedef enum {
|
||||
IrdaWorkerGetSignalResponseNew, /** Signal, provided by callback is new and encoder should be reseted */
|
||||
IrdaWorkerGetSignalResponseSame, /** Signal, provided by callback is same. No encoder resetting. */
|
||||
IrdaWorkerGetSignalResponseStop, /** No more signals available. */
|
||||
} IrdaWorkerGetSignalResponse;
|
||||
|
||||
/** Callback type for providing next signal to send. Should be used with
|
||||
* irda_worker_make_decoded_signal() or irda_worker_make_raw_signal()
|
||||
*/
|
||||
typedef IrdaWorkerGetSignalResponse (*IrdaWorkerGetSignalCallback)(void* context, IrdaWorker* instance);
|
||||
|
||||
/** Callback type for 'message is sent' event */
|
||||
typedef void (*IrdaWorkerMessageSentCallback)(void* context);
|
||||
|
||||
|
||||
/** Callback type to call by IrdaWorker thread when new signal is received */
|
||||
typedef void (*IrdaWorkerReceivedSignalCallback)(void* context, IrdaWorkerSignal* received_signal);
|
||||
|
||||
@@ -27,31 +44,33 @@ IrdaWorker* irda_worker_alloc();
|
||||
*/
|
||||
void irda_worker_free(IrdaWorker* instance);
|
||||
|
||||
/** Received data callback IrdaWorker
|
||||
*
|
||||
* @param[in] instance - IrdaWorker instance
|
||||
* @param[in] callback - IrdaWorkerReceivedSignalCallback callback
|
||||
*/
|
||||
void irda_worker_set_received_signal_callback(IrdaWorker* instance, IrdaWorkerReceivedSignalCallback callback);
|
||||
|
||||
/** Context callback IrdaWorker
|
||||
*
|
||||
* @param[in] instance - IrdaWorker instance
|
||||
* @param[in] context - context to pass to callbacks
|
||||
*/
|
||||
void irda_worker_set_context(IrdaWorker* instance, void* context);
|
||||
|
||||
/** Start IrdaWorker thread, initialise furi-hal, prepare all work.
|
||||
*
|
||||
* @param[in] instance - IrdaWorker instance
|
||||
*/
|
||||
void irda_worker_start(IrdaWorker* instance);
|
||||
void irda_worker_rx_start(IrdaWorker* instance);
|
||||
|
||||
/** Stop IrdaWorker thread, deinitialize furi-hal.
|
||||
*
|
||||
* @param[in] instance - IrdaWorker instance
|
||||
*/
|
||||
void irda_worker_stop(IrdaWorker* instance);
|
||||
void irda_worker_rx_stop(IrdaWorker* instance);
|
||||
|
||||
/** Set received data callback IrdaWorker
|
||||
*
|
||||
* @param[in] instance - IrdaWorker instance
|
||||
* @param[in] context - context to pass to callbacks
|
||||
* @param[in] callback - IrdaWorkerReceivedSignalCallback callback
|
||||
*/
|
||||
void irda_worker_rx_set_received_signal_callback(IrdaWorker* instance, IrdaWorkerReceivedSignalCallback callback, void* context);
|
||||
|
||||
/** Enable blinking on receiving any signal on IR port.
|
||||
*
|
||||
* @param[in] instance - instance of IrdaWorker
|
||||
* @param[in] enable - true if you want to enable blinking
|
||||
* false otherwise
|
||||
*/
|
||||
void irda_worker_rx_enable_blink_on_receiving(IrdaWorker* instance, bool enable);
|
||||
|
||||
/** Clarify is received signal either decoded or raw
|
||||
*
|
||||
@@ -60,6 +79,48 @@ void irda_worker_stop(IrdaWorker* instance);
|
||||
*/
|
||||
bool irda_worker_signal_is_decoded(const IrdaWorkerSignal* signal);
|
||||
|
||||
/** Start transmitting signal. Callback IrdaWorkerGetSignalCallback should be
|
||||
* set before this function is called, as it calls for it to fill buffer before
|
||||
* starting transmission.
|
||||
*
|
||||
* @param[in] instance - IrdaWorker instance
|
||||
*/
|
||||
void irda_worker_tx_start(IrdaWorker* instance);
|
||||
|
||||
/** Stop transmitting signal. Waits for end of current signal and stops transmission.
|
||||
*
|
||||
* @param[in] instance - IrdaWorker instance
|
||||
*/
|
||||
void irda_worker_tx_stop(IrdaWorker* instance);
|
||||
|
||||
/** Set callback for providing next signal to send
|
||||
*
|
||||
* @param[in] instance - IrdaWorker instance
|
||||
* @param[in] context - context to pass to callbacks
|
||||
* @param[in] callback - IrdaWorkerGetSignalCallback callback
|
||||
*/
|
||||
void irda_worker_tx_set_get_signal_callback(IrdaWorker* instance, IrdaWorkerGetSignalCallback callback, void* context);
|
||||
|
||||
/** Set callback for end of signal transmitting
|
||||
*
|
||||
* @param[in] instance - IrdaWorker instance
|
||||
* @param[in] context - context to pass to callbacks
|
||||
* @param[in] callback - IrdaWorkerMessageSentCallback callback
|
||||
*/
|
||||
void irda_worker_tx_set_signal_sent_callback(IrdaWorker* instance, IrdaWorkerMessageSentCallback callback, void* context);
|
||||
|
||||
/** Callback to pass to irda_worker_tx_set_get_signal_callback() if signal
|
||||
* is steady and will not be changed between irda_worker start and stop.
|
||||
* Before starting transmission, desired steady signal must be set with
|
||||
* irda_worker_make_decoded_signal() or irda_worker_make_raw_signal().
|
||||
*
|
||||
* This function should not be implicitly called.
|
||||
*
|
||||
* @param[in] context - context
|
||||
* @param[out] instance - IrdaWorker instance
|
||||
*/
|
||||
IrdaWorkerGetSignalResponse irda_worker_tx_get_signal_steady_callback(void* context, IrdaWorker* instance);
|
||||
|
||||
/** Acquire raw signal from interface struct 'IrdaWorkerSignal'.
|
||||
* First, you have to ensure that signal is raw.
|
||||
*
|
||||
@@ -73,17 +134,24 @@ void irda_worker_get_raw_signal(const IrdaWorkerSignal* signal, const uint32_t**
|
||||
* First, you have to ensure that signal is decoded.
|
||||
*
|
||||
* @param[in] signal - received signal
|
||||
* @return decoded irda message
|
||||
* @return decoded IRDA message
|
||||
*/
|
||||
const IrdaMessage* irda_worker_get_decoded_message(const IrdaWorkerSignal* signal);
|
||||
const IrdaMessage* irda_worker_get_decoded_signal(const IrdaWorkerSignal* signal);
|
||||
|
||||
/** Enable blinking on receiving any signal on IR port.
|
||||
/** Set current decoded signal for IrdaWorker instance
|
||||
*
|
||||
* @param[in] instance - instance of IrdaWorker
|
||||
* @param[in] enable - true if you want to enable blinking
|
||||
* false otherwise
|
||||
* @param[out] instance - IrdaWorker instance
|
||||
* @param[in] message - decoded signal
|
||||
*/
|
||||
void irda_worker_enable_blink_on_receiving(IrdaWorker* instance, bool enable);
|
||||
void irda_worker_set_decoded_signal(IrdaWorker* instance, const IrdaMessage* message);
|
||||
|
||||
/** Set current raw signal for IrdaWorker instance
|
||||
*
|
||||
* @param[out] instance - IrdaWorker instance
|
||||
* @param[in] timings - array of raw timings
|
||||
* @param[in] timings_cnt - size of array of raw timings
|
||||
*/
|
||||
void irda_worker_set_raw_signal(IrdaWorker* instance, const uint32_t* timings, size_t timings_cnt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Reference in New Issue
Block a user