Skip to content

Commit

Permalink
[driver] max31865 spi mode 3 fixed in #994
Browse files Browse the repository at this point in the history
  • Loading branch information
hshose committed Apr 9, 2023
1 parent 8e0a8dd commit eaff392
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion examples/stm32f469_discovery/max31865/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ThermocoupleThread : public modm::pt::Protothread
run()
{
PT_BEGIN();
pt100.initialize();
PT_CALL(pt100.initialize());

while (true)
{
Expand Down
2 changes: 1 addition & 1 deletion src/modm/driver/temperature/max31865.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class Max31865 : public max31865<pt>,
Max31865(max31865<pt>::Data &data);

/// Call this function once before using the device
void
modm::ResumableResult<void>
initialize();

/// Read the raw data from the sensor
Expand Down
11 changes: 2 additions & 9 deletions src/modm/driver/temperature/max31865_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,12 @@ namespace modm
template<typename SpiMaster, typename Cs, Pt pt>
Max31865<SpiMaster, Cs, pt>::Max31865(max31865<pt>::Data &data) : data(data)
{
this->attachConfigurationHandler([]() {
static_assert(std::is_same_v<SpiMaster, modm::platform::SpiMaster2>);
SPI2->CR1 &= ~SPI_CR1_SPE;
__DSB();
SpiMaster::setDataMode(SpiMaster::DataMode::Mode3);
SPI2->CR1 |= SPI_CR1_SPE;
__DSB();
});
this->attachConfigurationHandler([]() { SpiMaster::setDataMode(SpiMaster::DataMode::Mode3); });
Cs::setOutput(modm::Gpio::High);
}

template<typename SpiMaster, typename Cs, Pt pt>
void
modm::ResumableResult<void>
Max31865<SpiMaster, Cs, pt>::initialize()
{

Expand Down

0 comments on commit eaff392

Please sign in to comment.