Code: Select all
rmt_transmit(crs_channel, crs_encoder, &crs_gear_wave[out_index], sizeof(uint16_t), &crs_transmit_config);
// rmt_transmit(cas_channel, cas_encoder, &cas_gear_wave[out_index], sizeof(uint16_t), &cas_transmit_config);
rmt_transmit(crs_channel, crs_encoder, &crs_gear_wave[out_index + 1], sizeof(uint16_t), &crs_transmit_config);
Code: Select all
size_t IRAM_ATTR rmt_encode_ir_nec(rmt_encoder_t *encoder, rmt_channel_handle_t channel, const void *primary_data, size_t data_size, rmt_encode_state_t *ret_state)
{
rmt_ir_nec_encoder_t *nec_encoder = __containerof(encoder, rmt_ir_nec_encoder_t, base);
rmt_encode_state_t session_state = RMT_ENCODING_RESET;
rmt_encode_state_t state = RMT_ENCODING_RESET;
size_t encoded_symbols = 0;
uint16_t *gear_wave = (uint16_t *)primary_data;
rmt_encoder_handle_t bytes_encoder = nec_encoder->bytes_encoder;
switch (nec_encoder->state)
{
case 0:
encoded_symbols += bytes_encoder->encode(bytes_encoder, channel, &gear_wave[0], sizeof(uint16_t), &session_state);
if (session_state & RMT_ENCODING_COMPLETE)
{
nec_encoder->state = RMT_ENCODING_RESET; // back to the initial encoding session
state |= RMT_ENCODING_COMPLETE;
}
if (session_state & RMT_ENCODING_MEM_FULL)
{
state |= RMT_ENCODING_MEM_FULL;
goto out;
}
break;
default:
nec_encoder->state = RMT_ENCODING_RESET; // back to the initial encoding session
state |= RMT_ENCODING_COMPLETE;
break;
}
out:
*ret_state = state;
return encoded_symbols;
}