Line data Source code
1 : #include "SIM_config.h" 2 : 3 : #if AP_SIM_AS5600_ENABLED 4 : 5 : #include "SIM_I2CDevice.h" 6 : 7 : namespace SITL { 8 : 9 : // datasheet: https://ams.com/documents/20143/36005/AS5600_DS000365_5-00.pdf 10 : 11 : class AS5600DevReg : public I2CRegEnum { 12 : public: 13 : // low 14 : static const uint8_t ZMCO = 0x00; 15 : static const uint8_t ZPOS_HIGH = 0x01; 16 : static const uint8_t ZPOS_LOW = 0x02; 17 : static const uint8_t MPOS_HIGH = 0x03; 18 : static const uint8_t MPOS_LOW = 0x04; 19 : static const uint8_t MANG_HIGH = 0x05; 20 : static const uint8_t MANG_LOW = 0x06; 21 : static const uint8_t CONF_HIGH = 0x07; 22 : static const uint8_t CONF_LOW = 0x08; 23 : 24 : // output registers 25 : static const uint8_t RAW_ANGLE_HIGH = 0x0C; 26 : static const uint8_t RAW_ANGLE_LOW = 0x0D; 27 : static const uint8_t ANGLE_HIGH = 0x0E; 28 : static const uint8_t ANGLE_LOW = 0x0F; 29 : 30 : // status registers 31 : static const uint8_t STATUS = 0x0B; 32 : static const uint8_t AGC = 0x1A; 33 : static const uint8_t MAGNITUDE_HIGH = 0x1B; 34 : static const uint8_t MAGNITUDE_LOW = 0x1C; 35 : 36 : // Burn commands 37 : static const uint8_t BURN = 0xFF; 38 : }; 39 : 40 : class AS5600 : public I2CDevice, protected I2CRegisters_8Bit 41 : { 42 : public: 43 : void init() override; 44 : 45 : void update(const class Aircraft &aircraft) override; 46 : 47 0 : int rdwr(I2C::i2c_rdwr_ioctl_data *&data) override { 48 0 : return I2CRegisters_8Bit::rdwr(data); 49 : } 50 : 51 : private: 52 : 53 : }; 54 : 55 : } // namespace SITL 56 : 57 : #endif // AP_SIM_AS5600_ENABLED