From f27f99e9cc2027368efa149bbf4932754561b249 Mon Sep 17 00:00:00 2001 From: rusefi Date: Mon, 15 May 2017 08:40:54 -0400 Subject: [PATCH] better method name --- firmware/console/binary/tunerstudio_io.cpp | 4 ++-- firmware/controllers/core/fsio_impl.cpp | 2 +- firmware/controllers/idle_thread.cpp | 6 +++--- firmware/controllers/system/efiGpio.cpp | 2 +- firmware/development/engine_emulator.cpp | 2 +- firmware/hw_layer/adc_inputs.cpp | 2 +- firmware/hw_layer/board_test.cpp | 2 +- firmware/hw_layer/can_hw.cpp | 4 ++-- firmware/hw_layer/digital_input_hw.cpp | 2 +- firmware/hw_layer/hardware.cpp | 6 +++--- firmware/hw_layer/io_pins.cpp | 2 +- firmware/hw_layer/io_pins.h | 2 +- firmware/hw_layer/joystick.cpp | 10 +++++----- firmware/hw_layer/lcd/lcd_HD44780.cpp | 12 ++++++------ firmware/hw_layer/neo6m.cpp | 4 ++-- firmware/hw_layer/stepper.cpp | 6 +++--- firmware/hw_layer/stm32f4/mpu_util.cpp | 8 ++++---- 17 files changed, 38 insertions(+), 38 deletions(-) diff --git a/firmware/console/binary/tunerstudio_io.cpp b/firmware/console/binary/tunerstudio_io.cpp index de76cf5678..f1df9919ee 100644 --- a/firmware/console/binary/tunerstudio_io.cpp +++ b/firmware/console/binary/tunerstudio_io.cpp @@ -45,8 +45,8 @@ void startTsPort(void) { if (boardConfiguration->useSerialPort) { print("TunerStudio over USART"); - mySetPadMode2("tunerstudio rx", engineConfiguration->binarySerialRxPin, PAL_MODE_ALTERNATE(TS_SERIAL_AF)); - mySetPadMode2("tunerstudio tx", engineConfiguration->binarySerialTxPin, PAL_MODE_ALTERNATE(TS_SERIAL_AF)); + efiSetPadMode("tunerstudio rx", engineConfiguration->binarySerialRxPin, PAL_MODE_ALTERNATE(TS_SERIAL_AF)); + efiSetPadMode("tunerstudio tx", engineConfiguration->binarySerialTxPin, PAL_MODE_ALTERNATE(TS_SERIAL_AF)); tsSerialConfig.speed = boardConfiguration->tunerStudioSerialSpeed; diff --git a/firmware/controllers/core/fsio_impl.cpp b/firmware/controllers/core/fsio_impl.cpp index 071fac2d5c..8ed31b65e5 100644 --- a/firmware/controllers/core/fsio_impl.cpp +++ b/firmware/controllers/core/fsio_impl.cpp @@ -515,7 +515,7 @@ void initFsioImpl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S) { brain_pin_e inputPin = boardConfiguration->fsioDigitalInputs[i]; if (inputPin != GPIO_UNASSIGNED) { - mySetPadMode2("FSIO input", inputPin, getInputMode(engineConfiguration->fsioInputModes[i])); + efiSetPadMode("FSIO input", inputPin, getInputMode(engineConfiguration->fsioInputModes[i])); } } diff --git a/firmware/controllers/idle_thread.cpp b/firmware/controllers/idle_thread.cpp index 1ad755ee1d..b216a4097a 100644 --- a/firmware/controllers/idle_thread.cpp +++ b/firmware/controllers/idle_thread.cpp @@ -323,17 +323,17 @@ void startIdleThread(Logging*sharedLogger) { // this is idle switch INPUT - sometimes there is a switch on the throttle pedal // this switch is not used yet if (boardConfiguration->clutchDownPin != GPIO_UNASSIGNED) { - mySetPadMode2("clutch down switch", boardConfiguration->clutchDownPin, + efiSetPadMode("clutch down switch", boardConfiguration->clutchDownPin, getInputMode(boardConfiguration->clutchDownPinMode)); } if (boardConfiguration->clutchUpPin != GPIO_UNASSIGNED) { - mySetPadMode2("clutch up switch", boardConfiguration->clutchUpPin, + efiSetPadMode("clutch up switch", boardConfiguration->clutchUpPin, getInputMode(boardConfiguration->clutchUpPinMode)); } if (engineConfiguration->brakePedalPin != GPIO_UNASSIGNED) { - mySetPadMode2("brake pedal switch", engineConfiguration->brakePedalPin, + efiSetPadMode("brake pedal switch", engineConfiguration->brakePedalPin, getInputMode(engineConfiguration->brakePedalPinMode)); } diff --git a/firmware/controllers/system/efiGpio.cpp b/firmware/controllers/system/efiGpio.cpp index 2f624cb4d6..f5fba659d1 100644 --- a/firmware/controllers/system/efiGpio.cpp +++ b/firmware/controllers/system/efiGpio.cpp @@ -313,7 +313,7 @@ void OutputPin::initPin(const char *msg, brain_pin_e brainPin, pin_output_mode_e this->port = port; this->pin = pin; - mySetPadMode2(msg, brainPin, mode); + efiSetPadMode(msg, brainPin, mode); setDefaultPinState(outputMode); #endif /* EFI_GPIO_HARDWARE */ diff --git a/firmware/development/engine_emulator.cpp b/firmware/development/engine_emulator.cpp index fda64bbb16..404d656751 100644 --- a/firmware/development/engine_emulator.cpp +++ b/firmware/development/engine_emulator.cpp @@ -83,7 +83,7 @@ void startEmulator(void) { //} static void initECUstimulator(Engine *engine) { - mySetPadMode2("TEN", DIAG_PIN, PAL_MODE_OUTPUT_PUSHPULL); + efiSetPadMode("TEN", DIAG_PIN, PAL_MODE_OUTPUT_PUSHPULL); addConsoleActionI("diag", setDiag); addConsoleAction("emu", startEmulator); diff --git a/firmware/hw_layer/adc_inputs.cpp b/firmware/hw_layer/adc_inputs.cpp index 175f6088d4..21078b3d29 100644 --- a/firmware/hw_layer/adc_inputs.cpp +++ b/firmware/hw_layer/adc_inputs.cpp @@ -278,7 +278,7 @@ PWM_OUTPUT_DISABLED, NULL }, { PWM_OUTPUT_DISABLED, NULL } }, static void initAdcPin(brain_pin_e pin, const char *msg) { // todo: migrate to scheduleMsg if we want this back print("adc %s\r\n", msg); - mySetPadMode2("adc input", pin, PAL_MODE_INPUT_ANALOG); + efiSetPadMode("adc input", pin, PAL_MODE_INPUT_ANALOG); } brain_pin_e getAdcChannelBrainPin(const char *msg, adc_channel_e hwChannel) { diff --git a/firmware/hw_layer/board_test.cpp b/firmware/hw_layer/board_test.cpp index 5620aaa7f6..9b360d3c09 100644 --- a/firmware/hw_layer/board_test.cpp +++ b/firmware/hw_layer/board_test.cpp @@ -156,7 +156,7 @@ void printBoardTestState(void) { static void btInitOutputPins() { for (int i = 0; i < pinsCount; i++) { currentPin = BLINK_PINS[i]; - mySetPadMode2("test", currentPin, PAL_STM32_MODE_OUTPUT); + efiSetPadMode("test", currentPin, PAL_STM32_MODE_OUTPUT); } } diff --git a/firmware/hw_layer/can_hw.cpp b/firmware/hw_layer/can_hw.cpp index 55bef29dbd..e94f75ff11 100644 --- a/firmware/hw_layer/can_hw.cpp +++ b/firmware/hw_layer/can_hw.cpp @@ -284,8 +284,8 @@ void stopCanPins(DECLARE_ENGINE_PARAMETER_F) { } void startCanPins(DECLARE_ENGINE_PARAMETER_F) { - mySetPadMode2("CAN TX", boardConfiguration->canTxPin, PAL_MODE_ALTERNATE(EFI_CAN_TX_AF)); - mySetPadMode2("CAN RX", boardConfiguration->canRxPin, PAL_MODE_ALTERNATE(EFI_CAN_RX_AF)); + efiSetPadMode("CAN TX", boardConfiguration->canTxPin, PAL_MODE_ALTERNATE(EFI_CAN_TX_AF)); + efiSetPadMode("CAN RX", boardConfiguration->canRxPin, PAL_MODE_ALTERNATE(EFI_CAN_RX_AF)); } void initCan(void) { diff --git a/firmware/hw_layer/digital_input_hw.cpp b/firmware/hw_layer/digital_input_hw.cpp index dbc30e78ad..fab1b364f9 100644 --- a/firmware/hw_layer/digital_input_hw.cpp +++ b/firmware/hw_layer/digital_input_hw.cpp @@ -179,7 +179,7 @@ void turnOnCapturePin(const char *msg, brain_pin_e brainPin) { ICUDriver *driver = getInputCaptureDriver(msg, brainPin); if (driver != NULL) { iomode_t mode = (iomode_t) PAL_MODE_ALTERNATE(getAlternateFunctions(driver)); - mySetPadMode2(msg, brainPin, mode); + efiSetPadMode(msg, brainPin, mode); } } diff --git a/firmware/hw_layer/hardware.cpp b/firmware/hw_layer/hardware.cpp index 8e2584cb9e..4120f0d404 100644 --- a/firmware/hw_layer/hardware.cpp +++ b/firmware/hw_layer/hardware.cpp @@ -126,8 +126,8 @@ void initI2Cmodule(void) { i2cInit(); i2cStart(&I2CD1, &i2cfg); - mySetPadMode2("I2C clock", EFI_I2C_SCL_BRAIN_PIN, PAL_MODE_ALTERNATE(EFI_I2C_AF) | PAL_STM32_OTYPE_OPENDRAIN); - mySetPadMode2("I2C data", EFI_I2C_SDA_BRAIN_PIN, PAL_MODE_ALTERNATE(EFI_I2C_AF) | PAL_STM32_OTYPE_OPENDRAIN); + efiSetPadMode("I2C clock", EFI_I2C_SCL_BRAIN_PIN, PAL_MODE_ALTERNATE(EFI_I2C_AF) | PAL_STM32_OTYPE_OPENDRAIN); + efiSetPadMode("I2C data", EFI_I2C_SDA_BRAIN_PIN, PAL_MODE_ALTERNATE(EFI_I2C_AF) | PAL_STM32_OTYPE_OPENDRAIN); } //static char txbuf[1]; @@ -381,7 +381,7 @@ void initHardware(Logging *l) { bool isBoardTestMode_b; if (boardConfiguration->boardTestModeJumperPin != GPIO_UNASSIGNED) { - mySetPadMode2("board test", boardConfiguration->boardTestModeJumperPin, + efiSetPadMode("board test", boardConfiguration->boardTestModeJumperPin, PAL_MODE_INPUT_PULLUP); isBoardTestMode_b = (!efiReadPin(boardConfiguration->boardTestModeJumperPin)); diff --git a/firmware/hw_layer/io_pins.cpp b/firmware/hw_layer/io_pins.cpp index c6c3c7f054..5c33c993d6 100644 --- a/firmware/hw_layer/io_pins.cpp +++ b/firmware/hw_layer/io_pins.cpp @@ -60,7 +60,7 @@ bool efiReadPin(brain_pin_e pin) { /** * This method would set an error condition if pin is already used */ -void mySetPadMode2(const char *msg, brain_pin_e brainPin, iomode_t mode) { +void efiSetPadMode(const char *msg, brain_pin_e brainPin, iomode_t mode) { ioportid_t port = getHwPort(brainPin); ioportmask_t pin = getHwPin(brainPin); diff --git a/firmware/hw_layer/io_pins.h b/firmware/hw_layer/io_pins.h index dfb3ba7937..d982777259 100644 --- a/firmware/hw_layer/io_pins.h +++ b/firmware/hw_layer/io_pins.h @@ -53,7 +53,7 @@ // LED_HUGE_20, #if EFI_GPIO_HARDWARE || defined(__DOXYGEN__) -void mySetPadMode2(const char *msg, brain_pin_e pin, iomode_t mode); +void efiSetPadMode(const char *msg, brain_pin_e pin, iomode_t mode); bool efiReadPin(brain_pin_e pin); diff --git a/firmware/hw_layer/joystick.cpp b/firmware/hw_layer/joystick.cpp index 352b7a1445..26ab1af0ee 100644 --- a/firmware/hw_layer/joystick.cpp +++ b/firmware/hw_layer/joystick.cpp @@ -153,11 +153,11 @@ void initJoystick(Logging *shared) { applyPin(boardConfiguration->joystickCPin); applyPin(boardConfiguration->joystickDPin); - mySetPadMode2("joy center", boardConfiguration->joystickCenterPin, PAL_MODE_INPUT_PULLUP); - mySetPadMode2("joy A", boardConfiguration->joystickAPin, PAL_MODE_INPUT_PULLUP); - mySetPadMode2("joy B", boardConfiguration->joystickBPin, PAL_MODE_INPUT_PULLUP); - mySetPadMode2("joy C", boardConfiguration->joystickCPin, PAL_MODE_INPUT_PULLUP); - mySetPadMode2("joy D", boardConfiguration->joystickDPin, PAL_MODE_INPUT_PULLUP); + efiSetPadMode("joy center", boardConfiguration->joystickCenterPin, PAL_MODE_INPUT_PULLUP); + efiSetPadMode("joy A", boardConfiguration->joystickAPin, PAL_MODE_INPUT_PULLUP); + efiSetPadMode("joy B", boardConfiguration->joystickBPin, PAL_MODE_INPUT_PULLUP); + efiSetPadMode("joy C", boardConfiguration->joystickCPin, PAL_MODE_INPUT_PULLUP); + efiSetPadMode("joy D", boardConfiguration->joystickDPin, PAL_MODE_INPUT_PULLUP); addConsoleAction("joystickinfo", joystickInfo); diff --git a/firmware/hw_layer/lcd/lcd_HD44780.cpp b/firmware/hw_layer/lcd/lcd_HD44780.cpp index ccf93e1780..be27685a20 100644 --- a/firmware/hw_layer/lcd/lcd_HD44780.cpp +++ b/firmware/hw_layer/lcd/lcd_HD44780.cpp @@ -188,12 +188,12 @@ void lcd_HD44780_init(Logging *sharedLogger) { if (engineConfiguration->displayMode == DM_HD44780) { // initialize hardware lines - mySetPadMode2("lcd RS", boardConfiguration->HD44780_rs, PAL_MODE_OUTPUT_PUSHPULL); - mySetPadMode2("lcd E", boardConfiguration->HD44780_e, PAL_MODE_OUTPUT_PUSHPULL); - mySetPadMode2("lcd DB4", boardConfiguration->HD44780_db4, PAL_MODE_OUTPUT_PUSHPULL); - mySetPadMode2("lcd DB5", boardConfiguration->HD44780_db5, PAL_MODE_OUTPUT_PUSHPULL); - mySetPadMode2("lcd DB6", boardConfiguration->HD44780_db6, PAL_MODE_OUTPUT_PUSHPULL); - mySetPadMode2("lcd DB7", boardConfiguration->HD44780_db7, PAL_MODE_OUTPUT_PUSHPULL); + efiSetPadMode("lcd RS", boardConfiguration->HD44780_rs, PAL_MODE_OUTPUT_PUSHPULL); + efiSetPadMode("lcd E", boardConfiguration->HD44780_e, PAL_MODE_OUTPUT_PUSHPULL); + efiSetPadMode("lcd DB4", boardConfiguration->HD44780_db4, PAL_MODE_OUTPUT_PUSHPULL); + efiSetPadMode("lcd DB5", boardConfiguration->HD44780_db5, PAL_MODE_OUTPUT_PUSHPULL); + efiSetPadMode("lcd DB6", boardConfiguration->HD44780_db6, PAL_MODE_OUTPUT_PUSHPULL); + efiSetPadMode("lcd DB7", boardConfiguration->HD44780_db7, PAL_MODE_OUTPUT_PUSHPULL); // and zero values palWritePad(getHwPort(boardConfiguration->HD44780_rs), getHwPin(boardConfiguration->HD44780_rs), 0); palWritePad(getHwPort(boardConfiguration->HD44780_e), getHwPin(boardConfiguration->HD44780_e), 0); diff --git a/firmware/hw_layer/neo6m.cpp b/firmware/hw_layer/neo6m.cpp index 47deafaf21..b0dcd342a7 100644 --- a/firmware/hw_layer/neo6m.cpp +++ b/firmware/hw_layer/neo6m.cpp @@ -113,8 +113,8 @@ void initGps(void) { sdStart(GPS_SERIAL_DEVICE, &GPSserialConfig); // GPS we have USART1: PB7 -> USART1_RX and PB6 -> USART1_TX - mySetPadMode2("GPS tx", boardConfiguration->gps_tx_pin, PAL_MODE_ALTERNATE(7)); - mySetPadMode2("GPS rx", boardConfiguration->gps_rx_pin, PAL_MODE_ALTERNATE(7)); + efiSetPadMode("GPS tx", boardConfiguration->gps_tx_pin, PAL_MODE_ALTERNATE(7)); + efiSetPadMode("GPS rx", boardConfiguration->gps_rx_pin, PAL_MODE_ALTERNATE(7)); // todo: add a thread which would save location. If the GPS 5Hz - we should save the location each 200 ms chThdCreateStatic(gpsThreadStack, sizeof(gpsThreadStack), LOWPRIO, (tfunc_t)GpsThreadEntryPoint, NULL); diff --git a/firmware/hw_layer/stepper.cpp b/firmware/hw_layer/stepper.cpp index 19f3984784..de63541483 100644 --- a/firmware/hw_layer/stepper.cpp +++ b/firmware/hw_layer/stepper.cpp @@ -102,9 +102,9 @@ void StepperMotor::initialize(brain_pin_e stepPin, brain_pin_e directionPin, flo enablePort = getHwPort(enablePin); this->enablePin = getHwPin(enablePin); - mySetPadMode2("stepper step", stepPin, PAL_MODE_OUTPUT_PUSHPULL); - mySetPadMode2("stepper dir", directionPin, PAL_MODE_OUTPUT_PUSHPULL); - mySetPadMode2("stepper enable", enablePin, PAL_MODE_OUTPUT_PUSHPULL); + efiSetPadMode("stepper step", stepPin, PAL_MODE_OUTPUT_PUSHPULL); + efiSetPadMode("stepper dir", directionPin, PAL_MODE_OUTPUT_PUSHPULL); + efiSetPadMode("stepper enable", enablePin, PAL_MODE_OUTPUT_PUSHPULL); palWritePad(this->enablePort, enablePin, true); // disable stepper chThdCreateStatic(stThreadStack, sizeof(stThreadStack), NORMALPRIO, (tfunc_t) stThread, this); diff --git a/firmware/hw_layer/stm32f4/mpu_util.cpp b/firmware/hw_layer/stm32f4/mpu_util.cpp index 13aae57a00..a25f4bbc00 100644 --- a/firmware/hw_layer/stm32f4/mpu_util.cpp +++ b/firmware/hw_layer/stm32f4/mpu_util.cpp @@ -312,10 +312,10 @@ void initSpiModule(SPIDriver *driver, brain_pin_e sck, brain_pin_e miso, int mosiMode, int misoMode) { - mySetPadMode2("SPI clock", sck, PAL_MODE_ALTERNATE(getSpiAf(driver)) + sckMode); + efiSetPadMode("SPI clock", sck, PAL_MODE_ALTERNATE(getSpiAf(driver)) + sckMode); - mySetPadMode2("SPI master out", mosi, PAL_MODE_ALTERNATE(getSpiAf(driver)) + mosiMode); - mySetPadMode2("SPI master in ", miso, PAL_MODE_ALTERNATE(getSpiAf(driver)) + misoMode); + efiSetPadMode("SPI master out", mosi, PAL_MODE_ALTERNATE(getSpiAf(driver)) + mosiMode); + efiSetPadMode("SPI master in ", miso, PAL_MODE_ALTERNATE(getSpiAf(driver)) + misoMode); } void initSpiCs(SPIConfig *spiConfig, brain_pin_e csPin) { @@ -324,7 +324,7 @@ void initSpiCs(SPIConfig *spiConfig, brain_pin_e csPin) { ioportmask_t pin = getHwPin(csPin); spiConfig->ssport = port; spiConfig->sspad = pin; - mySetPadMode2("chip select", csPin, PAL_STM32_MODE_OUTPUT); + efiSetPadMode("chip select", csPin, PAL_STM32_MODE_OUTPUT); } #endif /* HAL_USE_SPI */