git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@427 05563f52-14a8-4384-a975-3d1654cca0fa
241 lines
7.4 KiB
C
241 lines
7.4 KiB
C
// -----------------------------------------------------------------------------
|
|
/// @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
|
|
// -----------------------------------------------------------------------------
|
|
|
|
/**
|
|
* %RepairProcess implementation
|
|
* \defgroup RepairProcess Package RepairProcess
|
|
* \ingroup hsb-mrts
|
|
* @{
|
|
*/
|
|
|
|
#ifndef REPAIRPROCESS_H_
|
|
#define REPAIRPROCESS_H_
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Include files
|
|
// -----------------------------------------------------------------------------
|
|
#include <stdbool.h>
|
|
|
|
#include "FreeRTOS.h"
|
|
#include "task.h"
|
|
#include "semphr.h"
|
|
|
|
#include "stm32f10x.h"
|
|
|
|
#include "ADConverter.h"
|
|
#include "DAConverter.h"
|
|
#include "RepairPreset.h"
|
|
#include "repairProcessRow.h"
|
|
#include "SignalProfileGenerator.h"
|
|
|
|
#include "PID.h"
|
|
|
|
#include "Observable.h"
|
|
#include "rtc.h"
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Constant and macro definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
#define REPAIRPROCESS_NUMBER_OF_ROWS (3)
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Type definitions.
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
struct RepairProcessParameters
|
|
{
|
|
const struct ADConverter* adcR1;
|
|
const struct ADConverter* adcR2;
|
|
const struct ADConverter* adcR3;
|
|
const struct DAConverter* dacR1;
|
|
const struct DAConverter* dacR2;
|
|
const struct DAConverter* dacR3;
|
|
};
|
|
|
|
|
|
struct RepairProcess
|
|
{
|
|
TaskHandle_t taskHandle;
|
|
int TaskPriority;
|
|
uint16_t stackSize;
|
|
bool runTask;
|
|
bool taskIsRunning;
|
|
SemaphoreHandle_t secondsSyncronisation;
|
|
struct SignalProfileGenerator signalProfileGenerator;
|
|
bool initialized;
|
|
bool isProcessRunning;
|
|
const struct RepairPreset* repairPreset;
|
|
struct RepairProcessRow row[REPAIRPROCESS_NUMBER_OF_ROWS];
|
|
struct Observable observable;
|
|
};
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Function declarations
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* repairProcess_construct
|
|
* Description of function
|
|
*
|
|
* @param self The process object
|
|
* @param parameters
|
|
* @param preset
|
|
* @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, struct RepairProcessParameters* parameters, const struct RepairPreset* preset, int taskPriority, uint16_t stackSize);
|
|
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* repairProcess_construct
|
|
* Destructor for repair process
|
|
*
|
|
* @param self The process object
|
|
*
|
|
* @return void
|
|
*
|
|
* @todo
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
extern void repairProcess_destruct(struct RepairProcess* self);
|
|
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* repairProcess_secondsFeed
|
|
* 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_secondsFeed(struct RepairProcess* self);
|
|
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* repairProcess_secondsFeedFromISR
|
|
* 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_secondsFeedFromISR(struct RepairProcess* self);
|
|
|
|
|
|
|
|
extern bool repairProcess_isProcessRunning(struct RepairProcess* self);
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* repairProcess_getRemainingRepairTime
|
|
* Returns the currently remaining repair time in seconds
|
|
*
|
|
* @param self The repair process object
|
|
*
|
|
* @return uint32_t The remaining repair time
|
|
*
|
|
* @todo
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
extern uint32_t repairProcess_getRemainingRepairTime(const struct RepairProcess* self);
|
|
|
|
|
|
extern uint32_t repairProcess_getTotalRepairtime(const struct RepairProcess* self);
|
|
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* repairProcess_getRowInformation
|
|
* Returns the current active repair time in seconds.
|
|
*
|
|
* @param self The repair process object
|
|
* @param rowIndex Index of the requested row. Starts with 0
|
|
*
|
|
* @return struct RepairProcessRow* The requested row object
|
|
*
|
|
* @todo
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
extern const struct RepairProcessRow* repairProcess_getRowInformation(const struct RepairProcess* self, int rowIndex);
|
|
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* repairProcess_getObservable
|
|
* Returns the observable of the repair process
|
|
*
|
|
* @param self THe repair process object
|
|
*
|
|
* @return struct Observable* The observable object
|
|
*
|
|
* @todo
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
extern const struct Observable* repairProcess_getObservable(struct RepairProcess* self);
|
|
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* repairProcess_pauseProcess
|
|
* Description of function
|
|
*
|
|
* @param self
|
|
* @param
|
|
* @return void
|
|
*
|
|
* @todo
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
extern void repairProcess_pauseProcess(struct RepairProcess* self);
|
|
|
|
|
|
/** ----------------------------------------------------------------------------
|
|
* repairProcess_continueProcess
|
|
* Description of function
|
|
*
|
|
* @param self
|
|
* @param
|
|
* @return void
|
|
*
|
|
* @todo
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
extern void repairProcess_continueProcess(struct RepairProcess* self);
|
|
|
|
#endif /* REPAIRPROCESS_H_ */
|
|
|
|
/** @} */
|