------------------------------------------------------------
/**************************************************************************//**
\brief Set PWM values for current X, Y and L values
******************************************************************************/
#if defined(APP_USE_PWM)
static void ledsSetColor(void)
{
#ifdef APP_USE_PWM
int maxL;
unsigned int r, g, b;
r = r * TOP / 65535;
g = g * TOP / 65535;
b = b * TOP / 65535;
bspSetPwmChannelCompareValue(r, g, b);//PWM_CHANNEL_0,PWM_CHANNEL_1,PWM_CHANNEL_2
#endif
}
--------------------------------------------------------------------------------------------------------------------------
#if defined(APP_USE_PWM)
/**************************************************************************//**
\brief Set compare value for PWM channels
\param[in] ch1, ch2, ch3 - compare value
******************************************************************************/
void bspSetPwmChannelCompareValue(uint16_t r, uint16_t g, uint16_t b)
{
//既然要PWM输出功能为何不开启该通道输出呢,那就我们自己加好了 !
//增加不同的板子判断PWM输出
//21——XPRO没有输出
#if BSP_SUPPORT == BOARD_SAMR21_XPRO
pwmChannel0.channelMask = (1 << PWM_CHANNEL_3);//PA19
HAL_SetPwmCompareValue(&pwmChannel0, b);
#else
pwmChannel0.channelMask = (1 << PWM_CHANNEL_2);
HAL_SetPwmCompareValue(&pwmChannel0, b);