rusefi-1/firmware/controllers/algo/signal_executor.h

65 lines
1.6 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
*/
scheduling_s signalTimerUp[2];
scheduling_s signalTimerDown[2];
};
2016-09-04 14:03:09 -07:00
void seScheduleByTime(const char *prefix, scheduling_s *scheduling, efitimeus_t time, schfunc_t callback, NamedOutputPin *param);
2015-07-10 06:01:56 -07:00
void initSignalExecutor(void);
2016-09-03 16:02:42 -07:00
void initEnginePinsNames(void);
2015-07-10 06:01:56 -07:00
void initSignalExecutorImpl(void);
#endif /* SPARKOUT_H_ */