Hey Everyone,
I have 2x ili9341 screens running on SPI1 and it seems to be all well. My only issue so far is using the frame buffer. When I update both screens in the loop I end up with flashing. Is there something I'm missing or a better way to do this?
Secondly, Is there a way to Anti Alias fonts? I've seen there were a few posts on it, but I can't see how to do it.
Below is my code and as for wiring, I have 2x pullups on the CS pins.
I have 2x ili9341 screens running on SPI1 and it seems to be all well. My only issue so far is using the frame buffer. When I update both screens in the loop I end up with flashing. Is there something I'm missing or a better way to do this?
Secondly, Is there a way to Anti Alias fonts? I've seen there were a few posts on it, but I can't see how to do it.
Below is my code and as for wiring, I have 2x pullups on the CS pins.
Code:
#include <Arduino.h>
#include <SPI.h>
#include <ILI9341_t3n.h>
#include <SPIN.h>
#include <fonts/font_Raleway-Medium.h>
#include <colours.h>
#define TFT_SCLK 27
#define TFT_DC 40
#define TFT_MOSI 26
#define TFT_MISO 39
#define TFT1_RST 33
#define TFT1_CS 0
#define TFT2_RST 34
#define TFT2_CS 38
ILI9341_t3n tft_Track = ILI9341_t3n(TFT1_CS, TFT_DC, TFT1_RST, TFT_MOSI, TFT_SCLK, TFT_MISO);
ILI9341_t3n tft_Func = ILI9341_t3n(TFT2_CS, TFT_DC, TFT2_RST, TFT_MOSI, TFT_SCLK, TFT_MISO);
void setup()
{
tft_Track.useFrameBuffer(true);
tft_Track.begin();
tft_Track.fillScreen(BACKGROUND);
tft_Func.useFrameBuffer(true);
tft_Func.begin();
tft_Func.fillScreen(BACKGROUND);
}
void DrawIndicator(ILI9341_t3n ScreenRef,uint16_t Y, uint16_t X, uint16_t Width,uint16_t Border, uint16_t IndColour,const char *TEXT,bool Active)
{
int OuterWidth = Width;
int OuterHeight = Width / 2;
int InnerWidth = OuterWidth - (Border*2);
int InnerHeight = (OuterHeight - (Border*2));
int IndHeight = (InnerHeight-6);
int IndWidth = (IndHeight/3);
uint16_t ActColour = BUTTON_ST;
if (Active == true){
ActColour = IndColour;
}
ScreenRef.fillRect(X, Y, OuterWidth, OuterHeight, BUTTON_ST);
ScreenRef.fillRect(X + Border, Y + Border, InnerWidth, InnerHeight, BUTTON_BG);
ScreenRef.fillRect(X + Border, Y + Border, InnerWidth, 2, BUTTON_HL);
ScreenRef.fillRect(X + (OuterWidth-Border-IndWidth-2), Y + Border + 4, IndWidth, IndHeight,ActColour);
ScreenRef.setTextColor(ILI9341_WHITE);
ScreenRef.setFont(RalewayMedium_12);
ScreenRef.setCursor(X+5,Y+(InnerHeight/2)-2.0);
ScreenRef.print(TEXT);
}
void loop()
{
DrawIndicator(tft_Track,30, 30,75,3,ILI9341_GREEN,"SOLO",true);
DrawIndicator(tft_Func,30, 30,75,3,ILI9341_RED,"MUTE",true);
tft_Track.updateScreen();
tft_Func.updateScreen();
}