You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix bug allowing SPI::abort_transfer to incorrectly unlock deep sleep mode
- Add flag to SPI class to track if the SPI instance has locked deep sleep mode.
- Wrap call to sleep_manager_lock_deep_sleep to only be called if SPI instance
hasn't already locked deep sleep.
- Wrap call to sleep_manager_unlock_deep_sleep to only be called if SPI has
currently locked deep sleep mode.
@@ -140,7 +141,7 @@ int SPI::transfer(const void *tx_buffer, int tx_length, void *rx_buffer, int rx_
140
141
voidSPI::abort_transfer()
141
142
{
142
143
spi_abort_asynch(&_spi);
143
-
sleep_manager_unlock_deep_sleep();
144
+
unlock_deep_sleep();
144
145
#if TRANSACTION_QUEUE_SIZE_SPI
145
146
dequeue_transaction();
146
147
#endif
@@ -200,13 +201,29 @@ int SPI::queue_transfer(const void *tx_buffer, int tx_length, void *rx_buffer, i
200
201
201
202
voidSPI::start_transfer(constvoid *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsignedchar bit_width, constevent_callback_t& callback, int event)
Copy file name to clipboardExpand all lines: drivers/SPI.h
+9Lines changed: 9 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -246,6 +246,14 @@ class SPI : private NonCopyable<SPI> {
246
246
*/
247
247
voidstart_transfer(constvoid *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsignedchar bit_width, constevent_callback_t& callback, int event);
248
248
249
+
private:
250
+
/** Lock deep sleep only if it is not yet locked */
251
+
voidlock_deep_sleep();
252
+
253
+
/** Unlock deep sleep in case it is locked */
254
+
voidunlock_deep_sleep();
255
+
256
+
249
257
#if TRANSACTION_QUEUE_SIZE_SPI
250
258
251
259
/** Start a new transaction
@@ -274,6 +282,7 @@ class SPI : private NonCopyable<SPI> {
0 commit comments