[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:
@@ -34,6 +34,8 @@ typedef struct {
|
||||
IrdaEncoders encoder;
|
||||
uint8_t address_length;
|
||||
uint8_t command_length;
|
||||
uint32_t frequency;
|
||||
float duty_cycle;
|
||||
} IrdaProtocolImplementation;
|
||||
|
||||
struct IrdaEncoderHandler {
|
||||
@@ -58,6 +60,8 @@ static const IrdaProtocolImplementation irda_protocols[] = {
|
||||
.free = irda_encoder_nec_free},
|
||||
.address_length = 2,
|
||||
.command_length = 2,
|
||||
.frequency = IRDA_COMMON_CARRIER_FREQUENCY,
|
||||
.duty_cycle = IRDA_COMMON_DUTY_CYCLE,
|
||||
},
|
||||
// #1 - have to be after NEC
|
||||
{ .protocol = IrdaProtocolNECext,
|
||||
@@ -74,6 +78,8 @@ static const IrdaProtocolImplementation irda_protocols[] = {
|
||||
.free = irda_encoder_nec_free},
|
||||
.address_length = 4,
|
||||
.command_length = 2,
|
||||
.frequency = IRDA_COMMON_CARRIER_FREQUENCY,
|
||||
.duty_cycle = IRDA_COMMON_DUTY_CYCLE,
|
||||
},
|
||||
// #2
|
||||
{ .protocol = IrdaProtocolSamsung32,
|
||||
@@ -90,6 +96,8 @@ static const IrdaProtocolImplementation irda_protocols[] = {
|
||||
.free = irda_encoder_samsung32_free},
|
||||
.address_length = 2,
|
||||
.command_length = 2,
|
||||
.frequency = IRDA_COMMON_CARRIER_FREQUENCY,
|
||||
.duty_cycle = IRDA_COMMON_DUTY_CYCLE,
|
||||
},
|
||||
// #3
|
||||
{ .protocol = IrdaProtocolRC6,
|
||||
@@ -106,6 +114,8 @@ static const IrdaProtocolImplementation irda_protocols[] = {
|
||||
.free = irda_encoder_rc6_free},
|
||||
.address_length = 2,
|
||||
.command_length = 2,
|
||||
.frequency = IRDA_COMMON_CARRIER_FREQUENCY,
|
||||
.duty_cycle = IRDA_COMMON_DUTY_CYCLE,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -222,10 +232,12 @@ IrdaProtocol irda_get_protocol_by_name(const char* protocol_name) {
|
||||
if (!strcmp(irda_protocols[i].name, protocol_name))
|
||||
return i;
|
||||
}
|
||||
furi_assert(0);
|
||||
return IrdaProtocolUnknown;
|
||||
}
|
||||
|
||||
const char* irda_get_protocol_name(IrdaProtocol protocol) {
|
||||
furi_assert(irda_is_protocol_valid(protocol));
|
||||
if (irda_is_protocol_valid(protocol))
|
||||
return irda_protocols[protocol].name;
|
||||
else
|
||||
@@ -233,6 +245,7 @@ const char* irda_get_protocol_name(IrdaProtocol protocol) {
|
||||
}
|
||||
|
||||
uint8_t irda_get_protocol_address_length(IrdaProtocol protocol) {
|
||||
furi_assert(irda_is_protocol_valid(protocol));
|
||||
if (irda_is_protocol_valid(protocol))
|
||||
return irda_protocols[protocol].address_length;
|
||||
else
|
||||
@@ -240,9 +253,26 @@ uint8_t irda_get_protocol_address_length(IrdaProtocol protocol) {
|
||||
}
|
||||
|
||||
uint8_t irda_get_protocol_command_length(IrdaProtocol protocol) {
|
||||
furi_assert(irda_is_protocol_valid(protocol));
|
||||
if (irda_is_protocol_valid(protocol))
|
||||
return irda_protocols[protocol].command_length;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t irda_get_protocol_frequency(IrdaProtocol protocol) {
|
||||
furi_assert(irda_is_protocol_valid(protocol));
|
||||
if (irda_is_protocol_valid(protocol))
|
||||
return irda_protocols[protocol].frequency;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
float irda_get_protocol_duty_cycle(IrdaProtocol protocol) {
|
||||
furi_assert(irda_is_protocol_valid(protocol));
|
||||
if (irda_is_protocol_valid(protocol))
|
||||
return irda_protocols[protocol].duty_cycle;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -10,6 +10,12 @@ extern "C" {
|
||||
#define IRDA_COMMON_CARRIER_FREQUENCY 38000
|
||||
#define IRDA_COMMON_DUTY_CYCLE 0.33
|
||||
|
||||
/* if we want to see splitted raw signals during brutforce,
|
||||
* we have to have RX raw timing delay less than TX */
|
||||
#define IRDA_RAW_RX_TIMING_DELAY_US 150000
|
||||
#define IRDA_RAW_TX_TIMING_DELAY_US 180000
|
||||
|
||||
|
||||
typedef struct IrdaDecoderHandler IrdaDecoderHandler;
|
||||
typedef struct IrdaEncoderHandler IrdaEncoderHandler;
|
||||
|
||||
@@ -150,6 +156,24 @@ IrdaStatus irda_encode(IrdaEncoderHandler* handler, uint32_t* duration, bool* le
|
||||
*/
|
||||
void irda_reset_encoder(IrdaEncoderHandler* handler, const IrdaMessage* message);
|
||||
|
||||
/**
|
||||
* Get PWM frequency value for selected protocol
|
||||
*
|
||||
* \param[in] protocol - protocol to get from PWM frequency
|
||||
*
|
||||
* \return frequency
|
||||
*/
|
||||
uint32_t irda_get_protocol_frequency(IrdaProtocol protocol);
|
||||
|
||||
/**
|
||||
* Get PWM duty cycle value for selected protocol
|
||||
*
|
||||
* \param[in] protocol - protocol to get from PWM duty cycle
|
||||
*
|
||||
* \return duty cycle
|
||||
*/
|
||||
float irda_get_protocol_duty_cycle(IrdaProtocol protocol);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -137,7 +137,8 @@ extern const IrdaCommonProtocolSpec protocol_samsung32;
|
||||
#define IRDA_RC6_BIT 444 // half of time-quant for 1 bit
|
||||
#define IRDA_RC6_PREAMBLE_TOLERANCE 0.07 // percents
|
||||
#define IRDA_RC6_BIT_TOLERANCE 120 // us
|
||||
#define IRDA_RC6_SILENCE 2700
|
||||
/* protocol allows 2700 silence, but it is hard to send 1 message without repeat */
|
||||
#define IRDA_RC6_SILENCE (2700 * 10)
|
||||
|
||||
void* irda_decoder_rc6_alloc(void);
|
||||
void irda_decoder_rc6_reset(void* decoder);
|
||||
|
Reference in New Issue
Block a user