mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-15 17:18:01 +00:00
13c5a8cb20
* Add RAW format * F5 stubs for build to pass * Fix saving decoded signal error * Irda: set ISR before starting timer, remove explicit NVIC configuration Co-authored-by: あく <alleteam@gmail.com>
61 lines
1.3 KiB
C++
61 lines
1.3 KiB
C++
#pragma once
|
|
#include <irda_worker.h>
|
|
#include <stdint.h>
|
|
#include <string>
|
|
#include <irda.h>
|
|
|
|
class IrdaAppSignal {
|
|
public:
|
|
typedef struct {
|
|
size_t timings_cnt;
|
|
uint32_t* timings;
|
|
} RawSignal;
|
|
|
|
private:
|
|
bool decoded;
|
|
union {
|
|
IrdaMessage message;
|
|
RawSignal raw;
|
|
} payload;
|
|
|
|
void copy_timings(const uint32_t* timings, size_t size);
|
|
void clear_timings();
|
|
|
|
public:
|
|
IrdaAppSignal() {
|
|
decoded = true;
|
|
payload.message.protocol = IrdaProtocolUnknown;
|
|
}
|
|
|
|
~IrdaAppSignal() {
|
|
clear_timings();
|
|
}
|
|
|
|
IrdaAppSignal(const uint32_t* timings, size_t timings_cnt);
|
|
IrdaAppSignal(const IrdaMessage* irda_message);
|
|
|
|
IrdaAppSignal(const IrdaAppSignal& other);
|
|
IrdaAppSignal(IrdaAppSignal&& other);
|
|
|
|
IrdaAppSignal& operator=(const IrdaAppSignal& signal);
|
|
|
|
void set_message(const IrdaMessage* irda_message);
|
|
void set_raw_signal(uint32_t* timings, size_t timings_cnt);
|
|
void copy_raw_signal(uint32_t* timings, size_t timings_cnt);
|
|
|
|
void transmit() const;
|
|
|
|
bool is_raw(void) const {
|
|
return !decoded;
|
|
}
|
|
|
|
const IrdaMessage& get_message(void) const {
|
|
furi_assert(decoded);
|
|
return payload.message;
|
|
}
|
|
|
|
const RawSignal& get_raw_signal(void) const {
|
|
furi_assert(!decoded);
|
|
return payload.raw;
|
|
}
|
|
};
|