auto-sync
This commit is contained in:
parent
52697e2802
commit
d2a8bd444a
|
@ -132,7 +132,6 @@ const char *getPinName(io_pin_e io_pin);
|
|||
io_pin_e getPinByName(const char *name);
|
||||
void turnOutputPinOn(io_pin_e pin);
|
||||
void turnOutputPinOff(io_pin_e pin);
|
||||
void setOutputPinValue(io_pin_e pin, int logicValue);
|
||||
void setDefaultPinState(io_pin_e pin, pin_output_mode_e *defaultState);
|
||||
|
||||
void outputPinRegisterExt2(const char *msg, io_pin_e ioPin, brain_pin_e brainPin, pin_output_mode_e *outputMode);
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "main.h"
|
||||
#include "signal_executor.h"
|
||||
#include "efiGpio.h"
|
||||
|
||||
#if EFI_WAVE_CHART
|
||||
/**
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "engine_configuration.h"
|
||||
#include "pin_repository.h"
|
||||
#include "ec2.h"
|
||||
#include "efiGpio.h"
|
||||
|
||||
static Logging logger;
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
// todo: clean this mess, this should become 'static'/private
|
||||
OutputPin outputs[IO_PIN_COUNT];
|
||||
pin_output_mode_e *pinDefaultState[IO_PIN_COUNT];
|
||||
|
||||
int getOutputPinValue(io_pin_e pin) {
|
||||
return getLogicPinValue(&outputs[pin]);
|
||||
|
@ -35,10 +36,33 @@ inline static int getElectricalValue1(pin_output_mode_e mode) {
|
|||
return mode == OM_DEFAULT || mode == OM_OPENDRAIN;
|
||||
}
|
||||
|
||||
// todo: this method is here for unit test visibility. todo: move to a bette place!
|
||||
int getElectricalValue(int logicalValue, pin_output_mode_e mode) {
|
||||
efiAssert(mode <= OM_OPENDRAIN_INVERTED, "invalid pin_output_mode_e", -1);
|
||||
|
||||
return logicalValue ? getElectricalValue1(mode) : getElectricalValue0(mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set's the value of the pin. On this layer the value is assigned as is, without any conversion.
|
||||
*/
|
||||
void setPinValue(OutputPin * outputPin, int electricalValue, int logicValue) {
|
||||
if (getLogicPinValue(outputPin) == logicValue)
|
||||
return;
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
palWritePad(outputPin->port, outputPin->pin, electricalValue);
|
||||
#endif
|
||||
outputPin->currentLogicValue = logicValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the value according to current electrical settings
|
||||
*/
|
||||
void setOutputPinValue(io_pin_e pin, int logicValue) {
|
||||
if (outputs[pin].port == GPIO_NULL)
|
||||
return;
|
||||
efiAssertVoid(pinDefaultState[pin]!=NULL, "pin mode not initialized");
|
||||
pin_output_mode_e mode = *pinDefaultState[pin];
|
||||
setPinValue(&outputs[pin], getElectricalValue(logicValue, mode), logicValue);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@ extern "C"
|
|||
int getLogicPinValue(OutputPin * outputPin);
|
||||
int getOutputPinValue(io_pin_e pin);
|
||||
int getElectricalValue(int logicalValue, pin_output_mode_e mode);
|
||||
void setOutputPinValue(io_pin_e pin, int logicValue);
|
||||
void setPinValue(OutputPin * outputPin, int electricalValue, int logicValue);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -47,15 +47,4 @@ void initOutputPin(const char *msg, OutputPin *outputPin, GPIO_TypeDef *port, ui
|
|||
initOutputPinExt(msg, outputPin, port, pinNumber, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set's the value of the pin. On this layer the value is assigned as is, without any conversion.
|
||||
*/
|
||||
void setPinValue(OutputPin * outputPin, int electricalValue, int logicValue) {
|
||||
if (getLogicPinValue(outputPin) == logicValue)
|
||||
return;
|
||||
|
||||
palWritePad(outputPin->port, outputPin->pin, electricalValue);
|
||||
outputPin->currentLogicValue = logicValue;
|
||||
}
|
||||
|
||||
#endif /* GPIO_HELPER_C_ */
|
||||
|
|
|
@ -15,6 +15,5 @@
|
|||
|
||||
void initOutputPin(const char *msg, OutputPin *outputPin, GPIO_TypeDef *port, uint32_t pinNumber);
|
||||
void initOutputPinExt(const char *msg, OutputPin *outputPin, GPIO_TypeDef *port, uint32_t pinNumber, iomode_t mode);
|
||||
void setPinValue(OutputPin * outputPin, int electricalValue, int logicValue);
|
||||
|
||||
#endif /* GPIO_HELPER_H_ */
|
||||
|
|
|
@ -25,7 +25,7 @@ extern board_configuration_s *boardConfiguration;
|
|||
|
||||
static Logging logger;
|
||||
|
||||
static pin_output_mode_e *pinDefaultState[IO_PIN_COUNT];
|
||||
extern pin_output_mode_e *pinDefaultState[IO_PIN_COUNT];
|
||||
extern OutputPin outputs[IO_PIN_COUNT];
|
||||
static io_pin_e leds[] = { LED_WARNING, LED_RUNNING, LED_ERROR, LED_COMMUNICATION_1, LED_DEBUG, LED_EXT_1,
|
||||
LED_CHECK_ENGINE };
|
||||
|
@ -57,17 +57,6 @@ inline static void assertOMode(pin_output_mode_e mode) {
|
|||
efiAssertVoid(mode <= OM_OPENDRAIN_INVERTED, "invalid pin_output_mode_e");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the value according to current electrical settings
|
||||
*/
|
||||
void setOutputPinValue(io_pin_e pin, int logicValue) {
|
||||
if (outputs[pin].port == GPIO_NULL)
|
||||
return;
|
||||
efiAssertVoid(pinDefaultState[pin]!=NULL, "pin mode not initialized");
|
||||
pin_output_mode_e mode = *pinDefaultState[pin];
|
||||
setPinValue(&outputs[pin], getElectricalValue(logicValue, mode), logicValue);
|
||||
}
|
||||
|
||||
void setDefaultPinState(io_pin_e pin, pin_output_mode_e *outputMode) {
|
||||
pin_output_mode_e mode = *outputMode;
|
||||
assertOMode(mode);
|
||||
|
|
|
@ -91,6 +91,7 @@
|
|||
#include "ec2.h"
|
||||
#include "hardware.h"
|
||||
#include "engine_controller.h"
|
||||
#include "efiGpio.h"
|
||||
|
||||
#include "global.h"
|
||||
extern "C" {
|
||||
|
@ -240,5 +241,5 @@ void firmwareError(const char *fmt, ...) {
|
|||
}
|
||||
|
||||
int getRusEfiVersion(void) {
|
||||
return 20140926;
|
||||
return 20140927;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue