mirror of https://github.com/rusefi/rusefi.git
we often mean inline when we say static
This commit is contained in:
parent
19f628658a
commit
4696848ad4
|
@ -286,7 +286,7 @@ static void setHellen64SdCardSpi() {
|
||||||
engineConfiguration->sdCardCsPin = Gpio::MM64_SPI3_CS;
|
engineConfiguration->sdCardCsPin = Gpio::MM64_SPI3_CS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void setHellenSdCardSpi2() {
|
inline void setHellenSdCardSpi2() {
|
||||||
engineConfiguration->isSdCardEnabled = true;
|
engineConfiguration->isSdCardEnabled = true;
|
||||||
engineConfiguration->sdCardSpiDevice = SPI_DEVICE_2;
|
engineConfiguration->sdCardSpiDevice = SPI_DEVICE_2;
|
||||||
engineConfiguration->spi2mosiPin = H_SPI2_MOSI;
|
engineConfiguration->spi2mosiPin = H_SPI2_MOSI;
|
||||||
|
@ -296,7 +296,7 @@ static inline void setHellenSdCardSpi2() {
|
||||||
engineConfiguration->is_enabled_spi_2 = true;
|
engineConfiguration->is_enabled_spi_2 = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setHellenSdCardSpi3() {
|
inline void setHellenSdCardSpi3() {
|
||||||
setHellenSdCardSpi3NoCS();
|
setHellenSdCardSpi3NoCS();
|
||||||
engineConfiguration->sdCardCsPin = H_SPI3_CS;
|
engineConfiguration->sdCardCsPin = H_SPI3_CS;
|
||||||
}
|
}
|
||||||
|
@ -304,12 +304,12 @@ static void setHellenSdCardSpi3() {
|
||||||
// *pullups* files CLT R211 IAT R213
|
// *pullups* files CLT R211 IAT R213
|
||||||
#define HELLEN_DEFAULT_AT_PULLUP 4700
|
#define HELLEN_DEFAULT_AT_PULLUP 4700
|
||||||
|
|
||||||
static inline void setDefaultHellenAtPullUps() {
|
inline void setDefaultHellenAtPullUps(){
|
||||||
engineConfiguration->clt.config.bias_resistor = HELLEN_DEFAULT_AT_PULLUP;
|
engineConfiguration->clt.config.bias_resistor = HELLEN_DEFAULT_AT_PULLUP;
|
||||||
engineConfiguration->iat.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->lps25BaroSensorScl = Gpio::B10;
|
||||||
engineConfiguration->lps25BaroSensorSda = Gpio::B11;
|
engineConfiguration->lps25BaroSensorSda = Gpio::B11;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
// Shifts angle into the [0..720) range for four stroke and [0..360) for two stroke
|
// Shifts angle into the [0..720) range for four stroke and [0..360) for two stroke
|
||||||
// See also wrapVvt
|
// 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)) {
|
if (cisnan(angle)) {
|
||||||
firmwareError(ObdCode::CUSTOM_ERR_ANGLE, "a NaN %s", msg);
|
firmwareError(ObdCode::CUSTOM_ERR_ANGLE, "a NaN %s", msg);
|
||||||
angle = 0;
|
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
|
// 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);
|
wrapAngle(param, msg, code);
|
||||||
return param;
|
return param;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
float getAnalogInputDividerCoefficient(adc_channel_e);
|
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) {
|
if (hwChannel <= EFI_ADC_NONE) {
|
||||||
return false;
|
return false;
|
||||||
} else if (hwChannel >= EFI_ADC_LAST_CHANNEL) {
|
} else if (hwChannel >= EFI_ADC_LAST_CHANNEL) {
|
||||||
|
|
|
@ -19,12 +19,12 @@ int djb2lowerCase(const char *str);
|
||||||
|
|
||||||
// http://en.wikipedia.org/wiki/Endianness
|
// 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));
|
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) |
|
return (((x >> 24) & 0x000000ff) | ((x << 8) & 0x00ff0000) |
|
||||||
((x >> 8) & 0x0000ff00) | ((x << 24) & 0xff000000));
|
((x >> 8) & 0x0000ff00) | ((x << 24) & 0xff000000));
|
||||||
|
@ -85,19 +85,19 @@ bool isInRange(T min, T val, T max) {
|
||||||
return val >= min && val <= 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;
|
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);
|
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);
|
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
|
// addition is commutative, just use the other operator
|
||||||
return b + a;
|
return b + a;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
#if HAL_USE_CAN
|
#if HAL_USE_CAN
|
||||||
CANDriver* detectCanDevice(brain_pin_e pinRx, brain_pin_e pinTx);
|
CANDriver* detectCanDevice(brain_pin_e pinRx, brain_pin_e pinTx);
|
||||||
bool isValidCanTxPin(brain_pin_e);
|
inline bool isValidCanTxPin(brain_pin_e) { return true; }
|
||||||
bool isValidCanRxPin(brain_pin_e);
|
inline bool isValidCanRxPin(brain_pin_e) { return true; }
|
||||||
void canHwInfo(CANDriver*);
|
void canHwInfo(CANDriver*);
|
||||||
#endif // HAL_USE_CAN
|
#endif // HAL_USE_CAN
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#include "rusefi_hw_enums.h"
|
#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) {
|
if (hwChannel <= EFI_ADC_NONE) {
|
||||||
return false;
|
return false;
|
||||||
} else if (hwChannel >= EFI_ADC_LAST_CHANNEL) {
|
} else if (hwChannel >= EFI_ADC_LAST_CHANNEL) {
|
||||||
|
|
Loading…
Reference in New Issue