dispatch.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2018-2019, Dataspeed Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Dataspeed Inc. nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 #ifndef _DBW_FCA_CAN_DISPATCH_H
36 #define _DBW_FCA_CAN_DISPATCH_H
37 #include <stdint.h>
38 
39 namespace dbw_fca_can
40 {
41 
42 typedef struct {
43  uint16_t PCMD;
44  uint8_t :4;
45  uint8_t CMD_TYPE :4;
46  uint8_t EN :1;
47  uint8_t CLEAR :1;
48  uint8_t IGNORE :1;
49  uint8_t :4;
50  uint8_t RES1 :1;
51  uint8_t :8;
52  uint8_t :8;
53  uint8_t :8;
54  uint8_t COUNT;
55 } MsgBrakeCmd;
56 
57 typedef struct {
58  uint16_t PI;
59  uint16_t PC;
60  uint16_t PO;
61  uint8_t BTYPE :2;
62  uint8_t :1;
63  uint8_t WDCBRK :1;
64  uint8_t WDCSRC :4;
65  uint8_t ENABLED :1;
66  uint8_t OVERRIDE :1;
67  uint8_t DRIVER :1;
68  uint8_t FLTWDC :1;
69  uint8_t FLT1 :1;
70  uint8_t FLT2 :1;
71  uint8_t FLTPWR :1;
72  uint8_t TMOUT :1;
74 
75 typedef struct {
76  uint16_t PCMD;
77  uint8_t :4;
78  uint8_t CMD_TYPE :4;
79  uint8_t EN :1;
80  uint8_t CLEAR :1;
81  uint8_t IGNORE :1;
82  uint8_t :4;
83  uint8_t RES1 :1;
84  uint8_t :8;
85  uint8_t :8;
86  uint8_t :8;
87  uint8_t COUNT;
89 
90 typedef struct {
91  uint16_t PI;
92  uint16_t PC;
93  uint16_t PO;
94  uint8_t :4;
95  uint8_t WDCSRC :4;
96  uint8_t ENABLED :1;
97  uint8_t OVERRIDE :1;
98  uint8_t DRIVER :1;
99  uint8_t FLTWDC :1;
100  uint8_t FLT1 :1;
101  uint8_t FLT2 :1;
102  uint8_t FLTPWR :1;
103  uint8_t TMOUT :1;
105 
106 typedef struct {
107  int16_t SCMD;
108  uint8_t EN :1;
109  uint8_t CLEAR :1;
110  uint8_t IGNORE :1;
111  uint8_t :1;
112  uint8_t QUIET :1;
113  uint8_t RES1 :1;
114  uint8_t :1;
115  uint8_t CMD_TYPE :1;
116  uint8_t SVEL;
117  uint8_t :8;
118  uint8_t :8;
119  uint8_t :8;
120  uint8_t COUNT;
122 
123 typedef struct {
124  int16_t ANGLE;
125  int16_t CMD :15;
126  uint8_t TMODE :1; // Torque mode
127  uint16_t SPEED;
128  int8_t TORQUE;
129  uint8_t ENABLED :1;
130  uint8_t OVERRIDE :1;
131  uint8_t FLTPWR :1;
132  uint8_t FLTWDC :1;
133  uint8_t FLTBUS1 :1;
134  uint8_t FLTBUS2 :1;
135  uint8_t FLTCAL :1;
136  uint8_t TMOUT :1;
138 
139 typedef struct {
140  uint8_t GCMD :3;
141  uint8_t :3;
142  uint8_t RES1 :1;
143  uint8_t CLEAR :1;
144 } MsgGearCmd;
145 
146 typedef struct {
147  uint8_t STATE :3;
148  uint8_t OVERRIDE :1;
149  uint8_t CMD :3;
150  uint8_t FLTBUS :1;
151  uint8_t REJECT :3;
152  uint8_t :5;
153 } MsgGearReport;
154 
155 typedef struct {
156  uint8_t TRNCMD :2;
157  uint8_t :2;
158  uint8_t DOORSEL :2;
159  uint8_t DOORCMD :2;
160  uint8_t ft_drv_temp_cmd :7;
161  uint8_t :1;
162  uint8_t ft_psg_temp_cmd :7;
163  uint8_t :1;
164  uint8_t ft_fn_sp_cmd :3;
165  uint8_t :5;
166  uint8_t max_ac :2;
167  uint8_t ac :2;
168  uint8_t ft_hvac :2;
169  uint8_t auto_md :2;
170  uint8_t recirc :2;
171  uint8_t sync :2;
172  uint8_t r_defr :2;
173  uint8_t f_defr :2;
174  uint8_t vent_md_cmd :4;
175  uint8_t :2;
176  uint8_t hsw_cmd :2;
177  uint8_t fl_hs_cmd :2;
178  uint8_t fl_vs_cmd :2;
179  uint8_t fr_hs_cmd :2;
180  uint8_t fr_vs_cmd :2;
181 } MsgMiscCmd;
182 
183 typedef struct {
184  uint8_t turn_signal :2;
185  uint8_t head_light_hi :2;
186  uint8_t wiper_front :4;
187  uint8_t :3;
188  uint8_t :1;
189  uint8_t :1;
190  uint8_t btn_cc_res :1;
191  uint8_t btn_cc_cncl :1;
192  uint8_t :1;
193  uint8_t btn_cc_on_off :1;
194  uint8_t :1;
195  uint8_t btn_cc_set_inc :1;
196  uint8_t btn_cc_set_dec :1;
197  uint8_t btn_cc_gap_inc :1;
198  uint8_t btn_cc_gap_dec :1;
199  uint8_t :1;
200  uint8_t FLTBUS :1;
201  uint8_t :1;
202  uint8_t :1;
203  uint8_t door_rear_left :1;
204  uint8_t door_rear_right :1;
205  uint8_t :1;
206  uint8_t door_trunk :1;
207  uint8_t :1;
208  uint8_t :1;
209  uint8_t :2;
210  uint8_t btn_ld_ok :1;
211  uint8_t btn_ld_up :1;
212  uint8_t btn_ld_down :1;
213  uint8_t btn_ld_left :1;
214  uint8_t btn_ld_right :1;
215  uint8_t :1;
216  uint8_t btn_cc_mode :1;
217  uint8_t :7;
218 } MsgMiscReport;
219 
220 typedef struct {
221  uint8_t ft_drv_temp_stat :7;
222  uint8_t :1;
223  uint8_t ft_psg_temp_stat :7;
224  uint8_t :1;
225  uint8_t ft_fn_sp_stat :3;
226  uint8_t :5;
227  uint8_t max_ac :1;
228  uint8_t ac :1;
229  uint8_t ft_hvac :1;
230  uint8_t auto_md :1;
231  uint8_t recirc :1;
232  uint8_t sync :1;
233  uint8_t r_defr :1;
234  uint8_t f_defr :1;
235  uint8_t vent_md_stat: 4;
236  uint8_t :3;
237  uint8_t hsw_stat :1;
238  uint8_t fl_hs_stat :2;
239  uint8_t fl_vs_stat :2;
240  uint8_t fr_hs_stat :2;
241  uint8_t fr_vs_stat :2;
243 
244 typedef struct {
245  int16_t front_left;
246  int16_t front_right;
247  int16_t rear_left;
248  int16_t rear_right;
250 
251 typedef struct {
252  int16_t accel_lat;
253  int16_t accel_long;
254  int16_t accel_vert;
256 
257 typedef struct {
258  int16_t gyro_roll;
259  int16_t gyro_yaw;
260 } MsgReportGyro;
261 
262 typedef struct {
263  int32_t latitude :31;
264  int32_t lat_valid :1;
265  int32_t longitude :31;
266  int32_t long_valid :1;
267 } MsgReportGps1;
268 
269 typedef struct {
270  uint8_t utc_year :7;
271  uint8_t :1;
272  uint8_t utc_month :4;
273  uint8_t :4;
274  uint8_t utc_day :5;
275  uint8_t :3;
276  uint8_t utc_hours :5;
277  uint8_t :3;
278  uint8_t utc_minutes :6;
279  uint8_t :2;
280  uint8_t utc_seconds :6;
281  uint8_t :2;
282  uint8_t compass_dir :4;
283  uint8_t :4;
284  uint8_t :5;
285  uint8_t :1;
286  uint8_t :1;
287  uint8_t :1;
288 } MsgReportGps2;
289 
290 typedef struct {
291  int32_t dr_latitude :31;
292  int32_t dr_lat_valid :1;
293  int32_t dr_longitude :31;
294  int32_t dr_long_valid :1;
295 } MsgReportGps3;
296 
297 typedef struct {
298  int16_t front_left;
299  int16_t front_right;
300  int16_t rear_left;
301  int16_t rear_right;
303 
304 typedef struct {
305  int16_t fuel_level :11; // 0.18696 %
306  uint8_t :5;
307  uint8_t :8;
308  uint8_t battery_12v :8; // 0.0625 V
309  uint32_t odometer :24; // 0.1 km
310  uint8_t :8;
312 
313 typedef struct {
314  uint16_t front_left;
315  uint16_t front_right;
316  uint16_t rear_left;
317  uint16_t rear_right;
319 
320 typedef struct {
321  uint32_t brake_torque_request :12;
322  uint32_t brake_torque_actual :12;
323  uint32_t brake_pc :8;
324  uint32_t brake_pressure :11;
325  uint32_t stationary :1;
326  uint32_t :4;
327  uint32_t :16;
329 
330 typedef struct {
331  int16_t axle_torque :15;
332  int16_t :1;
333  uint8_t throttle_pc :8;
334  uint8_t gear_num :5;
335  uint8_t :3;
336  uint8_t :8;
337  uint8_t :8;
338  uint8_t :8;
339  uint8_t :8;
341 
342 typedef enum {
343  LIC_MUX_F0 = 0x00, // Feature 0 (BASE)
344  LIC_MUX_F1 = 0x01, // Feature 1 (CONTROL)
345  LIC_MUX_F2 = 0x02, // Feature 2 (SENSORS)
346  LIC_MUX_F3 = 0x03, // Feature 3 (unused)
347  LIC_MUX_F4 = 0x04, // Feature 4 (unused)
348  LIC_MUX_F5 = 0x05, // Feature 5 (unused)
349  LIC_MUX_F6 = 0x06, // Feature 6 (unused)
350  LIC_MUX_F7 = 0x07, // Feature 7 (unused)
353  LIC_MUX_MAC = 0x80,
356  LIC_MUX_VIN0 = 0x83,
357  LIC_MUX_VIN1 = 0x84,
358  LIC_MUX_VIN2 = 0x85,
359 } LicenseMux;
360 typedef struct {
361  uint8_t mux;
362  uint8_t ready :1;
363  uint8_t trial :1;
364  uint8_t expired :1;
365  uint8_t :1;
366  uint8_t module :4;
367  union {
368  struct {
369  uint8_t enabled :1;
370  uint8_t trial :1;
371  uint8_t :6;
372  uint8_t :8;
373  uint16_t trials_used;
374  uint16_t trials_left;
375  } license;
376  struct {
377  uint8_t ldate0;
378  uint8_t ldate1;
379  uint8_t ldate2;
380  uint8_t ldate3;
381  uint8_t ldate4;
382  uint8_t ldate5;
383  } ldate0;
384  struct {
385  uint8_t ldate6;
386  uint8_t ldate7;
387  uint8_t ldate8;
388  uint8_t ldate9;
389  uint8_t :8;
390  uint8_t :8;
391  } ldate1;
392  struct {
393  uint8_t addr0;
394  uint8_t addr1;
395  uint8_t addr2;
396  uint8_t addr3;
397  uint8_t addr4;
398  uint8_t addr5;
399  } mac;
400  struct {
401  uint8_t date0;
402  uint8_t date1;
403  uint8_t date2;
404  uint8_t date3;
405  uint8_t date4;
406  uint8_t date5;
407  } bdate0;
408  struct {
409  uint8_t date6;
410  uint8_t date7;
411  uint8_t date8;
412  uint8_t date9;
413  uint8_t :8;
414  uint8_t :8;
415  } bdate1;
416  struct {
417  uint8_t vin00;
418  uint8_t vin01;
419  uint8_t vin02;
420  uint8_t vin03;
421  uint8_t vin04;
422  uint8_t vin05;
423  } vin0;
424  struct {
425  uint8_t vin06;
426  uint8_t vin07;
427  uint8_t vin08;
428  uint8_t vin09;
429  uint8_t vin10;
430  uint8_t vin11;
431  } vin1;
432  struct {
433  uint8_t vin12;
434  uint8_t vin13;
435  uint8_t vin14;
436  uint8_t vin15;
437  uint8_t vin16;
438  uint8_t :8;
439  } vin2;
440  };
441 } MsgLicense;
442 
443 typedef struct {
444  uint8_t module;
445  uint8_t platform;
446  uint16_t major;
447  uint16_t minor;
448  uint16_t build;
449 } MsgVersion;
450 
451 #define BUILD_ASSERT(cond) do { (void) sizeof(char [1 - 2*!(cond)]); } while(0)
452 static void dispatchAssertSizes() {
453  BUILD_ASSERT(8 == sizeof(MsgBrakeCmd));
454  BUILD_ASSERT(8 == sizeof(MsgBrakeReport));
455  BUILD_ASSERT(8 == sizeof(MsgThrottleCmd));
456  BUILD_ASSERT(8 == sizeof(MsgThrottleReport));
457  BUILD_ASSERT(8 == sizeof(MsgSteeringCmd));
458  BUILD_ASSERT(8 == sizeof(MsgSteeringReport));
459  BUILD_ASSERT(1 == sizeof(MsgGearCmd));
460  BUILD_ASSERT(2 == sizeof(MsgGearReport));
461  BUILD_ASSERT(8 == sizeof(MsgMiscCmd));
462  BUILD_ASSERT(6 == sizeof(MsgMiscReport));
463  BUILD_ASSERT(6 == sizeof(MsgMisc2Report));
464  BUILD_ASSERT(8 == sizeof(MsgReportWheelSpeed));
465  BUILD_ASSERT(6 == sizeof(MsgReportAccel));
466  BUILD_ASSERT(4 == sizeof(MsgReportGyro));
467  BUILD_ASSERT(8 == sizeof(MsgReportGps1));
468  BUILD_ASSERT(8 == sizeof(MsgReportGps2));
469  BUILD_ASSERT(8 == sizeof(MsgReportGps3));
470  BUILD_ASSERT(8 == sizeof(MsgReportWheelPosition));
471  BUILD_ASSERT(8 == sizeof(MsgReportTirePressure));
472  BUILD_ASSERT(8 == sizeof(MsgReportFuelLevel));
473  BUILD_ASSERT(8 == sizeof(MsgReportBrakeInfo));
474  BUILD_ASSERT(8 == sizeof(MsgReportThrottleInfo));
475  BUILD_ASSERT(8 == sizeof(MsgLicense));
476  BUILD_ASSERT(8 == sizeof(MsgVersion));
477 }
478 #undef BUILD_ASSERT
479 
480 enum {
481  ID_BRAKE_CMD = 0x060,
487  ID_GEAR_CMD = 0x066,
488  ID_GEAR_REPORT = 0x067,
489  ID_MISC_CMD = 0x068,
490  ID_MISC_REPORT = 0x069,
493  ID_REPORT_GYRO = 0x06C,
494  ID_REPORT_GPS1 = 0x06D,
495  ID_REPORT_GPS2 = 0x06E,
496  ID_REPORT_GPS3 = 0x06F,
503  ID_LICENSE = 0x07E,
504  ID_VERSION = 0x07F,
505 };
506 
507 } // namespace dbw_fca_can
508 
509 #endif // _DBW_FCA_CAN_DISPATCH_H
510 
#define BUILD_ASSERT(cond)
Definition: dispatch.h:451
static void dispatchAssertSizes()
Definition: dispatch.h:452


dbw_fca_can
Author(s): Kevin Hallenbeck
autogenerated on Wed May 12 2021 02:14:05