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:
@@ -109,4 +109,18 @@ extern ErrorStatus CoverSolenoid_unlock(void);
|
||||
*/
|
||||
extern ErrorStatus CoverSolenoid_lock(void);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* CoverSolenoid_getGpio
|
||||
* Description of function
|
||||
*
|
||||
* @param
|
||||
* @param
|
||||
* @return struct Gpio*
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern struct Gpio* CoverSolenoid_getGpio(void);
|
||||
|
||||
#endif /* SOLENOID_H_ */
|
||||
|
||||
@@ -58,22 +58,23 @@ typedef ErrorStatus (*DisplayResetFunction)(const struct DisplayDevice* self);
|
||||
typedef ErrorStatus (*DisplaySetStateFunction)(const struct DisplayDevice* self, DisplayDevice_functionalState state);
|
||||
typedef ErrorStatus (*DisplayBackspaceFunction)(const struct DisplayDevice* self);
|
||||
typedef ErrorStatus (*DisplayCursorPositionFunction)(const struct DisplayDevice* self, unsigned int row, unsigned int column);
|
||||
typedef ErrorStatus (*DisplayWriteFunction)(const struct DisplayDevice* self, const char* buffer, size_t length, size_t row, size_t column);
|
||||
typedef ErrorStatus (*DisplayWriteFunction)(const struct DisplayDevice* self, const char* buffer, unsigned int length, unsigned int row, unsigned int column);
|
||||
typedef ErrorStatus (*DisplayWriteCharacterFunction)(const struct DisplayDevice* self, const char* buffer, unsigned int row, unsigned int column);
|
||||
typedef ErrorStatus (*DisplayClearFunction)(const struct DisplayDevice* self);
|
||||
typedef ErrorStatus (*DisplayClearLineFunction)(const struct DisplayDevice* self, size_t row);
|
||||
typedef ErrorStatus (*DisplaySetBrightnessFunction)(const struct DisplayDevice* self, size_t brightness);
|
||||
typedef ErrorStatus (*DisplaySetContrastFunction)(const struct DisplayDevice* self, size_t contrast);
|
||||
typedef ErrorStatus (*DisplayClearLineFunction)(const struct DisplayDevice* self, unsigned int row);
|
||||
typedef ErrorStatus (*DisplaySetBrightnessFunction)(const struct DisplayDevice* self, unsigned int brightness);
|
||||
typedef ErrorStatus (*DisplaySetContrastFunction)(const struct DisplayDevice* self, unsigned int contrast);
|
||||
typedef ErrorStatus (*DisplayInvertFunction)(const struct DisplayDevice* self);
|
||||
typedef ErrorStatus (*DisplaySetBlinkingCursor)(const struct DisplayDevice* self, DisplayDevice_functionalState state);
|
||||
|
||||
struct DisplayDeviceParameters
|
||||
{
|
||||
size_t numberOfRows;
|
||||
size_t numberOfColumns;
|
||||
size_t contrastMin;
|
||||
size_t contrastMax;
|
||||
size_t brightnessMin;
|
||||
size_t brightnessMax;
|
||||
unsigned int numberOfRows;
|
||||
unsigned int numberOfColumns;
|
||||
unsigned int contrastMin;
|
||||
unsigned int contrastMax;
|
||||
unsigned int brightnessMin;
|
||||
unsigned int brightnessMax;
|
||||
};
|
||||
|
||||
struct DisplayDevice
|
||||
@@ -82,6 +83,7 @@ struct DisplayDevice
|
||||
DisplaySetStateFunction _setState;
|
||||
DisplayBackspaceFunction _backspace;
|
||||
DisplayCursorPositionFunction _setCursorToPosition;
|
||||
DisplayWriteCharacterFunction _writeCharacter;
|
||||
DisplayWriteFunction _write;
|
||||
DisplayClearFunction _clear;
|
||||
DisplayClearLineFunction _clearLine;
|
||||
@@ -102,6 +104,7 @@ extern ErrorStatus DisplayDevice_construct (struct DisplayDevice* self, struct D
|
||||
DisplaySetStateFunction setState,
|
||||
DisplayBackspaceFunction backspace,
|
||||
DisplayCursorPositionFunction setCursorToPosition,
|
||||
DisplayWriteCharacterFunction writeCharacter,
|
||||
DisplayWriteFunction write,
|
||||
DisplayClearFunction clear,
|
||||
DisplayClearLineFunction clearLine,
|
||||
@@ -114,11 +117,12 @@ extern ErrorStatus DisplayDevice_reset(const struct DisplayDevice* self);
|
||||
extern ErrorStatus DisplayDevice_setState(const struct DisplayDevice* self, DisplayDevice_functionalState state);
|
||||
extern ErrorStatus DisplayDevice_backspace(const struct DisplayDevice* self);
|
||||
extern ErrorStatus DisplayDevice_setCursorToPosition(const struct DisplayDevice* self, unsigned int row, unsigned int column);
|
||||
extern ErrorStatus DisplayDevice_write(const struct DisplayDevice* self, const char* buffer, size_t length, size_t row, size_t column);
|
||||
extern ErrorStatus DisplayDevice_writeCharacter(const struct DisplayDevice* self, const char* buffer, unsigned int row, unsigned int column);
|
||||
extern ErrorStatus DisplayDevice_write(const struct DisplayDevice* self, const char* buffer, unsigned int length, unsigned int row, unsigned int column);
|
||||
extern ErrorStatus DisplayDevice_clear(const struct DisplayDevice* self);
|
||||
extern ErrorStatus DisplayDevice_clearLine(const struct DisplayDevice* self, size_t row);
|
||||
extern ErrorStatus DisplayDevice_setBrightness(const struct DisplayDevice* self, size_t brightness);
|
||||
extern ErrorStatus DisplayDevice_setContrast(const struct DisplayDevice* self, size_t contrast);
|
||||
extern ErrorStatus DisplayDevice_clearLine(const struct DisplayDevice* self, unsigned int row);
|
||||
extern ErrorStatus DisplayDevice_setBrightness(const struct DisplayDevice* self, unsigned int brightness);
|
||||
extern ErrorStatus DisplayDevice_setContrast(const struct DisplayDevice* self, unsigned int contrast);
|
||||
extern ErrorStatus DisplayDevice_invert(const struct DisplayDevice* self);
|
||||
extern ErrorStatus DisplayDevice_setBlinkingCursorState(const struct DisplayDevice* self, DisplayDevice_functionalState state);
|
||||
|
||||
|
||||
@@ -95,6 +95,20 @@ extern ErrorStatus PID_construct(struct Pid* self, int Kp, int Ki, int Kd, int i
|
||||
extern void PID_destruct(struct Pid* self);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* PID_reset
|
||||
* Resets the pid regulator and cleans all history
|
||||
*
|
||||
* @param self PID object to reset
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern void PID_reset(struct Pid* self);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* PID_calculate
|
||||
* Calculate
|
||||
|
||||
@@ -104,4 +104,18 @@ extern ErrorStatus Power6V5Supply_off(void);
|
||||
*/
|
||||
extern ErrorStatus Power6V5Supply_on(void);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* Power6V5Supply_getGPIO
|
||||
* Description of function
|
||||
*
|
||||
* @param
|
||||
* @param
|
||||
* @return struct Gpio*
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern struct Gpio* Power6V5Supply_getGPIO(void);
|
||||
|
||||
#endif /* INC_POWER6V5SUPPLY_H_ */
|
||||
|
||||
@@ -109,4 +109,16 @@ extern ErrorStatus TeslaGunSafety_release(void);
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus TeslaGunSafety_block(void);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* TeslaGunSafety_getGpio
|
||||
* Description of function
|
||||
*
|
||||
* @return struct Gpio*
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern struct Gpio* TeslaGunSafety_getGpio(void);
|
||||
#endif /* INC_TESLASAFETY_H_ */
|
||||
|
||||
@@ -185,7 +185,7 @@ extern ErrorStatus NHD0420_getSpiParameters(struct SpiParameters* parameters);
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus NHD0420_setCursorToPosition(const struct NHD0420* self, size_t row, size_t column);
|
||||
extern ErrorStatus NHD0420_setCursorToPosition(const struct NHD0420* self, unsigned int row, unsigned int column);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
@@ -286,6 +286,6 @@ extern ErrorStatus NHD0420_setI2CAddress(const struct NHD0420* self, char addres
|
||||
*/
|
||||
extern ErrorStatus NHD0420_sendCommand(const struct NHD0420* self, char command);
|
||||
|
||||
extern ErrorStatus NHD0420_sendData(const struct NHD0420* self, const char* buffer, size_t length);
|
||||
extern ErrorStatus NHD0420_sendData(const struct NHD0420* self, const char* buffer, unsigned int length);
|
||||
|
||||
#endif /* DISPLAY_INC_NHD0420_H_ */
|
||||
|
||||
@@ -112,3 +112,9 @@ ErrorStatus CoverSolenoid_lock(void)
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
struct Gpio* CoverSolenoid_getGpio(void)
|
||||
{
|
||||
return self.gpio;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -112,3 +112,9 @@ ErrorStatus Power6V5Supply_on(void)
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
struct Gpio* Power6V5Supply_getGPIO(void)
|
||||
{
|
||||
return self.gpio;
|
||||
}
|
||||
|
||||
@@ -112,3 +112,9 @@ ErrorStatus TeslaGunSafety_block(void)
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
struct Gpio* TeslaGunSafety_getGpio(void)
|
||||
{
|
||||
return self.gpio;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user