eBoard ①⑧⑨
Written for SIA 2017/2018
eagle_Comfort.h
Go to the documentation of this file.
1 #ifndef EAGLE_EBOARD_HELPLIB_COMFORT
2  #define EAGLE_EBOARD_HELPLIB_COMFORT
3 
12 //=====================================================================================================================================================
13 // Comfort
14 //=====================================================================================================================================================
15 
16  //-------------------------------------------------------------------------------------------------------------------------------------------------
17  // sine8
18  //-------------------------------------------------------------------------------------------------------------------------------------------------
19 
25  inline int sine8(uint8_t val);
26 
27  //-------------------------------------------------------------------------------------------------------------------------------------------------
28  // gamma8
29  //-------------------------------------------------------------------------------------------------------------------------------------------------
30 
36  inline int gamma8(uint8_t val);
37 
39  inline int sine8(uint8_t val){
40  return int((__builtin_sin((val/128.0*PI))+1)*127.5+0.5);
41  }
42 
43  inline int gamma8(uint8_t val){
44  return int(pow((val)/255.0,2.6)*255.0+0.5);
45  }
47 #endif
int sine8(uint8_t val)
will return the mapped 8-bit sin you can use in e.g. NeoPixel
int gamma8(uint8_t val)
will return the mapped 8-bit gamma correction you can use in e.g. NeoPixel