= 8) ? 8 : (h - j*8) % 8; // Clac the amount of pixels in current byte
+
+ seg = font[o];
+ for (b=0; b>b) & 1) mct_SetPixel(x+i, y+j*8+b, color);
+ }
+ o++;
+ }
+ //mct_SetPixel(x+i, y, color); // For testing purposes
+ }
+ }
+ return w;
+}
+
+// Draw a string of characters
+void mct_String(uint8_t x, uint8_t y, const char *c, uint8_t color, const uint8_t *font) {
+ uint8_t w = font[0]; // Font char width
+ uint8_t h = font[1]; // Font char height
+ uint8_t s = font[2]; // Font space between characters
+
+ if (y+h > LCDHEIGHT) return;
+ while (c[0] != 0) {
+ if (x+w > LCDWIDTH) return;
+ w = mct_Char(x, y, (unsigned char)*c, color, font);
+ c++;
+ x += w + s;
+ }
+}
diff --git a/STM32_HAL_Lib/mctext.h b/STM32_HAL_Lib/mctext.h
new file mode 100644
index 0000000..c21b0f3
--- /dev/null
+++ b/STM32_HAL_Lib/mctext.h
@@ -0,0 +1,21 @@
+/*
+ * mctext.h
+ *
+ * Created on: May 16, 2025
+ * Author: User
+ */
+
+#ifndef INC_MCTEXT_H_
+#define INC_MCTEXT_H_
+
+#include "stm32f1xx_hal.h"
+
+
+
+// Draw a single character. Returns width of drawn character
+uint8_t mct_Char(uint8_t x, uint8_t y, unsigned char c, uint8_t color, const uint8_t *font);
+
+// Draw a string of characters
+void mct_String(uint8_t x, uint8_t y, const char *c, uint8_t color, const uint8_t *font);
+
+#endif /* INC_MCTEXT_H_ */