X-Git-Url: https://git.rohieb.name/hackover2013-badge-firmware.git/blobdiff_plain/9d18e10afb2439a6a9ba6978a799259746a837b7..4292be14c78b8f30075c9e4837dd026f6fec532e:/project/commands/drawing/cmd_button.c

diff --git a/project/commands/drawing/cmd_button.c b/project/commands/drawing/cmd_button.c
index 98d376f..9af4310 100644
--- a/project/commands/drawing/cmd_button.c
+++ b/project/commands/drawing/cmd_button.c
@@ -44,10 +44,10 @@
 #include "project/commands.h"       // Generic helper functions
 
 #ifdef CFG_TFTLCD    
-  #include "drivers/lcd/tft/lcd.h"    
-  #include "drivers/lcd/tft/drawing.h"  
-  #include "drivers/lcd/tft/touchscreen.h"
-  #include "drivers/lcd/tft/fonts/dejavusans9.h"
+  #include "drivers/displays/tft/lcd.h"    
+  #include "drivers/displays/tft/drawing.h"  
+  #include "drivers/displays/tft/touchscreen.h"
+  #include "drivers/displays/tft/controls/button.h"
 
 /**************************************************************************/
 /*! 
@@ -60,7 +60,7 @@
 /**************************************************************************/
 void cmd_button(uint8_t argc, char **argv)
 {
-  int32_t x, y, w, h, border, fill, font;
+  int32_t x, y, w, h, fontcolor;
   
   // ToDo: Validate data!
 
@@ -69,31 +69,29 @@ void cmd_button(uint8_t argc, char **argv)
   getNumber (argv[1], &y);
   getNumber (argv[2], &w);
   getNumber (argv[3], &h);
-  getNumber (argv[4], &border);
-  getNumber (argv[5], &fill);
-  getNumber (argv[6], &font);
+  getNumber (argv[4], &fontcolor);
 
-  if (argc == 7)
+  if (argc == 5)
   {
     // Render the button with no text
-    drawButton(x, y, w, h, &dejaVuSans9ptFontInfo, 7, (uint16_t)border, (uint16_t)fill, (uint16_t)font, NULL);
+    buttonRender(x, y, w, h, (uint16_t)fontcolor, NULL, themeGetDefault());
   }
   else
   {
     // Get text contents
     uint8_t i, len, *data_ptr, data[50];
     data_ptr = data;
-    for (i = 0; i < argc - 7; i++)
+    for (i = 0; i < argc - 5; i++)
     {
-      len = strlen(argv[i + 7]);
-      strcpy((char *)data_ptr, (char *)argv[i + 7]);
+      len = strlen(argv[i + 5]);
+      strcpy((char *)data_ptr, (char *)argv[i + 5]);
       data_ptr += len;
       *data_ptr++ = ' ';
     }
     *data_ptr++ = '\0';
 
     // Render the button with text
-    drawButton(x, y, w, h, &dejaVuSans9ptFontInfo, 7, (uint16_t)border, (uint16_t)fill, (uint16_t)font, (char *)&data);
+    buttonRender(x, y, w, h, (uint16_t)fontcolor, (char *)&data, themeGetDefault());
   }
 }