fome-fw/firmware/controllers/algo/signal_executor.h

62 lines
1.4 KiB
C
Raw Normal View History

2015-07-10 06:01:56 -07:00
/**
* @file signal_executor.h
* @brief Asynchronous output signal header
*
* @date Feb 10, 2013
2015-12-31 13:02:30 -08:00
* @author Andrey Belomutskiy, (c) 2012-2016
2015-07-10 06:01:56 -07:00
*/
#ifndef SPARKOUT_H_
#define SPARKOUT_H_
#include "rusefi_enums.h"
#include "global.h"
#include "efifeatures.h"
#include "io_pins.h"
#include "scheduler.h"
#include "efiGpio.h"
#if EFI_PROD_CODE
#include "datalogging.h"
#endif /* EFI_PROD_CODE */
#if EFI_SIGNAL_EXECUTOR_SLEEP
#include "signal_executor_sleep.h"
#endif /* EFI_SIGNAL_EXECUTOR_SLEEP */
2016-09-26 18:03:18 -07:00
class OutputSignalPair {
public:
OutputSignalPair();
scheduling_s signalTimerUp;
scheduling_s signalTimerDown;
/**
* we need atomic flag so that we do not schedule a new pair of up/down before previous down was executed.
*
* That's because we want to be sure that no 'down' side callback would be ignored since we are counting to see
* overlaps so we need the end counter to always have zero.
* TODO: make watchdog decrement relevant counter
*/
bool isScheduled;
InjectorOutputPin *output;
};
2015-07-10 06:01:56 -07:00
/**
* @brief Asynchronous output signal data structure
*/
typedef struct OutputSignal_struct OutputSignal;
struct OutputSignal_struct {
/**
* We are alternating instances so that events which extend into next revolution are not reused while
* scheduling next revolution events
*/
2016-09-26 19:02:53 -07:00
OutputSignalPair signalPair[2];
2015-07-10 06:01:56 -07:00
};
void initSignalExecutor(void);
void initSignalExecutorImpl(void);
#endif /* SPARKOUT_H_ */