summaryrefslogtreecommitdiff
path: root/lcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'lcd.c')
-rw-r--r--lcd.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/lcd.c b/lcd.c
index d90bb69..bedb844 100644
--- a/lcd.c
+++ b/lcd.c
@@ -189,7 +189,24 @@ static void LCD_RAM_write(int RAM_start,int row, int col, char *LCD_string)
void LCD_write(int row, int col, char *LCD_string)
{
LCD_RAM_write(LCD_DATA_RAM, row, col, LCD_string);
- return;
+}
+
+
+void LCD_write_padded_spaces(int row, int col, char *LCD_string, int width)
+{
+ gchar *padded = NULL;
+
+ int in_len = strlen (LCD_string);
+
+ if (in_len > width) {
+ padded = g_strdup (LCD_string);
+ padded[width] = 0;
+ } else {
+ padded = g_strdup_printf ("%s%*s", LCD_string, width - in_len, "");
+ }
+
+ LCD_write(row, col, padded);
+ g_free (padded);
}