ARMEBS4  revision-26.06.2015
lightness_to_pwm.h
Go to the documentation of this file.
1 /************************************************************************//**
2  * \file heivs/lightness_to_pwm.h
3  * \brief Handle non-linearity in human eye brightness sensitivity
4  * \author marc dot pignat at hevs dot ch
5  * \ingroup libheivs_stm32_misc
6  * @{
7  ***************************************************************************/
8 #ifndef HEIVS_PWM_LED_VALUES_H
9 #define HEIVS_PWM_LED_VALUES_H
10 
11 #include <stdint.h>
12 #include "heivs/error.h"
13 
14 #ifdef __cplusplus
15  extern "C" {
16 #endif
17 
18 /**
19  * \brief Number a step for a pwm using lightness_to_pwm
20  */
21 #define LIGHTNESS_PWM_STEP 255
22 
23 /**
24  * \brief PWM value for driving a LED expressed as perceived percentage
25  *
26  * \param percentage expected of luminosity (0..100)
27  *
28  * \return the value to be put in a 0..LIGHTNESS_PWM_STEP pwm
29  */
30 uint8_t lightness_to_pwm(uint8_t percentage);
31 
32 #ifdef __cplusplus
33  }
34 #endif
35 
36 /**
37  * @}
38  */
39 #endif /* HEIVS_PWM_LED_VALUES_H */
uint8_t lightness_to_pwm(uint8_t percentage)
PWM value for driving a LED expressed as perceived percentage.
Errors definitions.