extracting method

This commit is contained in:
rusefi 2020-04-08 22:36:18 -04:00
parent d2bbc30133
commit 4056cf1022
3 changed files with 9 additions and 3 deletions

View File

@ -196,5 +196,6 @@ const char *portname(ioportid_t GPIOx);
#endif /* EFI_GPIO_HARDWARE */
void printSpiConfig(Logging *logging, const char *msg, spi_device_e device);
brain_pin_e parseBrainPin(const char *str);
const char *hwPortname(brain_pin_e brainPin);

View File

@ -173,9 +173,7 @@ static void showHipInfo(void) {
getPinNameByAdcChannel("hip", engineConfiguration->hipOutputChannel, pinNameBuffer),
hipValueMax,
CONFIG(useTpicAdvancedMode));
scheduleMsg(logger, "mosi=%s", hwPortname(getMosiPin(engineConfiguration->hip9011SpiDevice)));
scheduleMsg(logger, "miso=%s", hwPortname(getMisoPin(engineConfiguration->hip9011SpiDevice)));
scheduleMsg(logger, "sck=%s", hwPortname(getSckPin(engineConfiguration->hip9011SpiDevice)));
printSpiConfig(logger, "hip9011", CONFIG(hip9011SpiDevice));
#endif /* EFI_PROD_CODE */
scheduleMsg(logger, "start %.2f end %.2f", engineConfiguration->knockDetectionWindowStart,

View File

@ -17,6 +17,7 @@
#include "memstreams.h"
#include "drivers/gpio/gpio_ext.h"
#include "smart_gpio.h"
#include "hardware.h"
static bool initialized = false;
@ -174,6 +175,12 @@ static void reportPins(void) {
static MemoryStream portNameStream;
static char portNameBuffer[20];
void printSpiConfig(Logging *logging, const char *msg, spi_device_e device) {
scheduleMsg(logging, "%s %s mosi=%s", msg, getSpi_device_e(device), hwPortname(getMosiPin(device)));
scheduleMsg(logging, "%s %s miso=%s", msg, getSpi_device_e(device), hwPortname(getMisoPin(device)));
scheduleMsg(logging, "%s %s sck=%s", msg, getSpi_device_e(device), hwPortname(getSckPin(device)));
}
const char *hwPortname(brain_pin_e brainPin) {
if (brainPin == GPIO_INVALID) {
return "INVALID";