mirror of https://github.com/rusefi/rusefi-1.git
auto-sync
This commit is contained in:
parent
0975ec58e6
commit
af5b413ff8
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
static Logging logger;
|
static Logging logger;
|
||||||
|
|
||||||
extern OutputPin outputs[IO_PIN_COUNT];
|
extern NamedOutputPin outputs[IO_PIN_COUNT];
|
||||||
|
|
||||||
EXTERN_ENGINE
|
EXTERN_ENGINE
|
||||||
;
|
;
|
||||||
|
|
|
@ -63,13 +63,13 @@ typedef enum {
|
||||||
|
|
||||||
IO_INVALID,
|
IO_INVALID,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* these seven segment display pins are related to unused external tachometer code
|
* these seven segment display pins are related to unused external tachometer code
|
||||||
* I still have the hardware so maybe one day I will fix it, but for now it's just dead code
|
* I still have the hardware so maybe one day I will fix it, but for now it's just dead code
|
||||||
* See https://www.youtube.com/watch?v=YYiHoN6MBqE
|
* See https://www.youtube.com/watch?v=YYiHoN6MBqE
|
||||||
* todo: this should be re-implemented in a smarter way with some sort of multiplexing anyway
|
* todo: this should be re-implemented in a smarter way with some sort of multiplexing anyway
|
||||||
*/
|
*/
|
||||||
/* digit 1 */
|
/* digit 1 */
|
||||||
// LED_HUGE_0, // B2
|
// LED_HUGE_0, // B2
|
||||||
// LED_HUGE_1,
|
// LED_HUGE_1,
|
||||||
// LED_HUGE_2,
|
// LED_HUGE_2,
|
||||||
|
@ -94,20 +94,19 @@ typedef enum {
|
||||||
// LED_HUGE_19,
|
// LED_HUGE_19,
|
||||||
// LED_HUGE_20,
|
// LED_HUGE_20,
|
||||||
|
|
||||||
|
|
||||||
} io_pin_e;
|
} io_pin_e;
|
||||||
|
|
||||||
#define IO_PIN_COUNT 100
|
#define IO_PIN_COUNT 24
|
||||||
|
|
||||||
void initPrimaryPins(void);
|
void initPrimaryPins(void);
|
||||||
void initOutputPins(void);
|
void initOutputPins(void);
|
||||||
|
|
||||||
|
io_pin_e getPinByName(const char *name);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
io_pin_e getPinByName(const char *name);
|
|
||||||
|
|
||||||
#if EFI_GPIO
|
#if EFI_GPIO
|
||||||
void turnAllPinsOff(void);
|
void turnAllPinsOff(void);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -41,7 +41,7 @@ extern WaveChart waveChart;
|
||||||
|
|
||||||
static Logging logger;
|
static Logging logger;
|
||||||
|
|
||||||
extern OutputPin outputs[IO_PIN_COUNT];
|
extern NamedOutputPin outputs[IO_PIN_COUNT];
|
||||||
|
|
||||||
void initSignalExecutor(void) {
|
void initSignalExecutor(void) {
|
||||||
initLogging(&logger, "s exec");
|
initLogging(&logger, "s exec");
|
||||||
|
@ -52,12 +52,12 @@ void initOutputSignal(OutputSignal *signal, io_pin_e ioPin) {
|
||||||
signal->io_pin = ioPin;
|
signal->io_pin = ioPin;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t dbgStart;
|
//uint32_t dbgStart;
|
||||||
uint32_t dbgDurr;
|
//uint32_t dbgDurr;
|
||||||
|
|
||||||
extern const char *namedPinsArray[NAMED_PIN_COUNT];
|
extern const char *namedPinsArray[NAMED_PIN_COUNT];
|
||||||
|
|
||||||
void turnPinHigh(io_pin_e pin) {
|
void turnPinHigh(NamedOutputPin *output) {
|
||||||
#if EFI_DEFAILED_LOGGING
|
#if EFI_DEFAILED_LOGGING
|
||||||
// signal->hi_time = hTimeNow();
|
// signal->hi_time = hTimeNow();
|
||||||
#endif /* EFI_DEFAILED_LOGGING */
|
#endif /* EFI_DEFAILED_LOGGING */
|
||||||
|
@ -65,14 +65,14 @@ void turnPinHigh(io_pin_e pin) {
|
||||||
#if EFI_GPIO
|
#if EFI_GPIO
|
||||||
// turn the output level ACTIVE
|
// turn the output level ACTIVE
|
||||||
// todo: this XOR should go inside the setOutputPinValue method
|
// todo: this XOR should go inside the setOutputPinValue method
|
||||||
doSetOutputPinValue2((&outputs[pin]), true);
|
doSetOutputPinValue2(output, true);
|
||||||
// sleep for the needed duration
|
// sleep for the needed duration
|
||||||
#endif
|
#endif
|
||||||
#if EFI_WAVE_CHART
|
#if EFI_WAVE_CHART
|
||||||
// explicit check here is a performance optimization to speed up no-chart mode
|
// explicit check here is a performance optimization to speed up no-chart mode
|
||||||
if (CONFIG(isDigitalChartEnabled)) {
|
if (CONFIG(isDigitalChartEnabled)) {
|
||||||
// this is a performance optimization - array index is cheaper then invoking a method with 'switch'
|
// this is a performance optimization - array index is cheaper then invoking a method with 'switch'
|
||||||
const char *pinName = namedPinsArray[pin];
|
const char *pinName = output->name;
|
||||||
// dbgDurr = hal_lld_get_counter_value() - dbgStart;
|
// dbgDurr = hal_lld_get_counter_value() - dbgStart;
|
||||||
|
|
||||||
addWaveChartEvent(pinName, WC_UP);
|
addWaveChartEvent(pinName, WC_UP);
|
||||||
|
@ -81,10 +81,10 @@ void turnPinHigh(io_pin_e pin) {
|
||||||
// dbgDurr = hal_lld_get_counter_value() - dbgStart;
|
// dbgDurr = hal_lld_get_counter_value() - dbgStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
void turnPinLow(io_pin_e pin) {
|
void turnPinLow(NamedOutputPin *output) {
|
||||||
#if EFI_GPIO
|
#if EFI_GPIO
|
||||||
// turn off the output
|
// turn off the output
|
||||||
doSetOutputPinValue2((&outputs[pin]), false);
|
doSetOutputPinValue2(output, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFI_DEFAILED_LOGGING
|
#if EFI_DEFAILED_LOGGING
|
||||||
|
@ -96,7 +96,7 @@ void turnPinLow(io_pin_e pin) {
|
||||||
#if EFI_WAVE_CHART
|
#if EFI_WAVE_CHART
|
||||||
if (CONFIG(isDigitalChartEnabled)) {
|
if (CONFIG(isDigitalChartEnabled)) {
|
||||||
// this is a performance optimization - array index is cheaper then invoking a method with 'switch'
|
// this is a performance optimization - array index is cheaper then invoking a method with 'switch'
|
||||||
const char *pinName = namedPinsArray[pin];
|
const char *pinName = output->name;
|
||||||
|
|
||||||
addWaveChartEvent(pinName, WC_DOWN);
|
addWaveChartEvent(pinName, WC_DOWN);
|
||||||
}
|
}
|
||||||
|
@ -128,8 +128,8 @@ void scheduleOutput(OutputSignal *signal, float delayMs, float durationMs) {
|
||||||
scheduling_s * sUp = &signal->signalTimerUp[index];
|
scheduling_s * sUp = &signal->signalTimerUp[index];
|
||||||
scheduling_s * sDown = &signal->signalTimerDown[index];
|
scheduling_s * sDown = &signal->signalTimerDown[index];
|
||||||
|
|
||||||
scheduleTask("out up", sUp, (int) MS2US(delayMs), (schfunc_t) &turnPinHigh, (void *) signal->io_pin);
|
scheduleTask("out up", sUp, (int) MS2US(delayMs), (schfunc_t) &turnPinHigh, &outputs[(int)signal->io_pin]);
|
||||||
scheduleTask("out down", sDown, (int) MS2US(delayMs) + MS2US(durationMs), (schfunc_t) &turnPinLow, (void*) signal->io_pin);
|
scheduleTask("out down", sDown, (int) MS2US(delayMs) + MS2US(durationMs), (schfunc_t) &turnPinLow, &outputs[(int)signal->io_pin]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,9 +48,6 @@ void scheduleOutput(OutputSignal *signal, float delayMs, float durationMs);
|
||||||
void initOutputSignalBase(OutputSignal *signal);
|
void initOutputSignalBase(OutputSignal *signal);
|
||||||
void scheduleOutputBase(OutputSignal *signal, float delayMs, float durationMs);
|
void scheduleOutputBase(OutputSignal *signal, float delayMs, float durationMs);
|
||||||
|
|
||||||
void turnPinHigh(io_pin_e pin);
|
|
||||||
void turnPinLow(io_pin_e pin);
|
|
||||||
|
|
||||||
void initSignalExecutor(void);
|
void initSignalExecutor(void);
|
||||||
void initSignalExecutorImpl(void);
|
void initSignalExecutorImpl(void);
|
||||||
void scheduleByAngle(int rpm, scheduling_s *timer, float angle, schfunc_t callback, void *param);
|
void scheduleByAngle(int rpm, scheduling_s *timer, float angle, schfunc_t callback, void *param);
|
||||||
|
|
|
@ -149,7 +149,6 @@ static SimplePwm fsioPwm[LE_COMMAND_COUNT] CCM_OPTIONAL;
|
||||||
|
|
||||||
static LECalculator calc;
|
static LECalculator calc;
|
||||||
extern LEElement * fsioLogics[LE_COMMAND_COUNT];
|
extern LEElement * fsioLogics[LE_COMMAND_COUNT];
|
||||||
extern OutputPin outputs[IO_PIN_COUNT];
|
|
||||||
|
|
||||||
// that's crazy, but what's an alternative? we need const char *, a shared buffer would not work for pin repository
|
// that's crazy, but what's an alternative? we need const char *, a shared buffer would not work for pin repository
|
||||||
static const char *getGpioPinName(int index) {
|
static const char *getGpioPinName(int index) {
|
||||||
|
@ -357,8 +356,6 @@ void runFsio(void) {
|
||||||
|
|
||||||
static pin_output_mode_e defa = OM_DEFAULT;
|
static pin_output_mode_e defa = OM_DEFAULT;
|
||||||
|
|
||||||
extern OutputPin outputs[IO_PIN_COUNT];
|
|
||||||
|
|
||||||
void initFsioImpl(Engine *engine) {
|
void initFsioImpl(Engine *engine) {
|
||||||
initLogging(&logger, "le");
|
initLogging(&logger, "le");
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ static bool_t isRunningBench = false;
|
||||||
|
|
||||||
static int is_injector_enabled[MAX_INJECTOR_COUNT];
|
static int is_injector_enabled[MAX_INJECTOR_COUNT];
|
||||||
|
|
||||||
extern OutputPin outputs[IO_PIN_COUNT];
|
extern NamedOutputPin outputs[IO_PIN_COUNT];
|
||||||
extern engine_pins_s enginePins;
|
extern engine_pins_s enginePins;
|
||||||
|
|
||||||
void initIgnitionCentral(void) {
|
void initIgnitionCentral(void) {
|
||||||
|
|
|
@ -40,8 +40,6 @@
|
||||||
|
|
||||||
static THD_WORKING_AREA(mfiThreadStack, UTILITY_THREAD_STACK_SIZE); // declare thread
|
static THD_WORKING_AREA(mfiThreadStack, UTILITY_THREAD_STACK_SIZE); // declare thread
|
||||||
|
|
||||||
extern OutputPin outputs[IO_PIN_COUNT];
|
|
||||||
|
|
||||||
extern OutputPin checkEnginePin;
|
extern OutputPin checkEnginePin;
|
||||||
|
|
||||||
static void blink_digits(int digit, int duration) {
|
static void blink_digits(int digit, int duration) {
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
EXTERN_ENGINE
|
EXTERN_ENGINE
|
||||||
;
|
;
|
||||||
|
|
||||||
extern OutputPin outputs[IO_PIN_COUNT];
|
extern NamedOutputPin outputs[IO_PIN_COUNT];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this cache allows us to find a close-enough (with one degree precision) trigger wheel index by
|
* this cache allows us to find a close-enough (with one degree precision) trigger wheel index by
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
pin_output_mode_e OUTPUT_MODE_DEFAULT = OM_DEFAULT;
|
pin_output_mode_e OUTPUT_MODE_DEFAULT = OM_DEFAULT;
|
||||||
|
|
||||||
// todo: clean this mess, this should become 'static'/private
|
// todo: clean this mess, this should become 'static'/private
|
||||||
OutputPin outputs[IO_PIN_COUNT];
|
NamedOutputPin outputs[IO_PIN_COUNT];
|
||||||
engine_pins_s enginePins;
|
engine_pins_s enginePins;
|
||||||
|
|
||||||
const char *namedPinsArray[NAMED_PIN_COUNT] = { "spa1", "spa2", "spa3", "spa4", "spa5", "spa6", "spa7", "spa8",
|
const char *namedPinsArray[NAMED_PIN_COUNT] = { "spa1", "spa2", "spa3", "spa4", "spa5", "spa6", "spa7", "spa8",
|
||||||
|
@ -54,6 +54,10 @@ const char *getPinName(io_pin_e io_pin) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NamedOutputPin::NamedOutputPin() : OutputPin() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
OutputPin::OutputPin() {
|
OutputPin::OutputPin() {
|
||||||
modePtr = &OUTPUT_MODE_DEFAULT;
|
modePtr = &OUTPUT_MODE_DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,12 @@ public:
|
||||||
int currentLogicValue;
|
int currentLogicValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class NamedOutputPin : public OutputPin {
|
||||||
|
public:
|
||||||
|
NamedOutputPin();
|
||||||
|
const char *name;
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
OutputPin mainRelay;
|
OutputPin mainRelay;
|
||||||
OutputPin fanRelay;
|
OutputPin fanRelay;
|
||||||
|
@ -113,6 +119,9 @@ typedef struct {
|
||||||
|
|
||||||
void outputPinRegisterExt2(const char *msg, OutputPin *output, brain_pin_e brainPin, pin_output_mode_e *outputMode);
|
void outputPinRegisterExt2(const char *msg, OutputPin *output, brain_pin_e brainPin, pin_output_mode_e *outputMode);
|
||||||
|
|
||||||
|
void turnPinHigh(NamedOutputPin *output);
|
||||||
|
void turnPinLow(NamedOutputPin *output);
|
||||||
|
|
||||||
const char *getPinName(io_pin_e io_pin);
|
const char *getPinName(io_pin_e io_pin);
|
||||||
|
|
||||||
#endif /* EFIGPIO_H_ */
|
#endif /* EFIGPIO_H_ */
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
||||||
|
|
||||||
#include "main_trigger_callback.h"
|
#include "main_trigger_callback.h"
|
||||||
|
#include "efiGpio.h"
|
||||||
#include "engine_math.h"
|
#include "engine_math.h"
|
||||||
#include "trigger_central.h"
|
#include "trigger_central.h"
|
||||||
#include "rpm_calculator.h"
|
#include "rpm_calculator.h"
|
||||||
|
@ -57,6 +57,7 @@
|
||||||
EXTERN_ENGINE
|
EXTERN_ENGINE
|
||||||
;
|
;
|
||||||
extern bool hasFirmwareErrorFlag;
|
extern bool hasFirmwareErrorFlag;
|
||||||
|
extern NamedOutputPin outputs[IO_PIN_COUNT];
|
||||||
|
|
||||||
static LocalVersionHolder localVersion;
|
static LocalVersionHolder localVersion;
|
||||||
|
|
||||||
|
@ -88,13 +89,13 @@ static Logging logger;
|
||||||
|
|
||||||
static void startSimultaniousInjection(Engine *engine) {
|
static void startSimultaniousInjection(Engine *engine) {
|
||||||
for (int i = 0; i < engine->engineConfiguration->cylindersCount; i++) {
|
for (int i = 0; i < engine->engineConfiguration->cylindersCount; i++) {
|
||||||
turnPinHigh(INJECTOR_PIN_BY_INDEX(i));
|
turnPinHigh(&outputs[(int)INJECTOR_PIN_BY_INDEX(i)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void endSimultaniousInjection(Engine *engine) {
|
static void endSimultaniousInjection(Engine *engine) {
|
||||||
for (int i = 0; i < engine->engineConfiguration->cylindersCount; i++) {
|
for (int i = 0; i < engine->engineConfiguration->cylindersCount; i++) {
|
||||||
turnPinLow(INJECTOR_PIN_BY_INDEX(i));
|
turnPinLow(&outputs[(int)INJECTOR_PIN_BY_INDEX(i)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ static Logging logger;
|
||||||
|
|
||||||
static OutputPin sdCsPin;
|
static OutputPin sdCsPin;
|
||||||
|
|
||||||
extern OutputPin outputs[IO_PIN_COUNT];
|
extern NamedOutputPin outputs[IO_PIN_COUNT];
|
||||||
extern engine_pins_s enginePins;
|
extern engine_pins_s enginePins;
|
||||||
|
|
||||||
#if defined(STM32F4XX)
|
#if defined(STM32F4XX)
|
||||||
|
@ -111,6 +111,9 @@ static void getPinValue(const char *name) {
|
||||||
void initOutputPins(void) {
|
void initOutputPins(void) {
|
||||||
initLogging(&logger, "io_pins");
|
initLogging(&logger, "io_pins");
|
||||||
|
|
||||||
|
for (int i = 0; i < IO_PIN_COUNT;i++)
|
||||||
|
outputs[i].name = getPinName((io_pin_e)i);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* want to make sure it's all zeros so that we can compare in initOutputPinExt() method
|
* want to make sure it's all zeros so that we can compare in initOutputPinExt() method
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -229,8 +229,6 @@ void chDbgStackOverflowPanic(Thread *otp) {
|
||||||
chDbgPanic3(panicMessage, __FILE__, __LINE__);
|
chDbgPanic3(panicMessage, __FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern OutputPin outputs[IO_PIN_COUNT];
|
|
||||||
|
|
||||||
extern OutputPin errorLedPin;
|
extern OutputPin errorLedPin;
|
||||||
|
|
||||||
// todo: why is this method here and not in error_handling.c ?
|
// todo: why is this method here and not in error_handling.c ?
|
||||||
|
|
Loading…
Reference in New Issue