Continued work on MAX5715. MACRO functions are done, mostly tested in logic analyzer. SPI unable to work with hardware SS, so software SS is used instead
Added UART3 on PB10/PB11 for terminal (future use) git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@225 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -70,17 +70,26 @@ static int nhd0420_cursorRowOffset[NHD0420_NUMBER_OF_ROWS] =
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
ErrorStatus NHD0420_construct(const struct IODevice* const device)
|
||||
ErrorStatus NHD0420_construct(struct NHD0420* self, const struct IODevice* device)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (self->device == NULL)
|
||||
{
|
||||
self->device = device;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
void NHD0420_destruct (const struct IODevice* self)
|
||||
void NHD0420_destruct (struct NHD0420* self)
|
||||
{
|
||||
|
||||
self->device = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,6 +127,7 @@ ErrorStatus NHD0420_getSpiParameters(struct SpiParameters* parameters)
|
||||
parameters->SPI_FirstBit = NHD0420_SPI_FirstBit;
|
||||
parameters->SPI_Mode = NHD0420_SPI_Mode;
|
||||
parameters->SPI_NSS = NHD0420_SPI_NSS;
|
||||
parameters->SPI_NSS_internal = NHD0420_SPI_NSS_INTERNAL;
|
||||
parameters->rxQueueSize = NHD0420_SPI_RX_QUEUE;
|
||||
parameters->txQueueSize = NHD0420_SPI_TX_QUEUE;
|
||||
}
|
||||
@@ -127,7 +137,7 @@ ErrorStatus NHD0420_getSpiParameters(struct SpiParameters* parameters)
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus NHD0420_setCursorToPosition(const struct IODevice* self, char row, char column)
|
||||
ErrorStatus NHD0420_setCursorToPosition(const struct NHD0420* self, char row, char column)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
@@ -157,7 +167,7 @@ ErrorStatus NHD0420_setCursorToPosition(const struct IODevice* self, char row, c
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus NHD0420_setContrast(const struct IODevice* self, char contrast)
|
||||
ErrorStatus NHD0420_setContrast(const struct NHD0420* self, char contrast)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
@@ -183,7 +193,7 @@ ErrorStatus NHD0420_setContrast(const struct IODevice* self, char contrast)
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus NHD0420_setBacklightBrightness(const struct IODevice* self, char brightness)
|
||||
ErrorStatus NHD0420_setBacklightBrightness(const struct NHD0420* self, char brightness)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
@@ -209,7 +219,7 @@ ErrorStatus NHD0420_setBacklightBrightness(const struct IODevice* self, char bri
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus NHD0420_setRS232Baudrate(const struct IODevice* self, char baudrate)
|
||||
ErrorStatus NHD0420_setRS232Baudrate(const struct NHD0420* self, char baudrate)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
@@ -233,7 +243,7 @@ ErrorStatus NHD0420_setRS232Baudrate(const struct IODevice* self, char baudrate)
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus NHD0420_setI2CAddress(const struct IODevice* self, char address)
|
||||
ErrorStatus NHD0420_setI2CAddress(const struct NHD0420* self, char address)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
@@ -268,23 +278,23 @@ ErrorStatus NHD0420_setI2CAddress(const struct IODevice* self, char address)
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
ErrorStatus NHD0420_sendCommand(const struct IODevice* self, char command)
|
||||
ErrorStatus NHD0420_sendCommand(const struct NHD0420* self, char command)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
char buffer[NHD0420_CMD_LENGTH] = {NHD0420_CMD_PREFIX, command};
|
||||
|
||||
returnValue = IODevice_write(self, buffer, NHD0420_CMD_LENGTH);
|
||||
returnValue = IODevice_write(self->device, buffer, NHD0420_CMD_LENGTH);
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus NHD0420_sendData(const struct IODevice* self, const char* buffer, size_t length)
|
||||
ErrorStatus NHD0420_sendData(const struct NHD0420* self, const char* buffer, size_t length)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
returnValue = IODevice_write(self, buffer, length);
|
||||
returnValue = IODevice_write(self->device, buffer, length);
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user