7#define MIN(a, b) ((a) < (b) ? (a) : (b))
9uint8_t Rc5Renderer::T = 1U;
19 unsigned int index = 0U;
22 emit(1U, index, pending, repeat);
23 emit(((~F) & 0x40U) >> 6U, index, pending, repeat);
24 emit(T & 1U, index, pending, repeat);
25 emitMsb(D, 5U, index, pending, repeat);
26 emitMsb(F, 6U, index, pending, repeat);
27 emitEnd(index, pending, repeat);
28 return new IrSignal(
nullptr, 0, repeat, index, frequency);
31void Rc5Renderer::emitMsb(
unsigned int x,
unsigned int length,
33 unsigned int mask = 1U << (length - 1U);
35 emit((x & mask) != 0, index, pending, repeat);
40void Rc5Renderer::emit(
unsigned int x,
unsigned int& index,
int& pending,
44 }
else if ((pending > 0) == ((x & 1U) != 0U)) {
45 repeat[index] = timebase;
47 repeat[index] = timebase;
50 repeat[index] = 2U * timebase;
53 pending = (x & 1U) ? 1 : -1;
56void Rc5Renderer::emitEnd(
unsigned int& index,
int& pending,
microseconds_t *repeat) {
58 repeat[index] = timebase; index++;
static constexpr microseconds_t MICROSECONDS_T_MAX
Largest microseconds_t number possible.
uint16_t microseconds_t
Type for durations in micro seconds.
static const IrSequence emptyIrSequence
This class consists of a vector of durations.
This class models an IR signal with intro-, repeat-, and ending sequences.
static const IrSignal * newIrSignal(unsigned int D, unsigned int F, unsigned int T)
Generates an RC5 signal from the RC5 parameters.