create alive_checker
This commit is contained in:
@ -34,6 +34,10 @@ WATCHDOG* WDcontroller(){
|
||||
return &theFactory.WDcontroller_;
|
||||
}
|
||||
|
||||
ALIVE_CHECKER* ACjoy() {
|
||||
return &theFactory.ACjoy_;
|
||||
}
|
||||
|
||||
|
||||
//initialize all objects
|
||||
void Factory_init() {
|
||||
@ -63,8 +67,15 @@ void Factory_init() {
|
||||
|
||||
// TODO init watchdog with EPROM CST
|
||||
WATCHDOG_init(WDcontroller());
|
||||
CAR_CST.CONTROL_ALIVE_TIME = 10;
|
||||
CAR_CST.CONTROL_ALIVE_TIME = 100;
|
||||
WATCHDOG_setTime(WDcontroller(), CAR_CST.CONTROL_ALIVE_TIME);
|
||||
|
||||
// TODO init ALIVE CHECKER with EPROM CST
|
||||
CAR_CST.JOYSTICK_MODE = 0;
|
||||
CAR_CST.JOYSTICK_PARAM1 = 100;
|
||||
CAR_CST.JOYSTICK_PARAM2 = 1;
|
||||
CAR_CST.JOYSTICK_ALIVE_TIME = 10;
|
||||
ALIVE_CHECKER_init(ACjoy());
|
||||
}
|
||||
|
||||
void foo(uint8_t a, uint8_t b, uint32_t c){
|
||||
@ -81,11 +92,18 @@ void Factory_build() {
|
||||
ECAN_SetRXBnInterruptHandler(CAN_newMsg);
|
||||
CAN_onReceiveCan(foo);
|
||||
|
||||
WATCHDOG_onAlive(WDcontroller(), CM_controller_alive, NULL);
|
||||
WATCHDOG_onAlive(WDcontroller(), CM_CONTROLLER_ALIVE, NULL);
|
||||
ALIVE_CHECKER_onSetup(ACjoy(), CM_JOY_SETUP, NULL);
|
||||
ALIVE_CHECKER_setAliveTime(ACjoy(), CAR_CST.JOYSTICK_ALIVE_TIME);
|
||||
|
||||
}
|
||||
|
||||
//start all state machines
|
||||
void Factory_start() {
|
||||
CAN_startBehaviour();
|
||||
WATCHDOG_startBehaviour(WDcontroller());
|
||||
ALIVE_CHECKER_startBehaviour(ACjoy());
|
||||
ALIVE_CHECKER_emitBorn(ACjoy(), 100, 0);
|
||||
ALIVE_CHECKER_emitReady(ACjoy(), 200, 0);
|
||||
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ typedef struct {
|
||||
LED l8_;
|
||||
|
||||
WATCHDOG WDcontroller_;
|
||||
ALIVE_CHECKER ACjoy_;
|
||||
|
||||
} Factory;
|
||||
|
||||
@ -51,6 +52,7 @@ LED* l7();
|
||||
LED* l8();
|
||||
|
||||
WATCHDOG* WDcontroller();
|
||||
ALIVE_CHECKER* ACjoy();
|
||||
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user