From 4696848ad45347b5c0555c59daf5875f13e89974 Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Thu, 28 Mar 2024 21:20:40 -0400 Subject: [PATCH] we often mean inline when we say static --- firmware/config/boards/hellen_meta.h | 8 ++++---- .../controllers/trigger/decoders/trigger_structure.h | 4 ++-- firmware/hw_layer/adc/adc_inputs.h | 2 +- firmware/util/efilib.h | 12 ++++++------ simulator/simulator/mpu_util.h | 4 ++-- unit_tests/adc_inputs.h | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/firmware/config/boards/hellen_meta.h b/firmware/config/boards/hellen_meta.h index 72e6729b4b..4a58eceda5 100644 --- a/firmware/config/boards/hellen_meta.h +++ b/firmware/config/boards/hellen_meta.h @@ -286,7 +286,7 @@ static void setHellen64SdCardSpi() { engineConfiguration->sdCardCsPin = Gpio::MM64_SPI3_CS; } -static inline void setHellenSdCardSpi2() { +inline void setHellenSdCardSpi2() { engineConfiguration->isSdCardEnabled = true; engineConfiguration->sdCardSpiDevice = SPI_DEVICE_2; engineConfiguration->spi2mosiPin = H_SPI2_MOSI; @@ -296,7 +296,7 @@ static inline void setHellenSdCardSpi2() { engineConfiguration->is_enabled_spi_2 = true; } -static void setHellenSdCardSpi3() { +inline void setHellenSdCardSpi3() { setHellenSdCardSpi3NoCS(); engineConfiguration->sdCardCsPin = H_SPI3_CS; } @@ -304,12 +304,12 @@ static void setHellenSdCardSpi3() { // *pullups* files CLT R211 IAT R213 #define HELLEN_DEFAULT_AT_PULLUP 4700 -static inline void setDefaultHellenAtPullUps() { +inline void setDefaultHellenAtPullUps(){ engineConfiguration->clt.config.bias_resistor = HELLEN_DEFAULT_AT_PULLUP; engineConfiguration->iat.config.bias_resistor = HELLEN_DEFAULT_AT_PULLUP; } -static inline void setHellenMMbaro() { +inline void setHellenMMbaro() { engineConfiguration->lps25BaroSensorScl = Gpio::B10; engineConfiguration->lps25BaroSensorSda = Gpio::B11; } diff --git a/firmware/controllers/trigger/decoders/trigger_structure.h b/firmware/controllers/trigger/decoders/trigger_structure.h index 352a590967..e3a1b3dbf4 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.h +++ b/firmware/controllers/trigger/decoders/trigger_structure.h @@ -29,7 +29,7 @@ // Shifts angle into the [0..720) range for four stroke and [0..360) for two stroke // See also wrapVvt -static inline void wrapAngle(angle_t& angle, const char* msg, ObdCode code) { +inline void wrapAngle(angle_t& angle, const char* msg, ObdCode code) { if (cisnan(angle)) { firmwareError(ObdCode::CUSTOM_ERR_ANGLE, "a NaN %s", msg); angle = 0; @@ -48,7 +48,7 @@ static inline void wrapAngle(angle_t& angle, const char* msg, ObdCode code) { } // proper method avoids un-wrapped state of variables -static inline angle_t wrapAngleMethod(angle_t param, const char *msg = "", ObdCode code = ObdCode::OBD_PCM_Processor_Fault) { +inline angle_t wrapAngleMethod(angle_t param, const char *msg = "", ObdCode code = ObdCode::OBD_PCM_Processor_Fault) { wrapAngle(param, msg, code); return param; } diff --git a/firmware/hw_layer/adc/adc_inputs.h b/firmware/hw_layer/adc/adc_inputs.h index 99af2c05f0..9b2727dc5e 100644 --- a/firmware/hw_layer/adc/adc_inputs.h +++ b/firmware/hw_layer/adc/adc_inputs.h @@ -17,7 +17,7 @@ float getAnalogInputDividerCoefficient(adc_channel_e); -static inline bool isAdcChannelValid(adc_channel_e hwChannel) { +inline bool isAdcChannelValid(adc_channel_e hwChannel) { if (hwChannel <= EFI_ADC_NONE) { return false; } else if (hwChannel >= EFI_ADC_LAST_CHANNEL) { diff --git a/firmware/util/efilib.h b/firmware/util/efilib.h index 9386ce00e5..b21e19bf03 100644 --- a/firmware/util/efilib.h +++ b/firmware/util/efilib.h @@ -19,12 +19,12 @@ int djb2lowerCase(const char *str); // http://en.wikipedia.org/wiki/Endianness -static inline uint16_t SWAP_UINT16(uint16_t x) +inline uint16_t SWAP_UINT16(uint16_t x) { return ((x << 8) | (x >> 8)); } -static inline uint32_t SWAP_UINT32(uint32_t x) +inline uint32_t SWAP_UINT32(uint32_t x) { return (((x >> 24) & 0x000000ff) | ((x << 8) & 0x00ff0000) | ((x >> 8) & 0x0000ff00) | ((x << 24) & 0xff000000)); @@ -85,19 +85,19 @@ bool isInRange(T min, T val, T max) { return val >= min && val <= max; } -static constexpr size_t operator-(Gpio a, Gpio b) { +inline constexpr size_t operator-(Gpio a, Gpio b) { return (size_t)a - (size_t)b; } -static constexpr Gpio operator-(Gpio a, size_t b) { +inline constexpr Gpio operator-(Gpio a, size_t b) { return (Gpio)((size_t)a - b); } -static constexpr Gpio operator+(Gpio a, size_t b) { +inline constexpr Gpio operator+(Gpio a, size_t b) { return (Gpio)((size_t)a + b); } -static constexpr Gpio operator+(size_t a, Gpio b) { +inline constexpr Gpio operator+(size_t a, Gpio b) { // addition is commutative, just use the other operator return b + a; } diff --git a/simulator/simulator/mpu_util.h b/simulator/simulator/mpu_util.h index ced1850843..45179c5767 100644 --- a/simulator/simulator/mpu_util.h +++ b/simulator/simulator/mpu_util.h @@ -2,8 +2,8 @@ #if HAL_USE_CAN CANDriver* detectCanDevice(brain_pin_e pinRx, brain_pin_e pinTx); - bool isValidCanTxPin(brain_pin_e); - bool isValidCanRxPin(brain_pin_e); +inline bool isValidCanTxPin(brain_pin_e) { return true; } +inline bool isValidCanRxPin(brain_pin_e) { return true; } void canHwInfo(CANDriver*); #endif // HAL_USE_CAN diff --git a/unit_tests/adc_inputs.h b/unit_tests/adc_inputs.h index 5313457d4e..7a3a83455e 100644 --- a/unit_tests/adc_inputs.h +++ b/unit_tests/adc_inputs.h @@ -9,7 +9,7 @@ #include "rusefi_hw_enums.h" -static inline bool isAdcChannelValid(adc_channel_e hwChannel) { +inline bool isAdcChannelValid(adc_channel_e hwChannel) { if (hwChannel <= EFI_ADC_NONE) { return false; } else if (hwChannel >= EFI_ADC_LAST_CHANNEL) {