#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#include "FreeSansBold24pt7b.h"
//#include "IMAGE_RESOURCES.h"
//#include "Win7.h"
Adafruit_ILI9341 tft = Adafruit_ILI9341(PB12, PA8, PB14, PB13, PA15, PB15);
#define mic PA0
const unsigned long eventInterval_sec = 1000;
unsigned long previousTime_sec = 0;
void afisare(int am){
//tft.fillRect(0, 0, 240, 320, ILI9341_BLACK);
//tft.fillRect(0, 80, 128, 64, ILI9341_BLACK);
void start = micros();
tft.setTextColor(ILI9341_ORANGE);
tft.setFont(&FreeSansBold24pt7b);
// tft.setFont();
tft.setTextSize(1);
tft.setCursor(0, 64);
tft.print("P3TRK");
tft.setCursor(0, 120);
tft.fillRect(0, 80, 128, 64, ILI9341_BLACK);
tft.print(am);
//delay(100);
return micros() - start;
//
//tft.drawRGBBitmap(0, 0, cat_tool, 100, 67);
///tft.fillScreen(ILI9341_BLACK);
//tft.drawXBitmap(0, 0, beso, 320, 189, ILI9341_GREEN);
//tft.fillRect(10, 10, 50, 30, ILI9341_WHITE);
//tft.setFont();
}
void setup() {
// Serial.begin(9600);
// Serial.println("ILI9341 Test!");
tft.begin();
tft.setRotation(3);
tft.fillScreen(ILI9341_BLACK);
}
void loop(void) {
int val = analogRead(mic);
afisare(val);
unsigned long current_time_sec = millis();
if (current_time_sec - previousTime_sec >= eventInterval_sec) {
previousTime_sec = current_time_sec;
}
}