Skip to content

Commit cf4ac28

Browse files
committed
Simple support for multiplexed signals.
1 parent b952fab commit cf4ac28

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

src/codegen/c-main-generator.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,15 @@ void CiMainGenerator::WriteSigStructField(const SignalDescriptor_t& sig, bool bi
322322
fwriter->AppendLine(" // " + std::regex_replace(sig.ValueText, std::regex("\n"), "\n // "));
323323
}
324324

325+
if (sig.Multiplex == MultiplexType::kMulValue)
326+
{
327+
fwriter->AppendLine(" // multiplex variable");
328+
}
329+
else if (sig.Multiplex == MultiplexType::kMaster)
330+
{
331+
fwriter->AppendLine(" // MULTIPLEX master signal");
332+
}
333+
325334
std::string dtype = "";
326335

327336
dtype += " " + PrintType((int)sig.Type) + " " + sig.Name;

src/parser/dbclineparser.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,25 @@ bool DbcLineParser::ParseSignalLine(SignalDescriptor_t* sig, const std::string&
153153
// split middle part on dedicated values
154154
auto valpart = resplit(trim(tailpart[0]), kRegSigReceivers, -1);
155155

156-
halfs = resplit(halfs[0], kRegSigSplit0, -1);
156+
halfs = resplit(halfs[0], kRegValTable, 0);
157157

158-
if (halfs.size() > 1)
158+
if (halfs.size() >= 2)
159159
{
160-
sig->Name = halfs[halfs.size() - 1];
160+
sig->Name = halfs[1];
161+
sig->Multiplex = MultiplexType::kNone;
162+
163+
if (halfs.size() == 3)
164+
{
165+
// Multiplex signal, put additional comment
166+
if (halfs[2] == "M")
167+
{
168+
sig->Multiplex = MultiplexType::kMaster;
169+
}
170+
else
171+
{
172+
sig->Multiplex = MultiplexType::kMulValue;
173+
}
174+
}
161175
}
162176
else
163177
{

src/types/message.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ enum class BitLayout
1313
kMotorolla
1414
};
1515

16+
enum class MultiplexType
17+
{
18+
kNone,
19+
kMaster,
20+
kMulValue
21+
};
22+
1623
enum class SigType
1724
{
1825
i8 = 0,
@@ -77,6 +84,8 @@ typedef struct
7784

7885
std::string ValueText;
7986

87+
MultiplexType Multiplex;
88+
8089
} SignalDescriptor_t;
8190

8291
typedef struct

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy