keypad functional
started with external DAC implementation git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@224 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -60,8 +60,6 @@ static int nhd0420_cursorRowOffset[NHD0420_NUMBER_OF_ROWS] =
|
||||
NHD0420_CURSOR_OFFSET_ROW4
|
||||
};
|
||||
|
||||
static const struct IODevice* displayDevice = NULL;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -76,20 +74,11 @@ ErrorStatus NHD0420_construct(const struct IODevice* const device)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (displayDevice == NULL)
|
||||
{
|
||||
displayDevice = device;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
void NHD0420_destruct (void)
|
||||
void NHD0420_destruct (const struct IODevice* self)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -138,7 +127,7 @@ ErrorStatus NHD0420_getSpiParameters(struct SpiParameters* parameters)
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus NHD0420_setCursorToPosition(char row, char column)
|
||||
ErrorStatus NHD0420_setCursorToPosition(const struct IODevice* self, char row, char column)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
@@ -161,14 +150,14 @@ ErrorStatus NHD0420_setCursorToPosition(char row, char column)
|
||||
{
|
||||
char address = nhd0420_cursorRowOffset[(int)row] + column;
|
||||
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_CURSOR_SET, address};
|
||||
returnValue = NHD0420_sendData(buffer, 3);
|
||||
returnValue = NHD0420_sendData(self, buffer, 3);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus NHD0420_setContrast(char contrast)
|
||||
ErrorStatus NHD0420_setContrast(const struct IODevice* self, char contrast)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
@@ -187,14 +176,14 @@ ErrorStatus NHD0420_setContrast(char contrast)
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_SET_CONTRAST, contrast};
|
||||
returnValue = NHD0420_sendData(buffer, 3);
|
||||
returnValue = NHD0420_sendData(self, buffer, 3);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus NHD0420_setBacklightBrightness(char brightness)
|
||||
ErrorStatus NHD0420_setBacklightBrightness(const struct IODevice* self, char brightness)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
@@ -213,14 +202,14 @@ ErrorStatus NHD0420_setBacklightBrightness(char brightness)
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_SET_BRIGHTNESS, brightness};
|
||||
returnValue = NHD0420_sendData(buffer, 3);
|
||||
returnValue = NHD0420_sendData(self, buffer, 3);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus NHD0420_setRS232Baudrate(char baudrate)
|
||||
ErrorStatus NHD0420_setRS232Baudrate(const struct IODevice* self, char baudrate)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
@@ -238,13 +227,13 @@ ErrorStatus NHD0420_setRS232Baudrate(char baudrate)
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_CHANGE_RS232_BR, baudrate};
|
||||
returnValue = NHD0420_sendData(buffer, 3);
|
||||
returnValue = NHD0420_sendData(self, buffer, 3);
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus NHD0420_setI2CAddress(char address)
|
||||
ErrorStatus NHD0420_setI2CAddress(const struct IODevice* self, char address)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
@@ -262,7 +251,7 @@ ErrorStatus NHD0420_setI2CAddress(char address)
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
char buffer[3] = {NHD0420_CMD_PREFIX, NHD0420_CMD_CHANGE_I2C_ADDRSS, address};
|
||||
returnValue = NHD0420_sendData(buffer, 3);
|
||||
returnValue = NHD0420_sendData(self, buffer, 3);
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
@@ -279,23 +268,23 @@ ErrorStatus NHD0420_setI2CAddress(char address)
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
ErrorStatus NHD0420_sendCommand(char command)
|
||||
ErrorStatus NHD0420_sendCommand(const struct IODevice* self, char command)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
char buffer[NHD0420_CMD_LENGTH] = {NHD0420_CMD_PREFIX, command};
|
||||
|
||||
returnValue = IODevice_write(displayDevice, buffer, NHD0420_CMD_LENGTH);
|
||||
returnValue = IODevice_write(self, buffer, NHD0420_CMD_LENGTH);
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus NHD0420_sendData(const char* buffer, size_t length)
|
||||
ErrorStatus NHD0420_sendData(const struct IODevice* self, const char* buffer, size_t length)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
returnValue = IODevice_write(displayDevice, buffer, length);
|
||||
returnValue = IODevice_write(self, buffer, length);
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user