update for SWO - hw validation menu integrated

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@239 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
mmi
2017-10-06 07:46:54 +00:00
parent ab3301889c
commit 5105d55089
12 changed files with 143 additions and 84 deletions

View File

@@ -40,9 +40,6 @@
// Constant and macro definitions
// -----------------------------------------------------------------------------
#define KEYPAD_STACK_SIZE (512)
#define KEYPAD_TASK_PRIORITY (3)
#define KEYPAD_DEF_QUEUESIZE (32)
// -----------------------------------------------------------------------------
// Type definitions
@@ -67,13 +64,13 @@ static void KeypadTask(void* parameters);
// -----------------------------------------------------------------------------
ErrorStatus Keypad_construct(struct Keypad* self, struct KeypadParameters* parameters, int debounceTime)
ErrorStatus Keypad_construct(struct Keypad* self, int debounceTime, int taskPriority, uint16_t stackSize, size_t rxQueueSize)
{
int rowCounter = 0;
int colCounter = 0;
ErrorStatus returnValue = SUCCESS;
if(keypad != NULL)
if(!self->initialized)
{
IODevice_construct(&self->device, read, NULL);
@@ -84,6 +81,9 @@ ErrorStatus Keypad_construct(struct Keypad* self, struct KeypadParameters* param
}
self->waitToDebounce_ms = debounceTime;
self->rxQueueSize = rxQueueSize;
self->stackSize = stackSize;
self->taskPriority = taskPriority;
// Initialize memory to keep track of state changes per key
for (rowCounter = 0; rowCounter < KEYPAD_NUMBER_OF_ROWS; rowCounter++)
@@ -95,7 +95,7 @@ ErrorStatus Keypad_construct(struct Keypad* self, struct KeypadParameters* param
}
//! Create a new FREERTOS queue to handle data from Keypad input to app
self->rxQueue = xQueueCreate(parameters->rxQueueSize, sizeof(struct KeypadQueueItem));
self->rxQueue = xQueueCreate(self->rxQueueSize, sizeof(struct KeypadQueueItem));
if (self->rxQueue == 0)
{
//! Queue identifier is 0 -> error
@@ -104,7 +104,7 @@ ErrorStatus Keypad_construct(struct Keypad* self, struct KeypadParameters* param
if(returnValue == SUCCESS)
{
xTaskCreate(KeypadTask, (const char*)"keypadTask", KEYPAD_STACK_SIZE, keypad, KEYPAD_TASK_PRIORITY, self->taskHandle);
xTaskCreate(KeypadTask, (const char*)"keypadTask", self->stackSize, keypad, self->taskPriority, &self->taskHandle);
}
if(returnValue == SUCCESS)
@@ -120,12 +120,17 @@ ErrorStatus Keypad_construct(struct Keypad* self, struct KeypadParameters* param
if(returnValue == SUCCESS)
{
LOGGER_INFO(mainLog, "Keypad task started");
self->initialized = true;
}
else
{
LOGGER_ERROR(mainLog, "Keypad task FAILED");
}
}
else
{
returnValue = ERROR;
}
return returnValue;
}
@@ -138,22 +143,22 @@ void Keypad_Destruct (const struct Keypad* self)
}
ErrorStatus Keypad_getDefaultParameters(struct KeypadParameters* parameters)
{
ErrorStatus errorStatus = SUCCESS;
parameters->rxQueueSize = KEYPAD_DEF_QUEUESIZE;
return errorStatus;
}
static ErrorStatus read(const struct IODevice* self, char* buffer, size_t length, size_t* actualLength)
{
ErrorStatus errorStatus = SUCCESS;
ErrorStatus returnValue = SUCCESS;
*actualLength = 1;
const struct Keypad* keypad = (const struct Keypad*)self;
return errorStatus;
if (keypad->initialized)
{
*actualLength = 1;
}
else
{
returnValue = ERROR;
}
return returnValue;
}