Clean up uniform brightness setting
This commit is contained in:
parent
fc5f7caa14
commit
ccfdd7aeab
|
@ -1 +1 @@
|
||||||
263
|
264
|
||||||
|
|
14
src/main.c
14
src/main.c
|
@ -13,7 +13,6 @@ int main(void)
|
||||||
|
|
||||||
LED_Init();
|
LED_Init();
|
||||||
|
|
||||||
int ct = 0;
|
|
||||||
uint8_t *data = (uint8_t*)LED_PixelData;
|
uint8_t *data = (uint8_t*)LED_PixelData;
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
|
@ -22,16 +21,13 @@ int main(void)
|
||||||
uint8_t brightness = LightSensor_RelativeBrightness * 255;
|
uint8_t brightness = LightSensor_RelativeBrightness * 255;
|
||||||
if(LED_FrameFlag)
|
if(LED_FrameFlag)
|
||||||
{
|
{
|
||||||
LED_FrameFlag = false;
|
for(int i = 0; i < LED_COLUMNS * LED_ROWS; i++)
|
||||||
data[ct] = brightness;
|
|
||||||
LED_Commit();
|
|
||||||
|
|
||||||
ct += 3;
|
|
||||||
if(ct >= LED_COLUMNS * LED_ROWS)
|
|
||||||
{
|
{
|
||||||
ct -= LED_COLUMNS * LED_ROWS;
|
data[i] = brightness;
|
||||||
ct += 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LED_FrameFlag = false;
|
||||||
|
LED_Commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue