From a31e5091d6581fd7a4fe3c10eec8a9aa1c2493c5 Mon Sep 17 00:00:00 2001 From: Pharap <2933055+Pharap@users.noreply.github.com> Date: Fri, 31 May 2019 06:38:43 +0100 Subject: [PATCH] Make width and height constexpr This allows these functions to be used as constant expressions. --- src/Arduboy2Core.cpp | 4 ---- src/Arduboy2Core.h | 12 ++---------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/Arduboy2Core.cpp b/src/Arduboy2Core.cpp index 64c5471..98bf257 100644 --- a/src/Arduboy2Core.cpp +++ b/src/Arduboy2Core.cpp @@ -298,10 +298,6 @@ void Arduboy2Core::displayOn() bootOLED(); } -uint8_t Arduboy2Core::width() { return WIDTH; } - -uint8_t Arduboy2Core::height() { return HEIGHT; } - /* Drawing */ diff --git a/src/Arduboy2Core.h b/src/Arduboy2Core.h index 9165b9e..698c7a3 100644 --- a/src/Arduboy2Core.h +++ b/src/Arduboy2Core.h @@ -435,23 +435,15 @@ class Arduboy2Core * Get the width of the display in pixels. * * \return The width of the display in pixels. - * - * \note - * In most cases, the defined value `WIDTH` would be better to use instead - * of this function. */ - uint8_t static width(); + constexpr uint8_t static width() { return WIDTH; } /** \brief * Get the height of the display in pixels. * * \return The height of the display in pixels. - * - * \note - * In most cases, the defined value `HEIGHT` would be better to use instead - * of this function. */ - uint8_t static height(); + constexpr uint8_t static height() { return HEIGHT; } /** \brief * Get the current state of all buttons as a bitmask.