Most parts of the menu structure are functional.
Error handler added Screens for warning, pause, FINISH etc yet to be added git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@255 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file Error.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 Error.h
|
||||
/// @ingroup {group_name}
|
||||
|
||||
#ifndef ERROR_H_
|
||||
#define ERROR_H_
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "stm32f10x.h"
|
||||
|
||||
#include "Observable.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GPIO_FAIL,
|
||||
INTERLOCK_COMMON_FAIL,
|
||||
INTERLOCK_TESLA_FAIL,
|
||||
POWERENABLE_FAIL,
|
||||
REPAIR_FAIL,
|
||||
} T_ErrorCode;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* Error_construct
|
||||
* Constructs the error handler
|
||||
*
|
||||
* @return ErrorStatus SUCCESS if construction was successful
|
||||
* ERROR otherwise
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus Error_construct(void);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* Error_getObservable
|
||||
* Returns the observable of the Error handler
|
||||
*
|
||||
* @return struct Observable* Observable of the ERROR handler
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern struct Observable* Error_getObservable(void);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* Error_postError
|
||||
* Posts a new error
|
||||
*
|
||||
* @param errorCode ERROR CODE
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern void Error_postError(T_ErrorCode errorCode);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* Error_postErrorFromISR
|
||||
* Posts a new error from an ISR context
|
||||
*
|
||||
* @param errorCode ERROR CODE
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern void Error_postErrorFromISR(T_ErrorCode errorCode);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* ERROR_H_ */
|
||||
@@ -0,0 +1,52 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file Warning.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 Warning.h
|
||||
/// @ingroup {group_name}
|
||||
|
||||
#ifndef WARNING_H_
|
||||
#define WARNING_H_
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
#endif /* WARNING_H_ */
|
||||
@@ -33,6 +33,8 @@
|
||||
|
||||
#include "stm32f10x.h"
|
||||
|
||||
#include "gpio.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -69,4 +71,33 @@ extern struct Display* const mainDisplay;
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus hsb_generateStartScreen(struct Display* Display);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* hsb_solenoidLock
|
||||
* Locks the solenoid
|
||||
*
|
||||
*
|
||||
* @return ErrorStatus SUCCESS if locking was successful
|
||||
* ERROR otherwise
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus hsb_solenoidLock (void);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* hsb_solenoidUnlock
|
||||
* Unlocks the solenoid
|
||||
*
|
||||
*
|
||||
* @return ErrorStatus SUCCESS if locking was successful
|
||||
* ERROR otherwise
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus hsb_solenoidUnlock (void);
|
||||
|
||||
#endif /* HSB_MRTS_H_ */
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "repairPreset.h"
|
||||
#include "repairProcess.h"
|
||||
|
||||
#include "Interlock.h"
|
||||
#include "keypadMatrix.h"
|
||||
#include "Observable.h"
|
||||
#include "rtc.h"
|
||||
@@ -67,6 +68,11 @@ typedef enum
|
||||
CALIBRATIONMENU,
|
||||
PRESETMENU,
|
||||
START_REPAIR,
|
||||
REPAIR_RUNNING,
|
||||
REPAIR_ASK_PAUSE,
|
||||
REPAIR_PAUSE,
|
||||
ERROR_STATE,
|
||||
WARNING_STATE,
|
||||
NO_MENU,
|
||||
NUMBER_OF_MENUS
|
||||
} T_MenuState;
|
||||
@@ -79,6 +85,8 @@ typedef enum
|
||||
NO_ACTION = 0,
|
||||
HOTKEY_SELECT,
|
||||
SELECT,
|
||||
GOTO_STATE,
|
||||
EXECUTE_FUNCTION,
|
||||
SCROLL_UP,
|
||||
SCROLL_DOWN,
|
||||
DIGIT_INSERT
|
||||
@@ -91,11 +99,14 @@ struct MenuRow
|
||||
RepairMenuFunctionCall actionPointer;
|
||||
};
|
||||
|
||||
|
||||
struct KeyActionBinding
|
||||
{
|
||||
char key;
|
||||
Keypad_KeyState keyState;
|
||||
T_KeyAction action;
|
||||
int argument;
|
||||
RepairMenuFunctionCall actionPointer;
|
||||
};
|
||||
|
||||
|
||||
@@ -103,8 +114,11 @@ struct MenuPage
|
||||
{
|
||||
bool hasCursor;
|
||||
int numberOfRows;
|
||||
int maxNumberOfRows;
|
||||
int numberOfKeys;
|
||||
int maxNumberOfKeys;
|
||||
struct MenuRow row[REPAIRMENU_MAX_NUMBER_OF_ROWS];
|
||||
struct KeyActionBinding keyActionBinding[REPAIRMENU_MAX_NUMBER_OF_KEYS];
|
||||
struct KeyActionBinding keyActionBinding[NUMBER_OF_KEY_EVENTS * REPAIRMENU_MAX_NUMBER_OF_KEYS];
|
||||
};
|
||||
|
||||
struct RepairMenu
|
||||
@@ -113,18 +127,18 @@ struct RepairMenu
|
||||
int TaskPriority;
|
||||
uint16_t stackSize;
|
||||
bool runTask;
|
||||
SemaphoreHandle_t secondsSyncronisation;
|
||||
bool initialized;
|
||||
struct Display* display;
|
||||
struct KeyboardDevice* keyboardDevice;
|
||||
T_MenuState menuState;
|
||||
Keypad_KeyState keyStateTrigger;
|
||||
int cursorIndex;
|
||||
int scrollOffset;
|
||||
struct RepairProcess repairProcess;
|
||||
const struct RepairPreset* repairPreset;
|
||||
struct RepairProcessParameters rpParameters;
|
||||
struct MenuPage menuArray[NUMBER_OF_MENUS];
|
||||
char errorMessage[20];
|
||||
char warningMessage[20];
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -197,4 +211,20 @@ extern void repairMenu_feedSecondsCounter(struct RepairMenu* self);
|
||||
*/
|
||||
extern void repairMenu_feedSecondsCounterFromISR(struct RepairMenu* self);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* repairMenu_interlockFailed
|
||||
* Interlock verification failed
|
||||
*
|
||||
* @param self The repair menu object
|
||||
* @param interlockID 0 for common interlock
|
||||
* !0 for the tesla interlock
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern void repairMenu_interlockFailed(struct RepairMenu* self, T_INTERLOCK_ID interlockID);
|
||||
|
||||
#endif /* INC_REPAIRMENU_H_ */
|
||||
|
||||
@@ -118,6 +118,20 @@ struct RepairProcess
|
||||
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_feedSecondsCounter
|
||||
* Feeds the seconds counter of the repair process.
|
||||
@@ -157,12 +171,15 @@ extern void repairProcess_feedSecondsCounterFromISR(struct RepairProcess* self);
|
||||
*
|
||||
* @param self
|
||||
* @param repairTime
|
||||
* @param hours
|
||||
* @param minutes
|
||||
* @param seconds
|
||||
*
|
||||
* @return ErrorStatus
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus repairProcess_getRepairTime(const struct RepairProcess* self, uint32_t* repairTime);
|
||||
extern ErrorStatus repairProcess_getRepairTime(const struct RepairProcess* self, uint32_t* repairTime, int* hours, int* minutes, int* seconds);
|
||||
|
||||
#endif /* REPAIRPROCESS_H_ */
|
||||
|
||||
Reference in New Issue
Block a user