mirror of https://github.com/ARMmbed/mbed-os.git
QSPI: Add pointer to HAL init function
parent
b35579ba39
commit
ef8a99472a
|
@ -235,6 +235,7 @@ protected:
|
||||||
bool _initialized;
|
bool _initialized;
|
||||||
PinName _qspi_io0, _qspi_io1, _qspi_io2, _qspi_io3, _qspi_clk, _qspi_cs; //IO lines, clock and chip select
|
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;
|
const qspi_pinmap_t *_explicit_pinmap;
|
||||||
|
bool (QSPI::* _init_func)(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* Private acquire function without locking/unlocking
|
/* Private acquire function without locking/unlocking
|
||||||
|
|
|
@ -60,9 +60,10 @@ QSPI::QSPI(PinName io0, PinName io1, PinName io2, PinName io3, PinName sclk, Pin
|
||||||
_mode = mode;
|
_mode = mode;
|
||||||
_hz = ONE_MHZ;
|
_hz = ONE_MHZ;
|
||||||
_initialized = false;
|
_initialized = false;
|
||||||
|
_init_func = &QSPI::_initialize;
|
||||||
|
|
||||||
//Go ahead init the device here with the default config
|
//Go ahead init the device here with the default config
|
||||||
bool success = _initialize();
|
bool success = (this->*_init_func)();
|
||||||
MBED_ASSERT(success);
|
MBED_ASSERT(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,9 +86,10 @@ QSPI::QSPI(const qspi_pinmap_t &pinmap, int mode) : _qspi()
|
||||||
_mode = mode;
|
_mode = mode;
|
||||||
_hz = ONE_MHZ;
|
_hz = ONE_MHZ;
|
||||||
_initialized = false;
|
_initialized = false;
|
||||||
|
_init_func = &QSPI::_initialize_direct;
|
||||||
|
|
||||||
//Go ahead init the device here with the default config
|
//Go ahead init the device here with the default config
|
||||||
bool success = _initialize_direct();
|
bool success = (this->*_init_func)();
|
||||||
MBED_ASSERT(success);
|
MBED_ASSERT(success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,7 +306,7 @@ bool QSPI::_acquire()
|
||||||
{
|
{
|
||||||
if (_owner != this) {
|
if (_owner != this) {
|
||||||
//This will set freq as well
|
//This will set freq as well
|
||||||
_initialize();
|
(this->*_init_func)();
|
||||||
_owner = this;
|
_owner = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue