Code style for methods with zero arguments #3535

This commit is contained in:
rusefillc 2022-01-11 22:40:52 -05:00
parent 963c168788
commit 4db4ac060c
5 changed files with 11 additions and 18 deletions

View File

@ -63,7 +63,7 @@ void setMockMapVoltage(float voltage) {
/** /**
* 64-bit result would not overflow, but that's complex stuff for our 32-bit MCU * 64-bit result would not overflow, but that's complex stuff for our 32-bit MCU
*/ */
efitimeus_t getTimeNowUs(void) { efitimeus_t getTimeNowUs() {
ScopePerf perf(PE::GetTimeNowUs); ScopePerf perf(PE::GetTimeNowUs);
return NT2US(getTimeNowNt()); return NT2US(getTimeNowNt());
} }

View File

@ -50,9 +50,6 @@
#define overflowDiff(now, time) ((now) - (time)) #define overflowDiff(now, time) ((now) - (time))
#ifdef __cplusplus #ifdef __cplusplus
extern "C"
{
/** /**
* Provide a 62-bit counter from a 32-bit counter source that wraps around. * Provide a 62-bit counter from a 32-bit counter source that wraps around.
* *
@ -83,8 +80,6 @@ private:
volatile uint32_t m_upper = 0; volatile uint32_t m_upper = 0;
}; };
#endif /* __cplusplus */
/** /**
* 64-bit counter of microseconds (1/1 000 000 of a second) since MCU reset * 64-bit counter of microseconds (1/1 000 000 of a second) since MCU reset
@ -95,7 +90,7 @@ private:
* WARNING: you should use getTimeNowNt where possible for performance reasons. * WARNING: you should use getTimeNowNt where possible for performance reasons.
* The heaviest part is '__aeabi_ildivmod' - non-native 64 bit division * The heaviest part is '__aeabi_ildivmod' - non-native 64 bit division
*/ */
efitimeus_t getTimeNowUs(void); efitimeus_t getTimeNowUs();
/** /**
* 64-bit counter CPU cycles since MCU reset * 64-bit counter CPU cycles since MCU reset
@ -104,22 +99,20 @@ efitimeus_t getTimeNowUs(void);
* Lower 32 bits are enough if all we need is to measure relatively short time durations * Lower 32 bits are enough if all we need is to measure relatively short time durations
* (BTW 2^32 cpu cycles at 168MHz is 25.59 seconds) * (BTW 2^32 cpu cycles at 168MHz is 25.59 seconds)
*/ */
efitick_t getTimeNowNt(void); efitick_t getTimeNowNt();
/** /**
* @brief Returns the number of milliseconds since the board initialization. * @brief Returns the number of milliseconds since the board initialization.
*/ */
efitimems_t currentTimeMillis(void); efitimems_t currentTimeMillis();
/** /**
* @brief Current system time in seconds. * @brief Current system time in seconds.
*/ */
efitimesec_t getTimeNowSeconds(void); efitimesec_t getTimeNowSeconds();
// Get a monotonically increasing (but wrapping) 32-bit timer value // Get a monotonically increasing (but wrapping) 32-bit timer value
uint32_t getTimeNowLowerNt(void); uint32_t getTimeNowLowerNt();
#ifdef __cplusplus
}
#endif /* __cplusplus */ #endif /* __cplusplus */

View File

@ -277,7 +277,7 @@ void EngineTestHelper::setTimeAndInvokeEventsUs(int targetTime) {
timeNowUs = targetTime; timeNowUs = targetTime;
} }
efitimeus_t EngineTestHelper::getTimeNowUs(void) { efitimeus_t EngineTestHelper::getTimeNowUs() {
return timeNowUs; return timeNowUs;
} }

View File

@ -95,7 +95,7 @@ public:
int executeActions(); int executeActions();
void moveTimeForwardMs(float deltaTimeMs); void moveTimeForwardMs(float deltaTimeMs);
void moveTimeForwardSec(float deltaTimeSec); void moveTimeForwardSec(float deltaTimeSec);
efitimeus_t getTimeNowUs(void); efitimeus_t getTimeNowUs();
Engine engine; Engine engine;
persistent_config_s persistentConfig; persistent_config_s persistentConfig;

View File

@ -11,15 +11,15 @@ bool verboseMode = false;
int timeNowUs = 0; int timeNowUs = 0;
efitimeus_t getTimeNowUs(void) { efitimeus_t getTimeNowUs() {
return timeNowUs; return timeNowUs;
} }
efitimesec_t getTimeNowSeconds(void) { efitimesec_t getTimeNowSeconds() {
return getTimeNowUs() / 1000 / 1000; return getTimeNowUs() / 1000 / 1000;
} }
efitick_t getTimeNowNt(void) { efitick_t getTimeNowNt() {
return getTimeNowUs() * US_TO_NT_MULTIPLIER; return getTimeNowUs() * US_TO_NT_MULTIPLIER;
} }