Fixed issue with external DAC handlign from repair process
repair process implemented. Simple regulation without feedback (must be addeed, yet) HW validation menu functional but buggy (IOs not OK) Added ClearLine functionality to displayDevice git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@244 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -60,6 +60,7 @@ ErrorStatus DisplayDevice_construct (struct DisplayDevice* self, struct DisplayD
|
||||
DisplaySetStateFunction setState,
|
||||
DisplayWriteFunction write,
|
||||
DisplayClearFunction clear,
|
||||
DisplayClearLineFunction clearLine,
|
||||
DisplaySetBrightnessFunction setBrightness,
|
||||
DisplaySetContrastFunction setContrast,
|
||||
DisplayInvertFunction invert)
|
||||
@@ -68,13 +69,14 @@ ErrorStatus DisplayDevice_construct (struct DisplayDevice* self, struct DisplayD
|
||||
|
||||
if (!self->initialized)
|
||||
{
|
||||
self->_reset = reset;
|
||||
self->_setState = setState;
|
||||
self->_write = write;
|
||||
self->_clear = clear;
|
||||
self->_reset = reset;
|
||||
self->_setState = setState;
|
||||
self->_write = write;
|
||||
self->_clear = clear;
|
||||
self->_clearLine = clearLine,
|
||||
self->_setBrightness = setBrightness;
|
||||
self->_setContrast = setContrast;
|
||||
self->_invert = invert;
|
||||
self->_setContrast = setContrast;
|
||||
self->_invert = invert;
|
||||
|
||||
self->parameters = *parameters;
|
||||
}
|
||||
@@ -158,6 +160,24 @@ ErrorStatus DisplayDevice_clear(const struct DisplayDevice* self)
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus DisplayDevice_clearLine(const struct DisplayDevice* self, size_t row)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
if (!self->initialized)
|
||||
{
|
||||
if (self->_clearLine != NULL)
|
||||
{
|
||||
returnValue = self->_clearLine(self, row);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus DisplayDevice_setBrightness(const struct DisplayDevice* self, size_t brightness)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file IODevice.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 IODevice.c
|
||||
/// @ingroup {group_name}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "IODevice.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// File-scope variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
ErrorStatus IODevice_construct (struct IODevice* self, ReadFunction read, WriteFunction write)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
self->_write = write;
|
||||
self->_read = read;
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
ErrorStatus IODevice_write(const struct IODevice* self, const char* buffer, size_t length)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (self->_write != NULL)
|
||||
{
|
||||
returnValue = self->_write(self, buffer, length);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus IODevice_read(const struct IODevice* self, char* buffer, size_t length, size_t* actualLength)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (self->_read != NULL)
|
||||
{
|
||||
returnValue = self->_read(self, buffer, length, actualLength);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
@@ -182,15 +182,29 @@ ErrorStatus MAX5715Channel_construct(struct MAX5715_DAC* self, struct MAX5715* p
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus MAX5715Channel_setValue(struct MAX5715_DAC* self, uint16_t value)
|
||||
ErrorStatus MAX5715Channel_setValue(const struct MAX5715_DAC* self, uint16_t value)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
// Send data to CODEn register
|
||||
MAX5715_writeCODEn(self->parent, self->id, value);
|
||||
if (self != NULL)
|
||||
{
|
||||
if ((self->initialized) && (self->parent->initialized))
|
||||
{
|
||||
// Send data to CODEn register
|
||||
MAX5715_writeCODEn(self->parent, self->id, value);
|
||||
|
||||
// Load CODEn register to DAC output
|
||||
MAX5715_writeLOADn(self->parent, self->id);
|
||||
// Load CODEn register to DAC output
|
||||
MAX5715_writeLOADn(self->parent, self->id);
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ static int nhd0420_cursorRowOffset[NHD0420_NUMBER_OF_ROWS] =
|
||||
static ErrorStatus setState(const struct DisplayDevice* self, DisplayDevice_functionalState state);
|
||||
static ErrorStatus write(const struct DisplayDevice* self, const char* buffer, size_t length, size_t row, size_t column);
|
||||
static ErrorStatus clear(const struct DisplayDevice* self);
|
||||
static ErrorStatus clearLine(const struct DisplayDevice* self);
|
||||
static ErrorStatus setBrightness(const struct DisplayDevice* self, size_t brightness);
|
||||
static ErrorStatus setContrast(const struct DisplayDevice* self, size_t contrast);
|
||||
|
||||
@@ -92,7 +93,7 @@ ErrorStatus NHD0420_construct(struct NHD0420* self, const struct IODevice* devic
|
||||
ddParameters.brightnessMax = NHD0420_BRIGHTNESS_MAX;
|
||||
ddParameters.contrastMin = NHD0420_CONTRAST_MIN;
|
||||
ddParameters.contrastMax = NHD0420_CONTRAST_MAX;
|
||||
DisplayDevice_construct(&self->displayDevice, &ddParameters, NULL, setState, write, clear, setBrightness, setContrast, NULL);
|
||||
DisplayDevice_construct(&self->displayDevice, &ddParameters, NULL, setState, write, clear, clearLine, setBrightness, setContrast, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -416,6 +417,31 @@ static ErrorStatus clear(const struct DisplayDevice* self)
|
||||
}
|
||||
|
||||
|
||||
static ErrorStatus clearLine(const struct DisplayDevice* self, size_t row)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (!self->initialized)
|
||||
{
|
||||
// Set cursor on display
|
||||
returnValue = NHD0420_setCursorToPosition((const struct NHD0420*)self, row, 1);
|
||||
|
||||
char buffer[self->parameters.numberOfColumns] = {0x20,};
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
returnValue = NHD0420_sendData((const struct NHD0420*)self, buffer, self->parameters.numberOfColumns);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
static ErrorStatus setBrightness(const struct DisplayDevice* self, size_t brightness)
|
||||
{
|
||||
if (!self->initialized)
|
||||
|
||||
Reference in New Issue
Block a user