/*
CREATIVE SOFTWARE 1.0
FOR CREATIVE DEVICE 2
AUTHOR: KAP PETROV
*/
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#define TFT_DC 9
#define TFT_CS 10
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
int ts = 2;
uint16_t tc = ILI9341_WHITE;
void InitDisplay(uint16_t textcolor, int textsize)
{
tft.begin();
tft.setCursor(0, 0);
tft.setTextColor(textcolor);
tft.setTextSize(textsize);
ts = textsize;
tc = textcolor;
}
void drawText(char* str, int x, int y, int textsize=ts, uint16_t textclr=tc)
{
tft.setCursor(x, y);
tft.setTextSize(textsize);
tft.setTextColor(textclr);
tft.println(str);
}
void App(char* name, int x, int y, uint16_t color)
{
tft.fillRect(x, y, 50, 50, color);
drawText(name, x, y + 51);
}
void setup() {
InitDisplay(ILI9341_WHITE, 2);
// Home screen color
tft.fillScreen(ILI9341_NAVY);
// Warnings And Info
drawText("Creative Software 1", 0, 0);
drawText("WARNING: PROTOTYPE SOFTWARE", 0, 20, ts, ILI9341_RED);
// Apps
App("Test app", 1, 100, ILI9341_GREEN);
App("Test app 2", 110, 100, ILI9341_BLUE);
}
void loop() { }