About this model:
-----------------
The TimeBomb example from the video course "Modern Embedded Systems Programming":
https://www.youtube.com/c/StateMachineCOM
This example demonstrates:
- Active object TimeBomb) with hierarchical state machine
- Automatic code genertation from the model
- Integration between the generated code and other code, such as the Board Support Package (BSP)
Building and running the example:
This example builds with the uVision project "lesson" and is designed to run on the TivaC LaunchPad board.
/* TimeBomb/Button with QP/C framework */
#include "qpc.h" /* QP/C API */
#include "bsp.h"
Q_DEFINE_THIS_MODULE("main") /* this module name for Q_ASSERT() */
/* The TimeBomb AO =======================================================*/
$declare${AOs::TimeBomb}
$define${AOs::TimeBomb}
static QEvt const *timeBomb_queue[10];
static TimeBomb timeBomb;
QActive *AO_TimeBomb = &timeBomb.super;
/* the main function =========================================================*/
int main() {
BSP_init(); /* initialize the BSP */
QF_init(); /* initialize QP/C */
/* create AO and start it */
TimeBomb_ctor(&timeBomb);
QACTIVE_START(AO_TimeBomb,
2U,
timeBomb_queue,
sizeof(timeBomb_queue)/sizeof(timeBomb_queue[0]),
(void *)0, 0U,
(void *)0);
QF_run(); /* run QP/C... */
return 0; /* NOTE: the scheduler does NOT return */
}
/* TimeBomb/Button with QP/C framework */
#include "qpc.h" /* QP/C API */
#include "bsp.h"
Q_DEFINE_THIS_MODULE("my_file1") /* this module name for Q_ASSERT() */
$define${AOs::TimeBomb::ctor}
/* TimeBomb/Button with QP/C framework */
#include "qpc.h" /* QP/C API */
#include "bsp.h"
Q_DEFINE_THIS_MODULE("my_file2") /* this module name for Q_ASSERT() */
$define${AOs}
/* TimeBomb/Button with QP/C framework */
#include "qpc.h" /* QP/C API */
#include "bsp.h"
Q_DEFINE_THIS_MODULE("my_file3") /* this module name for Q_ASSERT() */
$define1 ${AOs::TimeBomb::SM::armed}