AP_Baro: robust spi device
This commit is contained in:
parent
60f7788be4
commit
bfd03ab40c
@ -112,10 +112,16 @@ void AP_Baro_MS5611::_spi_write(uint8_t reg)
|
|||||||
// SPI should be initialized externally
|
// SPI should be initialized externally
|
||||||
bool AP_Baro_MS5611::init()
|
bool AP_Baro_MS5611::init()
|
||||||
{
|
{
|
||||||
hal.scheduler->suspend_timer_procs();
|
|
||||||
_spi = hal.spi->device(AP_HAL::SPIDevice_MS5611);
|
_spi = hal.spi->device(AP_HAL::SPIDevice_MS5611);
|
||||||
|
if (_spi == NULL) {
|
||||||
|
hal.console->println_P(PSTR("PANIC: AP_Baro_MS5611 could not get "
|
||||||
|
"valid SPI device driver!"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
_spi_sem = _spi->get_semaphore();
|
_spi_sem = _spi->get_semaphore();
|
||||||
|
|
||||||
|
hal.scheduler->suspend_timer_procs();
|
||||||
|
|
||||||
_spi_write(CMD_MS5611_RESET);
|
_spi_write(CMD_MS5611_RESET);
|
||||||
hal.scheduler->delay(4);
|
hal.scheduler->delay(4);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user