This repository has been archived on 2024-01-25. You can view files and clone it, but cannot push or open issues or pull requests.
SummerSchool2-Controller/306-controller_interface.X/factory/factory.c

63 lines
915 B
C
Raw Normal View History

2023-08-22 07:22:00 +00:00
#include "factory.h"
//the factory object containing all objects of our system
static Factory theFactory;
//all the getters
LED* l()
{
return &theFactory.l_;
}
Button* b()
{
return &theFactory.b_;
}
ButtonSM* bsm()
{
return &theFactory.bsm_;
}
BLControl* blc()
{
return &theFactory.blc_;
}
//initialize all objects
void Factory_init()
{
LED_init(l(),LID);
LED_initHW(l());
Button_init(b(),BID, true);
Button_initHW(b());
ButtonSM_init(bsm(),b());
BLControl_init(blc());
2023-08-22 13:53:38 +00:00
CANINTERFACE_init();
2023-08-22 07:22:00 +00:00
;
}
2023-08-22 13:53:38 +00:00
void foo(uint32_t a, uint32_t b){
}
2023-08-22 07:22:00 +00:00
//connect objects if required
2023-08-22 13:53:38 +00:00
void Factory_build() {
ButtonSM_setObserver(bsm(), blc(), &BLControl_onButton);
ECAN_SetRXBnInterruptHandler(CANINTERFACE_newMsg);
2023-08-22 15:50:49 +00:00
//CANINTERFACE_onProcessCan(foo);
2023-08-22 07:22:00 +00:00
}
//start all state machines
void Factory_start()
{
ButtonSM_startBehaviour(bsm());
}