Hi,
I'am using an arduino Nicla Vision with a waveshare 1.28inc LCD screen module.
The module is using SPI and GC9A01.
I found a demo for this type of driver : GitHub - carlfriess/GC9A01_demo: Arduino demo of the GC9A01 driver for a 240x240 display
And I changed the Pin atttribution for using the SPI4 bus of the arduino Nicla Vision. It compile without error and seems running but I have no results other than a black screen. I checked my wiring and my connections but I doesn't seem to come from this.
Any ideas ? I can't find a lot of examples about GPIO pin attribution with arduino Vision.
Thanks for your help.
This is the code modified for my Nicla :
#include <SPI.h>
#include "GC9A01.h"
#define TFT_BL PG_12
#define MOSI PE_14
#define CLK PE_12
#define CS PE_11
#define DC PG_1
#define RST PA_9
void GC9A01_set_reset(uint8_t val) {
digitalWrite(RST, val);
}
void GC9A01_set_data_command(uint8_t val) {
digitalWrite(DC, val);
}
void GC9A01_set_chip_select(uint8_t val) {
digitalWrite(CS, val);
}
void GC9A01_spi_tx(uint8_t *data, size_t len) {
while (len--) {
SPI.transfer(*data);
data++;
}
}
void GC9A01_delay(uint16_t ms) {
delay(ms);
}
void setup() {
pinMode(RST, OUTPUT);
pinMode(DC, OUTPUT);
pinMode(CS, OUTPUT);
SPI.begin();
GC9A01_init();
struct GC9A01_frame frame = {{0,0},{239,239}};
GC9A01_set_frame(frame);
}
void loop() {
uint8_t color[3];
// Triangle
color[0] = 0xFF;
color[1] = 0xFF;
for (int x = 0; x < 240; x++) {
for (int y = 0; y < 240; y++) {
if (x < y) {
color[2] = 0xFF;
} else {
color[2] = 0x00;
}
if (x == 0 && y == 0) {
GC9A01_write(color, sizeof(color));
} else {
GC9A01_write_continue(color, sizeof(color));
}
}
}
delay(1000);
// Rainbow
float frequency = 0.026;
for (int x = 0; x < 240; x++) {
color[0] = sin(frequency*x + 0) * 127 + 128;
color[1] = sin(frequency*x + 2) * 127 + 128;
color[2] = sin(frequency*x + 4) * 127 + 128;
for (int y = 0; y < 240; y++) {
if (x == 0 && y == 0) {
GC9A01_write(color, sizeof(color));
} else {
GC9A01_write_continue(color, sizeof(color));
}
}
}
delay(1000);
// Checkerboard
for (int x = 0; x < 240; x++) {
for (int y = 0; y < 240; y++) {
if ((x / 10) % 2 == (y / 10) % 2) {
color[0] = 0xFF;
color[1] = 0xFF;
color[2] = 0xFF;
} else {
color[0] = 0x00;
color[1] = 0x00;
color[2] = 0x00;
}
if (x == 0 && y == 0) {
GC9A01_write(color, sizeof(color));
} else {
GC9A01_write_continue(color, sizeof(color));
}
}
}
delay(1000);
// Swiss flag
color[0] = 0xFF;
for (int x = 0; x < 240; x++) {
for (int y = 0; y < 240; y++) {
if ((x >= 1*48 && x < 4*48 && y >= 2*48 && y < 3*48) ||
(x >= 2*48 && x < 3*48 && y >= 1*48 && y < 4*48)) {
color[1] = 0xFF;
color[2] = 0xFF;
} else {
color[1] = 0x00;
color[2] = 0x00;
}
if (x == 0 && y == 0) {
GC9A01_write(color, sizeof(color));
} else {
GC9A01_write_continue(color, sizeof(color));
}
}
}
delay(1000);
}