diff --git a/source/Core/Drivers/OLED.hpp b/source/Core/Drivers/OLED.hpp index 102afe56..f757b391 100644 --- a/source/Core/Drivers/OLED.hpp +++ b/source/Core/Drivers/OLED.hpp @@ -10,6 +10,7 @@ #ifndef OLED_HPP_ #define OLED_HPP_ #include "Font.h" +#include "FontUtils.h" #include "cmsis_os.h" #include "configuration.h" #include @@ -61,12 +62,6 @@ extern "C" { #endif #define FRAMEBUFFER_START 17 -enum class FontStyle { - SMALL, - LARGE, - EXTRAS, -}; - class OLED { public: enum DisplayState : bool { OFF = false, ON = true }; diff --git a/source/Core/Inc/FontUtils.h b/source/Core/Inc/FontUtils.h new file mode 100644 index 00000000..68c376be --- /dev/null +++ b/source/Core/Inc/FontUtils.h @@ -0,0 +1,12 @@ +#pragma once +#include +enum class FontStyle { + SMALL, + LARGE, + EXTRAS, + FROM_TEXT, // Magically pick from the text + FROM_HEIGHT, // Pick font to best fill the height +}; + +constexpr uint8_t get_fontstyle_height(const FontStyle font); +constexpr uint8_t get_fontstyle_width(const FontStyle font); diff --git a/source/Core/Src/FontUtils.cpp b/source/Core/Src/FontUtils.cpp new file mode 100644 index 00000000..58ec3b80 --- /dev/null +++ b/source/Core/Src/FontUtils.cpp @@ -0,0 +1,12 @@ +#include "FontUtils.h" +constexpr uint8_t get_fontstyle_height(const FontStyle font) { + if (font == FontStyle::SMALL) + return 8; + return 16; +} + +constexpr uint8_t get_fontstyle_width(const FontStyle font) { + if (font == FontStyle::SMALL) + return 6; + return 12; +} \ No newline at end of file