summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2023-03-23 05:30:30 +0000
committerGitHub <noreply@github.com>2023-03-23 05:30:30 +0000
commitb01dc36fbf09c3ebf8efe1bac54205ace1b1c6cc (patch)
treedacbffac9d1918eb8962f631517cfec544adb965 /quantum
parent42aa83787fd0d3a5acd0ac7fbe7d148648be742d (diff)
Tidy up duplication of MIN/MAX fallback implementations (#20236)
Diffstat (limited to 'quantum')
-rw-r--r--quantum/audio/audio.c1
-rw-r--r--quantum/audio/audio.h5
-rw-r--r--quantum/color.c4
-rw-r--r--quantum/midi/midi.c5
-rw-r--r--quantum/rgblight/rgblight.c8
-rw-r--r--quantum/velocikey.c8
6 files changed, 5 insertions, 26 deletions
diff --git a/quantum/audio/audio.c b/quantum/audio/audio.c
index 3f6dc20232..2570ad9cd1 100644
--- a/quantum/audio/audio.c
+++ b/quantum/audio/audio.c
@@ -18,6 +18,7 @@
#include "eeconfig.h"
#include "timer.h"
#include "wait.h"
+#include "util.h"
/* audio system:
*
diff --git a/quantum/audio/audio.h b/quantum/audio/audio.h
index 6feecb5e65..497f3dafd0 100644
--- a/quantum/audio/audio.h
+++ b/quantum/audio/audio.h
@@ -43,11 +43,6 @@ typedef union {
};
} audio_config_t;
-// AVR/LUFA has a MIN, arm/chibios does not
-#ifndef MIN
-# define MIN(a, b) (((a) < (b)) ? (a) : (b))
-#endif
-
/*
* a 'musical note' is represented by pitch and duration; a 'musical tone' adds intensity and timbre
* https://en.wikipedia.org/wiki/Musical_tone
diff --git a/quantum/color.c b/quantum/color.c
index c80078dbf2..767155c9db 100644
--- a/quantum/color.c
+++ b/quantum/color.c
@@ -17,6 +17,7 @@
#include "color.h"
#include "led_tables.h"
#include "progmem.h"
+#include "util.h"
RGB hsv_to_rgb_impl(HSV hsv, bool use_cie) {
RGB rgb;
@@ -109,9 +110,6 @@ RGB hsv_to_rgb_nocie(HSV hsv) {
}
#ifdef RGBW
-# ifndef MIN
-# define MIN(a, b) ((a) < (b) ? (a) : (b))
-# endif
void convert_rgb_to_rgbw(LED_TYPE *led) {
// Determine lowest value in all three colors, put that into
// the white channel and then shift all colors by that amount
diff --git a/quantum/midi/midi.c b/quantum/midi/midi.c
index 1ba3e73a40..1c481f2f0b 100644
--- a/quantum/midi/midi.c
+++ b/quantum/midi/midi.c
@@ -18,10 +18,7 @@
#include "midi.h"
#include <string.h> //for memcpy
-
-#ifndef MIN
-# define MIN(x, y) (((x) < (y)) ? (x) : (y))
-#endif
+#include "util.h"
#ifndef NULL
# define NULL 0
diff --git a/quantum/rgblight/rgblight.c b/quantum/rgblight/rgblight.c
index 4c476f924f..02188df95b 100644
--- a/quantum/rgblight/rgblight.c
+++ b/quantum/rgblight/rgblight.c
@@ -21,6 +21,7 @@
#include "rgblight.h"
#include "color.h"
#include "debug.h"
+#include "util.h"
#include "led_tables.h"
#include <lib/lib8tion/lib8tion.h>
#ifdef EEPROM_ENABLE
@@ -30,13 +31,6 @@
# include "velocikey.h"
#endif
-#ifndef MIN
-# define MIN(a, b) (((a) < (b)) ? (a) : (b))
-#endif
-#ifndef MAX
-# define MAX(a, b) (((a) > (b)) ? (a) : (b))
-#endif
-
#ifdef RGBLIGHT_SPLIT
/* for split keyboard */
# define RGBLIGHT_SPLIT_SET_CHANGE_MODE rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_MODE
diff --git a/quantum/velocikey.c b/quantum/velocikey.c
index 58e14215bb..03e91911f6 100644
--- a/quantum/velocikey.c
+++ b/quantum/velocikey.c
@@ -2,13 +2,7 @@
#include "timer.h"
#include "eeconfig.h"
#include "eeprom.h"
-
-#ifndef MIN
-# define MIN(a, b) (((a) < (b)) ? (a) : (b))
-#endif
-#ifndef MAX
-# define MAX(a, b) (((a) > (b)) ? (a) : (b))
-#endif
+#include "util.h"
#define TYPING_SPEED_MAX_VALUE 200
uint8_t typing_speed = 0;