Skip to content
Snippets Groups Projects
Commit c4e9f69c authored by Davide Mor's avatar Davide Mor
Browse files

[sx1278] Moved device sanity check before first device interrogation, caused...

[sx1278] Moved device sanity check before first device interrogation, caused stalling if the device was not responding
parent 12a9122b
No related branches found
No related tags found
No related merge requests found
......@@ -156,15 +156,16 @@ SX1278::SX1278(SPIBusInterface &bus, miosix::GpioPin cs) : bus_mgr(bus, cs) {}
SX1278::Error SX1278::init(Config config)
{
// Lock the bus
bus_mgr.lock(Mode::MODE_STDBY);
bus_mgr.waitForIrq(RegIrqFlags::MODE_READY);
// Check if the device is sane before locking the bus
if (getVersion() != 0x12)
{
return Error::BAD_VERSION;
}
// Lock the bus
bus_mgr.lock(Mode::MODE_STDBY);
bus_mgr.waitForIrq(RegIrqFlags::MODE_READY);
setBitrate(config.bitrate);
setFreqDev(config.freq_dev);
setFreqRF(config.freq_rf);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment