Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix for issue #82
This pull request modifies MagneticSensorSPI.cpp in the following ways:
Remove #ifndef STM32 masking out spi.beginTransaction and spi.endTransaction on STM32 MCUs. I can find no reason for doing this, and on the other hand doing so means the SPI settings don't get applied for the SPI call, meaning firstly that SPI clock speeds were all wrong for all STM32 users, and some users had clock speeds faster than the sensors they were using supported. Additionally there would be big problems using multiple SPI devices on the bus.
Remove the setClockDivider call - is there any architecture that needs it? Its an obsolete way of setting the SPI clock speed, the modern way is to use SPISettings and beginTransaction(). @askuric do you know where this came from?
Change the 10us delay, between calls, replacing it with a 1us delay. The sensors I can find (AMS, MagAlpha) all require significantly <1us downtime between requests, so this should be sufficient. For ESP32 there is a 50us delay (!) - anyone know why? I've left this for the moment.