Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidy up duplication of MIN/MAX fallback implementations #20236

Merged
merged 2 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions platforms/arm_atsam/eeprom_samd.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@
*/
#include "eeprom.h"
#include "debug.h"
#include "util.h"
#include "samd51j18a.h"
#include "core_cm4.h"
#include "component/nvmctrl.h"
#include "eeprom_samd.h"

#ifndef MAX
# define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
#endif

#ifndef BUSY_RETRIES
# define BUSY_RETRIES 10000
#endif
Expand Down
3 changes: 1 addition & 2 deletions platforms/avr/drivers/i2c_master.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "i2c_master.h"
#include "timer.h"
#include "wait.h"
#include "util.h"

#ifndef F_SCL
# define F_SCL 400000UL // SCL frequency
Expand All @@ -37,8 +38,6 @@

#define TWBR_val (((F_CPU / F_SCL) - 16) / 2)

#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))

void i2c_init(void) {
TWSR = 0; /* no prescaler */
TWBR = (uint8_t)TWBR_val;
Expand Down
1 change: 1 addition & 0 deletions quantum/audio/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "eeconfig.h"
#include "timer.h"
#include "wait.h"
#include "util.h"

/* audio system:
*
Expand Down
5 changes: 0 additions & 5 deletions quantum/audio/audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions quantum/color.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions quantum/midi/midi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 1 addition & 7 deletions quantum/rgblight/rgblight.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 1 addition & 7 deletions quantum/velocikey.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down