From 9d3f628f97004ef77514f83b053aceb70ec7b962 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sun, 20 Jun 2021 22:55:30 -0400 Subject: [PATCH] Yaml parsing refactor #2842 --- .../src/com/rusefi/PinType.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 java_tools/configuration_definition/src/com/rusefi/PinType.java diff --git a/java_tools/configuration_definition/src/com/rusefi/PinType.java b/java_tools/configuration_definition/src/com/rusefi/PinType.java new file mode 100644 index 0000000000..acda271011 --- /dev/null +++ b/java_tools/configuration_definition/src/com/rusefi/PinType.java @@ -0,0 +1,40 @@ +package com.rusefi; + +public enum PinType { + OUTPUTS("output_pin_e_enum", "brain_pin_e", "GPIO_UNASSIGNED"), + ANALOG_INPUTS("adc_channel_e_enum", "adc_channel_e", "EFI_ADC_NONE"), + EVENT_INPUTS("brain_input_pin_e_enum", "brain_pin_e", "GPIO_UNASSIGNED"), + SWITCH_INPUTS("switch_input_pin_e_enum", "brain_pin_e", "GPIO_UNASSIGNED"); + + + private final String outputEnumName; + private final String pinType; + private final String nothingName; + + PinType(String outputEnumName, String pinType, String nothingName) { + this.outputEnumName = outputEnumName; + this.pinType = pinType; + this.nothingName = nothingName; + } + + public String getOutputEnumName() { + return outputEnumName; + } + + public String getPinType() { + return pinType; + } + + public String getNothingName() { + return nothingName; + } + + public static PinType find(String key) { + for (PinType pinType : values()) { + if (pinType.name().equalsIgnoreCase(key)) { + return pinType; + } + } + throw new IllegalArgumentException(key + " not expected, possible keys are " + values()); + } +}