sensecraft/examples/PAGE_TEMPLE/PAGE_TEMPLE.ino

77 lines
2.2 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <TFT_eSPI.h>
#include "Free_Fonts.h"
TFT_eSPI tft;
TFT_eSprite spr = TFT_eSprite(&tft);
#define SCREEN_WIDTH 320 // Wio Terminal Maximum Width
#define SCREEN_HIGH 240 // Wio Terminal Maximum Height
#define PIXEL 4 // Width of one letter
const static unsigned int FONT_ROW_HEIGHT = 22; // The height of a letter
void DISPLAY_INIT() // Display initialization, black background rotation
{
tft.begin();
tft.setRotation(3);
tft.fillScreen(TFT_BLACK);
}
void Network_state(int s_key)
{
switch (s_key)
{
case 0:
spr.setTextColor(TFT_RED);
spr.drawString("OFF", 82, 218 , GFXFF);
break;
case 1:
spr.setTextColor(TFT_GREEN, TFT_BLACK); //Networking status indicationON
spr.drawString(" LoRa ", 82, 218 , GFXFF); //Show the network you are in
break;
default:;
}
spr.setTextColor(TFT_WHITE);
spr.drawString("Network :", 5, 218, GFXFF);
}
void Sense_Display() // Sense interface display
{
spr.createSprite(SCREEN_WIDTH, SCREEN_HIGH);
// put your main code here
spr.setFreeFont(FSSB9);
spr.setTextColor(TFT_BLACK, TFT_WHITE);
spr.fillRect(4 * PIXEL, 0, 21 * PIXEL, FONT_ROW_HEIGHT + 15, tft.color565(135, 206, 235));
spr.fillRect(30 * PIXEL, 0, 21 * PIXEL, FONT_ROW_HEIGHT + 15, TFT_WHITE);
spr.fillRect(56 * PIXEL, 0, 21 * PIXEL, FONT_ROW_HEIGHT + 15, TFT_WHITE);
spr.drawString("Process", 127, 11, GFXFF);
spr.drawString("Network", 231, 11, GFXFF);
spr.setTextColor(TFT_BLACK, tft.color565(135, 206, 235));
spr.drawString("Sense", 32, 11, GFXFF);
spr.drawLine(0, 2 * FONT_ROW_HEIGHT, SCREEN_WIDTH, 2 * FONT_ROW_HEIGHT, TFT_WHITE);
spr.setFreeFont(FSS9);
spr.setTextColor(TFT_BLACK, tft.color565(220, 220, 220));
spr.fillRect(128, 50, 16 * PIXEL, FONT_ROW_HEIGHT, tft.color565(220, 220, 220));
spr.drawString("Sensor", 132, 54, GFXFF);
Network_state(1);
spr.pushSprite(0, 0);
spr.deleteSprite();
}
void setup()
{
DISPLAY_INIT();
}
void loop()
{
Sense_Display();
}