ADC debugged and functional now
Added Version interface Added DisplayDevice to create an independent bridge between display app and specific display driver git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@228 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -0,0 +1,163 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file DisplayDevice.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 DisplayDevice.c
|
||||
/// @ingroup {group_name}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "DisplayDevice.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// File-scope variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
ErrorStatus DisplayDevice_construct (struct DisplayDevice* self, struct DisplayDeviceParameters* parameters,
|
||||
DisplayResetFunction reset,
|
||||
DisplaySetStateFunction setState,
|
||||
DisplayWriteFunction write,
|
||||
DisplayClearFunction clear,
|
||||
DisplaySetBrightnessFunction setBrightness,
|
||||
DisplaySetContrastFunction setContrast,
|
||||
DisplayInvertFunction invert)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
self->_reset = reset;
|
||||
self->_setState = setState;
|
||||
self->_write = write;
|
||||
self->_clear = clear;
|
||||
self->_setBrightness = setBrightness;
|
||||
self->_setContrast = setContrast;
|
||||
self->_invert = invert;
|
||||
|
||||
self->parameters = *parameters;
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
ErrorStatus DisplayDevice_reset(const struct DisplayDevice* self)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (self->_reset != NULL)
|
||||
{
|
||||
returnValue = self->_reset(self);
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus DisplayDevice_setState(const struct DisplayDevice* self, DisplayDevice_functionalState state)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (self->_setState != NULL)
|
||||
{
|
||||
returnValue = self->_setState(self, state);
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus DisplayDevice_write(const struct DisplayDevice* self, const char* buffer, size_t length, size_t row, size_t column)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (self->_write != NULL)
|
||||
{
|
||||
returnValue = self->_write(self, buffer, length, row, column);
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus DisplayDevice_clear(const struct DisplayDevice* self)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (self->_clear != NULL)
|
||||
{
|
||||
returnValue = self->_clear(self);
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus DisplayDevice_setBrightness(const struct DisplayDevice* self, size_t brightness)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (self->_setBrightness != NULL)
|
||||
{
|
||||
returnValue = self->_setBrightness(self, brightness);
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus DisplayDevice_setContrast(const struct DisplayDevice* self, size_t contrast)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (self->_setContrast != NULL)
|
||||
{
|
||||
returnValue = self->_setContrast(self, contrast);
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus DisplayDevice_invert(const struct DisplayDevice* self)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (self->_invert != NULL)
|
||||
{
|
||||
returnValue = self->_invert(self);
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
Reference in New Issue
Block a user