started rm3100 handler

This commit is contained in:
Robin Müller 2020-12-21 19:50:01 +01:00
parent bb1735d0fe
commit 1cf278e23e
3 changed files with 66 additions and 1 deletions

View File

@ -17,6 +17,15 @@ ReturnValue_t MGMHandlerRM3100::buildTransitionDeviceCommand(
}
void MGMHandlerRM3100::doStartUp() {
if(internalState == STATE_NONE) {
internalState = STATE_CONFIGURE_CMM;
}
switch(internalState) {
case(STATE_CONFIGURE_CMM): {
}
}
}
void MGMHandlerRM3100::doShutDown() {

View File

@ -31,9 +31,19 @@ protected:
private:
enum InternalState {
STATE_NONE, STATE_FIRST_CONTACT, STATE_SETUP, STATE_CHECK_REGISTERS
STATE_NONE,
STATE_CONFIGURE_CMM,
STATE_READ_CMM,
// The cycle count states are propably not going to be used because
// the default cycle count will be used.
STATE_CONFIGURE_CYCLE_COUNT,
STATE_READ_CYCLE_COUNT,
STATE_CONFIGURE_TMRC,
STATE_READ_TMRC,
STATE_NORMAL
};
InternalState internalState = InternalState::STATE_NONE;
bool commandExecuted = false;
};
#endif /* MISSION_DEVICEHANDLING_MGMRM3100HANDLER_H_ */

View File

@ -1,8 +1,54 @@
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_MGMHANDLERRM3100DEFINITIONS_H_
#define MISSION_DEVICES_DEVICEDEFINITIONS_MGMHANDLERRM3100DEFINITIONS_H_
#include <cstdint>
namespace RM3100 {
static constexpr uint8_t READ_MASK = 0b1000'0000;
/*----------------------------------------------------------------------------*/
/* CMM Register
/*----------------------------------------------------------------------------*/
static constexpr uint8_t SET_CMM_CMZ = 1 << 6;
static constexpr uint8_t SET_CMM_CMY = 1 << 5;
static constexpr uint8_t SET_CMM_CMX = 1 << 4;
static constexpr uint8_t SET_CMM_DRDM = 1 << 2;
static constexpr uint8_t SET_CMM_START = 1;
static constexpr uint8_t CMM_REGISTER = 0x01;
static constexpr uint8_t CMM_VALUE = SET_CMM_CMZ | SET_CMM_CMY | SET_CMM_CMX |
SET_CMM_DRDM | SET_CMM_START;
/*----------------------------------------------------------------------------*/
/* Cycle count register
/*----------------------------------------------------------------------------*/
static constexpr uint8_t CYCLE_COUNT_VALUE = 0xC8;
static constexpr uint8_t GAIN = CYCLE_COUNT_VALUE / 100 * 38;
static constexpr uint8_t CYCLE_COUNT_START_REGISTER = 0x04;
/*----------------------------------------------------------------------------*/
/* TMRC register
/*----------------------------------------------------------------------------*/
static constexpr uint8_t TMRC_150HZ_VALUE = 0x94;
static constexpr uint8_t TMRC_75HZ_VALUE = 0x95;
static constexpr uint8_t TMRC_DEFAULT_37HZ_VALUE = 0x96;
static constexpr uint8_t TMRC_REGISTER = 0x0B;
static constexpr uint8_t TMRC_DEFAULT_VALUE = TMRC_75HZ_VALUE;
static constexpr uint8_t MEASUREMENT_REG_START = 0x24;
static constexpr uint8_t BIST_REGISTER = 0x33;
static constexpr uint8_t DATA_READY_VAL = 0b1000'0000;
static constexpr uint8_t STATUS_REGISTER = 0x34;
static constexpr uint8_t REVID_REGISTER = 0x36;
// Range in Microtesla. 1 T equals 10000 Gauss (for comparison with LIS3 MGM)
static constexpr uint8_t RANGE = 800;
}