auto-sync
This commit is contained in:
parent
3186ff017f
commit
be30fedb74
|
@ -42,7 +42,6 @@ extern WaveChart waveChart;
|
|||
static Logging logger;
|
||||
|
||||
extern OutputPin outputs[IO_PIN_COUNT];
|
||||
extern pin_output_mode_e *pinDefaultState[IO_PIN_COUNT];
|
||||
|
||||
void initSignalExecutor(void) {
|
||||
initLogging(&logger, "s exec");
|
||||
|
|
|
@ -57,7 +57,6 @@
|
|||
#include "lcd_controller.h"
|
||||
|
||||
extern OutputPin outputs[IO_PIN_COUNT];
|
||||
extern pin_output_mode_e *pinDefaultState[IO_PIN_COUNT];
|
||||
extern bool hasFirmwareErrorFlag;
|
||||
|
||||
persistent_config_container_s persistentState CCM_OPTIONAL;
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
#include "efiGpio.h"
|
||||
#include "io_pins.h"
|
||||
|
||||
pin_output_mode_e OUTPUT_MODE_DEFAULT = OM_DEFAULT;
|
||||
|
||||
// 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]);
|
||||
|
@ -89,14 +89,21 @@ const char *getPinName(io_pin_e io_pin) {
|
|||
}
|
||||
}
|
||||
|
||||
OutputPin::OutputPin() {
|
||||
modePtr = &OUTPUT_MODE_DEFAULT;
|
||||
}
|
||||
|
||||
void OutputPin::setValue(int logicValue) {
|
||||
doSetOutputPinValue2(this, logicValue);
|
||||
}
|
||||
|
||||
extern uint32_t dbgStart;
|
||||
extern uint32_t dbgDurr;
|
||||
/**
|
||||
* @brief Sets the value according to current electrical settings
|
||||
*
|
||||
* This method costs about 85 ticks
|
||||
*/
|
||||
extern uint32_t dbgStart;
|
||||
extern uint32_t dbgDurr;
|
||||
|
||||
void setOutputPinValue(io_pin_e pin, int logicValue) {
|
||||
doSetOutputPinValue(pin, logicValue);
|
||||
}
|
||||
|
|
|
@ -13,17 +13,21 @@
|
|||
/**
|
||||
* @brief Single output pin reference and state
|
||||
*/
|
||||
typedef struct {
|
||||
class OutputPin {
|
||||
public:
|
||||
OutputPin();
|
||||
void setValue(int logicValue);
|
||||
#if EFI_PROD_CODE
|
||||
GPIO_TypeDef *port;
|
||||
int pin;
|
||||
#endif /* EFI_PROD_CODE */
|
||||
pin_output_mode_e *modePtr;
|
||||
/**
|
||||
* we track current pin status so that we do not touch the actual hardware if we want to write new pin bit
|
||||
* which is same as current pin value. This maybe helps in case of status leds, but maybe it's a total over-engineering
|
||||
*/
|
||||
int currentLogicValue;
|
||||
} OutputPin;
|
||||
};
|
||||
|
||||
/**
|
||||
* it's a macro to be sure that stack is not used
|
||||
|
@ -85,25 +89,24 @@ const char *getPinName(io_pin_e io_pin);
|
|||
#endif
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
#define doSetOutputPinValue(pin, logicValue) { \
|
||||
if (outputs[(pin)].port != GPIO_NULL) { \
|
||||
efiAssertVoid(pinDefaultState[pin]!=NULL, "pin mode not initialized"); \
|
||||
pin_output_mode_e mode = *pinDefaultState[pin]; \
|
||||
#define doSetOutputPinValue2(output, logicValue) { \
|
||||
if (output->port != GPIO_NULL) { \
|
||||
efiAssertVoid(output->modePtr!=NULL, "pin mode not initialized"); \
|
||||
pin_output_mode_e mode = *output->modePtr; \
|
||||
efiAssertVoid(mode <= OM_OPENDRAIN_INVERTED, "invalid pin_output_mode_e"); \
|
||||
OutputPin *output = &outputs[pin]; \
|
||||
int eValue = getElectricalValue(logicValue, mode); \
|
||||
setPinValue(output, eValue, logicValue); \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define doSetOutputPinValue(pin, logicValue) { \
|
||||
#define doSetOutputPinValue2(output, logicValue) { \
|
||||
pin_output_mode_e mode = OM_DEFAULT; \
|
||||
OutputPin *output = &outputs[pin]; \
|
||||
int eValue = getElectricalValue(logicValue, mode); \
|
||||
setPinValue(output, eValue, logicValue); \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define doSetOutputPinValue(pin, logicValue) doSetOutputPinValue2((&outputs[pin]), logicValue)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ extern board_configuration_s *boardConfiguration;
|
|||
|
||||
static Logging logger;
|
||||
|
||||
extern pin_output_mode_e *pinDefaultState[IO_PIN_COUNT];
|
||||
extern OutputPin outputs[IO_PIN_COUNT];
|
||||
|
||||
#if defined(STM32F4XX)
|
||||
|
@ -45,8 +44,8 @@ void setDefaultPinState(io_pin_e pin, pin_output_mode_e *outputMode) {
|
|||
#if EFI_GPIO
|
||||
pin_output_mode_e mode = *outputMode;
|
||||
assertOMode(mode);
|
||||
pinDefaultState[pin] = outputMode;
|
||||
setOutputPinValue(pin, FALSE); // initial state
|
||||
outputs[(int)pin].modePtr = outputMode;
|
||||
outputs[(int)pin].setValue(false); // initial state
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -24,14 +24,4 @@ void initPwmGenerator(void);
|
|||
void startSimplePwmExt(PwmConfig *state, const char *msg, brain_pin_e brainPin, io_pin_e ioPin,
|
||||
float frequency, float dutyCycle, pwm_gen_callback *stateChangeCallback);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* PWM_GENERATOR_H_ */
|
||||
|
|
|
@ -255,7 +255,7 @@ void firmwareError(const char *fmt, ...) {
|
|||
}
|
||||
}
|
||||
|
||||
static char UNUSED_RAM_SIZE[6000];
|
||||
static char UNUSED_RAM_SIZE[5000];
|
||||
|
||||
static char UNUSED_CCM_SIZE[9000] CCM_OPTIONAL;
|
||||
|
||||
|
|
Loading…
Reference in New Issue