bugfix IRQ masking

This commit is contained in:
Verkehrsrot 2019-07-23 11:47:38 +02:00
parent bdbf2db409
commit 1bc63bad94
3 changed files with 9 additions and 10 deletions

View File

@ -17,8 +17,8 @@
#include "timekeeper.h"
void irqHandler(void *pvParameters);
int mask_user_IRQ();
int unmask_user_IRQ();
bool mask_user_IRQ();
bool unmask_user_IRQ();
#ifdef HAS_DISPLAY
void IRAM_ATTR DisplayIRQ();

View File

@ -119,18 +119,18 @@ void IRAM_ATTR GpsIRQ() {
}
#endif
int mask_user_IRQ() {
bool mask_user_IRQ() {
// begin of time critical section: lock I2C bus to ensure accurate timing
if (I2C_MUTEX_LOCK()) {
xTaskNotify(irqHandlerTask, MASK_IRQ, eSetBits);
return 0;
return true;
} else
return 1; // failure
return false; // failure
}
int unmask_user_IRQ() {
bool unmask_user_IRQ() {
// end of time critical section: release I2C bus
I2C_MUTEX_UNLOCK();
xTaskNotify(irqHandlerTask, UNMASK_IRQ, eSetBits);
return 0;
return true;
}

View File

@ -116,8 +116,7 @@ void setup() {
// create some semaphores for syncing / mutexing tasks
I2Caccess = xSemaphoreCreateMutex(); // for access management of i2c bus
if (I2Caccess)
xSemaphoreGive(I2Caccess); // Flag the i2c bus available for use
assert(I2Caccess != NULL);
// disable brownout detection
#ifdef DISABLE_BROWNOUT