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:
mmi
2017-10-04 09:06:16 +00:00
parent 802e9c64ca
commit c613e64e8a
24 changed files with 1147 additions and 231 deletions

View File

@@ -64,6 +64,11 @@ static int nhd0420_cursorRowOffset[NHD0420_NUMBER_OF_ROWS] =
// Function declarations
// -----------------------------------------------------------------------------
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 setBrightness(const struct DisplayDevice* self, size_t brightness);
static ErrorStatus setContrast(const struct DisplayDevice* self, size_t contrast);
// -----------------------------------------------------------------------------
// Function definitions
@@ -77,6 +82,15 @@ ErrorStatus NHD0420_construct(struct NHD0420* self, const struct IODevice* devic
if (self->device == NULL)
{
self->device = device;
struct DisplayDeviceParameters ddParameters;
ddParameters.numberOfRows = NHD0420_NUMBER_OF_ROWS;
ddParameters.numberOfColumns = NHD0420_NUMBER_OF_COLUMNS;
ddParameters.brightnessMin = NHD0420_BRIGHTNESS_MIN;
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);
}
else
{
@@ -137,7 +151,7 @@ ErrorStatus NHD0420_getSpiParameters(struct SpiParameters* parameters)
}
ErrorStatus NHD0420_setCursorToPosition(const struct NHD0420* self, char row, char column)
ErrorStatus NHD0420_setCursorToPosition(const struct NHD0420* self, size_t row, size_t column)
{
ErrorStatus returnValue = SUCCESS;
@@ -298,3 +312,57 @@ ErrorStatus NHD0420_sendData(const struct NHD0420* self, const char* buffer, siz
return returnValue;
}
static ErrorStatus setState(const struct DisplayDevice* self, DisplayDevice_functionalState state)
{
ErrorStatus returnValue = SUCCESS;
if (state == ON)
{
returnValue = NHD0420_turnOnDisplay((const struct NHD0420*)self);
}
else
{
returnValue = NHD0420_turnOffDisplay((const struct NHD0420*)self);
}
return returnValue;
}
static ErrorStatus write(const struct DisplayDevice* self, const char* buffer, size_t length, size_t row, size_t column)
{
ErrorStatus returnValue = SUCCESS;
// Set cursor on display
returnValue = NHD0420_setCursorToPosition((const struct NHD0420*)self, row, column);
if (returnValue == SUCCESS)
{
returnValue = NHD0420_sendData((const struct NHD0420*)self, buffer, length);
}
return returnValue;
}
static ErrorStatus clear(const struct DisplayDevice* self)
{
return NHD0420_clearScreen((const struct NHD0420*)self);
}
static ErrorStatus setBrightness(const struct DisplayDevice* self, size_t brightness)
{
return NHD0420_setBacklightBrightness((const struct NHD0420*)self, brightness);
}
static ErrorStatus setContrast(const struct DisplayDevice* self, size_t contrast)
{
return NHD0420_setContrast((const struct NHD0420*)self, contrast);
}