#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_GYROADIS16507DEFINITIONS_H_ #define MISSION_DEVICES_DEVICEDEFINITIONS_GYROADIS16507DEFINITIONS_H_ #include "fsfw/datapoollocal/StaticLocalDataSet.h" #include namespace ADIS16507 { static constexpr size_t MAXIMUM_REPLY_SIZE = 64; static constexpr uint32_t GYRO_RANGE = 125; static constexpr uint32_t ACCELEROMETER_RANGE = 392; static constexpr uint16_t PROD_ID = 16507; static constexpr std::array BURST_READ_ENABLE = {0x68, 0x00}; static constexpr uint8_t DIAG_STAT_REG = 0x02; static constexpr uint8_t FILTER_CTRL_REG = 0x5c; static constexpr uint8_t MSC_CTRL_REG = 0x60; static constexpr uint8_t DEC_RATE_REG = 0x64; static constexpr uint8_t GLOB_CMD = 0x68; static constexpr uint8_t PROD_ID_REG = 0x72; static constexpr DeviceCommandId_t READ_SENSOR_DATA = 0; static constexpr DeviceCommandId_t READ_OUT_CONFIG = 1; static constexpr DeviceCommandId_t SELF_TEST_SENSORS = 2; static constexpr DeviceCommandId_t SELF_TEST_MEMORY = 3; static constexpr DeviceCommandId_t UPDATE_NV_CONFIGURATION = 4; static constexpr DeviceCommandId_t SELECT_BURST_READ_MODE = 5; static constexpr DeviceCommandId_t RESET_SENSOR_CONFIGURATION = 30; static constexpr DeviceCommandId_t SW_RESET = 31; static constexpr DeviceCommandId_t PRINT_CURRENT_CONFIGURATION = 32; static constexpr size_t CONFIG_READOUT_SIZE = 8; static constexpr size_t SENSOR_READOUT_SIZE = 22; static constexpr uint32_t ADIS_DATASET_ID = READ_SENSOR_DATA; static constexpr uint32_t ADIS_CFG_DATASET_ID = READ_OUT_CONFIG; enum PrimaryPoolIds: lp_id_t { ANG_VELOC_X, ANG_VELOC_Y, ANG_VELOC_Z, ACCELERATION_X, ACCELERATION_Y, ACCELERATION_Z, TEMPERATURE }; enum ConfigPoolIds: lp_id_t { FILTER_SETTINGS, MSC_CTRL_REGISTER, DEC_RATE_REGISTER, }; enum FilterSettings: uint8_t { NO_FILTER = 0, TWO_TAPS = 1, FOUR_TAPS = 2, EIGHT_TAPS = 3, SIXTEEN_TAPS = 4, THIRTYTWO_TAPS = 5, SIXTYFOUR_TAPS = 6 }; } class AdisGyroPrimaryDataset: public StaticLocalDataSet<7 * sizeof(float)> { public: /** Constructor for data users like controllers */ AdisGyroPrimaryDataset(object_id_t adisId): StaticLocalDataSet(sid_t(adisId, ADIS16507::ADIS_DATASET_ID)) { setAllVariablesReadOnly(); } /* Angular velocities in degrees per second (DPS) */ lp_var_t angVelocX = lp_var_t(sid.objectId, ADIS16507::ANG_VELOC_X, this); lp_var_t angVelocY = lp_var_t(sid.objectId, ADIS16507::ANG_VELOC_Y, this); lp_var_t angVelocZ = lp_var_t(sid.objectId, ADIS16507::ANG_VELOC_Z, this); lp_var_t accelX = lp_var_t(sid.objectId, ADIS16507::ACCELERATION_X, this); lp_var_t accelY = lp_var_t(sid.objectId, ADIS16507::ACCELERATION_Y, this); lp_var_t accelZ = lp_var_t(sid.objectId, ADIS16507::ACCELERATION_Z, this); lp_var_t temperature = lp_var_t(sid.objectId, ADIS16507::TEMPERATURE, this); private: friend class GyroADIS16507Handler; /** Constructor for the data creator */ AdisGyroPrimaryDataset(HasLocalDataPoolIF* hkOwner): StaticLocalDataSet(hkOwner, ADIS16507::ADIS_DATASET_ID) {} }; class AdisGyroConfigDataset: public StaticLocalDataSet<32> { public: /** Constructor for data users like controllers */ AdisGyroConfigDataset(object_id_t adisId): StaticLocalDataSet(sid_t(adisId, ADIS16507::ADIS_DATASET_ID)) { setAllVariablesReadOnly(); } lp_var_t filterSetting = lp_var_t(sid.objectId, ADIS16507::FILTER_SETTINGS); lp_var_t mscCtrlReg = lp_var_t(sid.objectId, ADIS16507::MSC_CTRL_REGISTER); lp_var_t decRateReg = lp_var_t(sid.objectId, ADIS16507::DEC_RATE_REGISTER); private: friend class GyroADIS16507Handler; /** Constructor for the data creator */ AdisGyroConfigDataset(HasLocalDataPoolIF* hkOwner): StaticLocalDataSet(hkOwner, ADIS16507::ADIS_CFG_DATASET_ID) {} }; #endif /* MISSION_DEVICES_DEVICEDEFINITIONS_GYROADIS16507DEFINITIONS_H_ */