Skip to content

Commit da7cea0

Browse files
committed
resolve the compiler issues with the SPI encoder init structures #95
1 parent 65e4c2f commit da7cea0

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

src/sensors/MagneticSensorSPI.cpp

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,28 @@ MagneticSensorSPIConfig_s AS5147_SPI = {
1111
.command_rw_bit = 14,
1212
.command_parity_bit = 15
1313
};
14-
// AS5048 and AS5047 are the same as AS5147
15-
MagneticSensorSPIConfig_s AS5048_SPI = AS5147_SPI;
16-
MagneticSensorSPIConfig_s AS5047_SPI = AS5147_SPI;
14+
15+
// AS5048 and AS5047 share the same configuration as AS5147
16+
// we have to explicilty assign them anyway due to compiler issues
17+
// Ex. https://community.simplefoc.com/t/esp32s3-qtpy-platformio-spi-problem/7444
18+
MagneticSensorSPIConfig_s AS5048_SPI = {
19+
.spi_mode = SPI_MODE1,
20+
.clock_speed = 1000000,
21+
.bit_resolution = 14,
22+
.angle_register = 0x3FFF,
23+
.data_start_bit = 13,
24+
.command_rw_bit = 14,
25+
.command_parity_bit = 15
26+
};
27+
MagneticSensorSPIConfig_s AS5047_SPI = {
28+
.spi_mode = SPI_MODE1,
29+
.clock_speed = 1000000,
30+
.bit_resolution = 14,
31+
.angle_register = 0x3FFF,
32+
.data_start_bit = 13,
33+
.command_rw_bit = 14,
34+
.command_parity_bit = 15
35+
};
1736

1837
/** Typical configuration for the 14bit MonolithicPower MA730 magnetic sensor over SPI interface */
1938
MagneticSensorSPIConfig_s MA730_SPI = {

0 commit comments

Comments
 (0)