Hello, everyone!!
I am doing a project that use an arduino board as a controller for small LED display. LED driver IC is MBI5042 which has 16-bit color depth PWMs.
My task at the moment is converting 8-bit source data to gamma-corrected 16-bit data.
I simply wrote a routine for this.
void gamma12(int i) {
value = pow(float(i)*16/4096,2.2)*65536;
// 'i' is a 8-bit source value, 0 to 255 and gamma 2.2
}
The number 16 in the code can be changed to 12, if I want to use 75% of PWM depth.
This code is called several hundred times in a loop.
Please, check this and let me know it is good or bad solution.