Apollo 10.0
自动驾驶开放平台
pc_bcm_201.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2019 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
19
20namespace apollo {
21namespace canbus {
22namespace ge3 {
23
24using ::apollo::drivers::canbus::Byte;
25
26const int32_t Pcbcm201::ID = 0x201;
27
28// public
30
31uint32_t Pcbcm201::GetPeriod() const {
32 // modify every protocol's period manually
33 static const uint32_t PERIOD = 20 * 1000;
34 return PERIOD;
35}
36
37void Pcbcm201::UpdateData(uint8_t* data) {
38 set_p_pc_reverselampreq(data, pc_reverselampreq_);
39 set_p_pc_lowbeamreq(data, pc_lowbeamreq_);
40 set_p_pc_highbeamreq(data, pc_highbeamreq_);
41 set_p_pc_rightturnlampreq(data, pc_rightturnlampreq_);
42 set_p_pc_leftturnlampreq(data, pc_leftturnlampreq_);
43 set_p_pc_hornreq(data, pc_hornreq_);
44 set_p_pc_hazardlampreq(data, pc_hazardlampreq_);
45}
46
48 // you should check this manually
49 pc_reverselampreq_ = Pc_bcm_201::PC_REVERSELAMPREQ_NOREQ;
50 pc_lowbeamreq_ = Pc_bcm_201::PC_LOWBEAMREQ_NOREQ;
51 pc_highbeamreq_ = Pc_bcm_201::PC_HIGHBEAMREQ_NOREQ;
52 pc_rightturnlampreq_ = Pc_bcm_201::PC_RIGHTTURNLAMPREQ_NOREQ;
53 pc_leftturnlampreq_ = Pc_bcm_201::PC_LEFTTURNLAMPREQ_NOREQ;
54 pc_hornreq_ = Pc_bcm_201::PC_HORNREQ_NOREQ;
55 pc_hazardlampreq_ = Pc_bcm_201::PC_HAZARDLAMPREQ_NOREQ;
56}
57
59 Pc_bcm_201::Pc_reverselampreqType pc_reverselampreq) {
60 pc_reverselampreq_ = pc_reverselampreq;
61 return this;
62}
63
64// config detail: {'description': 'Left turn lamp request', 'enum': {0:
65// 'PC_REVERSELAMPREQ_NOREQ', 1: 'PC_REVERSELAMPREQ_REQ'}, 'precision': 1.0,
66// 'len': 1, 'name': 'PC_ReverseLampReq', 'is_signed_var': False, 'offset': 0.0,
67// 'physical_range': '[0|1]', 'bit': 1, 'type': 'enum', 'order': 'motorola',
68// 'physical_unit': ''}
69void Pcbcm201::set_p_pc_reverselampreq(
70 uint8_t* data, Pc_bcm_201::Pc_reverselampreqType pc_reverselampreq) {
71 int x = pc_reverselampreq;
72
73 Byte to_set(data + 0);
74 to_set.set_value(static_cast<uint8_t>(x), 1, 1);
75}
76
78 Pc_bcm_201::Pc_lowbeamreqType pc_lowbeamreq) {
79 pc_lowbeamreq_ = pc_lowbeamreq;
80 return this;
81}
82
83// config detail: {'description': 'Left turn lamp request', 'enum': {0:
84// 'PC_LOWBEAMREQ_NOREQ', 1: 'PC_LOWBEAMREQ_REQ'}, 'precision': 1.0, 'len': 1,
85// 'name': 'PC_LowBeamReq', 'is_signed_var': False, 'offset': 0.0,
86// 'physical_range': '[0|1]', 'bit': 2, 'type': 'enum', 'order': 'motorola',
87// 'physical_unit': ''}
88void Pcbcm201::set_p_pc_lowbeamreq(
89 uint8_t* data, Pc_bcm_201::Pc_lowbeamreqType pc_lowbeamreq) {
90 int x = pc_lowbeamreq;
91
92 Byte to_set(data + 0);
93 to_set.set_value(static_cast<uint8_t>(x), 2, 1);
94}
95
97 Pc_bcm_201::Pc_highbeamreqType pc_highbeamreq) {
98 pc_highbeamreq_ = pc_highbeamreq;
99 return this;
100}
101
102// config detail: {'description': 'Left turn lamp request', 'enum': {0:
103// 'PC_HIGHBEAMREQ_NOREQ', 1: 'PC_HIGHBEAMREQ_REQ'}, 'precision': 1.0, 'len': 1,
104// 'name': 'PC_HighBeamReq', 'is_signed_var': False, 'offset': 0.0,
105// 'physical_range': '[0|1]', 'bit': 3, 'type': 'enum', 'order': 'motorola',
106// 'physical_unit': ''}
107void Pcbcm201::set_p_pc_highbeamreq(
108 uint8_t* data, Pc_bcm_201::Pc_highbeamreqType pc_highbeamreq) {
109 int x = pc_highbeamreq;
110
111 Byte to_set(data + 0);
112 to_set.set_value(static_cast<uint8_t>(x), 3, 1);
113}
114
116 Pc_bcm_201::Pc_rightturnlampreqType pc_rightturnlampreq) {
117 pc_rightturnlampreq_ = pc_rightturnlampreq;
118 return this;
119}
120
121// config detail: {'description': 'Right turn lamp request', 'enum': {0:
122// 'PC_RIGHTTURNLAMPREQ_NOREQ', 1: 'PC_RIGHTTURNLAMPREQ_REQ'}, 'precision': 1.0,
123// 'len': 1, 'name': 'PC_RightTurnLampReq', 'is_signed_var': False, 'offset':
124// 0.0, 'physical_range': '[0|3]', 'bit': 4, 'type': 'enum', 'order':
125// 'motorola', 'physical_unit': ''}
126void Pcbcm201::set_p_pc_rightturnlampreq(
127 uint8_t* data, Pc_bcm_201::Pc_rightturnlampreqType pc_rightturnlampreq) {
128 int x = pc_rightturnlampreq;
129
130 Byte to_set(data + 0);
131 to_set.set_value(static_cast<uint8_t>(x), 4, 1);
132}
133
135 Pc_bcm_201::Pc_leftturnlampreqType pc_leftturnlampreq) {
136 pc_leftturnlampreq_ = pc_leftturnlampreq;
137 return this;
138}
139
140// config detail: {'description': 'Left turn lamp request', 'enum': {0:
141// 'PC_LEFTTURNLAMPREQ_NOREQ', 1: 'PC_LEFTTURNLAMPREQ_REQ'}, 'precision': 1.0,
142// 'len': 1, 'name': 'PC_LeftTurnLampReq', 'is_signed_var': False, 'offset':
143// 0.0, 'physical_range': '[0|1]', 'bit': 5, 'type': 'enum', 'order':
144// 'motorola', 'physical_unit': ''}
145void Pcbcm201::set_p_pc_leftturnlampreq(
146 uint8_t* data, Pc_bcm_201::Pc_leftturnlampreqType pc_leftturnlampreq) {
147 int x = pc_leftturnlampreq;
148
149 Byte to_set(data + 0);
150 to_set.set_value(static_cast<uint8_t>(x), 5, 1);
151}
152
154 pc_hornreq_ = pc_hornreq;
155 return this;
156}
157
158// config detail: {'description': 'Horn request', 'enum': {0:
159// 'PC_HORNREQ_NOREQ', 1: 'PC_HORNREQ_REQ'}, 'precision': 1.0, 'len': 1, 'name':
160// 'PC_HornReq', 'is_signed_var': False, 'offset': 0.0, 'physical_range':
161// '[0|1]', 'bit': 6, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
162void Pcbcm201::set_p_pc_hornreq(uint8_t* data,
163 Pc_bcm_201::Pc_hornreqType pc_hornreq) {
164 int x = pc_hornreq;
165
166 Byte to_set(data + 0);
167 to_set.set_value(static_cast<uint8_t>(x), 6, 1);
168}
169
171 Pc_bcm_201::Pc_hazardlampreqType pc_hazardlampreq) {
172 pc_hazardlampreq_ = pc_hazardlampreq;
173 return this;
174}
175
176// config detail: {'description': 'Hazard lamp request', 'enum': {0:
177// 'PC_HAZARDLAMPREQ_NOREQ', 1: 'PC_HAZARDLAMPREQ_REQ'}, 'precision': 1.0,
178// 'len': 1, 'name': 'PC_HazardLampReq', 'is_signed_var': False, 'offset': 0.0,
179// 'physical_range': '[0|1]', 'bit': 7, 'type': 'enum', 'order': 'motorola',
180// 'physical_unit': ''}
181void Pcbcm201::set_p_pc_hazardlampreq(
182 uint8_t* data, Pc_bcm_201::Pc_hazardlampreqType pc_hazardlampreq) {
183 int x = pc_hazardlampreq;
184
185 Byte to_set(data + 0);
186 to_set.set_value(static_cast<uint8_t>(x), 7, 1);
187}
188
189} // namespace ge3
190} // namespace canbus
191} // namespace apollo
Defines the Byte class.
Pcbcm201 * set_pc_highbeamreq(Pc_bcm_201::Pc_highbeamreqType pc_highbeamreq)
Definition pc_bcm_201.cc:96
Pcbcm201 * set_pc_reverselampreq(Pc_bcm_201::Pc_reverselampreqType pc_reverselampreq)
Definition pc_bcm_201.cc:58
Pcbcm201 * set_pc_leftturnlampreq(Pc_bcm_201::Pc_leftturnlampreqType pc_leftturnlampreq)
static const int32_t ID
Definition pc_bcm_201.h:29
Pcbcm201 * set_pc_hazardlampreq(Pc_bcm_201::Pc_hazardlampreqType pc_hazardlampreq)
Pcbcm201 * set_pc_lowbeamreq(Pc_bcm_201::Pc_lowbeamreqType pc_lowbeamreq)
Definition pc_bcm_201.cc:77
void UpdateData(uint8_t *data) override
Definition pc_bcm_201.cc:37
Pcbcm201 * set_pc_rightturnlampreq(Pc_bcm_201::Pc_rightturnlampreqType pc_rightturnlampreq)
Pcbcm201 * set_pc_hornreq(Pc_bcm_201::Pc_hornreqType pc_hornreq)
uint32_t GetPeriod() const override
Definition pc_bcm_201.cc:31
class register implement
Definition arena_queue.h:37