Make width and height constexpr

This allows these functions to be used as constant expressions.
This commit is contained in:
Pharap 2019-05-31 06:38:43 +01:00 committed by GitHub
parent 096aaac8dd
commit a31e5091d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 14 deletions

View File

@ -298,10 +298,6 @@ void Arduboy2Core::displayOn()
bootOLED();
}
uint8_t Arduboy2Core::width() { return WIDTH; }
uint8_t Arduboy2Core::height() { return HEIGHT; }
/* Drawing */

View File

@ -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.