Hi,
Library RA8875 not work with this board, screen is black, but work with Adafruit_RA8875 on mbed.
include "mbed.h" testing: v147 - working: v146, v145, v142, v136, v128, fails: v148
include "RA8875.h" v138 - tested working
include "MyFont18x32.h"
include "BPG_Arial08x08.h"
include "BPG_Arial10x10.h"
include "BPG_Arial20x20.h"
include "BPG_Arial31x32.h"
include "BPG_Arial63x63.h"
define MOSI D11
define MISO D12
define SCLK D13
define CS D10
define RST D9
RA8875 lcd(MOSI, MISO, SCLK, CS, RST, "tft"); MOSI, MISO, SCK, /ChipSelect, /reset, name
LocalFileSystem local("local"); access to calibration file for resistive touch and printscreen
define LCD_C 16 color - bits per pixel
define LCD_W 800
define LCD_H 480
Serial pc(USBTX, USBRX); And a little feedback
Timer measurement;
RetCode_t callback(RA8875::filecmd_t cmd, uint8_t * buffer, uint16_t size)
{
static FILE * fh = NULL;
static unsigned int bytesDone = 0;
static unsigned int totalBytes = 0;
switch(cmd) {
case RA8875::OPEN:
bytesDone = 0;
totalBytes = *(uint32_t *)buffer;
pc.printf("PrintScreen callback to write %u bytes\r\n", totalBytes);
fh = fopen("/local/file.bmp", "w+b");
if (!fh)
return(file_not_found);
break;
case RA8875::WRITE:
bytesDone += size;
pc.printf(" Write %d bytes => %d of %d\r\n", size, bytesDone, totalBytes);
fwrite(buffer, 1, size, fh);
pc.printf(" %3d %% complete\r\n", ((100 * bytesDone)/totalBytes));
break;
case RA8875::CLOSE:
fclose(fh);
pc.printf("PrintScreen Closed.\r\n");
break;
default:
pc.printf("Unexpected callback %d\r\n", cmd);
break;
}
return noerror;
}
int main()
{
pc.baud(9600); I like a snappy terminal, so crank it up!
pc.printf("\r\nRA8875 Soft Fonts - Build " DATE " " TIME "\r\n");
measurement.start();
lcd.init(LCD_W, LCD_H, LCD_C);
lcd.Backlight(0.5f);
lcd.cls();
******
RunTestSet(lcd, pc); If the library was compiled for test mode...
lcd.foreground(Blue);
lcd.puts(0,100, "RA8875 Soft Fonts - Build " DATE " " TIME "\r\n");
lcd.SelectUserFont(Dave_Smart18x32);
lcd.puts(" ! Soft Fonts ! 0123456789\r\n");
lcd.puts("ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n");
lcd.puts("abcdefghijklmnopqrstuvwxyz\r\n");
lcd.SelectUserFont();
lcd.puts("Back to normal\r\n");
lcd.SelectUserFont(BPG_Arial08x08);
lcd.puts("BPG_Arial08x08 ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n");
lcd.puts("BPG_Arial08x08 abcdefghijklmnopqrstuvwxyz\r\n");
lcd.SelectUserFont(BPG_Arial10x10);
lcd.puts("BPG_Arial10x10 ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n");
lcd.puts("BPG_Arial10x10 abcdefghijklmnopqrstuvwxyz\r\n");
lcd.SelectUserFont(BPG_Arial20x20);
lcd.puts("BPG_Arial20x20 ");
lcd.SelectUserFont(BPG_Arial31x32);
lcd.puts("BPG_Arial31x32\r\n");
lcd.SelectUserFont(BPG_Arial63x63);
lcd.puts("BPG_Arial63x63");
pc.printf("Time trial completed in %d uSec\r\n", measurement.read_us());
lcd.rect(0,0, 10,10, BrightRed);
/* pc.printf("PrintScreen activated ...\r\n");
RetCode_t r = lcd.PrintScreen(0,0,LCD_W,LCD_H,"/local/file.bmp", 8);
pc.printf(" PrintScreen returned %d - %s\r\n", r, lcd.GetErrorMessage(r));*/
lcd.AttachPrintHandler(callback);
lcd.PrintScreen(0,0,LCD_W,LCD_H,8);
while(1) {
- end
- }
}
i use tft 5" and RA8875 board from adafruit.
Thanks for your responses.
Hi,
Library RA8875 not work with this board, screen is black, but work with Adafruit_RA8875 on mbed.
include "mbed.h" testing: v147 - working: v146, v145, v142, v136, v128, fails: v148 include "RA8875.h" v138 - tested working include "MyFont18x32.h" include "BPG_Arial08x08.h" include "BPG_Arial10x10.h" include "BPG_Arial20x20.h" include "BPG_Arial31x32.h" include "BPG_Arial63x63.h"
define MOSI D11 define MISO D12 define SCLK D13 define CS D10 define RST D9
RA8875 lcd(MOSI, MISO, SCLK, CS, RST, "tft"); MOSI, MISO, SCK, /ChipSelect, /reset, name
LocalFileSystem local("local"); access to calibration file for resistive touch and printscreen
define LCD_C 16 color - bits per pixel define LCD_W 800 define LCD_H 480
Serial pc(USBTX, USBRX); And a little feedback Timer measurement;
RetCode_t callback(RA8875::filecmd_t cmd, uint8_t * buffer, uint16_t size) { static FILE * fh = NULL; static unsigned int bytesDone = 0; static unsigned int totalBytes = 0;
switch(cmd) { case RA8875::OPEN: bytesDone = 0; totalBytes = *(uint32_t *)buffer; pc.printf("PrintScreen callback to write %u bytes\r\n", totalBytes); fh = fopen("/local/file.bmp", "w+b"); if (!fh) return(file_not_found); break; case RA8875::WRITE: bytesDone += size; pc.printf(" Write %d bytes => %d of %d\r\n", size, bytesDone, totalBytes); fwrite(buffer, 1, size, fh); pc.printf(" %3d %% complete\r\n", ((100 * bytesDone)/totalBytes)); break; case RA8875::CLOSE: fclose(fh); pc.printf("PrintScreen Closed.\r\n"); break; default: pc.printf("Unexpected callback %d\r\n", cmd); break; } return noerror; }
int main() { pc.baud(9600); I like a snappy terminal, so crank it up! pc.printf("\r\nRA8875 Soft Fonts - Build " DATE " " TIME "\r\n");
measurement.start(); lcd.init(LCD_W, LCD_H, LCD_C); lcd.Backlight(0.5f);
lcd.cls();
****** RunTestSet(lcd, pc); If the library was compiled for test mode...
lcd.foreground(Blue); lcd.puts(0,100, "RA8875 Soft Fonts - Build " DATE " " TIME "\r\n");
lcd.SelectUserFont(Dave_Smart18x32); lcd.puts(" ! Soft Fonts ! 0123456789\r\n"); lcd.puts("ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n"); lcd.puts("abcdefghijklmnopqrstuvwxyz\r\n"); lcd.SelectUserFont(); lcd.puts("Back to normal\r\n"); lcd.SelectUserFont(BPG_Arial08x08); lcd.puts("BPG_Arial08x08 ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n"); lcd.puts("BPG_Arial08x08 abcdefghijklmnopqrstuvwxyz\r\n"); lcd.SelectUserFont(BPG_Arial10x10); lcd.puts("BPG_Arial10x10 ABCDEFGHIJKLMNOPQRSTUVWXYZ\r\n"); lcd.puts("BPG_Arial10x10 abcdefghijklmnopqrstuvwxyz\r\n"); lcd.SelectUserFont(BPG_Arial20x20); lcd.puts("BPG_Arial20x20 "); lcd.SelectUserFont(BPG_Arial31x32); lcd.puts("BPG_Arial31x32\r\n"); lcd.SelectUserFont(BPG_Arial63x63); lcd.puts("BPG_Arial63x63"); pc.printf("Time trial completed in %d uSec\r\n", measurement.read_us());
lcd.rect(0,0, 10,10, BrightRed);
/* pc.printf("PrintScreen activated ...\r\n"); RetCode_t r = lcd.PrintScreen(0,0,LCD_W,LCD_H,"/local/file.bmp", 8); pc.printf(" PrintScreen returned %d - %s\r\n", r, lcd.GetErrorMessage(r));*/
lcd.AttachPrintHandler(callback); lcd.PrintScreen(0,0,LCD_W,LCD_H,8);
while(1) {
i use tft 5" and RA8875 board from adafruit.
Thanks for your responses.