Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: CAN_asser.cpp
- Revision:
- 9:2113adf37c66
- Parent:
- 8:94ecfe411d02
- Child:
- 11:e8c4a1c6553d
- Child:
- 13:9c62e263f245
diff -r 94ecfe411d02 -r 2113adf37c66 CAN_asser.cpp
--- a/CAN_asser.cpp Thu May 23 13:54:45 2019 +0000
+++ b/CAN_asser.cpp Thu May 23 15:37:33 2019 +0000
@@ -4,9 +4,8 @@
CANMessage msg_can[256];
unsigned char pt_lecture_can = 0, pt_ecriture_can = 0;
int nb_msg_can = 0;
-short pos[3];
-extern bool flagFinDpl;
-extern CAN can;
+
+CAN can(PB_8, PB_9,1000000);
Serial dbug(USBTX, USBRX, 115200);
void can_init(void)
@@ -27,21 +26,24 @@
}
}
-void trait_can(bool& flagFinDpl)
+void majFlagDpl(bool& flagFinDpl)
{
while(nb_msg_can>0)
{
- /*if(msg_can[pt_lecture_can].id == ODOMETRIE_POSITION)
- get_pos(msg_can[pt_lecture_can], pos);*/
-
if(msg_can[pt_lecture_can].id == 0x111)
- {
flagFinDpl = true;
- //dbug.printf("CAN fin dpl\n");
- }
-
- /*else if(msg_can[pt_lecture_can].id == 0x101)
- dbug.printf("CAN revived\n");*/
+
+ nb_msg_can--;
+ pt_lecture_can++;
+ }
+}
+
+void majPos(int* pos)
+{
+ while(nb_msg_can>0)
+ {
+ if(msg_can[pt_lecture_can].id == ODOMETRIE_POSITION)
+ get_pos(msg_can[pt_lecture_can], (short*)pos);
nb_msg_can--;
pt_lecture_can++;