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;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ ErrorStatus MAX5715Channel_construct(struct MAX5715_DAC* self, struct MAX5715* p
|
||||
if (id < MAX5715_NUMBER_OF_DACS)
|
||||
{
|
||||
// Check that the parent has no channel already initialized on that ID
|
||||
if (!parent->dac[id].initialized)
|
||||
if ((!parent->dac[id].initialized) && (parent->initialized))
|
||||
{
|
||||
if (!self->initialized)
|
||||
{
|
||||
|
||||
@@ -79,18 +79,25 @@ ErrorStatus NHD0420_construct(struct NHD0420* self, const struct IODevice* devic
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (self->device == NULL)
|
||||
if (!self->initialized)
|
||||
{
|
||||
self->device = device;
|
||||
if (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);
|
||||
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
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -104,6 +111,7 @@ ErrorStatus NHD0420_construct(struct NHD0420* self, const struct IODevice* devic
|
||||
void NHD0420_destruct (struct NHD0420* self)
|
||||
{
|
||||
self->device = NULL;
|
||||
self->initialized = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -154,29 +162,34 @@ ErrorStatus NHD0420_getSpiParameters(struct SpiParameters* parameters)
|
||||
ErrorStatus NHD0420_setCursorToPosition(const struct NHD0420* self, size_t row, size_t column)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
if (!self->initialized)
|
||||
{
|
||||
// Setting cursor requires sending a command sequence with an additional
|
||||
// address parameter representing the line/column
|
||||
|
||||
// Setting cursor requires sending a command sequence with an additional
|
||||
// address parameter representing the line/column
|
||||
// Each line has a dedicated offset, the column is simply added to that offset
|
||||
// Make sure to keep within boundaries to avoid glitches
|
||||
|
||||
// Each line has a dedicated offset, the column is simply added to that offset
|
||||
// Make sure to keep within boundaries to avoid glitches
|
||||
row = row -1;
|
||||
column = column - 1;
|
||||
|
||||
row = row -1;
|
||||
column = column - 1;
|
||||
// Check the coordinates to avoid glitches
|
||||
if ((row >= NHD0420_NUMBER_OF_ROWS) && (column >= NHD0420_NUMBER_OF_COLUMNS))
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
|
||||
// Check the coordinates to avoid glitches
|
||||
if ((row >= NHD0420_NUMBER_OF_ROWS) && (column >= NHD0420_NUMBER_OF_COLUMNS))
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
char address = nhd0420_cursorRowOffset[(int)row] + column;
|
||||
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_CURSOR_SET, address};
|
||||
returnValue = NHD0420_sendData(self, buffer, 3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
char address = nhd0420_cursorRowOffset[(int)row] + column;
|
||||
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_CURSOR_SET, address};
|
||||
returnValue = NHD0420_sendData(self, buffer, 3);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@@ -184,25 +197,30 @@ ErrorStatus NHD0420_setCursorToPosition(const struct NHD0420* self, size_t row,
|
||||
ErrorStatus NHD0420_setContrast(const struct NHD0420* self, char contrast)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
if (!self->initialized)
|
||||
{
|
||||
// Setting contrast requires sending a command sequence with an additional
|
||||
// parameter representing the contrast
|
||||
// Contrast values must be between NHD0420_CONTRAST_MIN and
|
||||
// NHD0420_CONTRAST_MAX. If boundaries are exceeded, this function will be
|
||||
// left with an ERROR
|
||||
|
||||
// Setting contrast requires sending a command sequence with an additional
|
||||
// parameter representing the contrast
|
||||
// Contrast values must be between NHD0420_CONTRAST_MIN and
|
||||
// NHD0420_CONTRAST_MAX. If boundaries are exceeded, this function will be
|
||||
// left with an ERROR
|
||||
if ((contrast < NHD0420_CONTRAST_MIN) || (contrast > NHD0420_CONTRAST_MAX))
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
|
||||
if ((contrast < NHD0420_CONTRAST_MIN) || (contrast > NHD0420_CONTRAST_MAX))
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_SET_CONTRAST, contrast};
|
||||
returnValue = NHD0420_sendData(self, buffer, 3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_SET_CONTRAST, contrast};
|
||||
returnValue = NHD0420_sendData(self, buffer, 3);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@@ -210,25 +228,30 @@ ErrorStatus NHD0420_setContrast(const struct NHD0420* self, char contrast)
|
||||
ErrorStatus NHD0420_setBacklightBrightness(const struct NHD0420* self, char brightness)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
if (!self->initialized)
|
||||
{
|
||||
// Setting backlight brightness requires sending a command sequence with an
|
||||
// additional parameter representing the brightness
|
||||
// Brightness values must be between NHD0420_BRIGHTNESS_MIN and
|
||||
// NHD0420_BRIGHTNESS_MAX. If boundaries are exceeded, this function will be
|
||||
// left with an ERROR
|
||||
|
||||
// Setting backlight brightness requires sending a command sequence with an
|
||||
// additional parameter representing the brightness
|
||||
// Brightness values must be between NHD0420_BRIGHTNESS_MIN and
|
||||
// NHD0420_BRIGHTNESS_MAX. If boundaries are exceeded, this function will be
|
||||
// left with an ERROR
|
||||
if ((brightness < NHD0420_BRIGHTNESS_MIN) || (brightness > NHD0420_BRIGHTNESS_MAX))
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
|
||||
if ((brightness < NHD0420_BRIGHTNESS_MIN) || (brightness > NHD0420_BRIGHTNESS_MAX))
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_SET_BRIGHTNESS, brightness};
|
||||
returnValue = NHD0420_sendData(self, buffer, 3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_SET_BRIGHTNESS, brightness};
|
||||
returnValue = NHD0420_sendData(self, buffer, 3);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@@ -236,23 +259,29 @@ ErrorStatus NHD0420_setBacklightBrightness(const struct NHD0420* self, char brig
|
||||
ErrorStatus NHD0420_setRS232Baudrate(const struct NHD0420* self, char baudrate)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (!self->initialized)
|
||||
{
|
||||
// Setting baudrate requires sending a command sequence with an
|
||||
// additional parameter representing the baudrate
|
||||
// Baudrate values must be between NHD0420_BAUDRATE_MIN and
|
||||
// NHD0420_BAUDRATE_MAX. If boundaries are exceeded, this function will be
|
||||
// left with an ERROR
|
||||
|
||||
if ((baudrate < NHD0420_BAUDRATE_MIN) || (baudrate > NHD0420_BAUDRATE_MAX))
|
||||
if ((baudrate < NHD0420_BAUDRATE_MIN) || (baudrate > NHD0420_BAUDRATE_MAX))
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_CHANGE_RS232_BR, baudrate};
|
||||
returnValue = NHD0420_sendData(self, buffer, 3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_CHANGE_RS232_BR, baudrate};
|
||||
returnValue = NHD0420_sendData(self, buffer, 3);
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@@ -260,23 +289,29 @@ ErrorStatus NHD0420_setRS232Baudrate(const struct NHD0420* self, char baudrate)
|
||||
ErrorStatus NHD0420_setI2CAddress(const struct NHD0420* self, char address)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
if (!self->initialized)
|
||||
{
|
||||
// Setting I2C requires sending a command sequence with an
|
||||
// additional parameter representing the address
|
||||
// Baudrate values must be between NHD0420_BAUDRATE_MIN and
|
||||
// NHD0420_BAUDRATE_MAX. If boundaries are exeeded, this function will be
|
||||
// left with an ERROR
|
||||
|
||||
// Setting I2C requires sending a command sequence with an
|
||||
// additional parameter representing the address
|
||||
// Baudrate values must be between NHD0420_BAUDRATE_MIN and
|
||||
// NHD0420_BAUDRATE_MAX. If boundaries are exeeded, this function will be
|
||||
// left with an ERROR
|
||||
if ((address | 0xFE) != 0xFE)
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
|
||||
if ((address | 0xFE) != 0xFE)
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_CHANGE_I2C_ADDRSS, address};
|
||||
returnValue = NHD0420_sendData(self, buffer, 3);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_CHANGE_I2C_ADDRSS, address};
|
||||
returnValue = NHD0420_sendData(self, buffer, 3);
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@@ -295,11 +330,16 @@ ErrorStatus NHD0420_setI2CAddress(const struct NHD0420* self, char address)
|
||||
ErrorStatus NHD0420_sendCommand(const struct NHD0420* self, char command)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
if (!self->initialized)
|
||||
{
|
||||
char buffer[NHD0420_CMD_LENGTH] = {NHD0420_CMD_PREFIX, command};
|
||||
|
||||
char buffer[NHD0420_CMD_LENGTH] = {NHD0420_CMD_PREFIX, command};
|
||||
|
||||
returnValue = IODevice_write(self->device, buffer, NHD0420_CMD_LENGTH);
|
||||
|
||||
returnValue = IODevice_write(self->device, buffer, NHD0420_CMD_LENGTH);
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@@ -307,28 +347,36 @@ ErrorStatus NHD0420_sendCommand(const struct NHD0420* self, char command)
|
||||
ErrorStatus NHD0420_sendData(const struct NHD0420* self, const char* buffer, size_t length)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
returnValue = IODevice_write(self->device, buffer, length);
|
||||
|
||||
if (!self->initialized)
|
||||
{
|
||||
returnValue = IODevice_write(self->device, buffer, length);
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static ErrorStatus setState(const struct DisplayDevice* self, DisplayDevice_functionalState state)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
if (state == ON)
|
||||
if (!self->initialized)
|
||||
{
|
||||
returnValue = NHD0420_turnOnDisplay((const struct NHD0420*)self);
|
||||
if (state == ON)
|
||||
{
|
||||
returnValue = NHD0420_turnOnDisplay((const struct NHD0420*)self);
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = NHD0420_turnOffDisplay((const struct NHD0420*)self);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = NHD0420_turnOffDisplay((const struct NHD0420*)self);
|
||||
returnValue = ERROR;
|
||||
}
|
||||
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@@ -336,33 +384,61 @@ static ErrorStatus setState(const struct DisplayDevice* self, DisplayDevice_func
|
||||
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)
|
||||
if (!self->initialized)
|
||||
{
|
||||
returnValue = NHD0420_sendData((const struct NHD0420*)self, buffer, length);
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
static ErrorStatus clear(const struct DisplayDevice* self)
|
||||
{
|
||||
return NHD0420_clearScreen((const struct NHD0420*)self);
|
||||
if (!self->initialized)
|
||||
{
|
||||
return NHD0420_clearScreen((const struct NHD0420*)self);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static ErrorStatus setBrightness(const struct DisplayDevice* self, size_t brightness)
|
||||
{
|
||||
return NHD0420_setBacklightBrightness((const struct NHD0420*)self, brightness);
|
||||
if (!self->initialized)
|
||||
{
|
||||
return NHD0420_setBacklightBrightness((const struct NHD0420*)self, brightness);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static ErrorStatus setContrast(const struct DisplayDevice* self, size_t contrast)
|
||||
{
|
||||
return NHD0420_setContrast((const struct NHD0420*)self, contrast);
|
||||
if (!self->initialized)
|
||||
{
|
||||
return NHD0420_setContrast((const struct NHD0420*)self, contrast);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user