#include "PWMCtrl.h"
#include "BoardCfg.h"


void PWMSetValue(unsigned int percent)
{
    if(percent >  100)
        percent = 100;
#ifdef REVERSE_POLARITY
    percent = 100 - percent;
#endif
    
    LED_PWM_VAL_REG = ((PWM_RANGE_MAX / 100) * percent);
    
}

void PWMShutDown()
{
    PWMSetValue(0);
}

void PWMSetAbsoluteValue(unsigned int value)
{
    if(value > PWM_RANGE_MAX)
    {
        value = PWM_RANGE_MAX;
    }
    
    LED_PWM_VAL_REG = value;
    
}