#include "SPI.h"
#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.h>
///////////////////////////////////////////////////////////////////
// Need to create library for RADAR, WEATHER, ROTATION and SPEED //
///////////////////////////////////////////////////////////////////
// Defining screen variables
#define TFT_DC 9
#define TFT_CS 10
#define TFT_CS2 6
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
Adafruit_ILI9341 tft2 = Adafruit_ILI9341(TFT_CS2, TFT_DC);
// Defining global functions. Working from displayOverflow.h. Not needed in production, only in simulation.
#ifndef DrawCircles
#define DrawCircles
void DrawMultipleCircles()
{
int spacer = 45;
for(int i=0; i<=7;i++){
tft.drawCircle(120, 315, spacer, ILI9341_WHITE);
spacer = spacer + 45;
}
}
#endif
#ifndef BlackOutTriangles
#define BlackOutTriangles
void DrawBlackOutTriangles()
{
// Draw 2 black triangles to hide a part of circles
tft.fillTriangle(0, 170, 0, 320, 120, 320, ILI9341_BLACK);
tft.fillTriangle(320, 170, 320, 320, 90, 320, ILI9341_BLACK);
}
#endif
#ifndef AirplaneV1
#define AirplaneV1
void DrawAirplaneV1()
{
// Draw airplane v1
tft.fillRoundRect(110, 300, 22, 2, 2, ILI9341_YELLOW);
tft.fillRoundRect(120, 295, 2, 22, 2, ILI9341_YELLOW);
tft.fillRoundRect(115, 312, 12, 2, 2, ILI9341_YELLOW);
}
#endif
#ifndef RadarV1
#define RadarV1
void drawRadarV1()
{
// Draw dots from ultrasonic radar
}
void getRadarDataPoints(){
}
void normalizeDataPoints(){
}
void DrawScan(){
}
#endif
#ifndef WeatherV1
#define WeatherV1
void DrawWeatherV1()
{
// Draw weather information from sensor
tft.setTextColor(ILI9341_YELLOW);
tft.setTextSize(2);
tft.setCursor(0,10);
tft.println("22 C");
}
#endif
#ifndef Accel
#define Accel
void DrawAccel()
{
// Draw weather information from sensor
tft2.setTextColor(ILI9341_YELLOW);
tft2.setTextSize(2);
tft2.setCursor(180,300);
tft2.println("9 m/s");
}
#endif
#ifndef axisPowers
#define axisPowers
void rotationX()
{
// Draw weather information from sensor
tft2.setTextColor(ILI9341_YELLOW);
tft2.setTextSize(2);
tft2.setCursor(180,300);
tft2.println("9 m/s");
}
void rotationY()
{
// Draw weather information from sensor
tft2.setTextColor(ILI9341_YELLOW);
tft2.setTextSize(2);
tft2.setCursor(200,300);
tft2.println("9 m/s");
}
void rotationZ()
{
// Draw weather information from sensor
tft2.setTextColor(ILI9341_YELLOW);
tft2.setTextSize(2);
tft2.setCursor(180,300);
tft2.println("9 m/s");
}
void DrawBackground(){
// x1, y1, x2, y2, color
tft2.fillRect(40, 0, 160, 119, ILI9341_BLUE);
tft2.fillRect(40, 121, 160, 119, ILI9341_MAROON);
}
void DrawXYZ(){
tft2.drawLine(40, 120, 200, 120, ILI9341_WHITE);
}
void DrawPitch(){
int pitchSpacing = 0;
tft2.setTextColor(ILI9341_WHITE);
tft2.setTextSize(1);
for(int i = 0; i<=23; i++){
if(i%5){
tft2.drawLine(90, pitchSpacing, 150, pitchSpacing, ILI9341_WHITE);
}else{
tft2.drawLine(70, pitchSpacing, 170, pitchSpacing, ILI9341_WHITE);
tft2.setCursor(175,pitchSpacing);
tft2.println("@dp");
}
pitchSpacing = pitchSpacing + 10;
}
}
#endif
void setup() {
// put your setup code here, to run once:
tft.begin();
tft2.begin();
tft.fillScreen(ILI9341_BLACK);
tft2.fillScreen(ILI9341_BLACK);
DrawMultipleCircles();
DrawBlackOutTriangles();
DrawAirplaneV1();
DrawWeatherV1();
DrawScan();
DrawBackground();
DrawXYZ();
DrawPitch();
DrawAccel();
}
void loop() {
// put your main code here, to run repeatedly:
}