Display brightness set to max git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@479 05563f52-14a8-4384-a975-3d1654cca0fa
136 lines
4.1 KiB
C
136 lines
4.1 KiB
C
// -----------------------------------------------------------------------------
|
|
/// @file Displays.c
|
|
/// @brief Description
|
|
// -----------------------------------------------------------------------------
|
|
// Micro-Key bv
|
|
// Industrieweg 28, 9804 TG Noordhorn
|
|
// Postbus 92, 9800 AB Zuidhorn
|
|
// The Netherlands
|
|
// Tel: +31 594 503020
|
|
// Fax: +31 594 505825
|
|
// Email: support@microkey.nl
|
|
// Web: www.microkey.nl
|
|
// -----------------------------------------------------------------------------
|
|
/// $Revision$
|
|
/// $Author$
|
|
/// $Date$
|
|
// (c) 2017 Micro-Key bv
|
|
// -----------------------------------------------------------------------------
|
|
|
|
/// @file Displays.c
|
|
/// @ingroup {group_name}
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Include files
|
|
// -----------------------------------------------------------------------------
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "stm32f10x.h"
|
|
#include "Displays.h"
|
|
#include "hsb-mrts.h"
|
|
|
|
#include "platform.h"
|
|
#include "nhd0420.h"
|
|
#include "rtc.h"
|
|
// -----------------------------------------------------------------------------
|
|
// Constant and macro definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
#define MAINDISP_MAX_CHAR_CHUNK (10)
|
|
#define MAINDISP_REFRESH_FEED_MS (1000)
|
|
#define MAINDISP_REFRESH_PERIOD (5000)
|
|
|
|
#define MAINDISP_DEFAULT_BRIGHTNESS (NHD0420_BRIGHTNESS_MAX) // Set to MAX to avoid background light issue
|
|
#define MAINDISP_DEFAULT_CONTRAST (40)
|
|
// -----------------------------------------------------------------------------
|
|
// Type definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// File-scope variables
|
|
// -----------------------------------------------------------------------------
|
|
|
|
static struct Display _mainDisplay = {.initialized = false};
|
|
struct Display* const mainDisplay = &_mainDisplay;
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Function declarations
|
|
// -----------------------------------------------------------------------------
|
|
|
|
static ErrorStatus Displays_initMainDisplay(void);
|
|
static ErrorStatus Displays_mainDisplayObserverFromISR(const void* const data);
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Function definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
ErrorStatus Displays_construct(void)
|
|
{
|
|
ErrorStatus returnValue = SUCCESS;
|
|
|
|
if (returnValue == SUCCESS)
|
|
{
|
|
returnValue = Displays_initMainDisplay();
|
|
}
|
|
|
|
return returnValue;
|
|
}
|
|
|
|
|
|
extern void Displays_destruct(void)
|
|
{
|
|
Observable_deleteObserver(RTC_getObservable(rtc), Displays_mainDisplayObserverFromISR);
|
|
Display_destruct(mainDisplay);
|
|
}
|
|
|
|
|
|
static ErrorStatus Displays_initMainDisplay(void)
|
|
{
|
|
ErrorStatus returnValue = SUCCESS;
|
|
|
|
if (returnValue == SUCCESS)
|
|
{
|
|
returnValue = Display_construct(mainDisplay, &nhd0420->displayDevice, HSB_MAINDISP_TASK_PRIORITY, HSB_MAINDISP_TASK_STACKSIZE, MAINDISP_MAX_CHAR_CHUNK, MAINDISP_REFRESH_FEED_MS, MAINDISP_REFRESH_PERIOD);
|
|
}
|
|
|
|
if (returnValue == SUCCESS)
|
|
{
|
|
returnValue = Observable_addObserver(RTC_getObservable(rtc), Displays_mainDisplayObserverFromISR);
|
|
}
|
|
|
|
if (returnValue == SUCCESS)
|
|
{
|
|
returnValue = Display_setBlinkingCursorState(mainDisplay, OFF);
|
|
}
|
|
|
|
if (returnValue == SUCCESS)
|
|
{
|
|
returnValue = Display_clearScreen(mainDisplay);
|
|
}
|
|
|
|
if (returnValue == SUCCESS)
|
|
{
|
|
returnValue = Display_setBrightness(mainDisplay, MAINDISP_DEFAULT_BRIGHTNESS);
|
|
}
|
|
|
|
if (returnValue == SUCCESS)
|
|
{
|
|
returnValue = Display_setContrast(mainDisplay, MAINDISP_DEFAULT_CONTRAST);
|
|
}
|
|
|
|
return returnValue;
|
|
}
|
|
|
|
|
|
static ErrorStatus Displays_mainDisplayObserverFromISR(const void* const data)
|
|
{
|
|
Display_feedRefreshCounterFromISR(mainDisplay);
|
|
return SUCCESS;
|
|
}
|
|
|
|
|