From 09767649de29863d68c387fb9a86ce1281fb4fdc Mon Sep 17 00:00:00 2001 From: rusefi Date: Tue, 4 Jun 2019 12:21:28 -0400 Subject: [PATCH] extracting hw-specific enums --- .../controllers/algo/auto_generated_enums.cpp | 4 +++- .../controllers/algo/auto_generated_enums.h | 4 +++- firmware/controllers/algo/rusefi_enums.h | 11 +-------- firmware/controllers/algo/rusefi_hw_enums.h | 21 ++++++++++++++++++ firmware/gen_enum_to_string.bat | 2 +- java_tools/enum2string.jar | Bin 11829 -> 11813 bytes java_tools/enum_to_string/.idea/encodings.xml | 4 ++++ .../src/com/rusefi/EnumToString.java | 12 ++++------ 8 files changed, 37 insertions(+), 21 deletions(-) create mode 100644 firmware/controllers/algo/rusefi_hw_enums.h create mode 100644 java_tools/enum_to_string/.idea/encodings.xml 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 4b35ce07598d5787abf47160f519546a77fded33..f5279a1afa6977c4cfa3d28c81d6190880275ae4 100644 GIT binary patch delta 4844 zcmeI$XFD5=8V7JfDY3_q5RX>O7@>Bp8nt59IwIv!jlFlQJVq&rqEVq*wMVE?+QjNm zp)D$AXzf|0M*CDlmDA_#xz3C80o?a>zxZF*{Q-X0|0${(#chvZVdZ3EI?u!eztNY^ zEytpKqpww4k(v8UU%E zJV-iSXvkRQiaHIyXYacLghq;Vaa%+ zoZJ8c-K}W)Z4ljUY$Wa>zv66-)e!W2{W`Gt`0^h+OJBAy-`O}qR}Xo>=9pvxUTZK8 zhbL$7Q9s`7ei+CA?z!kb6utYxOdl=^z|O(?R#+SI$E4i@ClgY7kJ(`6uW+Q zbfQJC}QTukI69bT14G65Chh@Qpj6q_h8fTQKoh7Q-mO zvxApv(TQgLzONaO8mUB&eiP2ihkfujj0!ybE#nEk`3-}FZ*HBZqZ3W~wRD^ouI&XU zX67Uk$qR)2Bo0IS7TnzF#qnGOBmau?CBjTV4gOC18mJIzFR{?Di=~%1c4|z`?%uQs z42pbjodcS2NeLLYs)>MR%!Nvcs|E9;wZGuop3k8_NlDqO?I>FXxdd-PtfGD#aPvqV zePHiol@t*-o>H)!kBJ(bsjrR5xS|voeZX_TAh~y~JOpq$l6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Aw`XPK}k8V2e_IDHX#l<-Lg-6)fAZCa+lv;(zzmDa$E0c zjQQ@S2BgEsU_Ix`mg@*6uRN6`tLXE0d}~3LvrWKZnWGW$pV&CdGt`6^XNTi%0eSu2 zE{;t(VH035iDA-sn~vc4OTyEi<1bj8hanLlk76&QjS2^FW_Tu^=K;))vwoQab>ww=2(_+xR@R*zaZtkMTSE3~S%vz;<7WswpGVk>y6jM~oob3T zoKxu~nwlx+y?1NMHYMMWn<+nYbJjP<}&8a>9Xob zJ4i0xMO#g zXK@)}n;L1Jtuk>k^sEPJ@*Aw6r?hd3yPmj^zhrfgruHI=sCX@Y4=M3e6syM)KGnk& z89ti&B(mK26nWQyHQnTq%~?Z~DmW%uZsSe&{kQ-YEe+*CVW zqGJ>nJAZv%`C?;d(|#vs0E;#lapA5F{TU6E&bs~Ux>0Glz_kN22w8?({h!w7RwI_Q z7gri{7#tWc#dImAOEF!F=~7IWV!9O5rI;?o^uNRezUjnB^`~P(CqtC}?VQlPkiGvB zRHuXkWii@R%7}6nT`Z*s=we4}Q1YS)lHC9ABQpmLEybT<{ + + + \ 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");