chore: Companion - add support for GHOST 12bit opt (#1689)

* chore: Companion - add support for 12bit GHOST opt
Resolves #1510

* Ghost protocol reading and writing non-yaml formats

Co-authored-by: elecpower <neilh713@tpg.com.au>
This commit is contained in:
Peter Feerick
2022-03-14 11:10:12 +10:00
committed by GitHub
co-authored by elecpower
parent 9e6ab84599
commit 4571c7b724
7 changed files with 70 additions and 2 deletions
@@ -2260,6 +2260,29 @@ class ModuleUnionField: public UnionField<unsigned int> {
char receiverName[PXX2_MAX_RECEIVERS_PER_MODULE][PXX2_LEN_RX_NAME+1] = {};
};
class GhostField: public UnionField::TransformedMember {
public:
GhostField(DataField * parent, ModuleData& module):
UnionField::TransformedMember(parent, internalField),
internalField(this, "GHOST")
{
internalField.Append(new BoolField<1>(this, module.ghost.raw12bits));
internalField.Append(new SpareBitsField<7>(this));
}
bool select(const unsigned int & attr) const override
{
return attr == PULSES_GHOST;
}
void beforeExport() override {}
void afterImport() override {}
private:
StructField internalField;
};
public:
ModuleUnionField(DataField * parent, ModuleData & module, Board::Type board, unsigned int version):
UnionField<unsigned int>(parent, module.protocol)
@@ -2267,6 +2290,7 @@ class ModuleUnionField: public UnionField<unsigned int> {
if (version >= 219) {
Append(new AccessField(parent, module));
Append(new Afhds3Field(parent, module));
Append(new GhostField(parent, module));
}
Append(new PxxField(parent, module, version));
Append(new MultiField(parent, module));