Fixed HW validation menu

Fixed some minor issues/bugs

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@284 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
mmi
2017-11-21 12:36:16 +00:00
parent 5ccc28e32d
commit ff01d92ea8
23 changed files with 395 additions and 182 deletions

View File

@@ -112,3 +112,9 @@ ErrorStatus CoverSolenoid_lock(void)
}
return returnValue;
}
struct Gpio* CoverSolenoid_getGpio(void)
{
return self.gpio;
}

View File

@@ -62,6 +62,7 @@ ErrorStatus DisplayDevice_construct (struct DisplayDevice* self, struct DisplayD
DisplaySetStateFunction setState,
DisplayBackspaceFunction backspace,
DisplayCursorPositionFunction setCursorToPosition,
DisplayWriteCharacterFunction writeCharacter,
DisplayWriteFunction write,
DisplayClearFunction clear,
DisplayClearLineFunction clearLine,
@@ -78,6 +79,7 @@ ErrorStatus DisplayDevice_construct (struct DisplayDevice* self, struct DisplayD
self->_setState = setState;
self->_backspace = backspace;
self->_setCursorToPosition = setCursorToPosition;
self->_writeCharacter = writeCharacter;
self->_write = write;
self->_clear = clear;
self->_clearLine = clearLine,
@@ -170,7 +172,25 @@ ErrorStatus DisplayDevice_setCursorToPosition(const struct DisplayDevice* self,
}
ErrorStatus DisplayDevice_write(const struct DisplayDevice* self, const char* buffer, size_t length, size_t row, size_t column)
ErrorStatus DisplayDevice_writeCharacter(const struct DisplayDevice* self, const char* buffer, unsigned int row, unsigned int column)
{
ErrorStatus returnValue = SUCCESS;
if (self->initialized)
{
if (self->_writeCharacter != NULL)
{
returnValue = self->_writeCharacter(self, buffer, row, column);
}
}
else
{
returnValue = ERROR;
}
return returnValue;
}
ErrorStatus DisplayDevice_write(const struct DisplayDevice* self, const char* buffer, unsigned int length, unsigned int row, unsigned int column)
{
ErrorStatus returnValue = SUCCESS;
if (self->initialized)
@@ -206,7 +226,7 @@ ErrorStatus DisplayDevice_clear(const struct DisplayDevice* self)
}
ErrorStatus DisplayDevice_clearLine(const struct DisplayDevice* self, size_t row)
ErrorStatus DisplayDevice_clearLine(const struct DisplayDevice* self, unsigned int row)
{
ErrorStatus returnValue = SUCCESS;
if (self->initialized)
@@ -224,7 +244,7 @@ ErrorStatus DisplayDevice_clearLine(const struct DisplayDevice* self, size_t row
}
ErrorStatus DisplayDevice_setBrightness(const struct DisplayDevice* self, size_t brightness)
ErrorStatus DisplayDevice_setBrightness(const struct DisplayDevice* self, unsigned int brightness)
{
ErrorStatus returnValue = SUCCESS;
if (self->initialized)
@@ -242,7 +262,7 @@ ErrorStatus DisplayDevice_setBrightness(const struct DisplayDevice* self, size_t
}
ErrorStatus DisplayDevice_setContrast(const struct DisplayDevice* self, size_t contrast)
ErrorStatus DisplayDevice_setContrast(const struct DisplayDevice* self, unsigned int contrast)
{
ErrorStatus returnValue = SUCCESS;
if (self->initialized)

View File

@@ -95,6 +95,16 @@ void PID_destruct(struct Pid* self)
}
void PID_reset(struct Pid* self)
{
if (self->initialized)
{
self->iTerm = 0;
self->input_d1 = 0;
}
}
int PID_calculate(struct Pid* self, int error)
{
int returnValue = 0;

View File

@@ -112,3 +112,9 @@ ErrorStatus Power6V5Supply_on(void)
}
return returnValue;
}
struct Gpio* Power6V5Supply_getGPIO(void)
{
return self.gpio;
}

View File

@@ -112,3 +112,9 @@ ErrorStatus TeslaGunSafety_block(void)
}
return returnValue;
}
struct Gpio* TeslaGunSafety_getGpio(void)
{
return self.gpio;
}

View File

@@ -69,10 +69,11 @@ static int nhd0420_cursorRowOffset[NHD0420_NUMBER_OF_ROWS] =
static ErrorStatus setState(const struct DisplayDevice* self, DisplayDevice_functionalState state);
static ErrorStatus backspace(const struct DisplayDevice* self);
static ErrorStatus setCursorToPosition(const struct DisplayDevice* self, unsigned int row, unsigned int column);
static ErrorStatus write(const struct DisplayDevice* self, const char* buffer, size_t length, size_t row, size_t column);
static ErrorStatus writeCharacter(const struct DisplayDevice* self, const char* buffer, unsigned int row, unsigned int column);
static ErrorStatus write(const struct DisplayDevice* self, const char* buffer, unsigned int length, unsigned int row, unsigned int 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);
static ErrorStatus setBrightness(const struct DisplayDevice* self, unsigned int brightness);
static ErrorStatus setContrast(const struct DisplayDevice* self, unsigned int contrast);
static ErrorStatus setBlinkingCursorState(const struct DisplayDevice* self, DisplayDevice_functionalState state);
// -----------------------------------------------------------------------------
@@ -98,7 +99,7 @@ ErrorStatus NHD0420_construct(struct NHD0420* self, const struct IODevice* devic
ddParameters.contrastMin = NHD0420_CONTRAST_MIN;
ddParameters.contrastMax = NHD0420_CONTRAST_MAX;
returnValue = DisplayDevice_construct(&self->displayDevice, &ddParameters, NULL, setState, backspace, setCursorToPosition, write, clear, NULL, setBrightness, setContrast, NULL, setBlinkingCursorState);
returnValue = DisplayDevice_construct(&self->displayDevice, &ddParameters, NULL, setState, backspace, setCursorToPosition, writeCharacter, write, clear, NULL, setBrightness, setContrast, NULL, setBlinkingCursorState);
if (returnValue == SUCCESS)
{
@@ -170,7 +171,7 @@ ErrorStatus NHD0420_getSpiParameters(struct SpiParameters* parameters)
}
ErrorStatus NHD0420_setCursorToPosition(const struct NHD0420* self, size_t row, size_t column)
ErrorStatus NHD0420_setCursorToPosition(const struct NHD0420* self, unsigned int row, unsigned int column)
{
ErrorStatus returnValue = SUCCESS;
if (self->initialized)
@@ -357,7 +358,7 @@ ErrorStatus NHD0420_sendCommand(const struct NHD0420* self, char command)
}
ErrorStatus NHD0420_sendData(const struct NHD0420* self, const char* buffer, size_t length)
ErrorStatus NHD0420_sendData(const struct NHD0420* self, const char* buffer, unsigned int length)
{
ErrorStatus returnValue = SUCCESS;
if (self->initialized)
@@ -405,10 +406,34 @@ ErrorStatus setCursorToPosition(const struct DisplayDevice* self, unsigned int r
}
static ErrorStatus write(const struct DisplayDevice* self, const char* buffer, size_t length, size_t row, size_t column)
ErrorStatus writeCharacter(const struct DisplayDevice* self, const char* buffer, unsigned int row, unsigned int column)
{
ErrorStatus returnValue = SUCCESS;
if (self->initialized)
{
if ((column) > NHD0420_NUMBER_OF_COLUMNS)
{
returnValue = ERROR;
}
// Set cursor on display
returnValue = NHD0420_setCursorToPosition((const struct NHD0420*)self, row, column);
if (returnValue == SUCCESS)
{
returnValue = NHD0420_sendData((const struct NHD0420*)self, buffer, 1);
}
}
else
{
returnValue = ERROR;
}
return returnValue;
}
static ErrorStatus write(const struct DisplayDevice* self, const char* buffer, unsigned int length, unsigned int row, unsigned int column)
{
///TODO REMOVE
// volatile int i;
ErrorStatus returnValue = SUCCESS;
if (self->initialized)
{
@@ -420,8 +445,6 @@ static ErrorStatus write(const struct DisplayDevice* self, const char* buffer, s
// Set cursor on display
returnValue = NHD0420_setCursorToPosition((const struct NHD0420*)self, row, column);
// for (i = 0; i < 3000; i++);
if (returnValue == SUCCESS)
{
// Send one byte at a time (display requirement)
@@ -431,7 +454,6 @@ static ErrorStatus write(const struct DisplayDevice* self, const char* buffer, s
returnValue = NHD0420_sendData((const struct NHD0420*)self, &buffer[loopcounter], 1);
}
}
// for (i = 0; i < 1000; i++);
}
else
{
@@ -455,7 +477,7 @@ static ErrorStatus clear(const struct DisplayDevice* self)
}
static ErrorStatus setBrightness(const struct DisplayDevice* self, size_t brightness)
static ErrorStatus setBrightness(const struct DisplayDevice* self, unsigned int brightness)
{
if (self->initialized)
{
@@ -468,7 +490,7 @@ static ErrorStatus setBrightness(const struct DisplayDevice* self, size_t bright
}
static ErrorStatus setContrast(const struct DisplayDevice* self, size_t contrast)
static ErrorStatus setContrast(const struct DisplayDevice* self, unsigned int contrast)
{
if (self->initialized)
{