implement alive_checker
This commit is contained in:
parent
88390a294a
commit
0d766220ed
@ -78,23 +78,16 @@ void Factory_init() {
|
|||||||
ALIVE_CHECKER_init(ACjoy());
|
ALIVE_CHECKER_init(ACjoy());
|
||||||
}
|
}
|
||||||
|
|
||||||
void foo(uint8_t a, uint8_t b, uint32_t c){
|
|
||||||
if(b){
|
|
||||||
LED_on(l1());
|
|
||||||
} else {
|
|
||||||
LED_off(l1());
|
|
||||||
}
|
|
||||||
CAN_Send(a, b, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
//connect objects if required
|
//connect objects if required
|
||||||
void Factory_build() {
|
void Factory_build() {
|
||||||
ECAN_SetRXBnInterruptHandler(CAN_newMsg);
|
ECAN_SetRXBnInterruptHandler(CAN_newMsg);
|
||||||
CAN_onReceiveCan(foo);
|
CAN_onReceiveCan(CM_processIncome);
|
||||||
|
|
||||||
WATCHDOG_onAlive(WDcontroller(), CM_CONTROLLER_ALIVE, NULL);
|
WATCHDOG_onAlive(WDcontroller(), CM_CONTROLLER_ALIVE, NULL);
|
||||||
ALIVE_CHECKER_onSetup(ACjoy(), CM_JOY_SETUP, NULL);
|
ALIVE_CHECKER_onSetup(ACjoy(), CM_JOY_SETUP, NULL);
|
||||||
ALIVE_CHECKER_setAliveTime(ACjoy(), CAR_CST.JOYSTICK_ALIVE_TIME);
|
ALIVE_CHECKER_setAliveTime(ACjoy(), CAR_CST.JOYSTICK_ALIVE_TIME);
|
||||||
|
ALIVE_CHECKER_onBorn(ACjoy(), LED_on, l1());
|
||||||
|
ALIVE_CHECKER_onDead(ACjoy(), LED_off, l1());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ void ALIVE_CHECKER_setAliveTime(ALIVE_CHECKER* me, uint8_t v) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ALIVE_CHECKER_setIsAlive(ALIVE_CHECKER* me, bool v) {
|
void ALIVE_CHECKER_setIsAlive(ALIVE_CHECKER* me, bool v) {
|
||||||
me->aliveTime = v;
|
me->isAlive = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ALIVE_CHECKER_ISALIVE(ALIVE_CHECKER* me) {
|
void ALIVE_CHECKER_ISALIVE(ALIVE_CHECKER* me) {
|
||||||
|
Reference in New Issue
Block a user