unleashed-firmware/firmware/targets/api-hal-include/api-hal-irda.h
Albert Kharisov 6c74ea65c2
[FL-1369, FL-1397, FL-1420] IRDA + SDcard (#513)
* Add saving to SD-Card (not ready yet)
* Add saving to SD-card (done)
* Select previous menu item
* Fix central button
* Fix current_button
* Refactoring
* Add notifications
* [FL-1417] Add IRDA CLI
  CLI commands:
  1) ir_rx
  Receives all IR-trafic, decodes and prints result to stdout
  2) ir_tx <protocol> <address> <command>
  Transmits IR-signal. Address and command are hex-formatted
* Fix BUG with random memory corruption at random time in random place in random universe in random unknown space and time forever amen
* Fix submenu set_selected_item
* Bring protocol order back
* Add TODO sdcard check
2021-06-09 16:04:49 +03:00

61 lines
1.3 KiB
C

#pragma once
#include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* Signature of callback function for receiving continuous IRDA rx signal.
*
* @param level - level of input IRDA rx signal
* @param duration - duration of continuous rx signal level in us
*/
typedef void (*TimerISRCallback)(void* ctx, bool level, uint32_t duration);
/**
* Initialize IRDA RX timer to receive interrupts.
* It provides interrupts for every RX-signal edge changing
* with its duration.
*/
void api_hal_irda_rx_irq_init(void);
/**
* Deinitialize IRDA RX interrupt.
*/
void api_hal_irda_rx_irq_deinit(void);
/**
* Setup callback for previously initialized IRDA RX interrupt.
*
* @param callback - callback to call when RX signal edge changing occurs
* @param ctx - context for callback
*/
void api_hal_irda_rx_irq_set_callback(TimerISRCallback callback, void *ctx);
/**
* Start generating IRDA TX PWM. Provides PWM initialization on
* defined frequency.
*
* @param duty_cycle - duty cycle
* @param freq - PWM frequency to generate
*/
void api_hal_irda_pwm_set(float duty_cycle, float freq);
/**
* Stop generating IRDA PWM signal.
*/
void api_hal_irda_pwm_stop();
/**
* Check if IRDA is in use now.
* @return false - IRDA is busy, true otherwise.
*/
bool api_hal_irda_rx_irq_is_busy(void);
#ifdef __cplusplus
}
#endif