input pins: merge inverted flag into pin_input_mode_e_enum

This commit is contained in:
Andrey Gusakov 2025-02-11 14:21:56 +03:00 committed by rusefillc
parent 40c1d576cf
commit 9209bc64cb
3 changed files with 12 additions and 3 deletions

View File

@ -259,7 +259,13 @@ typedef enum __attribute__ ((__packed__)) {
typedef enum __attribute__ ((__packed__)) {
PI_DEFAULT = 0,
PI_PULLUP = 1,
PI_PULLDOWN = 2
PI_PULLDOWN = 2,
/**
* bit 2 is used as inverted flag, so skip one here
*/
PI_INVERTED_DEFAULT = 4,
PI_INVERTED_PULLUP = 5,
PI_INVERTED_PULLDOWN = 6
} pin_input_mode_e;
/**

View File

@ -103,10 +103,13 @@ bool efiReadPin(brain_pin_e pin) {
iomode_t getInputMode(pin_input_mode_e mode) {
switch (mode) {
case PI_PULLUP:
case PI_INVERTED_PULLUP:
return PAL_MODE_INPUT_PULLUP;
case PI_PULLDOWN:
case PI_INVERTED_PULLDOWN:
return PAL_MODE_INPUT_PULLDOWN;
case PI_DEFAULT:
case PI_INVERTED_DEFAULT:
default:
return PAL_MODE_INPUT;
}

View File

@ -362,8 +362,8 @@ custom output_pin_e 2 bits, U16, @OFFSET@, [0:8], $output_pin_e_list
#define pin_output_mode_e_enum "default", "default inverted", "open collector", "open collector inverted"
custom pin_output_mode_e 1 bits, U08, @OFFSET@, [0:1], @@pin_output_mode_e_enum@@
#define pin_input_mode_e_enum "DEFAULT", "PULLUP", "PULLDOWN"
custom pin_input_mode_e 1 bits, U08, @OFFSET@, [0:1], @@pin_input_mode_e_enum@@
#define pin_input_mode_e_enum "DEFAULT", "PULLUP", "PULLDOWN", "INVALID", "INVERTED DEFAULT", "INVERTED PULLUP", "INVERTED PULLDOWN"
custom pin_input_mode_e 1 bits, U08, @OFFSET@, [0:2], @@pin_input_mode_e_enum@@
#define gppwm_channel_e_enum "Zero", "TPS", "MAP", "CLT", "IAT", "Fuel Load", "Ignition Load", "Aux Temp 1", "Aux Temp 2", "Accel Pedal", "Battery Voltage", "VVT 1 I", "VVT 1 E", "VVT 2 I", "VVT 2 E", "Ethanol (Flex) %", "Aux Linear 1", "Aux Linear 2", "GPPWM Output 1", "GPPWM Output 2", "GPPWM Output 3", "GPPWM Output 4", "Lua Gauge 1", "Lua Gauge 2", "RPM", "Gear (detected)", "Baro pressure", "EGT 1", "EGT 2", "Aux Linear 3", "Aux Linear 4", "Vehicle speed", "Oil pressure", "Oil temp"
custom gppwm_channel_e 1 bits, U08, @OFFSET@, [0:5], @@gppwm_channel_e_enum@@