extracting hw-specific enums
This commit is contained in:
parent
3a10946940
commit
09767649de
|
@ -1,8 +1,10 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "rusefi_enums.h"
|
#include "rusefi_enums.h"
|
||||||
|
#include "rusefi_hw_enums.h"
|
||||||
|
// auto-generated from rusefi_hw_enums.h
|
||||||
// auto-generated from rusefi_enums.h
|
// auto-generated from rusefi_enums.h
|
||||||
// by enum2string.jar tool
|
// 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
|
// see also gen_config_and_enums.bat
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
|
// auto-generated from rusefi_hw_enums.h
|
||||||
// auto-generated from rusefi_enums.h
|
// auto-generated from rusefi_enums.h
|
||||||
// by enum2string.jar tool
|
// 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
|
// see also gen_config_and_enums.bat
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "rusefi_enums.h"
|
#include "rusefi_enums.h"
|
||||||
|
#include "rusefi_hw_enums.h"
|
||||||
#ifndef _A_H_HEADER_
|
#ifndef _A_H_HEADER_
|
||||||
#define _A_H_HEADER_
|
#define _A_H_HEADER_
|
||||||
const char *getPidAutoTune_AutoTunerState(PidAutoTune_AutoTunerState value);
|
const char *getPidAutoTune_AutoTunerState(PidAutoTune_AutoTunerState value);
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include "efifeatures.h"
|
#include "efifeatures.h"
|
||||||
#include "obd_error_codes.h"
|
#include "obd_error_codes.h"
|
||||||
|
#include "rusefi_hw_enums.h"
|
||||||
|
|
||||||
#define HIP_NAME "HIP"
|
#define HIP_NAME "HIP"
|
||||||
#define TACH_NAME "tach"
|
#define TACH_NAME "tach"
|
||||||
|
@ -444,16 +445,6 @@ typedef enum __attribute__ ((__packed__)) {
|
||||||
OM_OPENDRAIN_INVERTED = 3
|
OM_OPENDRAIN_INVERTED = 3
|
||||||
} pin_output_mode_e;
|
} 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__)) {
|
typedef enum __attribute__ ((__packed__)) {
|
||||||
PI_DEFAULT = 0,
|
PI_DEFAULT = 0,
|
||||||
PI_PULLUP = 1,
|
PI_PULLUP = 1,
|
||||||
|
|
|
@ -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_ */
|
|
@ -1,3 +1,3 @@
|
||||||
rem This batch files reads rusefi_enums.h and produses auto_generated_enums.* files
|
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
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
|
||||||
|
</project>
|
|
@ -24,10 +24,8 @@ public class EnumToString {
|
||||||
|
|
||||||
private final static StringBuilder headerFileContent = new StringBuilder();
|
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_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";
|
private final static String KEY_OUTPUT = "-outputPath";
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
|
@ -46,17 +44,15 @@ public class EnumToString {
|
||||||
String key = args[i];
|
String key = args[i];
|
||||||
if (key.equals(KEY_INPUT_PATH)) {
|
if (key.equals(KEY_INPUT_PATH)) {
|
||||||
inputPath = args[i + 1];
|
inputPath = args[i + 1];
|
||||||
// } else if (key.equals(KEY_INPUT_FILE)) {
|
} else if (key.equals(KEY_ENUM_INPUT_FILE)) {
|
||||||
// String inputFile = args[i + 1];
|
String inputFile = args[i + 1];
|
||||||
// consumeFile(inputPath, inputFile);
|
consumeFile(inputPath, inputFile);
|
||||||
} else if (key.equals(KEY_OUTPUT)) {
|
} else if (key.equals(KEY_OUTPUT)) {
|
||||||
outputPath = args[i + 1];
|
outputPath = args[i + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
consumeFile(inputPath, COMMON_HEADER_RELATIVE_NAME);
|
|
||||||
|
|
||||||
headerFileContent.append("#ifndef _A_H_HEADER_\r\n");
|
headerFileContent.append("#ifndef _A_H_HEADER_\r\n");
|
||||||
headerFileContent.append("#define _A_H_HEADER_\r\n");
|
headerFileContent.append("#define _A_H_HEADER_\r\n");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue