Implement workaround for https://github.com/JF002/Pinetime/issues/60 : disable sleep for TWI and SPI, and add a delay (500ms) between 2 button IRQ.

This commit is contained in:
JF 2020-09-13 19:06:02 +02:00
parent d757344f1b
commit 88f4c94f8a
4 changed files with 14 additions and 5 deletions

View File

@ -62,7 +62,7 @@ namespace Pinetime {
void IdleState();
QueueHandle_t msgQueue;
static constexpr uint8_t queueSize = 10;
static constexpr uint8_t queueSize = 1;
static constexpr uint8_t itemSize = 1;
Pinetime::Controllers::Battery &batteryController;

View File

@ -226,18 +226,19 @@ bool SpiMaster::Read(uint8_t pinCsn, uint8_t* cmd, size_t cmdSize, uint8_t *data
void SpiMaster::Sleep() {
/*
while(spiBaseAddress->ENABLE != 0) {
spiBaseAddress->ENABLE = (SPIM_ENABLE_ENABLE_Disabled << SPIM_ENABLE_ENABLE_Pos);
}
nrf_gpio_cfg_default(params.pinSCK);
nrf_gpio_cfg_default(params.pinMOSI);
nrf_gpio_cfg_default(params.pinMISO);
*/
NRF_LOG_INFO("[SPIMASTER] sleep")
}
void SpiMaster::Wakeup() {
Init();
//Init();
NRF_LOG_INFO("[SPIMASTER] Wakeup");
}

View File

@ -140,13 +140,15 @@ void TwiMaster::Write(uint8_t deviceAddress, const uint8_t *data, size_t size, b
}
void TwiMaster::Sleep() {
/*
nrf_gpio_cfg_default(6);
nrf_gpio_cfg_default(7);
twiBaseAddress->ENABLE = 0;
*/
NRF_LOG_INFO("[TWIMASTER] Sleep");
}
void TwiMaster::Wakeup() {
Init();
//Init();
NRF_LOG_INFO("[TWIMASTER] Wakeup");
}

View File

@ -101,9 +101,15 @@ extern "C" {
}
}
TickType_t previousTickCount = 0;
void DebounceTimerCallback(TimerHandle_t xTimer) {
xTimerStop(xTimer, 0);
systemTask->OnButtonPushed();
auto currentTickCount = xTaskGetTickCountFromISR();
if(currentTickCount - previousTickCount > 500) {
systemTask->OnButtonPushed();
previousTickCount = currentTickCount;
}
}
void SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler(void) {