added back self-test support

This commit is contained in:
2023-02-20 02:32:48 +01:00
parent 641c069664
commit 2bacf1efa0
5 changed files with 293 additions and 225 deletions

View File

@ -10,14 +10,17 @@ class ImtqHandler;
namespace imtq {
enum class RequestType : uint8_t { MEASURE, ACTUATE };
enum class RequestType : uint8_t { MEASURE_WITH_ACTUATION, ACTUATE };
enum class SpecialRequest : uint8_t {
NONE = 0,
DO_SELF_TEST_X = 1,
DO_SELF_TEST_Y = 2,
DO_SELF_TEST_Z = 3,
GET_SELF_TEST_RESULT = 4
DO_SELF_TEST_POS_X = 1,
DO_SELF_TEST_NEG_X = 2,
DO_SELF_TEST_POS_Y = 3,
DO_SELF_TEST_NEG_Y = 4,
DO_SELF_TEST_POS_Z = 5,
DO_SELF_TEST_NEG_Z = 6,
GET_SELF_TEST_RESULT = 7
};
static const uint8_t INTERFACE_ID = CLASS_ID::IMTQ_HANDLER;
@ -50,16 +53,6 @@ static const DeviceCommandId_t GET_SELF_TEST_RESULT = 0xD;
} // namespace cmdIds
// static const DeviceCommandId_t NONE = 0x0;
// static const DeviceCommandId_t GET_ENG_HK_DATA = 0x1;
// static const DeviceCommandId_t GET_COMMANDED_DIPOLE = 0x3;
///** Generates new measurement of the magnetic field */
// static const DeviceCommandId_t START_MTM_MEASUREMENT = 0x4;
///** Requests the calibrated magnetometer measurement */
// static const DeviceCommandId_t GET_CAL_MTM_MEASUREMENT = 0x5;
///** Requests the raw values measured by the built-in MTM XEN1210 */
// static const DeviceCommandId_t GET_RAW_MTM_MEASUREMENT = 0x6;
static const uint8_t POINTER_REG_SIZE = 1;
enum SetIds : uint32_t {
@ -1105,7 +1098,7 @@ struct ImtqRequest {
imtq::RequestType getRequestType() const { return static_cast<imtq::RequestType>(rawData[0]); }
void setMeasureRequest(imtq::SpecialRequest specialRequest) {
rawData[0] = static_cast<uint8_t>(imtq::RequestType::MEASURE);
rawData[0] = static_cast<uint8_t>(imtq::RequestType::MEASURE_WITH_ACTUATION);
rawData[1] = static_cast<uint8_t>(specialRequest);
}
@ -1148,7 +1141,7 @@ struct ImtqRequest {
private:
ImtqRequest(uint8_t* rawData, size_t maxLen) : rawData(rawData) {
if (rawData != nullptr) {
rawData[0] = static_cast<uint8_t>(imtq::RequestType::MEASURE);
rawData[0] = static_cast<uint8_t>(imtq::RequestType::MEASURE_WITH_ACTUATION);
}
}
uint8_t* rawData;