bugfix IRQ masking
This commit is contained in:
parent
1bc63bad94
commit
31c0037cba
@ -42,8 +42,8 @@
|
|||||||
#define SCREEN_MODE (0x80)
|
#define SCREEN_MODE (0x80)
|
||||||
|
|
||||||
// I2C bus access control
|
// I2C bus access control
|
||||||
#define I2C_MUTEX_LOCK() xSemaphoreTake(I2Caccess, pdMS_TO_TICKS(10)) == pdTRUE
|
#define I2C_MUTEX_LOCK() (xSemaphoreTake(I2Caccess, pdMS_TO_TICKS(10)) == pdTRUE)
|
||||||
#define I2C_MUTEX_UNLOCK() xSemaphoreGive(I2Caccess)
|
#define I2C_MUTEX_UNLOCK() (xSemaphoreGive(I2Caccess))
|
||||||
|
|
||||||
// Struct holding devices's runtime configuration
|
// Struct holding devices's runtime configuration
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
#include "timekeeper.h"
|
#include "timekeeper.h"
|
||||||
|
|
||||||
void irqHandler(void *pvParameters);
|
void irqHandler(void *pvParameters);
|
||||||
bool mask_user_IRQ();
|
int mask_user_IRQ();
|
||||||
bool unmask_user_IRQ();
|
int unmask_user_IRQ();
|
||||||
|
|
||||||
#ifdef HAS_DISPLAY
|
#ifdef HAS_DISPLAY
|
||||||
void IRAM_ATTR DisplayIRQ();
|
void IRAM_ATTR DisplayIRQ();
|
||||||
|
@ -119,18 +119,18 @@ void IRAM_ATTR GpsIRQ() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool mask_user_IRQ() {
|
int mask_user_IRQ() {
|
||||||
// begin of time critical section: lock I2C bus to ensure accurate timing
|
// begin of time critical section: lock I2C bus to ensure accurate timing
|
||||||
if (I2C_MUTEX_LOCK()) {
|
if (I2C_MUTEX_LOCK()) {
|
||||||
xTaskNotify(irqHandlerTask, MASK_IRQ, eSetBits);
|
xTaskNotify(irqHandlerTask, MASK_IRQ, eSetBits);
|
||||||
return true;
|
return 0;
|
||||||
} else
|
} else
|
||||||
return false; // failure
|
return 1; // failure
|
||||||
}
|
}
|
||||||
|
|
||||||
bool unmask_user_IRQ() {
|
int unmask_user_IRQ() {
|
||||||
// end of time critical section: release I2C bus
|
// end of time critical section: release I2C bus
|
||||||
I2C_MUTEX_UNLOCK();
|
I2C_MUTEX_UNLOCK();
|
||||||
xTaskNotify(irqHandlerTask, UNMASK_IRQ, eSetBits);
|
xTaskNotify(irqHandlerTask, UNMASK_IRQ, eSetBits);
|
||||||
return true;
|
return 0;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user