diff --git a/firmware/controllers/algo/auto_generated_enums.cpp b/firmware/controllers/algo/auto_generated_enums.cpp index c3a39f175a..95e7ef181c 100644 --- a/firmware/controllers/algo/auto_generated_enums.cpp +++ b/firmware/controllers/algo/auto_generated_enums.cpp @@ -1,8 +1,10 @@ #include "global.h" #include "rusefi_enums.h" +#include "rusefi_hw_enums.h" +// auto-generated from rusefi_hw_enums.h // auto-generated from rusefi_enums.h // by enum2string.jar tool -// on Sun Jun 02 16:14:34 EDT 2019 +// on Tue Jun 04 12:17:32 EDT 2019 // see also gen_config_and_enums.bat diff --git a/firmware/controllers/algo/auto_generated_enums.h b/firmware/controllers/algo/auto_generated_enums.h index d5e359b6b7..1b86ea3c4d 100644 --- a/firmware/controllers/algo/auto_generated_enums.h +++ b/firmware/controllers/algo/auto_generated_enums.h @@ -1,11 +1,13 @@ +// auto-generated from rusefi_hw_enums.h // auto-generated from rusefi_enums.h // by enum2string.jar tool -// on Sun Jun 02 16:14:34 EDT 2019 +// on Tue Jun 04 12:17:32 EDT 2019 // see also gen_config_and_enums.bat #include "rusefi_enums.h" +#include "rusefi_hw_enums.h" #ifndef _A_H_HEADER_ #define _A_H_HEADER_ const char *getPidAutoTune_AutoTunerState(PidAutoTune_AutoTunerState value); diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index ff1ee14557..165e29a2ce 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -13,6 +13,7 @@ #include "efifeatures.h" #include "obd_error_codes.h" +#include "rusefi_hw_enums.h" #define HIP_NAME "HIP" #define TACH_NAME "tach" @@ -444,16 +445,6 @@ typedef enum __attribute__ ((__packed__)) { OM_OPENDRAIN_INVERTED = 3 } pin_output_mode_e; -// todo: migrate/unify with pin_output_mode_e? rename? something is messy here -// this enum is currently only used for SPI pins -typedef enum __attribute__ ((__packed__)) { -// todo: here we have a rare example of stm32-specific enum, todo: make this not stm32 specific? - PO_DEFAULT = 0, - PO_OPENDRAIN = 4, // PAL_STM32_OTYPE_OPENDRAIN - PO_PULLUP = 32, // PAL_STM32_PUDR_PULLUP - PO_PULLDOWN = 64 // PAL_STM32_PUPDR_PULLDOWN -} pin_mode_e; - typedef enum __attribute__ ((__packed__)) { PI_DEFAULT = 0, PI_PULLUP = 1, diff --git a/firmware/controllers/algo/rusefi_hw_enums.h b/firmware/controllers/algo/rusefi_hw_enums.h new file mode 100644 index 0000000000..75c79c3c19 --- /dev/null +++ b/firmware/controllers/algo/rusefi_hw_enums.h @@ -0,0 +1,21 @@ +/* + * @file rusefi_hw_enums.h + * + * @date Jun 2, 2019 + * @author Andrey Belomutskiy, (c) 2012-2019 + */ + +#ifndef RUSEFI_HW_ENUMS_H_ +#define RUSEFI_HW_ENUMS_H_ + +// todo: migrate/unify with pin_output_mode_e? rename? something is messy here +// this enum is currently only used for SPI pins +typedef enum __attribute__ ((__packed__)) { +// todo: here we have a rare example of stm32-specific enum, todo: make this not stm32 specific? + PO_DEFAULT = 0, + PO_OPENDRAIN = 4, // PAL_STM32_OTYPE_OPENDRAIN + PO_PULLUP = 32, // PAL_STM32_PUDR_PULLUP + PO_PULLDOWN = 64 // PAL_STM32_PUPDR_PULLDOWN +} pin_mode_e; + +#endif /* RUSEFI_HW_ENUMS_H_ */ diff --git a/firmware/gen_enum_to_string.bat b/firmware/gen_enum_to_string.bat index 2c1f3eb12a..17607d9c8b 100644 --- a/firmware/gen_enum_to_string.bat +++ b/firmware/gen_enum_to_string.bat @@ -1,3 +1,3 @@ rem This batch files reads rusefi_enums.h and produses auto_generated_enums.* files -java -jar ../java_tools/enum2string.jar -inputPath . -outputPath controllers/algo +java -jar ../java_tools/enum2string.jar -inputPath . -outputPath controllers/algo -enumInputFile controllers/algo/rusefi_enums.h -enumInputFile controllers/algo/rusefi_hw_enums.h diff --git a/java_tools/enum2string.jar b/java_tools/enum2string.jar index 4b35ce0759..f5279a1afa 100644 Binary files a/java_tools/enum2string.jar and b/java_tools/enum2string.jar differ diff --git a/java_tools/enum_to_string/.idea/encodings.xml b/java_tools/enum_to_string/.idea/encodings.xml new file mode 100644 index 0000000000..15a15b218a --- /dev/null +++ b/java_tools/enum_to_string/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/java_tools/enum_to_string/src/com/rusefi/EnumToString.java b/java_tools/enum_to_string/src/com/rusefi/EnumToString.java index d82dba95e3..9ef241a160 100644 --- a/java_tools/enum_to_string/src/com/rusefi/EnumToString.java +++ b/java_tools/enum_to_string/src/com/rusefi/EnumToString.java @@ -24,10 +24,8 @@ public class EnumToString { private final static StringBuilder headerFileContent = new StringBuilder(); - public static final String COMMON_HEADER_RELATIVE_NAME = "controllers/algo/rusefi_enums.h"; - private final static String KEY_INPUT_PATH = "-inputPath"; - // private final static String KEY_INPUT_FILE = "-inputFile"; + private final static String KEY_ENUM_INPUT_FILE = "-enumInputFile"; private final static String KEY_OUTPUT = "-outputPath"; public static void main(String[] args) throws IOException { @@ -46,17 +44,15 @@ public class EnumToString { String key = args[i]; if (key.equals(KEY_INPUT_PATH)) { inputPath = args[i + 1]; -// } else if (key.equals(KEY_INPUT_FILE)) { -// String inputFile = args[i + 1]; -// consumeFile(inputPath, inputFile); + } else if (key.equals(KEY_ENUM_INPUT_FILE)) { + String inputFile = args[i + 1]; + consumeFile(inputPath, inputFile); } else if (key.equals(KEY_OUTPUT)) { outputPath = args[i + 1]; } } - consumeFile(inputPath, COMMON_HEADER_RELATIVE_NAME); - headerFileContent.append("#ifndef _A_H_HEADER_\r\n"); headerFileContent.append("#define _A_H_HEADER_\r\n");