microbit: improved appearance of greyscale

The impact of the pixels at lower values was  not distinct enough
this commit adds a blocking wait for the first two timings for
greyscale.

Additionally, this commit  modifies the timings const array to
take into account the time taken for renderGreyscale to execute.
master
James Devine 2016-02-02 17:05:59 +00:00
parent 3596f3d842
commit f546da66e8
1 changed files with 7 additions and 1 deletions

View File

@ -8,7 +8,7 @@
#include "MicroBitMatrixMaps.h"
#include "nrf_gpio.h"
const int timings[MICROBIT_DISPLAY_GREYSCALE_BIT_DEPTH] = {10, 47, 94, 187, 375, 750, 1500, 3000};
const int timings[MICROBIT_DISPLAY_GREYSCALE_BIT_DEPTH] = {1, 23, 70, 163, 351, 726, 1476, 2976};
/**
* Constructor.
@ -222,6 +222,12 @@ void MicroBitDisplay::renderGreyscale()
greyscaleBitMsk <<= 1;
if(timingCount < 3)
{
wait_us(timings[timingCount++]);
renderGreyscale();
return;
}
renderTimer.attach_us(this,&MicroBitDisplay::renderGreyscale, timings[timingCount++]);
}