Tidy up duplication of MIN/MAX fallback implementations (#20236)

This commit is contained in:
Joel Challis 2023-03-23 05:30:30 +00:00 committed by GitHub
parent 42aa83787f
commit b01dc36fbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 7 additions and 32 deletions

View File

@ -15,15 +15,12 @@
*/ */
#include "eeprom.h" #include "eeprom.h"
#include "debug.h" #include "debug.h"
#include "util.h"
#include "samd51j18a.h" #include "samd51j18a.h"
#include "core_cm4.h" #include "core_cm4.h"
#include "component/nvmctrl.h" #include "component/nvmctrl.h"
#include "eeprom_samd.h" #include "eeprom_samd.h"
#ifndef MAX
# define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
#endif
#ifndef BUSY_RETRIES #ifndef BUSY_RETRIES
# define BUSY_RETRIES 10000 # define BUSY_RETRIES 10000
#endif #endif

View File

@ -23,6 +23,7 @@
#include "i2c_master.h" #include "i2c_master.h"
#include "timer.h" #include "timer.h"
#include "wait.h" #include "wait.h"
#include "util.h"
#ifndef F_SCL #ifndef F_SCL
# define F_SCL 400000UL // SCL frequency # define F_SCL 400000UL // SCL frequency
@ -37,8 +38,6 @@
#define TWBR_val (((F_CPU / F_SCL) - 16) / 2) #define TWBR_val (((F_CPU / F_SCL) - 16) / 2)
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
void i2c_init(void) { void i2c_init(void) {
TWSR = 0; /* no prescaler */ TWSR = 0; /* no prescaler */
TWBR = (uint8_t)TWBR_val; TWBR = (uint8_t)TWBR_val;

View File

@ -18,6 +18,7 @@
#include "eeconfig.h" #include "eeconfig.h"
#include "timer.h" #include "timer.h"
#include "wait.h" #include "wait.h"
#include "util.h"
/* audio system: /* audio system:
* *

View File

@ -43,11 +43,6 @@ typedef union {
}; };
} audio_config_t; } 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 * a 'musical note' is represented by pitch and duration; a 'musical tone' adds intensity and timbre
* https://en.wikipedia.org/wiki/Musical_tone * https://en.wikipedia.org/wiki/Musical_tone

View File

@ -17,6 +17,7 @@
#include "color.h" #include "color.h"
#include "led_tables.h" #include "led_tables.h"
#include "progmem.h" #include "progmem.h"
#include "util.h"
RGB hsv_to_rgb_impl(HSV hsv, bool use_cie) { RGB hsv_to_rgb_impl(HSV hsv, bool use_cie) {
RGB rgb; RGB rgb;
@ -109,9 +110,6 @@ RGB hsv_to_rgb_nocie(HSV hsv) {
} }
#ifdef RGBW #ifdef RGBW
# ifndef MIN
# define MIN(a, b) ((a) < (b) ? (a) : (b))
# endif
void convert_rgb_to_rgbw(LED_TYPE *led) { void convert_rgb_to_rgbw(LED_TYPE *led) {
// Determine lowest value in all three colors, put that into // Determine lowest value in all three colors, put that into
// the white channel and then shift all colors by that amount // the white channel and then shift all colors by that amount

View File

@ -18,10 +18,7 @@
#include "midi.h" #include "midi.h"
#include <string.h> //for memcpy #include <string.h> //for memcpy
#include "util.h"
#ifndef MIN
# define MIN(x, y) (((x) < (y)) ? (x) : (y))
#endif
#ifndef NULL #ifndef NULL
# define NULL 0 # define NULL 0

View File

@ -21,6 +21,7 @@
#include "rgblight.h" #include "rgblight.h"
#include "color.h" #include "color.h"
#include "debug.h" #include "debug.h"
#include "util.h"
#include "led_tables.h" #include "led_tables.h"
#include <lib/lib8tion/lib8tion.h> #include <lib/lib8tion/lib8tion.h>
#ifdef EEPROM_ENABLE #ifdef EEPROM_ENABLE
@ -30,13 +31,6 @@
# include "velocikey.h" # include "velocikey.h"
#endif #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 #ifdef RGBLIGHT_SPLIT
/* for split keyboard */ /* for split keyboard */
# define RGBLIGHT_SPLIT_SET_CHANGE_MODE rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_MODE # define RGBLIGHT_SPLIT_SET_CHANGE_MODE rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_MODE

View File

@ -2,13 +2,7 @@
#include "timer.h" #include "timer.h"
#include "eeconfig.h" #include "eeconfig.h"
#include "eeprom.h" #include "eeprom.h"
#include "util.h"
#ifndef MIN
# define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef MAX
# define MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif
#define TYPING_SPEED_MAX_VALUE 200 #define TYPING_SPEED_MAX_VALUE 200
uint8_t typing_speed = 0; uint8_t typing_speed = 0;