Skip to content

Commit 3d12eef

Browse files
author
ABA
committed
add MT6701 I2C sensor configuration
1 parent 6fafa35 commit 3d12eef

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/sensors/MagneticSensorI2C.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ MagneticSensorI2CConfig_s AS5048_I2C = {
1616
.data_start_bit = 15
1717
};
1818

19+
/** Typical configuration for the 12bit MT6701 magnetic sensor over I2C interface */
20+
MagneticSensorI2CConfig_s MT6701_I2C = {
21+
.chip_address = 0x06,
22+
.bit_resolution = 14,
23+
.angle_register = 0x03,
24+
.data_start_bit = 15
25+
};
26+
1927

2028
// MagneticSensorI2C(uint8_t _chip_address, float _cpr, uint8_t _angle_register_msb)
2129
// @param _chip_address I2C chip address
@@ -34,6 +42,7 @@ MagneticSensorI2C::MagneticSensorI2C(uint8_t _chip_address, int _bit_resolution,
3442
// LSB and MSB register used bits
3543
// AS5600 uses 0..7 LSB and 8..11 MSB
3644
// AS5048 uses 0..5 LSB and 6..13 MSB
45+
// MT6701 uses 0..5 LSB and 6..13 MSB
3746
// used bits in LSB
3847
lsb_used = _bit_resolution - _bits_used_msb;
3948
// extraction masks
@@ -111,6 +120,7 @@ int MagneticSensorI2C::read(uint8_t angle_reg_msb) {
111120
// LSB and MSB register used bits
112121
// AS5600 uses 0..7 LSB and 8..11 MSB
113122
// AS5048 uses 0..5 LSB and 6..13 MSB
123+
// MT6701 uses 0..5 LSB and 6..13 MSB
114124
readValue = ( readArray[1] & lsb_mask );
115125
readValue += ( ( readArray[0] & msb_mask ) << lsb_used );
116126
return readValue;

0 commit comments

Comments
 (0)