IRsend_enableIROut 主要实现的功能是配置PWM波的载波频率,一般为38KHZ 1/3~1/4Duty (当然也有一些特别)
要发出红外波,就是以PWM驱动红外LED传播红外波
其代码如下:void Sct_Pwm_Init(uint32_t PWM_RATE)
{
/* Initialize the SCT as PWM and set frequency */
Chip_SCTPWM_Init(LPC_SCT);
Chip_SCTPWM_SetRate(LPC_SCT, PWM_RATE);
/* Setup Board specific output pin */
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 9, IOCON_FUNC2 | IOCON_MODE_INACT | IOCON_DIGITAL_EN | IOCON_INPFILT_OFF);
/* Use SCT0_OUT1 pin */
Chip_SCTPWM_SetOutPin(LPC_SCT, SCT_PWM_OUT, SCT_PWM_PIN_OUT);
/* Start with 0% duty cycle */
Chip_SCTPWM_SetDutyCycle(LPC_SCT, SCT_PWM_OUT, Chip_SCTPWM_GetTicksPerCycle(LPC_SCT) / 4);
//Chip_SCTPWM_Start(LPC_SCT);
}
|