Re: LCD
Posted: Sat Jan 23, 2021 7:18 pm
I think that the response is a weebit misleading, at least from the old Leaflab's core (Roger's):ag123 wrote: Sat Jan 23, 2021 5:00 pm agree for beginners, life is easier starting with a bigger mcu e.g. in the stm32f4xx series.
...
if you are new to micro-controllers programming, that stm32f103c8 blue pill only has 20k sram and 64k flash.
the 20k sram is particularly limiting and 64k flash isn't really a lot either, but works well for 'small' apps.
...
i'm messing with a ili9341 lcd currently with the Adafruit library. struggling with various problems as well, no display, takes time to 'debug' and troubleshoot what is going on.
if you do not already have the lcd, i'd suggest to try sending the data back to your pc on the serial monitor.
...
Using Adafruit's at-that-time github code and with DMA modifications by Victor Perez on 03/17/2015, the ILI-9341 had reasonable memory and flash footprints, IMO.
Sketch uses 26,124 bytes (21%) of program storage space. Maximum is 122,880 bytes.
Global variables use 3,456 bytes of dynamic memory.
Code: Select all
Adafruit code updated to use SPI DMA
Compiled under Arduino 1.7.8 OS: Linux Mint 17.3 Cinnamon
Sketch uses 26,124 bytes (21%) of program storage space. Maximum is 122,880 bytes.
Global variables use 3,456 bytes of dynamic memory.
OLD STM Port non-DMA STM Port STM DMA Port
ILI9341 Test!
Benchmark Time (microseconds) Time (microseconds) Time (microseconds)
Screen fill 1,026,635 716,291 174,901
Text 74,910 46,087 65,358
Lines 702,724 400,688 692,868
Horiz/Vert Lines 84,359 57,074 23,342
Rectangles (outline) 54,489 36,604 16,625
Rectangles (filled) 2,132,392 1,487,410 371,832
Circles (filled) 344,984 220,662 181,100
Circles (outline) 306,326 174,199 302,904
Triangles (outline) 222,948 127,154 219,106
Triangles (filled) 715,597 472,077 243,512
Rounded rects (outline) 130,131 78,591 91,564
Rounded rects (filled) 2,331,405 1,615,938 488,708
Mute sound: https://youtu.be/EQ8qvEkZam4
The Mesmerize base codebase:
Code: Select all
#include "SPI.h"
#include "./Adafruit_GFX_AS.h"
#include "./Adafruit_ILI9341_STM.h"
// Pinout for Maple Mini (// For the Adafruit shield, these are the default)
#define TFT_CS 13 // PB4
#define TFT_DC 12 // PA15
#define TFT_RST 14 // PB3
// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
// Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired
// Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);
Adafruit_ILI9341_STM tft = Adafruit_ILI9341_STM(TFT_CS, TFT_DC, TFT_RST); // Use hardware SPI
int nFrames = 100; // higher number, slower full-cycle annimation
void setup() {
tft.begin();
tft.fillScreen(ILI9341_BLACK);
}
void loop(void) {
for (int frame=0; frame < nFrames; frame++)
{
HariChord(frame);
}
tft.fillScreen(ILI9341_BLACK);
for (int frame=(nFrames-1); frame >= 0; frame--)
{
HariChord(frame);
}
tft.fillScreen(ILI9341_BLACK);
}
void HariChord(int frame)
{
static boolean flipflop = true;
flipflop = !flipflop;
int n = 7;
int r = frame * 120 / nFrames; // half smaller of 240 or 320
float rot = frame * 2*PI / nFrames;
for (int i=0; i<(n-1); i++)
{
float a = rot + i * 2*PI / n;
int x1 = 120 + cos(a) * r; // half 240
int y1 = 160 + sin(a) * r; // half 320
for (int j=i+1; j<n; j++)
{
a = rot + j * 2*PI / n;
int x2 = 120 + cos(a) * r;
int y2 = 160 + sin(a) * r;
if ( flipflop) tft.drawLine(x1,y1, x2,y2, (long) random(65535));
if (!flipflop) tft.drawLine(x1,y1, x2,y2, (long) random(65535));
}
}
}