Skip to content
Extraits de code Groupes Projets
Valider c3db3ad5 rédigé par Diego de Bernard de Fauconval's avatar Diego de Bernard de Fauconval
Parcourir les fichiers

nul

parent 36c022ec
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
{ {
"files.associations": { "files.associations": {
"iostream": "cpp" "iostream": "cpp",
"limits": "cpp"
} }
} }
\ No newline at end of file
...@@ -18,9 +18,7 @@ int main(int argc, char const *argv[]) ...@@ -18,9 +18,7 @@ int main(int argc, char const *argv[])
struct sockaddr_can addr; struct sockaddr_can addr;
struct ifreq ifr; struct ifreq ifr;
struct can_frame frame; struct can_frame frame;
printf("CAN TRY\n");
fd = socket(PF_CAN, SOCK_RAW, CAN_RAW); fd = socket(PF_CAN, SOCK_RAW, CAN_RAW);
if (fd < 0) { if (fd < 0) {
perror("error socket"); perror("error socket");
...@@ -39,10 +37,10 @@ int main(int argc, char const *argv[]) ...@@ -39,10 +37,10 @@ int main(int argc, char const *argv[])
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
frame.can_id = 0x02; frame.can_id = 0x708;
frame.can_dlc = 1; frame.can_dlc = 2;
frame.data[0] = 0b011111111; frame.data[0] = 0xff;
frame.data[1] = 0xff; // 0b0100 0000
if (write(fd, &frame, sizeof(struct can_frame)) != sizeof(struct can_frame)) { if (write(fd, &frame, sizeof(struct can_frame)) != sizeof(struct can_frame)) {
perror("error write"); perror("error write");
...@@ -52,6 +50,7 @@ int main(int argc, char const *argv[]) ...@@ -52,6 +50,7 @@ int main(int argc, char const *argv[])
// int nbytes; // int nbytes;
// struct can_frame readframe; // struct can_frame readframe;
// readframe.can_id = 0x700;
// nbytes = read(fd, &readframe, sizeof(struct can_frame)); // nbytes = read(fd, &readframe, sizeof(struct can_frame));
...@@ -66,7 +65,6 @@ int main(int argc, char const *argv[]) ...@@ -66,7 +65,6 @@ int main(int argc, char const *argv[])
// printf("0x\n", readframe.data[i]); // printf("0x\n", readframe.data[i]);
// } // }
// printf("\r");
return 0; return 0;
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter