/*****************************************************************************
* Product: Board Support Package (BSP) for the History example
* Last Updated for Version: 6.3.7
* Date of the Last Update: 2018-12-13
*
* Q u a n t u m L e a P s
* ------------------------
* Modern Embedded Software
*
* Copyright (C) 2005-2018 Quantum Leaps, LLC. All rights reserved.
*
* This program is open source software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alternatively, this program may be distributed and modified under the
* terms of Quantum Leaps commercial licenses, which expressly supersede
* the GNU General Public License and are specifically designed for
* licensees interested in retaining the proprietary status of their code.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* Contact information:
*
*
*****************************************************************************/
#include "qpn.h" /* QP-nano */
#include "bsp.h" /* Board Support Package */
#include "history.h" /* Application interface */
#include "safe_std.h" /* portable "safe" / facilities */
#include
/*..........................................................................*/
/* dummy definition of the QF_active[] array (not used in this example) */
QActiveCB const Q_ROM QF_active[] = {
{ (QActive *)0, (QEvt *)0, 0U }
};
/*..........................................................................*/
void BSP_init(void) {
PRINTF_S("History state pattern\nQP-nano version: %s\n"
"Press 'o' to OPEN the door\n"
"Press 'c' to CLOSE the door\n"
"Press 't' to start TOASTING\n"
"Press 'b' to start BAKING\n"
"Press 'f' to turn the oven OFF\n"
"Press ESC to quit...\n",
QP_VERSION_STR);
}
/*..........................................................................*/
void BSP_exit(void) {
PRINTF_S("\n%s\n", "Bye! Bye!");
QF_onCleanup();
exit(0);
}
/*--------------------------------------------------------------------------*/
void QF_onStartup(void) {
QF_consoleSetup();
QF_setTickRate(BSP_TICKS_PER_SEC, 50); /* desired tick rate/ticker-prio */
}
/*..........................................................................*/
void QF_onCleanup(void) {
QF_consoleCleanup();
}
/*..........................................................................*/
void QF_onClockTickISR(void) {
}
/*..........................................................................*/
/* this function is used by the QP embedded systems-friendly assertions */
Q_NORETURN Q_onAssert(char const * const file, int line) {
PRINTF_S("Assertion failed in %s, line %d", file, line);
exit(-1);
}