auto-sync

This commit is contained in:
rusEfi 2015-02-08 14:07:01 -06:00
parent a93dc56baf
commit d2e9ee5eb4
7 changed files with 36 additions and 37 deletions

View File

@ -96,4 +96,23 @@ typedef brain_pin_e brain_input_pin_e;
typedef fuel_table_t ve_table_t;
typedef fuel_table_t afr_table_t;
typedef void (*VoidPtr)(void*);
typedef void (*VoidInt)(int);
typedef void (*VoidIntVoidPtr)(int, void*);
typedef void (*VoidFloat)(float);
typedef void (*VoidFloatFloat)(float, float);
typedef void (*VoidFloatFloatVoidPtr)(float, float, void*);
typedef void (*VoidIntInt)(int, int);
typedef void (*VoidIntIntVoidPtr)(int, int, void*);
typedef void (*VoidCharPtr)(const char *);
typedef void (*VoidCharPtrVoidPtr)(const char *, void*);
typedef void (*VoidCharPtrCharPtr)(const char *, const char *);
typedef void (*VoidCharPtrCharPtrVoidPtr)(const char *, const char *, void*);
typedef void (*VoidCharPtrCharPtrCharPtr)(const char *, const char *, const char *);
typedef void (*VoidCharPtrCharPtrCharPtrCharPtrCharPtr)(const char *, const char *, const char *, const char *, const char *);
#endif /* CONTROLLERS_ALGO_RUSEFI_TYPES_H_ */

View File

@ -50,7 +50,7 @@ uint64_t getStartOfRevolutionIndex() {
void TriggerCentral::addEventListener(ShaftPositionListener listener, const char *name, Engine *engine) {
print("registerCkpListener: %s\r\n", name);
triggerListeneres.registerCallback((IntListener) listener, engine);
triggerListeneres.registerCallback((VoidInt) listener, engine);
}
/**

View File

@ -123,9 +123,9 @@ static void initWave(const char *name, int index) {
reader->name = name;
hw->widthListeners.registerCallback((IntListener) waAnaWidthCallback, (void*) reader);
hw->widthListeners.registerCallback((VoidInt) waAnaWidthCallback, (void*) reader);
hw->periodListeners.registerCallback((IntListener) waIcuPeriodCallback, (void*) reader);
hw->periodListeners.registerCallback((VoidInt) waIcuPeriodCallback, (void*) reader);
initWaveAnalyzerDriver(hw, brainPin);

View File

@ -57,7 +57,7 @@ void initVehicleSpeed(Logging *l) {
initWaveAnalyzerDriver(&vehicleSpeedInput, engineConfiguration->vehicleSpeedSensorInputPin);
startInputDriver(&vehicleSpeedInput, true);
vehicleSpeedInput.widthListeners.registerCallback((IntListener) vsAnaWidthCallback, NULL);
vehicleSpeedInput.widthListeners.registerCallback((VoidInt) vsAnaWidthCallback, NULL);
addConsoleAction("speedinfo", speedInfo);
}

View File

@ -9,14 +9,8 @@
#ifndef RFICONSOLE_LOGIC_H_
#define RFICONSOLE_LOGIC_H_
#include "datalogging.h"
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#include "efifeatures.h"
#include "datalogging.h"
#include "rusefi_types.h"
typedef enum {
@ -45,26 +39,13 @@ typedef struct {
void *param;
} TokenCallback;
int tokenLength(const char *msgp);
typedef void (*VoidPtr)(void*);
typedef void (*VoidInt)(int);
typedef void (*VoidIntVoidPtr)(int, void*);
typedef void (*VoidFloat)(float);
typedef void (*VoidFloatFloat)(float, float);
typedef void (*VoidFloatFloatVoidPtr)(float, float, void*);
typedef void (*VoidIntInt)(int, int);
typedef void (*VoidIntIntVoidPtr)(int, int, void*);
typedef void (*VoidCharPtr)(const char *);
typedef void (*VoidCharPtrVoidPtr)(const char *, void*);
typedef void (*VoidCharPtrCharPtr)(const char *, const char *);
typedef void (*VoidCharPtrCharPtrVoidPtr)(const char *, const char *, void*);
typedef void (*VoidCharPtrCharPtrCharPtr)(const char *, const char *, const char *);
typedef void (*VoidCharPtrCharPtrCharPtrCharPtrCharPtr)(const char *, const char *, const char *, const char *, const char *);
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
char *validateSecureLine(char *line);
void resetConsoleActions(void);

View File

@ -12,7 +12,7 @@ IntListenerArray::IntListenerArray() {
currentListenersCount = 0;
}
void IntListenerArray::registerCallback(IntListener handler, void *arg) {
void IntListenerArray::registerCallback(VoidInt handler, void *arg) {
efiAssertVoid(currentListenersCount < MAX_INT_LISTENER_COUNT, "Too many callbacks");
int index = currentListenersCount++;
callbacks[index] = handler;
@ -20,7 +20,7 @@ void IntListenerArray::registerCallback(IntListener handler, void *arg) {
}
void IntListenerArray::registerCallback(Void listener) {
registerCallback((IntListener)listener, NULL);
registerCallback((VoidInt)listener, NULL);
}
void invokeCallbacks(IntListenerArray *array, int value) {
@ -30,7 +30,7 @@ void invokeCallbacks(IntListenerArray *array, int value) {
void IntListenerArray::invokeJustArgCallbacks() {
for (int i = 0; i < currentListenersCount; i++) {
ArgListener listener = (ArgListener)callbacks[i];
VoidPtr listener = (VoidPtr)callbacks[i];
void *arg = args[i];
(listener)(arg);
}
@ -46,7 +46,7 @@ void invokeArgIntCallbacks(IntListenerArray *array, int value) {
void invokeIntIntCallbacks(IntListenerArray *array, int value, int value2) {
for (int i = 0; i < array->currentListenersCount; i++) {
IntIntListener listener = (IntIntListener)array->callbacks[i];
VoidIntInt listener = (VoidIntInt)array->callbacks[i];
(listener)(value, value2);
}
}

View File

@ -12,8 +12,6 @@
#define MAX_INT_LISTENER_COUNT 15
typedef void (*IntListener)(int value);
typedef void (*IntIntListener)(int value1, int value2);
// todo: reorder parameters for consistency?
typedef void (*IntIntVoidListener)(int value1, int value2, void *arg);
@ -21,14 +19,15 @@ typedef void (*IntIntVoidListener)(int value1, int value2, void *arg);
typedef void (*ArgListener)(void *arg);
typedef void (*ArgIntListener)(void *arg, int value);
// todo: rename this class, that's not just 'callback(int param) anymore
class IntListenerArray {
public:
IntListenerArray();
void registerCallback(IntListener handler, void *arg);
void registerCallback(VoidInt handler, void *arg);
void registerCallback(Void listener);
void invokeJustArgCallbacks();
int currentListenersCount;
IntListener callbacks[MAX_INT_LISTENER_COUNT];
VoidInt callbacks[MAX_INT_LISTENER_COUNT];
void * args[MAX_INT_LISTENER_COUNT];
};