X-Git-Url: https://git.rohieb.name/hackover2013-badge-firmware.git/blobdiff_plain/9d18e10afb2439a6a9ba6978a799259746a837b7..45de93d504a066644b2d82711479c7ca37244695:/project/commands/drawing/cmd_rectangle.c?ds=sidebyside diff --git a/project/commands/drawing/cmd_rectangle.c b/project/commands/drawing/cmd_rectangle.c index 581d864..05f039d 100644 --- a/project/commands/drawing/cmd_rectangle.c +++ b/project/commands/drawing/cmd_rectangle.c @@ -43,8 +43,8 @@ #include "project/commands.h" // Generic helper functions #ifdef CFG_TFTLCD - #include "drivers/lcd/tft/lcd.h" - #include "drivers/lcd/tft/drawing.h" + #include "drivers/displays/tft/lcd.h" + #include "drivers/displays/tft/drawing.h" /**************************************************************************/ /*! @@ -94,4 +94,39 @@ void cmd_rectangle(uint8_t argc, char **argv) } } +/**************************************************************************/ +/*! + Displays a rectangle with rounded corners on the LCD. +*/ +/**************************************************************************/ +void cmd_rectangleround(uint8_t argc, char **argv) +{ + int32_t x1, y1, x2, y2, c, radius, corners; + + // Convert supplied parameters + getNumber (argv[0], &x1); + getNumber (argv[1], &y1); + getNumber (argv[2], &x2); + getNumber (argv[3], &y2); + getNumber (argv[4], &c); + getNumber (argv[5], &radius); + getNumber (argv[6], &corners); + + // ToDo: Validate data! + if (c < 0 || c > 0xFFFF) + { + printf("Invalid Color%s", CFG_PRINTF_NEWLINE); + return; + } + + if ((radius == 0) || (corners == 0) || (corners > 5)) + { + drawRectangleFilled(x1, y1, x2, y2, (uint16_t)c); + } + else + { + drawRoundedRectangleFilled(x1, y1, x2, y2, (uint16_t)c, radius, corners); + } +} + #endif