Fix race conditions during sleep/wakeup, where SPI/TWI could be disabled while transaction were in progress (https://github.com/JF002/Pinetime/issues/60).
This commit is contained in:
parent
d757344f1b
commit
20f5b0ffba
3 changed files with 34 additions and 18 deletions
|
|
@ -140,9 +140,11 @@ void TwiMaster::Write(uint8_t deviceAddress, const uint8_t *data, size_t size, b
|
|||
}
|
||||
|
||||
void TwiMaster::Sleep() {
|
||||
while(twiBaseAddress->ENABLE != 0) {
|
||||
twiBaseAddress->ENABLE = (TWIM_ENABLE_ENABLE_Disabled << TWIM_ENABLE_ENABLE_Pos);
|
||||
}
|
||||
nrf_gpio_cfg_default(6);
|
||||
nrf_gpio_cfg_default(7);
|
||||
twiBaseAddress->ENABLE = 0;
|
||||
NRF_LOG_INFO("[TWIMASTER] Sleep");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue