Going on with structure
Added observer/observable for RTC git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@251 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file repairMenus.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 repairMenus.c
|
||||
/// @ingroup {group_name}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "hsb-mrts.h"
|
||||
|
||||
#include "repairMenus.h"
|
||||
#include "repairMenu.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "Observable.h"
|
||||
#include "rtc.h"
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static struct RepairMenu _mainMenu = {.initialized = false};
|
||||
struct RepairMenu* const mainMenu = &_mainMenu;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// File-scope variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static ErrorStatus repairMenus_mainMenuObserverFromISR(const void* const data);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
//TODO REMOVE
|
||||
extern struct Display* display;
|
||||
ErrorStatus repairMenus_construct(void)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
// Create first repair menu
|
||||
returnValue = repairMenu_construct(mainMenu, mainDisplay, HSB_MAINMENU_TASK_PRIORITY, HSB_MAINMENU_TASK_STACKSIZE);
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
returnValue = Observable_addObserver(RTC_getObservable(rtc), repairMenus_mainMenuObserverFromISR);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
void repairMenus_destruct(void)
|
||||
{
|
||||
Observable_deleteObserver(RTC_getObservable(rtc), repairMenus_mainMenuObserverFromISR);
|
||||
repairMenu_destruct(mainMenu);
|
||||
}
|
||||
|
||||
|
||||
static ErrorStatus repairMenus_mainMenuObserverFromISR(const void* const data)
|
||||
{
|
||||
repairMenu_feedSecondsCounterFromISR(mainMenu);
|
||||
return SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user