Separate code from headers
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
|
||||
// Arduino Libraries
|
||||
#include <Arduino.h>
|
||||
#include <map>
|
||||
#include "soc/gpio_struct.h"
|
||||
#ifndef TEST
|
||||
#include "pins.h"
|
||||
@@ -30,10 +29,6 @@
|
||||
#define SPARK_FLAG_12 (1 << 9)
|
||||
#define SPARK_FLAG_34 (1 << 10)
|
||||
|
||||
// Task handle
|
||||
TaskHandle_t trigA_TaskHandle = NULL;
|
||||
TaskHandle_t trigB_TaskHandle = NULL;
|
||||
|
||||
// Spark Status
|
||||
enum sparkStatus
|
||||
{
|
||||
@@ -83,53 +78,8 @@ struct ignitionBoxStatus
|
||||
struct isrParams {
|
||||
const uint32_t flag;
|
||||
ignitionBoxStatus* ign_stat;
|
||||
TaskHandle_t* rt_handle_ptr;
|
||||
};
|
||||
|
||||
|
||||
// =====================
|
||||
// ISR (Pass return bitmask to ISR management function)
|
||||
// one function for each wake up pin conncted to a trigger
|
||||
// =====================
|
||||
void IRAM_ATTR trig_isr_a(void *arg)
|
||||
{
|
||||
const int64_t time_us = esp_timer_get_time();
|
||||
|
||||
// exit if task is not running
|
||||
if (!trigA_TaskHandle || !arg)
|
||||
return;
|
||||
|
||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||
isrParams *params = (isrParams*)arg;
|
||||
ignitionBoxStatus *box = box;
|
||||
|
||||
// reset spark flags, cannot be same time as trigger flags
|
||||
box->coils12.spark_ok = false;
|
||||
box->coils34.spark_ok = false;
|
||||
|
||||
switch (params->flag)
|
||||
{
|
||||
case TRIG_FLAG_12P:
|
||||
box->coils12.trig_time = time_us;
|
||||
xTaskNotifyFromISR(trigA_TaskHandle, params->flag, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
||||
break;
|
||||
case TRIG_FLAG_34P:
|
||||
box->coils34.trig_time = time_us;
|
||||
xTaskNotifyFromISR(trigA_TaskHandle, params->flag, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
|
||||
break;
|
||||
case SPARK_FLAG_12:
|
||||
box->coils12.spark_ok = true;
|
||||
box->coils12.spark_time = time_us;
|
||||
vTaskNotifyGiveFromISR(trigA_TaskHandle, &xHigherPriorityTaskWoken);
|
||||
break;
|
||||
case SPARK_FLAG_34:
|
||||
box->coils34.spark_ok = true;
|
||||
box->coils34.spark_time = time_us;
|
||||
vTaskNotifyGiveFromISR(trigA_TaskHandle, &xHigherPriorityTaskWoken);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (xHigherPriorityTaskWoken)
|
||||
portYIELD_FROM_ISR();
|
||||
}
|
||||
void IRAM_ATTR trig_isr(void *arg);
|
||||
|
||||
Reference in New Issue
Block a user