aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/oled
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/oled')
-rw-r--r--drivers/oled/oled_driver.c4
-rw-r--r--drivers/oled/oled_driver.h4
2 files changed, 5 insertions, 3 deletions
diff --git a/drivers/oled/oled_driver.c b/drivers/oled/oled_driver.c
index f20f4629a..e541228ea 100644
--- a/drivers/oled/oled_driver.c
+++ b/drivers/oled/oled_driver.c
@@ -392,6 +392,8 @@ void oled_write_char(const char data, bool invert) {
static uint8_t oled_temp_buffer[OLED_FONT_WIDTH];
memcpy(&oled_temp_buffer, oled_cursor, OLED_FONT_WIDTH);
+ _Static_assert(sizeof(font) >= ((OLED_FONT_END + 1 - OLED_FONT_START) * OLED_FONT_WIDTH), "OLED_FONT_END references outside array");
+
// set the reder buffer data
uint8_t cast_data = (uint8_t)data; // font based on unsigned type for index
if (cast_data < OLED_FONT_START || cast_data > OLED_FONT_END) {
@@ -585,4 +587,4 @@ void oled_task(void) {
#endif
}
-__attribute__((weak)) void oled_task_user(void) {} \ No newline at end of file
+__attribute__((weak)) void oled_task_user(void) {}
diff --git a/drivers/oled/oled_driver.h b/drivers/oled/oled_driver.h
index f490f367a..e8a718857 100644
--- a/drivers/oled/oled_driver.h
+++ b/drivers/oled/oled_driver.h
@@ -131,7 +131,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif
// unsigned char value of the last character in the font file
#if !defined(OLED_FONT_END)
-# define OLED_FONT_END 224
+# define OLED_FONT_END 223
#endif
// Font render width
#if !defined(OLED_FONT_WIDTH)
@@ -260,4 +260,4 @@ bool oled_scroll_off(void);
uint8_t oled_max_chars(void);
// Returns the maximum number of lines that will fit on the oled
-uint8_t oled_max_lines(void); \ No newline at end of file
+uint8_t oled_max_lines(void);