Resized nearly all task stacks Also: - Menu fixes for insertion. Almost done, just need to fix the negative voltage insertion for mcp and cathode - Added Device parameters, must be filled in git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@271 05563f52-14a8-4384-a975-3d1654cca0fa
116 lines
3.3 KiB
C
116 lines
3.3 KiB
C
// -----------------------------------------------------------------------------
|
|
/// @file Error.c
|
|
/// @brief Description
|
|
// -----------------------------------------------------------------------------
|
|
// Micro-Key bv
|
|
// Industrieweg 28, 9804 TG Noordhorn
|
|
// Postbus 92, 9800 AB Zuidhorn
|
|
// The Netherlands
|
|
// Tel: +31 594 503020
|
|
// Fax: +31 594 505825
|
|
// Email: support@microkey.nl
|
|
// Web: www.microkey.nl
|
|
// -----------------------------------------------------------------------------
|
|
/// $Revision$
|
|
/// $Author$
|
|
/// $Date$
|
|
// (c) 2017 Micro-Key bv
|
|
// -----------------------------------------------------------------------------
|
|
|
|
/// @file Error.c
|
|
/// @ingroup {group_name}
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Include files
|
|
// -----------------------------------------------------------------------------
|
|
|
|
#include "Error.h"
|
|
|
|
#include "platform.h"
|
|
#include "Logger.h"
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Constant and macro definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
#define ERROR_QUEUE_SIZE (10)
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Type definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
struct ErrorQueueItem
|
|
{
|
|
T_ErrorCode errorCode;
|
|
};
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// File-scope variables
|
|
// -----------------------------------------------------------------------------
|
|
|
|
static struct Observable observable;
|
|
static TaskHandle_t errorTaskHandle;
|
|
static QueueHandle_t errorQueue;
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Function declarations
|
|
// -----------------------------------------------------------------------------
|
|
|
|
static void ErrorTask (void* parameters);
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Function definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
ErrorStatus Error_construct(void)
|
|
{
|
|
Observable_construct(&observable);
|
|
|
|
errorQueue = xQueueCreate(ERROR_QUEUE_SIZE, sizeof(struct ErrorQueueItem));
|
|
xTaskCreate(ErrorTask, "ErrorTask", 300, NULL, 1, &errorTaskHandle);
|
|
|
|
return SUCCESS;
|
|
}
|
|
|
|
|
|
struct Observable* Error_getObservable(void)
|
|
{
|
|
return &observable;
|
|
}
|
|
|
|
|
|
void Error_postError(T_ErrorCode errorCode)
|
|
{
|
|
LOGGER_ERROR(mainLog, "ERROR POSTED WITH CODE %d", errorCode);
|
|
struct ErrorQueueItem queueItem;
|
|
queueItem.errorCode = errorCode;
|
|
xQueueSend(errorQueue, &queueItem, 0);
|
|
}
|
|
|
|
|
|
void Error_postErrorFromISR(T_ErrorCode errorCode)
|
|
{
|
|
portBASE_TYPE higherPriorityTaskWoken = pdFALSE;
|
|
LOGGER_ERROR_ISR(mainLog, "ERROR POSTED FROM ISR");
|
|
|
|
struct ErrorQueueItem queueItem;
|
|
queueItem.errorCode = errorCode;
|
|
xQueueSendFromISR(errorQueue, &queueItem, &higherPriorityTaskWoken);
|
|
|
|
portEND_SWITCHING_ISR(higherPriorityTaskWoken);
|
|
}
|
|
|
|
|
|
static void ErrorTask (void* parameters)
|
|
{
|
|
struct ErrorQueueItem queueItem;
|
|
while (1)
|
|
{
|
|
xQueueReceive(errorQueue, &queueItem, portMAX_DELAY);
|
|
Observable_notifyObservers(&observable, (const void* const)queueItem.errorCode);
|
|
}
|
|
}
|