QSPI: Add pointer to HAL init function

pull/11892/head
Przemyslaw Stekiel 2019-10-24 12:49:41 +02:00
parent b35579ba39
commit ef8a99472a
2 changed files with 6 additions and 3 deletions

View File

@ -235,6 +235,7 @@ protected:
bool _initialized;
PinName _qspi_io0, _qspi_io1, _qspi_io2, _qspi_io3, _qspi_clk, _qspi_cs; //IO lines, clock and chip select
const qspi_pinmap_t *_explicit_pinmap;
bool (QSPI::* _init_func)(void);
private:
/* Private acquire function without locking/unlocking

View File

@ -60,9 +60,10 @@ QSPI::QSPI(PinName io0, PinName io1, PinName io2, PinName io3, PinName sclk, Pin
_mode = mode;
_hz = ONE_MHZ;
_initialized = false;
_init_func = &QSPI::_initialize;
//Go ahead init the device here with the default config
bool success = _initialize();
bool success = (this->*_init_func)();
MBED_ASSERT(success);
}
@ -85,9 +86,10 @@ QSPI::QSPI(const qspi_pinmap_t &pinmap, int mode) : _qspi()
_mode = mode;
_hz = ONE_MHZ;
_initialized = false;
_init_func = &QSPI::_initialize_direct;
//Go ahead init the device here with the default config
bool success = _initialize_direct();
bool success = (this->*_init_func)();
MBED_ASSERT(success);
}
@ -304,7 +306,7 @@ bool QSPI::_acquire()
{
if (_owner != this) {
//This will set freq as well
_initialize();
(this->*_init_func)();
_owner = this;
}