Could be working version
This commit is contained in:
@@ -152,4 +152,13 @@ uint16_t util::percent_to_16b(uint8_t percent)
|
||||
return pwm;
|
||||
}
|
||||
|
||||
uint16_t util::percent_of(uint8_t percent, uint16_t value)
|
||||
{
|
||||
if(percent == 0) return 0;
|
||||
else if(percent >= 100) return value;
|
||||
|
||||
uint32_t temp = (uint32_t)value * percent;
|
||||
return temp/100;
|
||||
}
|
||||
|
||||
/**** Private function definitions ****/
|
||||
Reference in New Issue
Block a user