diff --git a/UML/can.pdf b/UML/can.pdf new file mode 100644 index 0000000..14c421a Binary files /dev/null and b/UML/can.pdf differ diff --git a/UML/can.uxf b/UML/can.uxf index d40dc6b..ac0abd3 100644 --- a/UML/can.uxf +++ b/UML/can.uxf @@ -1,154 +1,54 @@ - + 15 - - UMLSpecialState - - 450 - 150 - 30 - 30 - - type=initial - - - - UMLState - - 390 - 240 - 150 - 60 - - STCA_WAIT - - - - Relation - - 450 - 165 - 120 - 105 - - lt=-> -evCAinit - - 10.0;10.0;10.0;50.0 - - - Relation - - 450 - 285 - 165 - 105 - - lt=-> -evCAnewMsg - 10.0;10.0;10.0;50.0 - - - UMLState - - 315 - 360 - 285 - 105 - - STCA_READ -- --. -/entry: processCan - - - - Relation - - 480 - 255 - 225 - 360 - - lt=-> -m1=[queue empty] - - 10.0;210.0;130.0;210.0;130.0;10.0;40.0;10.0 - - - UMLSpecialState - - 435 - 540 - 60 - 60 - - type=decision - - - - Relation - - 450 - 450 - 135 - 120 - - lt=-> -evCAdone - 10.0;10.0;10.0;60.0 - - - Relation - - 210 - 375 - 255 - 240 - - lt=-> -m1=[else] - - 150.0;130.0;10.0;130.0;10.0;10.0;70.0;10.0 - UMLNote - 90 - 630 - 615 - 270 + 645 + 255 + 675 + 525 - _*How to use*_ + _*How to use CAN interface*_ + +*In Factory_Init: * +CAN_init(); *In Factory_build: * -ECAN_SetRXBnInterruptHandler(CANINTERFACE_newMsg); -CANINTERFACE_onProcessCan(&processCan); +ECAN_SetRXBnInterruptHandler(CAN_newMsg); +CAN_onReceiveCan(&receiveCan); +CAN_setSender(idSender); -*Somewhere:* -void processCan(uint32_t canId, uint32_t canData) { +*In Factory_start:* +CAN_startBehaviour(); + +*Somewhere for process input can message:* +void receiveCan(uint8_t idSender, uint8_t idMsg, uint32_t canData) { ..... -} +} + +*For send can message: * +CAN_sendCanMsg(uint8_t idRecipient, uint8_t idMsg, uint32_t data); Relation - 900 - 225 + 360 + 330 90 - 105 + 135 lt=-> evInit - 10.0;10.0;10.0;50.0 + 10.0;10.0;10.0;70.0 UMLSpecialState - 900 - 210 + 360 + 315 30 30 @@ -158,71 +58,39 @@ evInit UMLState - 840 - 300 - 150 - 60 - - STCS_WAIT - - - - UMLState - - 810 - 420 - 210 + 240 + 435 + 270 90 - STCS_SEND --- --. -/entry sendCan + STCA_PROCESS Relation - 900 - 345 - 135 - 105 + 450 + 465 + 180 + 180 lt=-> -evCSsend - - 10.0;10.0;10.0;50.0 +m1=evCAsend +m1=\n/sendCan() + 10.0;40.0;10.0;100.0;100.0;100.0;100.0;10.0;40.0;10.0 Relation - 900 - 315 - 270 - 270 + 135 + 465 + 300 + 180 lt=-> -evCSdone +m1= evCAnewMsg +m1= \n/receiveCan() - 10.0;130.0;10.0;160.0;100.0;160.0;100.0;10.0;60.0;10.0 - - - UMLNote - - 765 - 630 - 705 - 270 - - _*How to use*_ - -*Like a static class:* -sendCanMsg(uint32_t id, uint32_t data); - -*Or like an Object: * -CANSENDER_seSender(CANSENDER* me, uint8_t s); -CANSENDER_setRecipient(CANSENDER* me, uint8_t r); -CANSENDER_sendCanMsg(CANSENDER* me, uint8_t id, uint32_t data); - + 100.0;40.0;100.0;100.0;10.0;100.0;10.0;10.0;70.0;10.0