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:
parent
d757344f1b
commit
88f4c94f8a
@ -62,7 +62,7 @@ namespace Pinetime {
|
|||||||
void IdleState();
|
void IdleState();
|
||||||
QueueHandle_t msgQueue;
|
QueueHandle_t msgQueue;
|
||||||
|
|
||||||
static constexpr uint8_t queueSize = 10;
|
static constexpr uint8_t queueSize = 1;
|
||||||
static constexpr uint8_t itemSize = 1;
|
static constexpr uint8_t itemSize = 1;
|
||||||
|
|
||||||
Pinetime::Controllers::Battery &batteryController;
|
Pinetime::Controllers::Battery &batteryController;
|
||||||
|
@ -226,18 +226,19 @@ bool SpiMaster::Read(uint8_t pinCsn, uint8_t* cmd, size_t cmdSize, uint8_t *data
|
|||||||
|
|
||||||
|
|
||||||
void SpiMaster::Sleep() {
|
void SpiMaster::Sleep() {
|
||||||
|
/*
|
||||||
while(spiBaseAddress->ENABLE != 0) {
|
while(spiBaseAddress->ENABLE != 0) {
|
||||||
spiBaseAddress->ENABLE = (SPIM_ENABLE_ENABLE_Disabled << SPIM_ENABLE_ENABLE_Pos);
|
spiBaseAddress->ENABLE = (SPIM_ENABLE_ENABLE_Disabled << SPIM_ENABLE_ENABLE_Pos);
|
||||||
}
|
}
|
||||||
nrf_gpio_cfg_default(params.pinSCK);
|
nrf_gpio_cfg_default(params.pinSCK);
|
||||||
nrf_gpio_cfg_default(params.pinMOSI);
|
nrf_gpio_cfg_default(params.pinMOSI);
|
||||||
nrf_gpio_cfg_default(params.pinMISO);
|
nrf_gpio_cfg_default(params.pinMISO);
|
||||||
|
*/
|
||||||
NRF_LOG_INFO("[SPIMASTER] sleep")
|
NRF_LOG_INFO("[SPIMASTER] sleep")
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpiMaster::Wakeup() {
|
void SpiMaster::Wakeup() {
|
||||||
Init();
|
//Init();
|
||||||
NRF_LOG_INFO("[SPIMASTER] Wakeup");
|
NRF_LOG_INFO("[SPIMASTER] Wakeup");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,13 +140,15 @@ void TwiMaster::Write(uint8_t deviceAddress, const uint8_t *data, size_t size, b
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TwiMaster::Sleep() {
|
void TwiMaster::Sleep() {
|
||||||
|
/*
|
||||||
nrf_gpio_cfg_default(6);
|
nrf_gpio_cfg_default(6);
|
||||||
nrf_gpio_cfg_default(7);
|
nrf_gpio_cfg_default(7);
|
||||||
twiBaseAddress->ENABLE = 0;
|
twiBaseAddress->ENABLE = 0;
|
||||||
|
*/
|
||||||
NRF_LOG_INFO("[TWIMASTER] Sleep");
|
NRF_LOG_INFO("[TWIMASTER] Sleep");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TwiMaster::Wakeup() {
|
void TwiMaster::Wakeup() {
|
||||||
Init();
|
//Init();
|
||||||
NRF_LOG_INFO("[TWIMASTER] Wakeup");
|
NRF_LOG_INFO("[TWIMASTER] Wakeup");
|
||||||
}
|
}
|
||||||
|
@ -101,9 +101,15 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TickType_t previousTickCount = 0;
|
||||||
void DebounceTimerCallback(TimerHandle_t xTimer) {
|
void DebounceTimerCallback(TimerHandle_t xTimer) {
|
||||||
xTimerStop(xTimer, 0);
|
xTimerStop(xTimer, 0);
|
||||||
|
|
||||||
|
auto currentTickCount = xTaskGetTickCountFromISR();
|
||||||
|
if(currentTickCount - previousTickCount > 500) {
|
||||||
systemTask->OnButtonPushed();
|
systemTask->OnButtonPushed();
|
||||||
|
previousTickCount = currentTickCount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler(void) {
|
void SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler(void) {
|
||||||
|
Loading…
Reference in New Issue
Block a user