#include "NMEA.h"
#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.h>
#include "notes.h"
#include "gps.h"
#include "param.h"
#include "interface.h"
#define BTN1_PIN 5
#define BTN2_PIN 21
#define BTN3_PIN 22
#define TFT_DC 2
#define TFT_CS 15
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
void setup() {
Serial.begin(115200);
Serial.println("Initializing...");
// Init connexions
pinMode(BTN1_PIN, INPUT_PULLUP);
pinMode(BTN2_PIN, INPUT_PULLUP);
pinMode(BTN3_PIN, INPUT_PULLUP);
pinMode(SPEAKER_PIN, OUTPUT);
// Initalisation affichage
tft.begin();
tft.setRotation(0);
test();
while (1) {delay(100);} ;
tft.setTextColor(ILI9341_WHITE);
tft.setTextSize(2);
gpsInit();
paramLoad();
interfaceInit();
soundMusic();
}
void test()
{
tft.drawRect(0,0,120,240,WHITE);
tft.setTextColor(GREEN);
tft.setTextSize(1);
tft.setCursor(90,10);
tft.print("Wifi");
tft.setTextColor(WHITE);
tft.setTextSize(1);
tft.setCursor(5,10);
tft.print("Temperature");
tft.setTextSize(3);
tft.setCursor(30,30);
tft.print("20.1");
tft.drawLine(0,60,120,60,WHITE);
tft.setTextSize(1);
tft.setCursor(5,68);
tft.print("Humdite");
tft.setCursor(65,68);
tft.print("Pression");
tft.setTextSize(2);
tft.setCursor(10,83);
tft.print("65");
tft.setCursor(65,83);
tft.print("19.6");
//tft.drawLine(0,110,120,110,WHITE);
tft.drawLine(58,60,58,110,WHITE);
tft.fillRect(0,110,120,11,0x2C7F);
tft.setTextColor(BLACK);
tft.fillRect(0,122,120,32,GREY);
tft.setTextSize(1);
tft.setCursor(5,112);
tft.print("Ext: Temp");
tft.setCursor(65,112);
tft.print("Humidite");
tft.setTextSize(2);
tft.setCursor(10,132);
tft.print("12");
tft.setCursor(65,132);
tft.print("19.6");
tft.drawLine(0,154,120,154,WHITE);
tft.drawLine(58,122,58,154,WHITE);
tft.setTextColor(WHITE);
tft.setTextSize(1);
tft.setCursor(5,162);
tft.print("Mode: ");
tft.setTextColor(GREEN);
tft.print("Automatique");
tft.fillRect(0,175,120,35,RED);
tft.setTextColor(WHITE);
tft.setTextSize(4);
tft.setCursor(30,178);
tft.print("On");
tft.setTextColor(GREY);
tft.setTextSize(1);
tft.setCursor(5,217);
tft.print("Duree:");
tft.setCursor(70,217);
tft.print("00:01:00");
tft.setCursor(5,227);
tft.print("Total jour:");
tft.setCursor(70,227);
tft.print("01:27:00");
}
void loop() {
bool button1, button2, button3;
gpsRead();
button1= digitalRead(BTN1_PIN)==LOW;
button2= digitalRead(BTN2_PIN)==LOW;
button3= digitalRead(BTN3_PIN)==LOW;
buttonsPressed(button1, button2, button3);
interfaceRefresh();
delay(1);
}