diff options
author | boessu <[email protected]> | 2024-12-16 10:27:42 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2024-12-16 10:27:42 +0100 |
commit | d3c9dff9d27245168fe02c03462f0aeba10ba97a (patch) | |
tree | 95eb2ad1537a924be48134a75f6aaf06c3d099e6 | |
parent | 0f3993b9a3cd3a50b2c9e5d920d6bdb40a9d78be (diff) | |
download | qmk_firmware-d3c9dff9d27245168fe02c03462f0aeba10ba97a.tar.gz qmk_firmware-d3c9dff9d27245168fe02c03462f0aeba10ba97a.zip |
small refactoring of TIMER_DIFF (#24678)
A small refactoring of the defines TIMER_DIFF_8, TIMER_DIFF_16, TIMER_DIFF_32, TIMER_DIFF_RAW.
Removing obsolete TIMER_DIFF helper.
Discussion: https://github.com/qmk/qmk_firmware/issues/24652
-rw-r--r-- | platforms/timer.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/platforms/timer.h b/platforms/timer.h index fb8ff6bc54..8a2ffd476b 100644 --- a/platforms/timer.h +++ b/platforms/timer.h @@ -24,10 +24,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <stdint.h> -#define TIMER_DIFF(a, b, max) ((max == UINT8_MAX) ? ((uint8_t)((a) - (b))) : ((max == UINT16_MAX) ? ((uint16_t)((a) - (b))) : ((max == UINT32_MAX) ? ((uint32_t)((a) - (b))) : ((a) >= (b) ? (a) - (b) : (max) + 1 - (b) + (a))))) -#define TIMER_DIFF_8(a, b) TIMER_DIFF(a, b, UINT8_MAX) -#define TIMER_DIFF_16(a, b) TIMER_DIFF(a, b, UINT16_MAX) -#define TIMER_DIFF_32(a, b) TIMER_DIFF(a, b, UINT32_MAX) +#define TIMER_DIFF_8(a, b) (uint8_t)((a) - (b)) +#define TIMER_DIFF_16(a, b) (uint16_t)((a) - (b)) +#define TIMER_DIFF_32(a, b) (uint32_t)((a) - (b)) #define TIMER_DIFF_RAW(a, b) TIMER_DIFF_8(a, b) #ifdef __cplusplus |