checked in missing file
git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@240 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file repairPreset.h
|
||||
/// @brief File 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) 2015 Micro-Key bv
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/// @defgroup {group_name} {group_description}
|
||||
/// Description
|
||||
|
||||
/// @file repairPreset.h
|
||||
/// @ingroup {group_name}
|
||||
|
||||
#ifndef REPAIRPRESET_H_
|
||||
#define REPAIRPRESET_H_
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#define REPAIR_PRESET_MAX_STAGES (2)
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
struct RepairPresetParameters
|
||||
{
|
||||
int voltage;
|
||||
int duration;
|
||||
int softstartDuration;
|
||||
};
|
||||
|
||||
struct RepairPreset
|
||||
{
|
||||
size_t numberOfStages;
|
||||
struct RepairPresetParameters preset[REPAIR_PRESET_MAX_STAGES];
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
#endif /* REPAIRPRESET_H_ */
|
||||
@@ -0,0 +1,122 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file repairProcess.h
|
||||
/// @brief File 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) 2015 Micro-Key bv
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/// @defgroup {group_name} {group_description}
|
||||
/// Description
|
||||
|
||||
/// @file repairProcess.h
|
||||
/// @ingroup {group_name}
|
||||
|
||||
#ifndef REPAIRPROCESS_H_
|
||||
#define REPAIRPROCESS_H_
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "stm32f10x.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
typedef enum
|
||||
{
|
||||
IDLE = 0,
|
||||
SOFTSTART = 1,
|
||||
VOLTAGE_HOLD = 2,
|
||||
PAUSE = 3
|
||||
} RepairState;
|
||||
|
||||
|
||||
struct RepairProcess
|
||||
{
|
||||
TaskHandle_t taskHandle;
|
||||
int TaskPriority;
|
||||
uint16_t stackSize;
|
||||
bool runTask;
|
||||
SemaphoreHandle_t secondsSyncronisation;
|
||||
uint32_t secondsCounter;
|
||||
RepairState currentState;
|
||||
bool initialized;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* repairProcess_construct
|
||||
* Description of function
|
||||
*
|
||||
* @param self The process object
|
||||
* @param taskPriority Task priority for the repair process
|
||||
* @param stackSize Stacksize of the task
|
||||
*
|
||||
* @return ErrorStatus SUCCESS if construction was successful
|
||||
* ERROR otherwise
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus repairProcess_construct(struct RepairProcess* self, int taskPriority, uint16_t stackSize);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* repairProcess_feedSecondsCounter
|
||||
* Feeds the seconds counter of the repair process.
|
||||
* The process is designed to be run every second, so this feed function should
|
||||
* be called every second.
|
||||
*
|
||||
* @param self The repair process
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern void repairProcess_feedSecondsCounter(struct RepairProcess* self);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* repairProcess_feedSecondsCounterFromISR
|
||||
* Feeds the seconds counter of the repair process.
|
||||
* This function should be called in an ISR context
|
||||
* The process is designed to be run every second, so this feed function should
|
||||
* be called every second.
|
||||
*
|
||||
* @param self The repair process
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern void repairProcess_feedSecondsCounterFromISR(struct RepairProcess* self);
|
||||
|
||||
#endif /* REPAIRPROCESS_H_ */
|
||||
@@ -221,13 +221,15 @@ static void initTask(void* parameters)
|
||||
hwTestItems.cat2Relay = NULL;
|
||||
hwTestItems.pcba = pcba;
|
||||
// EEPROM TO BE DONE
|
||||
HwValidationMenu_construct(hwValidation, &uart1->device, &hwTestItems, 2, 1024);
|
||||
// HwValidationMenu_construct(hwValidation, &uart1->device, &hwTestItems, 2, 1024);
|
||||
|
||||
|
||||
MAX5715_construct(&max5715, &spiDAC->device);
|
||||
|
||||
MAX5715_writeREF_ON_2V5(&max5715, MAX5715_SEL_DACA | MAX5715_SEL_DACB | MAX5715_SEL_DACC);
|
||||
|
||||
MAX5715Channel_construct(&max5715.dac[0], &max5715, 0);
|
||||
|
||||
|
||||
repairProcess_construct(rp, 3, 1024);
|
||||
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file repairProcess.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 repairProcess.c
|
||||
/// @ingroup {group_name}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "queue.h"
|
||||
#include "semphr.h"
|
||||
#include "task.h"
|
||||
|
||||
#include "repairProcess.h"
|
||||
#include "repairPreset.h"
|
||||
|
||||
#include "Logger.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// File-scope variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static void repairProcess_task(void* parameters);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
ErrorStatus repairProcess_construct(struct RepairProcess* self, int taskPriority, uint16_t stackSize)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (!self->initialized)
|
||||
{
|
||||
// Create a semaphore to sync access to the display shadow
|
||||
vSemaphoreCreateBinary(self->secondsSyncronisation);
|
||||
xSemaphoreGive(self->secondsSyncronisation);
|
||||
|
||||
|
||||
if (xTaskCreate(repairProcess_task, "RepairProcess", stackSize, self, taskPriority, &self->taskHandle) != pdTRUE)
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
self->runTask = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
void repairProcess_feedSecondsCounter(struct RepairProcess* self)
|
||||
{
|
||||
xSemaphoreGive(self->secondsSyncronisation);
|
||||
|
||||
}
|
||||
|
||||
void repairProcess_feedSecondsCounterFromISR(struct RepairProcess* self)
|
||||
{
|
||||
portBASE_TYPE higherPriorityTaskWoken = pdFALSE;
|
||||
|
||||
xSemaphoreGiveFromISR(self->secondsSyncronisation, &higherPriorityTaskWoken);
|
||||
|
||||
portEND_SWITCHING_ISR(higherPriorityTaskWoken);
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void repairProcess_task(void* parameters)
|
||||
{
|
||||
struct RepairProcess* self = (struct RepairProcess*)parameters;
|
||||
|
||||
|
||||
while(self->runTask)
|
||||
{
|
||||
xSemaphoreTake(self->secondsSyncronisation, portMAX_DELAY);
|
||||
int hours = (self->secondsCounter / (60 * 60));
|
||||
int minutes = (self->secondsCounter - (hours * 60 * 60)) / 60;
|
||||
int seconds = (self->secondsCounter - (hours * 60 * 60) - (minutes * 60));
|
||||
LOGGER_WARNING(mainLog, "--- Repair clock %02i %02d %02d", hours, minutes, seconds);
|
||||
|
||||
self->secondsCounter++;
|
||||
}
|
||||
|
||||
vTaskDelete(self->taskHandle);
|
||||
}
|
||||
Reference in New Issue
Block a user