Fixed some initialisation issues
git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@237 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -66,15 +66,22 @@ ErrorStatus DisplayDevice_construct (struct DisplayDevice* self, struct DisplayD
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
self->_reset = reset;
|
||||
self->_setState = setState;
|
||||
self->_write = write;
|
||||
self->_clear = clear;
|
||||
self->_setBrightness = setBrightness;
|
||||
self->_setContrast = setContrast;
|
||||
self->_invert = invert;
|
||||
if (!self->initialized)
|
||||
{
|
||||
self->_reset = reset;
|
||||
self->_setState = setState;
|
||||
self->_write = write;
|
||||
self->_clear = clear;
|
||||
self->_setBrightness = setBrightness;
|
||||
self->_setContrast = setContrast;
|
||||
self->_invert = invert;
|
||||
|
||||
self->parameters = *parameters;
|
||||
self->parameters = *parameters;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
@@ -82,10 +89,16 @@ ErrorStatus DisplayDevice_construct (struct DisplayDevice* self, struct DisplayD
|
||||
ErrorStatus DisplayDevice_reset(const struct DisplayDevice* self)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (self->_reset != NULL)
|
||||
if (!self->initialized)
|
||||
{
|
||||
returnValue = self->_reset(self);
|
||||
if (self->_reset != NULL)
|
||||
{
|
||||
returnValue = self->_reset(self);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
@@ -94,10 +107,16 @@ ErrorStatus DisplayDevice_reset(const struct DisplayDevice* self)
|
||||
ErrorStatus DisplayDevice_setState(const struct DisplayDevice* self, DisplayDevice_functionalState state)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (self->_setState != NULL)
|
||||
if (!self->initialized)
|
||||
{
|
||||
returnValue = self->_setState(self, state);
|
||||
if (self->_setState != NULL)
|
||||
{
|
||||
returnValue = self->_setState(self, state);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
@@ -106,10 +125,16 @@ ErrorStatus DisplayDevice_setState(const struct DisplayDevice* self, DisplayDevi
|
||||
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)
|
||||
if (!self->initialized)
|
||||
{
|
||||
returnValue = self->_write(self, buffer, length, row, column);
|
||||
if (self->_write != NULL)
|
||||
{
|
||||
returnValue = self->_write(self, buffer, length, row, column);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
@@ -118,10 +143,16 @@ ErrorStatus DisplayDevice_write(const struct DisplayDevice* self, const char* bu
|
||||
ErrorStatus DisplayDevice_clear(const struct DisplayDevice* self)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (self->_clear != NULL)
|
||||
if (!self->initialized)
|
||||
{
|
||||
returnValue = self->_clear(self);
|
||||
if (self->_clear != NULL)
|
||||
{
|
||||
returnValue = self->_clear(self);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
@@ -130,10 +161,16 @@ ErrorStatus DisplayDevice_clear(const struct DisplayDevice* self)
|
||||
ErrorStatus DisplayDevice_setBrightness(const struct DisplayDevice* self, size_t brightness)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (self->_setBrightness != NULL)
|
||||
if (!self->initialized)
|
||||
{
|
||||
returnValue = self->_setBrightness(self, brightness);
|
||||
if (self->_setBrightness != NULL)
|
||||
{
|
||||
returnValue = self->_setBrightness(self, brightness);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
@@ -142,10 +179,16 @@ ErrorStatus DisplayDevice_setBrightness(const struct DisplayDevice* self, size_t
|
||||
ErrorStatus DisplayDevice_setContrast(const struct DisplayDevice* self, size_t contrast)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (self->_setContrast != NULL)
|
||||
if (!self->initialized)
|
||||
{
|
||||
returnValue = self->_setContrast(self, contrast);
|
||||
if (self->_setContrast != NULL)
|
||||
{
|
||||
returnValue = self->_setContrast(self, contrast);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
@@ -154,10 +197,16 @@ ErrorStatus DisplayDevice_setContrast(const struct DisplayDevice* self, size_t c
|
||||
ErrorStatus DisplayDevice_invert(const struct DisplayDevice* self)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (self->_invert != NULL)
|
||||
if (!self->initialized)
|
||||
{
|
||||
returnValue = self->_invert(self);
|
||||
if (self->_invert != NULL)
|
||||
{
|
||||
returnValue = self->_invert(self);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user