mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-30 06:43:34 +08:00
makeDataType() moved to generic transfer test helpers
This commit is contained in:
@@ -29,18 +29,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static uavcan::DataTypeDescriptor makeDataType(uavcan::DataTypeKind kind, uint16_t id)
|
|
||||||
{
|
|
||||||
uavcan::DataTypeDescriptor dtd(kind, id, uavcan::DataTypeHash());
|
|
||||||
for (int i = 0; i < uavcan::DataTypeHash::NUM_BYTES; i += 2)
|
|
||||||
{
|
|
||||||
dtd.hash.value[i] = id & 0xFF;
|
|
||||||
dtd.hash.value[i + 1] = id >> 8;
|
|
||||||
}
|
|
||||||
return dtd;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static const uavcan::NodeID SELF_NODE_ID(64);
|
static const uavcan::NodeID SELF_NODE_ID(64);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -209,6 +209,17 @@ std::vector<uavcan::RxFrame> serializeTransfer(const Transfer& transfer)
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uavcan::DataTypeDescriptor makeDataType(uavcan::DataTypeKind kind, uint16_t id)
|
||||||
|
{
|
||||||
|
uavcan::DataTypeDescriptor dtd(kind, id, uavcan::DataTypeHash());
|
||||||
|
for (int i = 0; i < uavcan::DataTypeHash::NUM_BYTES; i += 2)
|
||||||
|
{
|
||||||
|
dtd.hash.value[i] = id & 0xFF;
|
||||||
|
dtd.hash.value[i + 1] = id >> 8;
|
||||||
|
}
|
||||||
|
return dtd;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -272,4 +283,3 @@ public:
|
|||||||
|
|
||||||
template <int SIZE> void send(const Transfer (&transfers)[SIZE]) { send(transfers, SIZE); }
|
template <int SIZE> void send(const Transfer (&transfers)[SIZE]) { send(transfers, SIZE); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user