better method name
This commit is contained in:
parent
41c4b7a0f8
commit
f27f99e9cc
|
@ -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;
|
||||
|
||||
|
|
|
@ -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]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue