Apollo 10.0
自动驾驶开放平台
adc_auxiliarycontrol_110.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
18
20
21namespace apollo {
22namespace canbus {
23namespace transit {
24
25using ::apollo::drivers::canbus::Byte;
26
27const int32_t Adcauxiliarycontrol110::ID = 0x110;
28
29// public
31
33 // TODO(All) : modify every protocol's period manually
34 static const uint32_t PERIOD = 10 * 1000;
35 return PERIOD;
36}
37
39 set_p_adc_auxcontrol_counter(data, adc_auxcontrol_counter_);
40 set_p_adc_auxcontrol_checksum(data, adc_auxcontrol_checksum_);
41 set_p_adc_cmd_inverter_controlenable(data, adc_cmd_inverter_controlenable_);
42 set_p_adc_cmd_inverter(data, adc_cmd_inverter_);
43 set_p_adc_cmd_wiper(data, adc_cmd_wiper_);
44 set_p_adc_cmd_pdu_controlenable(data, adc_cmd_pdu_controlenable_);
45 set_p_adc_cmd_pdu_ch8(data, adc_cmd_pdu_ch8_);
46 set_p_adc_cmd_pdu_ch7(data, adc_cmd_pdu_ch7_);
47 set_p_adc_cmd_pdu_ch6(data, adc_cmd_pdu_ch6_);
48 set_p_adc_cmd_pdu_ch5(data, adc_cmd_pdu_ch5_);
49 set_p_adc_cmd_pdu_ch4(data, adc_cmd_pdu_ch4_);
50 set_p_adc_cmd_pdu_ch3(data, adc_cmd_pdu_ch3_);
51 set_p_adc_cmd_pdu_ch2(data, adc_cmd_pdu_ch2_);
52 set_p_adc_cmd_pdu_ch1(data, adc_cmd_pdu_ch1_);
53 set_p_adc_cmd_hazardlights(data, adc_cmd_hazardlights_);
54 set_p_adc_cmd_highbeam(data, adc_cmd_highbeam_);
55 set_p_adc_cmd_lowbeam(data, adc_cmd_lowbeam_);
56 set_p_adc_cmd_horn(data, adc_cmd_horn_);
57 set_p_adc_cmd_turnsignal(data, adc_cmd_turnsignal_);
58}
59
61 // TODO(All) : you should check this manually
62 adc_auxcontrol_counter_ = 0;
63 adc_auxcontrol_checksum_ = 0;
64 adc_cmd_inverter_controlenable_ = false;
65 adc_cmd_inverter_ = false;
66 adc_cmd_wiper_ = 0;
67 adc_cmd_pdu_controlenable_ = false;
68 adc_cmd_pdu_ch8_ = false;
69 adc_cmd_pdu_ch7_ = false;
70 adc_cmd_pdu_ch6_ = false;
71 adc_cmd_pdu_ch5_ = false;
72 adc_cmd_pdu_ch4_ = false;
73 adc_cmd_pdu_ch3_ = false;
74 adc_cmd_pdu_ch2_ = false;
75 adc_cmd_pdu_ch1_ = false;
76 adc_cmd_hazardlights_ = false;
77 adc_cmd_highbeam_ = false;
78 adc_cmd_lowbeam_ = false;
79 adc_cmd_horn_ = false;
81}
82
84 int adc_auxcontrol_counter) {
85 adc_auxcontrol_counter_ = adc_auxcontrol_counter;
86 return this;
87}
88
89// config detail: {'description': 'Aux control heartbeat counter', 'offset':
90// 0.0, 'precision': 1.0, 'len': 2, 'name': 'ADC_AuxControl_Counter',
91// 'is_signed_var': False, 'physical_range': '[0|3]', 'bit': 54, 'type': 'int',
92// 'order': 'intel', 'physical_unit': ''}
93void Adcauxiliarycontrol110::set_p_adc_auxcontrol_counter(
94 uint8_t* data, int adc_auxcontrol_counter) {
95 adc_auxcontrol_counter =
96 ProtocolData::BoundedValue(0, 3, adc_auxcontrol_counter);
97 uint8_t x = static_cast<uint8_t>(adc_auxcontrol_counter);
98
99 Byte to_set(data + 6);
100 to_set.set_value(x, 6, 2);
101}
102
104 int adc_auxcontrol_checksum) {
105 adc_auxcontrol_checksum_ = adc_auxcontrol_checksum;
106 return this;
107}
108
109// config detail: {'description': 'Aux control checksum', 'offset': 0.0,
110// 'precision': 1.0, 'len': 8, 'name': 'ADC_AuxControl_Checksum',
111// 'is_signed_var': False, 'physical_range': '[0|255]', 'bit': 56, 'type':
112// 'int', 'order': 'intel', 'physical_unit': ''}
113void Adcauxiliarycontrol110::set_p_adc_auxcontrol_checksum(
114 uint8_t* data, int adc_auxcontrol_checksum) {
115 adc_auxcontrol_checksum =
116 ProtocolData::BoundedValue(0, 255, adc_auxcontrol_checksum);
117 uint8_t x = static_cast<uint8_t>(adc_auxcontrol_checksum);
118
119 Byte to_set(data + 7);
120 to_set.set_value(x, 0, 8);
121}
122
123Adcauxiliarycontrol110*
125 bool adc_cmd_inverter_controlenable) {
126 adc_cmd_inverter_controlenable_ = adc_cmd_inverter_controlenable;
127 return this;
128}
129
130// config detail: {'description': 'Control inverter override (default ON if not
131// overridden)', 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name':
132// 'ADC_CMD_Inverter_ControlEnable', 'is_signed_var': False, 'physical_range':
133// '[0|1]', 'bit': 1, 'type': 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
134void Adcauxiliarycontrol110::set_p_adc_cmd_inverter_controlenable(
135 uint8_t* data, bool adc_cmd_inverter_controlenable) {
136 uint8_t x = adc_cmd_inverter_controlenable;
137
138 Byte to_set(data + 0);
139 to_set.set_value(x, 1, 1);
140}
141
143 bool adc_cmd_inverter) {
144 adc_cmd_inverter_ = adc_cmd_inverter;
145 return this;
146}
147
148// config detail: {'description': 'Control inverter', 'offset': 0.0,
149// 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_Inverter', 'is_signed_var':
150// False, 'physical_range': '[0|1]', 'bit': 2, 'type': 'bool', 'order': 'intel',
151// 'physical_unit': 'T/F'}
152void Adcauxiliarycontrol110::set_p_adc_cmd_inverter(uint8_t* data,
153 bool adc_cmd_inverter) {
154 uint8_t x = adc_cmd_inverter;
155
156 Byte to_set(data + 0);
157 to_set.set_value(x, 2, 1);
158}
159
161 int adc_cmd_wiper) {
162 adc_cmd_wiper_ = adc_cmd_wiper;
163 return this;
164}
165
166// config detail: {'description': '(Reserved) Control wiper', 'offset': 0.0,
167// 'precision': 1.0, 'len': 2, 'name': 'ADC_CMD_Wiper', 'is_signed_var': False,
168// 'physical_range': '[0|3]', 'bit': 4, 'type': 'int', 'order': 'intel',
169// 'physical_unit': ''}
170void Adcauxiliarycontrol110::set_p_adc_cmd_wiper(uint8_t* data,
171 int adc_cmd_wiper) {
172 adc_cmd_wiper = ProtocolData::BoundedValue(0, 3, adc_cmd_wiper);
173 uint8_t x = static_cast<uint8_t>(adc_cmd_wiper);
174
175 Byte to_set(data + 0);
176 to_set.set_value(x, 4, 2);
177}
178
180 bool adc_cmd_pdu_controlenable) {
181 adc_cmd_pdu_controlenable_ = adc_cmd_pdu_controlenable;
182 return this;
183}
184
185// config detail: {'description': 'PDU Control Override (all channels default ON
186// if not overridden)', 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name':
187// 'ADC_CMD_PDU_ControlEnable', 'is_signed_var': False, 'physical_range':
188// '[0|1]', 'bit': 0, 'type': 'bool', 'order': 'intel', 'physical_unit': 'T/F'}
189void Adcauxiliarycontrol110::set_p_adc_cmd_pdu_controlenable(
190 uint8_t* data, bool adc_cmd_pdu_controlenable) {
191 uint8_t x = adc_cmd_pdu_controlenable;
192
193 Byte to_set(data + 0);
194 to_set.set_value(x, 0, 1);
195}
196
198 bool adc_cmd_pdu_ch8) {
199 adc_cmd_pdu_ch8_ = adc_cmd_pdu_ch8;
200 return this;
201}
202
203// config detail: {'description': 'Control PDU Ch 8 (when override enabled)',
204// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch8',
205// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 15, 'type': 'bool',
206// 'order': 'intel', 'physical_unit': 'T/F'}
207void Adcauxiliarycontrol110::set_p_adc_cmd_pdu_ch8(uint8_t* data,
208 bool adc_cmd_pdu_ch8) {
209 uint8_t x = adc_cmd_pdu_ch8;
210
211 Byte to_set(data + 1);
212 to_set.set_value(x, 7, 1);
213}
214
216 bool adc_cmd_pdu_ch7) {
217 adc_cmd_pdu_ch7_ = adc_cmd_pdu_ch7;
218 return this;
219}
220
221// config detail: {'description': 'Control PDU Ch 7 (when override enabled)',
222// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch7',
223// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 14, 'type': 'bool',
224// 'order': 'intel', 'physical_unit': 'T/F'}
225void Adcauxiliarycontrol110::set_p_adc_cmd_pdu_ch7(uint8_t* data,
226 bool adc_cmd_pdu_ch7) {
227 uint8_t x = adc_cmd_pdu_ch7;
228
229 Byte to_set(data + 1);
230 to_set.set_value(x, 6, 1);
231}
232
234 bool adc_cmd_pdu_ch6) {
235 adc_cmd_pdu_ch6_ = adc_cmd_pdu_ch6;
236 return this;
237}
238
239// config detail: {'description': 'Control PDU Ch 6 (when override enabled)',
240// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch6',
241// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 13, 'type': 'bool',
242// 'order': 'intel', 'physical_unit': 'T/F'}
243void Adcauxiliarycontrol110::set_p_adc_cmd_pdu_ch6(uint8_t* data,
244 bool adc_cmd_pdu_ch6) {
245 uint8_t x = adc_cmd_pdu_ch6;
246
247 Byte to_set(data + 1);
248 to_set.set_value(x, 5, 1);
249}
250
252 bool adc_cmd_pdu_ch5) {
253 adc_cmd_pdu_ch5_ = adc_cmd_pdu_ch5;
254 return this;
255}
256
257// config detail: {'description': 'Control PDU Ch 5 (when override enabled)',
258// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch5',
259// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 12, 'type': 'bool',
260// 'order': 'intel', 'physical_unit': 'T/F'}
261void Adcauxiliarycontrol110::set_p_adc_cmd_pdu_ch5(uint8_t* data,
262 bool adc_cmd_pdu_ch5) {
263 uint8_t x = adc_cmd_pdu_ch5;
264
265 Byte to_set(data + 1);
266 to_set.set_value(x, 4, 1);
267}
268
270 bool adc_cmd_pdu_ch4) {
271 adc_cmd_pdu_ch4_ = adc_cmd_pdu_ch4;
272 return this;
273}
274
275// config detail: {'description': 'Control PDU Ch 4 (when override enabled)',
276// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch4',
277// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 11, 'type': 'bool',
278// 'order': 'intel', 'physical_unit': 'T/F'}
279void Adcauxiliarycontrol110::set_p_adc_cmd_pdu_ch4(uint8_t* data,
280 bool adc_cmd_pdu_ch4) {
281 uint8_t x = adc_cmd_pdu_ch4;
282
283 Byte to_set(data + 1);
284 to_set.set_value(x, 3, 1);
285}
286
288 bool adc_cmd_pdu_ch3) {
289 adc_cmd_pdu_ch3_ = adc_cmd_pdu_ch3;
290 return this;
291}
292
293// config detail: {'description': 'Control PDU Ch 3 (when override enabled)',
294// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch3',
295// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 10, 'type': 'bool',
296// 'order': 'intel', 'physical_unit': 'T/F'}
297void Adcauxiliarycontrol110::set_p_adc_cmd_pdu_ch3(uint8_t* data,
298 bool adc_cmd_pdu_ch3) {
299 uint8_t x = adc_cmd_pdu_ch3;
300
301 Byte to_set(data + 1);
302 to_set.set_value(x, 2, 1);
303}
304
306 bool adc_cmd_pdu_ch2) {
307 adc_cmd_pdu_ch2_ = adc_cmd_pdu_ch2;
308 return this;
309}
310
311// config detail: {'description': 'Control PDU Ch 2 (when override enabled)',
312// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch2',
313// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 9, 'type': 'bool',
314// 'order': 'intel', 'physical_unit': 'T/F'}
315void Adcauxiliarycontrol110::set_p_adc_cmd_pdu_ch2(uint8_t* data,
316 bool adc_cmd_pdu_ch2) {
317 uint8_t x = adc_cmd_pdu_ch2;
318
319 Byte to_set(data + 1);
320 to_set.set_value(x, 1, 1);
321}
322
324 bool adc_cmd_pdu_ch1) {
325 adc_cmd_pdu_ch1_ = adc_cmd_pdu_ch1;
326 return this;
327}
328
329// config detail: {'description': 'Control PDU Ch 1 (when override enabled)',
330// 'offset': 0.0, 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_PDU_Ch1',
331// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 8, 'type': 'bool',
332// 'order': 'intel', 'physical_unit': 'T/F'}
333void Adcauxiliarycontrol110::set_p_adc_cmd_pdu_ch1(uint8_t* data,
334 bool adc_cmd_pdu_ch1) {
335 uint8_t x = adc_cmd_pdu_ch1;
336
337 Byte to_set(data + 1);
338 to_set.set_value(x, 0, 1);
339}
340
342 bool adc_cmd_hazardlights) {
343 adc_cmd_hazardlights_ = adc_cmd_hazardlights;
344 return this;
345}
346
347// config detail: {'description': 'Control hazard lights', 'offset': 0.0,
348// 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_HazardLights', 'is_signed_var':
349// False, 'physical_range': '[0|1]', 'bit': 28, 'type': 'bool', 'order':
350// 'intel', 'physical_unit': 'T/F'}
351void Adcauxiliarycontrol110::set_p_adc_cmd_hazardlights(
352 uint8_t* data, bool adc_cmd_hazardlights) {
353 uint8_t x = adc_cmd_hazardlights;
354
355 Byte to_set(data + 3);
356 to_set.set_value(x, 4, 1);
357}
358
360 bool adc_cmd_highbeam) {
361 adc_cmd_highbeam_ = adc_cmd_highbeam;
362 return this;
363}
364
365// config detail: {'description': 'Control high beam', 'offset': 0.0,
366// 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_HighBeam', 'is_signed_var':
367// False, 'physical_range': '[0|1]', 'bit': 27, 'type': 'bool', 'order':
368// 'intel', 'physical_unit': 'T/F'}
369void Adcauxiliarycontrol110::set_p_adc_cmd_highbeam(uint8_t* data,
370 bool adc_cmd_highbeam) {
371 uint8_t x = adc_cmd_highbeam;
372
373 Byte to_set(data + 3);
374 to_set.set_value(x, 3, 1);
375}
376
378 bool adc_cmd_lowbeam) {
379 adc_cmd_lowbeam_ = adc_cmd_lowbeam;
380 return this;
381}
382
383// config detail: {'description': 'Control low beam', 'offset': 0.0,
384// 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_LowBeam', 'is_signed_var':
385// False, 'physical_range': '[0|1]', 'bit': 26, 'type': 'bool', 'order':
386// 'intel', 'physical_unit': 'T/F'}
387void Adcauxiliarycontrol110::set_p_adc_cmd_lowbeam(uint8_t* data,
388 bool adc_cmd_lowbeam) {
389 uint8_t x = adc_cmd_lowbeam;
390
391 Byte to_set(data + 3);
392 to_set.set_value(x, 2, 1);
393}
394
396 bool adc_cmd_horn) {
397 adc_cmd_horn_ = adc_cmd_horn;
398 return this;
399}
400
401// config detail: {'description': 'Control horn', 'offset': 0.0,
402// 'precision': 1.0, 'len': 1, 'name': 'ADC_CMD_Horn', 'is_signed_var': False,
403// 'physical_range': '[0|1]', 'bit': 3, 'type': 'bool', 'order': 'intel',
404// 'physical_unit': 'T/F'}
405void Adcauxiliarycontrol110::set_p_adc_cmd_horn(uint8_t* data,
406 bool adc_cmd_horn) {
407 uint8_t x = adc_cmd_horn;
408
409 Byte to_set(data + 0);
410 to_set.set_value(x, 3, 1);
411}
412
415 adc_cmd_turnsignal_ = adc_cmd_turnsignal;
416 return this;
417}
418
419// config detail: {'description': 'Requested turn signals', 'enum': {0:
420// 'ADC_CMD_TURNSIGNAL_NONE', 1: 'ADC_CMD_TURNSIGNAL_LEFT', 2:
421// 'ADC_CMD_TURNSIGNAL_RIGHT', 3: 'ADC_CMD_TURNSIGNAL_RESERVE'},
422// 'precision': 1.0, 'len': 2, 'name': 'ADC_CMD_TurnSignal', 'is_signed_var':
423// False, 'offset': 0.0, 'physical_range': '[0|3]', 'bit': 24, 'type': 'enum',
424// 'order': 'intel', 'physical_unit': ''}
425void Adcauxiliarycontrol110::set_p_adc_cmd_turnsignal(
426 uint8_t* data,
428 uint8_t x = adc_cmd_turnsignal;
429
430 Byte to_set(data + 3);
431 to_set.set_value(x, 0, 2);
432}
433
434} // namespace transit
435} // namespace canbus
436} // namespace apollo
Defines the Byte class.
Adcauxiliarycontrol110 * set_adc_cmd_horn(bool adc_cmd_horn)
Adcauxiliarycontrol110 * set_adc_cmd_turnsignal(Adc_auxiliarycontrol_110::Adc_cmd_turnsignalType adc_cmd_turnsignal)
Adcauxiliarycontrol110 * set_adc_cmd_lowbeam(bool adc_cmd_lowbeam)
Adcauxiliarycontrol110 * set_adc_cmd_pdu_ch4(bool adc_cmd_pdu_ch4)
Adcauxiliarycontrol110 * set_adc_cmd_inverter_controlenable(bool adc_cmd_inverter_controlenable)
Adcauxiliarycontrol110 * set_adc_cmd_pdu_ch2(bool adc_cmd_pdu_ch2)
Adcauxiliarycontrol110 * set_adc_cmd_wiper(int adc_cmd_wiper)
Adcauxiliarycontrol110 * set_adc_cmd_pdu_ch6(bool adc_cmd_pdu_ch6)
Adcauxiliarycontrol110 * set_adc_cmd_pdu_ch8(bool adc_cmd_pdu_ch8)
Adcauxiliarycontrol110 * set_adc_cmd_pdu_ch3(bool adc_cmd_pdu_ch3)
Adcauxiliarycontrol110 * set_adc_cmd_pdu_ch7(bool adc_cmd_pdu_ch7)
Adcauxiliarycontrol110 * set_adc_auxcontrol_counter(int adc_auxcontrol_counter)
Adcauxiliarycontrol110 * set_adc_cmd_pdu_ch5(bool adc_cmd_pdu_ch5)
Adcauxiliarycontrol110 * set_adc_cmd_hazardlights(bool adc_cmd_hazardlights)
Adcauxiliarycontrol110 * set_adc_cmd_pdu_ch1(bool adc_cmd_pdu_ch1)
Adcauxiliarycontrol110 * set_adc_auxcontrol_checksum(int adc_auxcontrol_checksum)
Adcauxiliarycontrol110 * set_adc_cmd_inverter(bool adc_cmd_inverter)
Adcauxiliarycontrol110 * set_adc_cmd_pdu_controlenable(bool adc_cmd_pdu_controlenable)
Adcauxiliarycontrol110 * set_adc_cmd_highbeam(bool adc_cmd_highbeam)
class register implement
Definition arena_queue.h:37