diff --git a/teensy/RA8875_t4.cpp b/teensy/RA8875_t4.cpp index b9a91da..7818d74 100644 --- a/teensy/RA8875_t4.cpp +++ b/teensy/RA8875_t4.cpp @@ -112,7 +112,7 @@ void RA8875_t4::_initializeTFT() delay(1); // colorspace - _writeRegister(RA8875_SYSR, 0x0C); // 65k + _writeRegister(RA8875_SYSR, 0x00); // 8-bit (0x0C == 16-bit) _writeRegister(RA8875_HDWR, 0x63); // LCD horizontal display width == (v+1)*8 _writeRegister(RA8875_HNDFTR, 0x00); // Horizontal non-display period fine tuning @@ -242,6 +242,11 @@ void RA8875_t4::fillWindow(uint16_t color) _waitPoll(RA8875_DCR, RA8875_DCR_LINESQUTRI_STATUS, _RA8875_WAITPOLL_TIMEOUT_DCR_LINESQUTRI_STATUS); } +// *** Remove this and convert to native 8-bit? Or make it inline? +uint8_t _color16To8bpp(uint16_t color) { + return ((color & 0xe000) >> 8) | ((color & 0x700) >> 6) | ((color & 0x18) >> 3); +} + void RA8875_t4::drawPixel(int16_t x, int16_t y, uint16_t color) { // FIXME: bounds checking @@ -255,7 +260,8 @@ void RA8875_t4::drawPixel(int16_t x, int16_t y, uint16_t color) // Send pixel data writeCommand(RA8875_MRWC); // write to wherever MWCR1 says (which we expect to be default graphics layer) - writeData16(color); + // writeData16(color); + _writeData(_color16To8bpp(color)); } uint32_t RA8875_t4::frameCount() diff --git a/teensy/teensy-display.cpp b/teensy/teensy-display.cpp index 3d510ec..c3fb964 100644 --- a/teensy/teensy-display.cpp +++ b/teensy/teensy-display.cpp @@ -15,13 +15,14 @@ extern const unsigned char interface_glyphs[256]; #include "globals.h" #include "applevm.h" +#include "images.h" + #ifndef RA8875_HEIGHT #define RA8875_HEIGHT 480 #endif #include -//#define _clock 50000000 - +#define _clock 20000000u // FIXME bring this up - it's under the default now #define PIN_RST 8 #define PIN_DC 9 @@ -30,9 +31,6 @@ extern const unsigned char interface_glyphs[256]; #define PIN_MISO 1 #define PIN_SCK 27 -#define SCREENINSET_X (120) -#define SCREENINSET_Y (10) - // RGB map of each of the lowres colors const uint16_t loresPixelColors[16] = { 0x0000, // 0 black 0xC006, // 1 magenta @@ -63,7 +61,7 @@ RA8875_t4 tft = RA8875_t4(PIN_CS, PIN_RST, PIN_MOSI, PIN_SCK, PIN_MISO); TeensyDisplay::TeensyDisplay() { // tft.begin(Adafruit_800x480); - tft.begin(); + tft.begin(_clock); tft.fillWindow(); driveIndicator[0] = driveIndicator[1] = false;