rusefi-1/firmware/controllers/trigger/trigger_central.h

52 lines
1.4 KiB
C
Raw Normal View History

2015-07-10 06:01:56 -07:00
/*
* @file trigger_central.h
*
* @date Feb 23, 2014
2015-12-31 13:02:30 -08:00
* @author Andrey Belomutskiy, (c) 2012-2016
2015-07-10 06:01:56 -07:00
*/
#ifndef TRIGGER_CENTRAL_H_
#define TRIGGER_CENTRAL_H_
#include "rusefi_enums.h"
#include "listener_array.h"
#include "trigger_decoder.h"
class Engine;
typedef void (*ShaftPositionListener)(trigger_event_e signal, uint32_t index DECLARE_ENGINE_PARAMETER_S);
#ifdef __cplusplus
2015-09-13 14:02:44 -07:00
class Engine;
2015-07-10 06:01:56 -07:00
#define HW_EVENT_TYPES 6
2015-07-15 17:01:33 -07:00
// todo: maybe merge TriggerCentral and TriggerState classes into one class?
2015-07-10 06:01:56 -07:00
class TriggerCentral {
public:
TriggerCentral();
void addEventListener(ShaftPositionListener handler, const char *name, Engine *engine);
void handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PARAMETER_S);
int getHwEventCounter(int index);
void resetCounters();
TriggerState triggerState;
efitick_t nowNt;
private:
IntListenerArray triggerListeneres;
int hwEventCounters[HW_EVENT_TYPES];
};
#endif
void triggerInfo(void);
2015-09-13 14:02:44 -07:00
efitime_t getCrankEventCounter(DECLARE_ENGINE_PARAMETER_F);
efitime_t getStartOfRevolutionIndex(DECLARE_ENGINE_PARAMETER_F);
2015-07-10 06:01:56 -07:00
void hwHandleShaftSignal(trigger_event_e signal);
float getTriggerDutyCycle(int index);
void initTriggerCentral(Logging *sharedLogger, Engine *engine);
void printAllCallbacksHistogram(void);
void printAllTriggers();
void addTriggerEventListener(ShaftPositionListener handler, const char *name, Engine *engine);
int isSignalDecoderError(void);
#endif /* TRIGGER_CENTRAL_H_ */