Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1
185
Ver.1.0.0
else
if
(ir_send_ctrl.
is_sending
== IR_SENDING_REPEAT){
//Add FifoTask_repeat*n to Dma
pwm_start_dma_ir_sending();
}
}
else
{
ir_send_release();
}
}
}
10.2.4 IR Initialization
10.2.4.1 rc_ir_init
IR initialization function is shown as below. Please refer to demo code in SDK.
void
rc_ir_init
(
void
)
10.2.4.2 IR Hardware Configuration
The demo code is as below:
pwm_n_revert(
PWM0_ID
);
gpio_set_func(
GPIO_PA0
,
AS_PWM0
);
pwm_set_mode(
PWM0_ID
,
PWM_IR_DMA_FIFO_MODE
);
pwm_set_phase(
PWM0_ID
, 0);
//no phase at pwm beginning
pwm_set_cycle_and_duty(
PWM0_ID
, PWM_CARRIER_CYCLE_TICK,
PWM_CARRIER_HIGH_TICK );
pwm_set_dma_address(&T_dmaData_buf);
reg_irq_mask |=
FLD_IRQ_SW_PWM_EN
;
reg_pwm_irq_sta =
FLD_IRQ_PWM0_IR_DMA_FIFO_DONE
;
Since only PWM0 supports ID DMA FIFO mode, PA0 is selected to correspond to PWM0
herein.
In the demo, IR carrier frequency is 38K, cycle is 26.3us, and duty cycle is 1/3. The API
“pwm_set_cycle_and_duty” should be used to configure the cycle and duty cycle. Since
all FifoTasks share the same carrier frequency, the carrier of 38K can meet the
configuration requirement, and PWM shadow mode is not needed.
DMA FIFO buffer is
“T_dmaData_buf”
。
Enable system interrupt mask
“FLD_IRQ_SW_PWM_EN”.