diff options
Diffstat (limited to 'Software/Code_Composer/twine_graphicslib/graphics_adapter.c')
| -rw-r--r-- | Software/Code_Composer/twine_graphicslib/graphics_adapter.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Software/Code_Composer/twine_graphicslib/graphics_adapter.c b/Software/Code_Composer/twine_graphicslib/graphics_adapter.c new file mode 100644 index 000000000..47500d0a3 --- /dev/null +++ b/Software/Code_Composer/twine_graphicslib/graphics_adapter.c @@ -0,0 +1,45 @@ +/* + * graphics_adapter.c + * + * Created on: Sep 24, 2017 + * Author: Roy + */ + +#include <stdbool.h> +#include <stdlib.h> +#include <stdint.h> +#include "graphics_adapter.h" +#include "grlib/grlib.h" +#include "drivers/frame.h" +#include "drivers/kentec320x240x16_ssd2119.h" + + +void init_graphics(uint32_t ui32SysClock) +{ + // Initialize the display driver. + Kentec320x240x16_SSD2119Init(ui32SysClock); + + // Initialize the graphics context. + GrContextInit(&g_sContext, &g_sKentec320x240x16_SSD2119); +} + +void draw_image(uint8_t* data) +{ + GrImageDraw(&g_sContext, data, 0, 0); +} + +void draw_string(char* data, size_t length) +{ + tRectangle backRect; + backRect.i16XMin = 100; + backRect.i16XMax = 300; + backRect.i16YMin = 100; + backRect.i16YMax = 80; + + GrContextForegroundSet(&g_sContext, ClrBlack); + GrRectFill(&g_sContext, &backRect); + + GrContextFontSet(&g_sContext, TEXT_FONT); + GrContextForegroundSet(&g_sContext, ClrWhite); + GrStringDraw(&g_sContext, data, length, 150, 80, true); +} |
