From 79d25cbb1607a6965dc992851c0f40bad26747a3 Mon Sep 17 00:00:00 2001 From: Jon Burgess Date: Sat, 13 Sep 2014 19:58:15 +0100 Subject: [PATCH] Update PMIC and IMU interrupt handlers to be more like the documented examples of xEventGroupSetBitsFromISR() in event_groups.h and http://www.freertos.org/xEventGroupSetBitsFromISR.html --- EMF2014/IMUTask.cpp | 11 ++++++----- EMF2014/PMICTask.cpp | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/EMF2014/IMUTask.cpp b/EMF2014/IMUTask.cpp index db49319..4c00d37 100644 --- a/EMF2014/IMUTask.cpp +++ b/EMF2014/IMUTask.cpp @@ -77,14 +77,15 @@ static signed char gyro_orientation[9] = { 1, 0, 0, // X axis mappin // Callbacks static void IMU_interrupt(void) { if (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING) { - static BaseType_t xHigherPriorityTaskWoken = pdFALSE; + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + BaseType_t xResult; // set the int state bit to wake the IMU Task - xEventGroupSetBitsFromISR(imuTask.eventGroup, - IMU_INT_BIT, - &xHigherPriorityTaskWoken); + xResult = xEventGroupSetBitsFromISR(imuTask.eventGroup, + IMU_INT_BIT, + &xHigherPriorityTaskWoken); - if (xHigherPriorityTaskWoken) { + if (xResult == pdPASS) { portYIELD_FROM_ISR(xHigherPriorityTaskWoken); } } diff --git a/EMF2014/PMICTask.cpp b/EMF2014/PMICTask.cpp index 9fe8974..a91d0da 100644 --- a/EMF2014/PMICTask.cpp +++ b/EMF2014/PMICTask.cpp @@ -44,14 +44,15 @@ static void PMICChargeStateInterrupt(void) { if (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING) { - static BaseType_t xHigherPriorityTaskWoken = pdFALSE; + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + BaseType_t xResult; // set the Charge state bit to wake the PMIC Task - xEventGroupSetBitsFromISR(PMIC.eventGroup, - PMIC_CHAREG_STATE_BIT, - &xHigherPriorityTaskWoken); + xResult = xEventGroupSetBitsFromISR(PMIC.eventGroup, + PMIC_CHAREG_STATE_BIT, + &xHigherPriorityTaskWoken); - if (xHigherPriorityTaskWoken) { + if (xResult == pdPASS) { portYIELD_FROM_ISR(xHigherPriorityTaskWoken); } }