Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this user
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
golwalkars
/
7166CEM
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Projects
0
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Projects
Security
Insights
Files
b42c813
CMakeFiles
include
lib
src
main.c
main_test.c
CMakeCache.txt
CMakeLists.txt
Makefile
README.md
candata.dbc
candump.log
cmake_install.cmake
Breadcrumbs
7166CEM
/
src
/
main_test.c
Blame
Blame
Latest commit
History
History
130 lines (96 loc) · 2.67 KB
Breadcrumbs
7166CEM
/
src
/
main_test.c
Top
File metadata and controls
Code
Blame
130 lines (96 loc) · 2.67 KB
Raw
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <linux/can.h> #include <linux/can/raw.h> #include "can_wrap.h" #include "candata.h" #include "signal.h" void Test_001() { const char *canChannel = "vcan0"; const int canSocket = can_connect(canChannel, false); struct can_frame frame; frame.can_id = CANDATA_VCU_WHEEL_SPEEDS_FRAME_ID; frame.can_dlc = CANDATA_VCU_WHEEL_SPEEDS_LENGTH; frame.data[0] = 0b00010100; frame.data[1] = 0b00000000; frame.data[2] = 0b00010100; frame.data[3] = 0b00000000; frame.data[4] = 0b00010100; frame.data[5] = 0b00000000; frame.data[6] = 0b00010100; frame.data[7] = 0b00000000; printf("0x%X [%X]", frame.can_id, frame.can_dlc); for (int i = 0; i < frame.can_dlc; ++i) printf(" %02X", frame.data[i]); printf("\n"); if (!can_write(canSocket, &frame)) printf("Error\n"); sleep(1); can_close(canSocket); } void Test_002() { const char *canChannel = "vcan0"; const int canSocket = can_connect(canChannel, false); struct can_frame frame; frame.can_id = CANDATA_AI_DRIVE_REQUEST_FRAME_ID; frame.can_dlc = CANDATA_AI_DRIVE_REQUEST_LENGTH; frame.data[0] = 0b11111111; frame.data[1] = 0b11111111; frame.data[2] = 0b00000000; frame.data[3] = 0b00000000; frame.data[4] = 0b11111111; frame.data[5] = 0b11111111; printf("0x%X [%X]", frame.can_id, frame.can_dlc); for (int i = 0; i < frame.can_dlc; ++i) printf(" %02X", frame.data[i]); printf("\n"); if (!can_write(canSocket, &frame)) printf("Error\n"); sleep(1); can_close(canSocket); } void Test_003() { const char *canChannel = "vcan0"; const int canSocket = can_connect(canChannel, false); struct can_frame frame; frame.can_id = CANDATA_VCU_BATTERY_FRAME_ID; frame.can_dlc = CANDATA_VCU_BATTERY_LENGTH; frame.data[0] = 0b00001011; frame.data[1] = 0b00000000; printf("0x%X [%X]", frame.can_id, frame.can_dlc); for (int i = 0; i < frame.can_dlc; ++i) printf(" %02X", frame.data[i]); printf("\n"); if (!can_write(canSocket, &frame)) printf("Error\n"); sleep(1); can_close(canSocket); } void Test_004() { const char *canChannel = "vcan0"; const int canSocket = can_connect(canChannel, false); struct can_frame frame; if (can_read(canSocket, &frame)) { printf("0x%X [%X]", frame.can_id, frame.can_dlc); for (int i = 0; i < frame.can_dlc; ++i) printf(" %02X", frame.data[i]); printf("\n"); } can_close(canSocket); } int main(int argc, char *argv[]) { int tmp; while (1) { printf("Enter choices 1/0 :"); scanf("%d",&tmp); if( tmp < 1) break; Test_001(); Test_002(); Test_003(); Test_004(); } }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
You can’t perform that action at this time.