From da411065e8c28fa88b7a34c1143d515e91a19bf4 Mon Sep 17 00:00:00 2001 From: mmi Date: Mon, 26 Mar 2018 09:00:38 +0000 Subject: [PATCH] LED inverted Display brightness set to max git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@479 05563f52-14a8-4384-a975-3d1654cca0fa --- .../0 - Code/HAL/src/Leds.c | 30 ++++++++++++++----- .../0 - Code/hsb-mrts/src/Displays.c | 2 +- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/Leds.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/Leds.c index 1dce736..c966cff 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/Leds.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/Leds.c @@ -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].initialized = true; + Led_off(LED_ONBOARD_GREEN); self.leds[LED_ONBOARD_ORANGE].ioDevice = &onboardOrange->device; 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].initialized = true; + Led_off(LED_BICOLOR_GREEN); self.leds[LED_BICOLOR_RED].ioDevice = &bicolourRed->device; self.leds[LED_BICOLOR_RED].initialized = true; + Led_off(LED_BICOLOR_RED); } 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 if (led == LED_BICOLOR_ORANGE) { - 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_GREEN].ioDevice, &bufferFalse, 1); + IODevice_write(self.leds[LED_BICOLOR_RED].ioDevice, &bufferFalse, 1); } else if (led == LED_BICOLOR_GREEN) { - 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_GREEN].ioDevice, &bufferFalse, 1); + IODevice_write(self.leds[LED_BICOLOR_RED].ioDevice, &bufferTrue, 1); } else if (led == LED_BICOLOR_RED) { - 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_GREEN].ioDevice, &bufferTrue, 1); + IODevice_write(self.leds[LED_BICOLOR_RED].ioDevice, &bufferFalse, 1); } else { @@ -135,7 +139,9 @@ extern void Led_on(Led led) extern void Led_off(Led led) { + char bufferTrue = (char)true; char bufferFalse = (char)false; + if (self.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 if (led == LED_BICOLOR_ORANGE) { - 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_GREEN].ioDevice, &bufferTrue, 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 diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/Displays.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/Displays.c index 80eb070..9522a6f 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/Displays.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/Displays.c @@ -42,7 +42,7 @@ #define MAINDISP_REFRESH_FEED_MS (1000) #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) // ----------------------------------------------------------------------------- // Type definitions