LED inverted

Display brightness set to max

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@479 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
mmi
2018-03-26 09:00:38 +00:00
parent 8fecd7ef99
commit da411065e8
2 changed files with 23 additions and 9 deletions

View File

@@ -80,15 +80,19 @@ ErrorStatus Led_construct(struct Gpio* onboardGreen, struct Gpio* onboardOrange,
self.leds[LED_ONBOARD_GREEN].ioDevice = &onboardGreen->device; self.leds[LED_ONBOARD_GREEN].ioDevice = &onboardGreen->device;
self.leds[LED_ONBOARD_GREEN].initialized = true; self.leds[LED_ONBOARD_GREEN].initialized = true;
Led_off(LED_ONBOARD_GREEN);
self.leds[LED_ONBOARD_ORANGE].ioDevice = &onboardOrange->device; self.leds[LED_ONBOARD_ORANGE].ioDevice = &onboardOrange->device;
self.leds[LED_ONBOARD_ORANGE].initialized = true; self.leds[LED_ONBOARD_ORANGE].initialized = true;
Led_off(LED_ONBOARD_ORANGE);
self.leds[LED_BICOLOR_GREEN].ioDevice = &bicolourGreen->device; self.leds[LED_BICOLOR_GREEN].ioDevice = &bicolourGreen->device;
self.leds[LED_BICOLOR_GREEN].initialized = true; self.leds[LED_BICOLOR_GREEN].initialized = true;
Led_off(LED_BICOLOR_GREEN);
self.leds[LED_BICOLOR_RED].ioDevice = &bicolourRed->device; self.leds[LED_BICOLOR_RED].ioDevice = &bicolourRed->device;
self.leds[LED_BICOLOR_RED].initialized = true; self.leds[LED_BICOLOR_RED].initialized = true;
Led_off(LED_BICOLOR_RED);
} }
else else
{ {
@@ -110,18 +114,18 @@ extern void Led_on(Led led)
// IN case of the BICOLOUR LED, actually the GREEN and RED LEDs must be switched // IN case of the BICOLOUR LED, actually the GREEN and RED LEDs must be switched
if (led == LED_BICOLOR_ORANGE) if (led == LED_BICOLOR_ORANGE)
{ {
IODevice_write(self.leds[LED_BICOLOR_GREEN].ioDevice, &bufferTrue, 1); IODevice_write(self.leds[LED_BICOLOR_GREEN].ioDevice, &bufferFalse, 1);
IODevice_write(self.leds[LED_BICOLOR_RED].ioDevice, &bufferTrue, 1); IODevice_write(self.leds[LED_BICOLOR_RED].ioDevice, &bufferFalse, 1);
} }
else if (led == LED_BICOLOR_GREEN) else if (led == LED_BICOLOR_GREEN)
{ {
IODevice_write(self.leds[LED_BICOLOR_GREEN].ioDevice, &bufferTrue, 1); IODevice_write(self.leds[LED_BICOLOR_GREEN].ioDevice, &bufferFalse, 1);
IODevice_write(self.leds[LED_BICOLOR_RED].ioDevice, &bufferFalse, 1); IODevice_write(self.leds[LED_BICOLOR_RED].ioDevice, &bufferTrue, 1);
} }
else if (led == LED_BICOLOR_RED) else if (led == LED_BICOLOR_RED)
{ {
IODevice_write(self.leds[LED_BICOLOR_GREEN].ioDevice, &bufferFalse, 1); IODevice_write(self.leds[LED_BICOLOR_GREEN].ioDevice, &bufferTrue, 1);
IODevice_write(self.leds[LED_BICOLOR_RED].ioDevice, &bufferTrue, 1); IODevice_write(self.leds[LED_BICOLOR_RED].ioDevice, &bufferFalse, 1);
} }
else else
{ {
@@ -135,7 +139,9 @@ extern void Led_on(Led led)
extern void Led_off(Led led) extern void Led_off(Led led)
{ {
char bufferTrue = (char)true;
char bufferFalse = (char)false; char bufferFalse = (char)false;
if (self.initialized) if (self.initialized)
{ {
if (self.leds[led].initialized) if (self.leds[led].initialized)
@@ -143,8 +149,16 @@ extern void Led_off(Led led)
// IN case of the BICOLOUR ORANGE LED, actually the GREEN and RED LEDs must be switched // IN case of the BICOLOUR ORANGE LED, actually the GREEN and RED LEDs must be switched
if (led == LED_BICOLOR_ORANGE) if (led == LED_BICOLOR_ORANGE)
{ {
IODevice_write(self.leds[LED_BICOLOR_GREEN].ioDevice, &bufferFalse, 1); IODevice_write(self.leds[LED_BICOLOR_GREEN].ioDevice, &bufferTrue, 1);
IODevice_write(self.leds[LED_BICOLOR_RED].ioDevice, &bufferFalse, 1); IODevice_write(self.leds[LED_BICOLOR_RED].ioDevice, &bufferTrue, 1);
}
else if (led == LED_BICOLOR_GREEN)
{
IODevice_write(self.leds[LED_BICOLOR_GREEN].ioDevice, &bufferTrue, 1);
}
else if (led == LED_BICOLOR_RED)
{
IODevice_write(self.leds[LED_BICOLOR_RED].ioDevice, &bufferTrue, 1);
} }
else else

View File

@@ -42,7 +42,7 @@
#define MAINDISP_REFRESH_FEED_MS (1000) #define MAINDISP_REFRESH_FEED_MS (1000)
#define MAINDISP_REFRESH_PERIOD (5000) #define MAINDISP_REFRESH_PERIOD (5000)
#define MAINDISP_DEFAULT_BRIGHTNESS (5) // Set to MAX to avoid background light issue #define MAINDISP_DEFAULT_BRIGHTNESS (NHD0420_BRIGHTNESS_MAX) // Set to MAX to avoid background light issue
#define MAINDISP_DEFAULT_CONTRAST (40) #define MAINDISP_DEFAULT_CONTRAST (40)
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Type definitions // Type definitions