looking for a bug...

This commit is contained in:
Jorj Bauer 2022-01-30 15:30:11 -05:00
parent ab888aea88
commit 5cb631057c
4 changed files with 22 additions and 20 deletions

View File

@ -14,7 +14,7 @@
class ILI9341_Wrap : public BaseDisplay {
public:
ILI9341_Wrap(uint8_t cs_pin, uint8_t rst_pin, uint8_t mosi_pin, uint8_t sck_pin, uint8_t miso_pin, uint8_t dc_pin);
ILI9341_Wrap(uint8_t cs_pin, uint8_t rst_pin, uint8_t mosi_pin, uint8_t sck_pin, uint8_t miso_pin, uint8_t dc_pin=255);
~ILI9341_Wrap();
virtual void begin(uint32_t spi_clock=30000000u, uint32_t spi_clock_read=2000000);

View File

@ -119,8 +119,10 @@ RA8875_t4::~RA8875_t4()
void RA8875_t4::begin(uint32_t spi_clock, uint32_t spi_clock_read)
{
Serial.print(" starting RA8875 @ ");
Serial.println(spi_clock);
_spi_clock = spi_clock;
_spi_clock_read = spi_clock_read;
_spi_clock_read = spi_clock_read; // FIXME not used at the moment, not sure we need it yet
_clock = 4000000UL; // start at low speed
// figure out which SPI bus we're using

View File

@ -23,7 +23,7 @@ enum {
class RA8875_t4 : public BaseDisplay {
public:
RA8875_t4(uint8_t cs_pin, uint8_t rst_pin, uint8_t mosi_pin, uint8_t sck_pin, uint8_t miso_pin, uint8_t dc_pin); // dc pin is unused for this display but it's needed for the ILI and base class.
RA8875_t4(uint8_t cs_pin, uint8_t rst_pin, uint8_t mosi_pin, uint8_t sck_pin, uint8_t miso_pin, uint8_t dc_pin=255); // dc pin is unused for this display but it's needed for the ILI and base class.
~RA8875_t4();
@ -77,8 +77,8 @@ private:
uint32_t _clock; // current clock, used in starting transactions (b/c we have to slow down sometimes)
// DMA stuff
DMASetting _dmasettings[12];
DMAChannel _dmatx;
DMASetting _dmasettings[12];
DMAChannel _dmatx;
uint32_t _spi_fcr_save;
uint8_t *_pfbtft;
volatile uint8_t _dma_state;

View File

@ -30,11 +30,6 @@ DMAMEM uint8_t dmaBuffer[RA8875_HEIGHT * RA8875_WIDTH] __attribute__((aligned(32
uint16_t *dmaBuffer16 = NULL; // At runtime, this points to dmaBuffer.
#include <SPI.h>
// 30MHz: solid performance, 9 FPS
// 57.5MHz: solid performance, 14/15 FPS
// 60MHz: unexpected palatte shifts & (may be audio overruns, needs checking since bumping up buffer sizes) 17 FPS
// And I can't get the SPI bus working at 80MHz or higher. Not sure why yet...
#define _clock 57500000u
#define PIN_RST 8
#define PIN_DC 9
@ -90,8 +85,10 @@ TeensyDisplay::TeensyDisplay()
pinMode(11, INPUT);
digitalWrite(11, HIGH); // turn on pull-up
if (digitalRead(11)) {
// FIXME: reversed for debugging
if (!digitalRead(11)) {
// Default: use older, small ILI display if pin 11 is not connected to ground
Serial.println(" using ILI9341 display");
tft = new ILI9341_Wrap(PIN_CS, PIN_RST, PIN_MOSI, PIN_SCK, PIN_MISO, PIN_DC);
use8875 = false;
@ -102,9 +99,12 @@ TeensyDisplay::TeensyDisplay()
getImageInfoAndData(IMG_9341_D2OPEN, &driveWidth, &driveHeight, &d2OpenImage);
getImageInfoAndData(IMG_9341_D2CLOSED, &driveWidth, &driveHeight, &d2ClosedImage);
getImageInfoAndData(IMG_9341_APPLEBATTERY, &appleImageWidth, &appleImageHeight, &appleImage);
tft->begin(50000000u);
} else {
// If someone grounded pin 11, then use the new RA8875 display
tft = new RA8875_t4(PIN_CS, PIN_RST, PIN_MOSI, PIN_SCK, PIN_MISO, 255);
Serial.println(" using RA8875 display");
tft = new RA8875_t4(PIN_CS, PIN_RST, PIN_MOSI, PIN_SCK, PIN_MISO);
use8875 = true;
// Load the 8875 images
@ -114,9 +114,13 @@ TeensyDisplay::TeensyDisplay()
getImageInfoAndData(IMG_8875_D2OPEN, &driveWidth, &driveHeight, &d2OpenImage);
getImageInfoAndData(IMG_8875_D2CLOSED, &driveWidth, &driveHeight, &d2ClosedImage);
getImageInfoAndData(IMG_8875_APPLEBATTERY, &appleImageWidth, &appleImageHeight, &appleImage);
// 30MHz: solid performance, 9 FPS
// 57.5MHz: solid performance, 14/15 FPS
// 60MHz: unexpected palatte shifts & (may be audio overruns, needs checking since bumping up buffer sizes) 17 FPS
// And I can't get the SPI bus working at 80MHz or higher. Not sure why yet...
tft->begin(57500000);
}
tft->begin(_clock);
tft->setFrameBuffer((uint8_t *)dmaBuffer);
tft->fillWindow();
}
@ -383,12 +387,8 @@ void TeensyDisplay::cacheDoubleWidePixel(uint16_t x, uint16_t y, uint16_t color1
{
if (use8875) {
for (int yoff=0; yoff<2; yoff++) {
if (use8875) {
for (int xoff=0; xoff<2; xoff++) {
dmaBuffer[((y*2)+SCREENINSET_8875_Y+yoff)*RA8875_WIDTH+(x*2)+SCREENINSET_8875_X+xoff] = _565To332(color16);
}
} else {
dmaBuffer[((y*2)+SCREENINSET_8875_Y+yoff)*RA8875_WIDTH+x+SCREENINSET_8875_X] = _565To332(color16);
for (int xoff=0; xoff<2; xoff++) {
dmaBuffer[((y*2)+SCREENINSET_8875_Y+yoff)*RA8875_WIDTH+(x*2)+SCREENINSET_8875_X+xoff] = _565To332(color16);
}
}
} else {