mirror of
https://github.com/JorjBauer/aiie.git
synced 2024-11-23 21:31:08 +00:00
add HSV pixel blending for the ILI display in double-hi-res modes
This commit is contained in:
parent
97072d7dd6
commit
70e28fa438
@ -3,6 +3,7 @@
|
||||
#include "images.h"
|
||||
#include "globals.h"
|
||||
#include "appledisplay.h"
|
||||
#include "palette.h"
|
||||
|
||||
#define _332To565(c) ((((c) & 0xe0) << 8) | (((c) & 0x1c) << 6) | ((c) & 0x03))
|
||||
|
||||
@ -34,9 +35,9 @@ void ILI9341_Wrap::begin(uint32_t spi_clock=30000000u, uint32_t spi_clock_read=2
|
||||
}
|
||||
}
|
||||
|
||||
void ILI9341_Wrap::fillWindow(uint16_t color = 0x0000)
|
||||
void ILI9341_Wrap::fillWindow(uint8_t coloridx = 0x00)
|
||||
{
|
||||
tft->fillScreen(color);
|
||||
tft->fillScreen(palette16[coloridx]);
|
||||
}
|
||||
|
||||
void ILI9341_Wrap::setFrameBuffer(uint8_t *frame_buffer)
|
||||
@ -67,15 +68,27 @@ void ILI9341_Wrap::drawPixel(int16_t x, int16_t y, uint16_t color)
|
||||
frame_buffer[y*ILI9341_WIDTH+x] = color;
|
||||
}
|
||||
|
||||
// find the color in the array and return its index
|
||||
static uint8_t reverseColor(uint16_t c)
|
||||
{
|
||||
for (int i=0; i<16; i++) {
|
||||
if (palette16[i] == c)
|
||||
return i;
|
||||
}
|
||||
// didn't find it, return black
|
||||
return c_black;
|
||||
}
|
||||
|
||||
// The 9341 is half the width we need, so this jumps through hoops to
|
||||
// reduce the resolution in a way that's reasonable by blending pixels
|
||||
void ILI9341_Wrap::cacheApplePixel(uint16_t x, uint16_t y, uint16_t color)
|
||||
void ILI9341_Wrap::cacheApplePixel(uint16_t x, uint16_t y, uint8_t coloridx)
|
||||
{
|
||||
if (x>=560 || y>=192)
|
||||
return;
|
||||
|
||||
if (x&1) {
|
||||
uint16_t origColor =frame_buffer[(y+SCREENINSET_9341_Y)*ILI9341_WIDTH+(x>>1)+SCREENINSET_9341_X];
|
||||
uint16_t blendedColor = mix16[reverseColor(origColor)][coloridx];
|
||||
if (g_displayType == m_blackAndWhite) {
|
||||
// There are four reasonable decisions here: if either pixel
|
||||
// *was* on, then it's on; if both pixels *were* on, then it's
|
||||
@ -84,26 +97,34 @@ void ILI9341_Wrap::cacheApplePixel(uint16_t x, uint16_t y, uint16_t color)
|
||||
// some certain overall brightness, then it's on. This is the
|
||||
// last of those - where the brightness cutoff is defined in
|
||||
// the bios as g_luminanceCutoff.
|
||||
uint16_t blendedColor = blendColors(origColor, color);
|
||||
uint16_t luminance = luminanceFromRGB(_565toR(blendedColor),
|
||||
_565toG(blendedColor),
|
||||
_565toB(blendedColor));
|
||||
cacheDoubleWideApplePixel(x>>1,y,(uint16_t)((luminance >= g_luminanceCutoff) ? 0xFFFF : 0x0000));
|
||||
cacheDoubleWideApplePixel(x>>1,y,(uint16_t)((luminance >= g_luminanceCutoff) ? c_white : c_black));
|
||||
} else {
|
||||
cacheDoubleWideApplePixel(x>>1, y, color);
|
||||
cacheBlendedPixel(x>>1, y, blendedColor);
|
||||
}
|
||||
} else {
|
||||
// All of the even pixels get drawn...
|
||||
cacheDoubleWideApplePixel(x>>1, y, color);
|
||||
cacheDoubleWideApplePixel(x>>1, y, coloridx);
|
||||
}
|
||||
}
|
||||
|
||||
void ILI9341_Wrap::cacheDoubleWideApplePixel(uint16_t x, uint16_t y, uint16_t color16)
|
||||
// This is an internal method that sets a non-standard indexed color
|
||||
void ILI9341_Wrap::cacheBlendedPixel(uint16_t x, uint16_t y, uint16_t c)
|
||||
{
|
||||
if (x>=280 || y>=192)
|
||||
return;
|
||||
|
||||
frame_buffer[(y+SCREENINSET_9341_Y)*ILI9341_WIDTH + (x) + SCREENINSET_9341_X] = color16;
|
||||
frame_buffer[(y+SCREENINSET_9341_Y)*ILI9341_WIDTH + (x) + SCREENINSET_9341_X] = c;
|
||||
}
|
||||
|
||||
void ILI9341_Wrap::cacheDoubleWideApplePixel(uint16_t x, uint16_t y, uint8_t coloridx)
|
||||
{
|
||||
if (x>=280 || y>=192)
|
||||
return;
|
||||
|
||||
frame_buffer[(y+SCREENINSET_9341_Y)*ILI9341_WIDTH + (x) + SCREENINSET_9341_X] = palette16[coloridx];
|
||||
}
|
||||
|
||||
uint32_t ILI9341_Wrap::frameCount()
|
||||
|
@ -19,7 +19,7 @@ class ILI9341_Wrap : public BaseDisplay {
|
||||
|
||||
virtual void begin(uint32_t spi_clock=30000000u, uint32_t spi_clock_read=2000000);
|
||||
|
||||
virtual void fillWindow(uint16_t color = 0x0000);
|
||||
virtual void fillWindow(uint8_t coloridx = 0x00);
|
||||
|
||||
virtual void setFrameBuffer(uint8_t *frame_buffer);
|
||||
|
||||
@ -28,8 +28,10 @@ class ILI9341_Wrap : public BaseDisplay {
|
||||
|
||||
virtual void drawPixel(int16_t x, int16_t y, uint16_t color);
|
||||
|
||||
virtual void cacheApplePixel(uint16_t x, uint16_t y, uint16_t color);
|
||||
virtual void ILI9341_Wrap::cacheDoubleWideApplePixel(uint16_t x, uint16_t y, uint16_t color16);
|
||||
virtual void cacheApplePixel(uint16_t x, uint16_t y, uint8_t coloridx);
|
||||
virtual void cacheDoubleWideApplePixel(uint16_t x, uint16_t y, uint8_t coloridx);
|
||||
|
||||
void cacheBlendedPixel(uint16_t x, uint16_t y, uint16_t color16);
|
||||
|
||||
virtual uint32_t frameCount();
|
||||
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#include "images.h"
|
||||
|
||||
#include "palette.h"
|
||||
|
||||
// Discussion about DMA channels: http://forum.pjrc.com/threads/25778-Could-there-be-something-like-an-ISR-template-function/page3
|
||||
// Thread discussing the way to get started: https://forum.pjrc.com/threads/63353-Teensy-4-1-How-to-start-using-DMA
|
||||
// Thread of someone writing an LCD interface: https://forum.pjrc.com/threads/67247-Teensy-4-0-DMA-SPI
|
||||
@ -396,13 +398,13 @@ bool RA8875_t4::updateScreenAsync(bool update_cont)
|
||||
return true;
|
||||
}
|
||||
|
||||
void RA8875_t4::fillWindow(uint16_t color)
|
||||
void RA8875_t4::fillWindow(uint8_t coloridx)
|
||||
{
|
||||
if (!_pfbtft)
|
||||
return;
|
||||
|
||||
// Reduce color to 8 bit
|
||||
uint8_t c8 = _565To332(color);
|
||||
uint8_t c8 = palette8[coloridx];
|
||||
memset(_pfbtft, c8, RA8875_WIDTH*RA8875_HEIGHT);
|
||||
}
|
||||
|
||||
@ -419,7 +421,7 @@ void RA8875_t4::drawPixel(int16_t x, int16_t y, uint16_t color)
|
||||
_pfbtft[y*RA8875_WIDTH+x] = _565To332(color);
|
||||
}
|
||||
|
||||
void RA8875_t4::cacheApplePixel(uint16_t x, uint16_t y, uint16_t color)
|
||||
void RA8875_t4::cacheApplePixel(uint16_t x, uint16_t y, uint8_t coloridx)
|
||||
{
|
||||
if (x>=560 || y>=192) {
|
||||
Serial.print("! ");
|
||||
@ -430,13 +432,13 @@ void RA8875_t4::cacheApplePixel(uint16_t x, uint16_t y, uint16_t color)
|
||||
}
|
||||
|
||||
// The 8875 display doubles vertically
|
||||
uint c8 = _565To332(color);
|
||||
uint c8 = palette8[coloridx];
|
||||
for (int yoff=0; yoff<2; yoff++) {
|
||||
_pfbtft[((y*2)+SCREENINSET_8875_Y+yoff) * RA8875_WIDTH +x+SCREENINSET_8875_X] = c8;
|
||||
}
|
||||
}
|
||||
|
||||
void RA8875_t4::cacheDoubleWideApplePixel(uint16_t x, uint16_t y, uint16_t color16)
|
||||
void RA8875_t4::cacheDoubleWideApplePixel(uint16_t x, uint16_t y, uint8_t coloridx)
|
||||
{
|
||||
if (x>=280 || y>=192) {
|
||||
Serial.println("@");
|
||||
@ -446,7 +448,7 @@ void RA8875_t4::cacheDoubleWideApplePixel(uint16_t x, uint16_t y, uint16_t color
|
||||
// The RA8875 doubles Apple's pixels.
|
||||
for (int yoff=0; yoff<2; yoff++) {
|
||||
for (int xoff=0; xoff<2; xoff++) {
|
||||
_pfbtft[((y*2)+SCREENINSET_8875_Y+yoff)*RA8875_WIDTH+(x*2)+SCREENINSET_8875_X+xoff] = _565To332(color16);
|
||||
_pfbtft[((y*2)+SCREENINSET_8875_Y+yoff)*RA8875_WIDTH+(x*2)+SCREENINSET_8875_X+xoff] = palette8[coloridx];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ class RA8875_t4 : public BaseDisplay {
|
||||
|
||||
virtual void begin(uint32_t spi_clock=30000000u, uint32_t spi_clock_read=2000000);
|
||||
|
||||
virtual void fillWindow(uint16_t color = 0x0000);
|
||||
virtual void fillWindow(uint8_t coloridx = 0x00);
|
||||
|
||||
virtual void setFrameBuffer(uint8_t *frame_buffer);
|
||||
|
||||
@ -38,8 +38,8 @@ class RA8875_t4 : public BaseDisplay {
|
||||
|
||||
virtual void drawPixel(int16_t x, int16_t y, uint16_t color);
|
||||
|
||||
virtual void cacheApplePixel(uint16_t x, uint16_t y, uint16_t color16);
|
||||
virtual void cacheDoubleWideApplePixel(uint16_t x, uint16_t y, uint16_t color16);
|
||||
virtual void cacheApplePixel(uint16_t x, uint16_t y, uint8_t coloridx);
|
||||
virtual void cacheDoubleWideApplePixel(uint16_t x, uint16_t y, uint8_t coloridx);
|
||||
|
||||
virtual uint32_t frameCount();
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#define _565To332(c) ((((c) & 0xe000) >> 8) | (((c) & 0x700) >> 6) | (((c) & 0x18) >> 3))
|
||||
#define _332To565(c) ((((c) & 0xe0) << 8) | (((c) & 0x1c) << 6) | ((c) & 0x03))
|
||||
|
||||
#define blendColors(a,b) RGBto565( (_565toR(a) + _565toR(b))/2, (_565toG(a) + _565toG(b))/2, (_565toB(a) + _565toB(b))/2 )
|
||||
//#define blendColors(a,b) RGBto565( (_565toR(a) + _565toR(b))/2, (_565toG(a) + _565toG(b))/2, (_565toB(a) + _565toB(b))/2 )
|
||||
|
||||
class BaseDisplay {
|
||||
public:
|
||||
@ -20,7 +20,7 @@ class BaseDisplay {
|
||||
|
||||
virtual void begin(uint32_t spi_clock=30000000u, uint32_t spi_clock_read=2000000) = 0;
|
||||
|
||||
virtual void fillWindow(uint16_t color = 0x0000) = 0;
|
||||
virtual void fillWindow(uint8_t coloridx = 0x00) = 0;
|
||||
|
||||
virtual void setFrameBuffer(uint8_t *frame_buffer) = 0;
|
||||
|
||||
@ -30,8 +30,8 @@ class BaseDisplay {
|
||||
virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0;
|
||||
|
||||
// Apple interface methods
|
||||
virtual void cacheApplePixel(uint16_t x, uint16_t y, uint16_t color) = 0;
|
||||
virtual void cacheDoubleWideApplePixel(uint16_t x, uint16_t y, uint16_t color16) = 0;
|
||||
virtual void cacheApplePixel(uint16_t x, uint16_t y, uint8_t coloridx) = 0;
|
||||
virtual void cacheDoubleWideApplePixel(uint16_t x, uint16_t y, uint8_t coloridx) = 0;
|
||||
|
||||
virtual uint32_t frameCount() = 0;
|
||||
};
|
||||
|
99
teensy/palette.h
Normal file
99
teensy/palette.h
Normal file
@ -0,0 +1,99 @@
|
||||
#ifndef __PALETTE_H
|
||||
#define __PALETTE_H
|
||||
|
||||
static const uint8_t palette8[16] = {
|
||||
0x00, // 0 black
|
||||
0xC0, // 1 magenta
|
||||
0x02, // 2 dark blue
|
||||
0xA6, // 3 purple
|
||||
0x10, // 4 dark green
|
||||
0x6D, // 5 dark grey
|
||||
0x0F, // 6 med blue
|
||||
0x17, // 7 light blue
|
||||
0x88, // 8 brown
|
||||
0xE0, // 9 orange
|
||||
0x96, // 10 light gray
|
||||
0xF2, // 11 pink
|
||||
0x1C, // 12 green
|
||||
0xFC, // 13 yellow
|
||||
0x9E, // 14 aqua
|
||||
0xFF // 15 white
|
||||
};
|
||||
|
||||
static const uint16_t palette16[16] = {
|
||||
0x0000, // 0 black
|
||||
0xC006, // 1 magenta
|
||||
0x0010, // 2 dark blue
|
||||
0xA1B5, // 3 purple
|
||||
0x0480, // 4 dark green
|
||||
0x6B4D, // 5 dark grey
|
||||
0x1B9F, // 6 med blue
|
||||
0x0DFD, // 7 light blue
|
||||
0x92A5, // 8 brown
|
||||
0xF8C5, // 9 orange
|
||||
0x9555, // 10 light gray
|
||||
0xFCF2, // 11 pink
|
||||
0x07E0, // 12 green
|
||||
0xFFE0, // 13 yellow
|
||||
0x87F0, // 14 aqua
|
||||
0xFFFF // 15 white
|
||||
};
|
||||
|
||||
static const uint8_t mix8[16][16] = {
|
||||
0x00, 0x29, 0x28, 0x2D, 0x28, 0x49, 0x28, 0x6D, 0x24, 0x69, 0x24, 0x4D, 0x6D, 0x6D, 0x6D, 0x6D,
|
||||
0x29, 0xA1, 0x62, 0xA2, 0x02, 0x52, 0x42, 0xAB, 0x0E, 0x3B, 0x8A, 0xC6, 0x0B, 0x37, 0x47, 0x7B,
|
||||
0x28, 0x62, 0x02, 0x42, 0x0E, 0x31, 0x0A, 0x2B, 0x0C, 0x18, 0x46, 0x87, 0x16, 0x39, 0x32, 0x79,
|
||||
0x2D, 0xA2, 0x42, 0xA3, 0x0A, 0x56, 0x03, 0x8B, 0x16, 0x3E, 0x8A, 0xEB, 0x37, 0x5F, 0x4F, 0x9E,
|
||||
0x28, 0x02, 0x0E, 0x0A, 0x10, 0x70, 0x11, 0x37, 0x2C, 0x98, 0x2A, 0x2B, 0x14, 0x78, 0x35, 0xB9,
|
||||
0x49, 0x52, 0x31, 0x56, 0x70, 0x91, 0x55, 0x9A, 0x8C, 0xD1, 0x72, 0x9B, 0xB9, 0xDA, 0x99, 0xDA,
|
||||
0x28, 0x42, 0x0A, 0x03, 0x11, 0x55, 0x12, 0x4F, 0x10, 0x58, 0x2A, 0x67, 0x19, 0x39, 0x3A, 0x99,
|
||||
0x6D, 0xAB, 0x2B, 0x8B, 0x37, 0x9A, 0x4F, 0x93, 0x35, 0x7E, 0x92, 0xD3, 0x7F, 0x9F, 0x9B, 0xDF,
|
||||
0x24, 0x0E, 0x0C, 0x16, 0x2C, 0x8C, 0x10, 0x35, 0x68, 0xAC, 0x2D, 0x36, 0x94, 0xB4, 0x54, 0xB1,
|
||||
0x69, 0x3B, 0x18, 0x3E, 0x98, 0xD1, 0x58, 0x7E, 0xAC, 0xED, 0x76, 0x7F, 0xFC, 0xF5, 0xBD, 0xF6,
|
||||
0x24, 0x8A, 0x46, 0x8A, 0x2A, 0x72, 0x2A, 0x92, 0x2D, 0x76, 0x6D, 0xAE, 0x56, 0x76, 0x72, 0xB6,
|
||||
0x4D, 0xC6, 0x87, 0xEB, 0x2B, 0x9B, 0x67, 0xD3, 0x36, 0x7F, 0xAE, 0xEF, 0x57, 0x7F, 0x6F, 0xBF,
|
||||
0x6D, 0x0B, 0x16, 0x37, 0x14, 0xB9, 0x19, 0x7F, 0x94, 0xFC, 0x56, 0x57, 0x7C, 0xDD, 0x5D, 0xFE,
|
||||
0x6D, 0x37, 0x39, 0x5F, 0x78, 0xDA, 0x39, 0x9F, 0xB4, 0xF5, 0x76, 0x7F, 0xDD, 0xFD, 0x9D, 0xFA,
|
||||
0x6D, 0x47, 0x32, 0x4F, 0x35, 0x99, 0x3A, 0x9B, 0x54, 0xBD, 0x72, 0x6F, 0x5D, 0x9D, 0x7E, 0xFE,
|
||||
0x6D, 0x7B, 0x79, 0x9E, 0xB9, 0xDA, 0x99, 0xDF, 0xB1, 0xF6, 0xB6, 0xBF, 0xFE, 0xFA, 0xFE, 0xFF,
|
||||
};
|
||||
|
||||
static const uint16_t mix16[16][16] = {
|
||||
0x0000, 0x2AA9, 0x2204, 0x3B49, 0x3A04, 0x4A48, 0x3AC5, 0x63EC, 0x3943, 0x7AAA, 0x39E7, 0x5BEE, 0x7348, 0x7B6B, 0x6BAA, 0x7BEF,
|
||||
0x2AA9, 0xA889, 0x7032, 0xB8B3, 0x0052, 0x4CB4, 0x5056, 0xBA7A, 0x03D2, 0x2EB9, 0x9231, 0xD1F1, 0x1AF9, 0x3D7A, 0x41D9, 0x76B8,
|
||||
0x2204, 0x7032, 0x0050, 0x4055, 0x0390, 0x3C8A, 0x0213, 0x3A18, 0x03E5, 0x1E05, 0x49B0, 0x8978, 0x15B2, 0x2E0D, 0x2CB7, 0x660C,
|
||||
0x3B49, 0xB8B3, 0x4055, 0xA8DA, 0x0A75, 0x55D4, 0x0878, 0x8ABD, 0x0D30, 0x2F51, 0x9275, 0xEA3B, 0x25BB, 0x4759, 0x43BB, 0x8735,
|
||||
0x3A04, 0x0052, 0x0390, 0x0A75, 0x0405, 0x6487, 0x04EF, 0x3D58, 0x33E0, 0x9603, 0x32D0, 0x2A38, 0x15A2, 0x6605, 0x2DCD, 0xB60C,
|
||||
0x4A48, 0x4CB4, 0x3C8A, 0x55D4, 0x6487, 0x9CAF, 0x4548, 0x9675, 0x8BA6, 0xCCED, 0x7470, 0x8659, 0xAE0B, 0xCE10, 0x962F, 0xCE17,
|
||||
0x3AC5, 0x5056, 0x0213, 0x0878, 0x04EF, 0x4548, 0x0456, 0x43FB, 0x04A0, 0x56C3, 0x3A13, 0x61BB, 0x166C, 0x36C8, 0x2E97, 0x96CD,
|
||||
0x63EC, 0xBA7A, 0x3A18, 0x8ABD, 0x3D58, 0x9675, 0x43FB, 0x9CFF, 0x3DED, 0x77F0, 0x9C57, 0xDC5F, 0x679B, 0x8FF8, 0x86DE, 0xCFF9,
|
||||
0x3943, 0x03D2, 0x03E5, 0x0D30, 0x33E0, 0x8BA6, 0x04A0, 0x3DED, 0x7AE0, 0xBB43, 0x33ED, 0x2DB7, 0x9582, 0xBD25, 0x5DA5, 0xBC0B,
|
||||
0x7AAA, 0x2EB9, 0x1E05, 0x2F51, 0x9603, 0xCCED, 0x56C3, 0x77F0, 0xBB43, 0xFB88, 0x6DF2, 0x67FB, 0xF727, 0xFDCC, 0xBFAB, 0xFD74,
|
||||
0x39E7, 0x9231, 0x49B0, 0x9275, 0x32D0, 0x7470, 0x3A13, 0x9C57, 0x33ED, 0x6DF2, 0x734F, 0xBBD7, 0x5D36, 0x7DF6, 0x7476, 0xADF6,
|
||||
0x5BEE, 0xD1F1, 0x8978, 0xEA3B, 0x2A38, 0x8659, 0x61BB, 0xDC5F, 0x2DB7, 0x67FB, 0xBBD7, 0xFBDA, 0x551E, 0x7F7F, 0x73DE, 0xBFFD,
|
||||
0x7348, 0x1AF9, 0x15B2, 0x25BB, 0x15A2, 0xAE0B, 0x166C, 0x679B, 0x9582, 0xF727, 0x5D36, 0x551E, 0x7725, 0xC78A, 0x4F4B, 0xF712,
|
||||
0x7B6B, 0x3D7A, 0x2E0D, 0x4759, 0x6605, 0xCE10, 0x36C8, 0x8FF8, 0xBD25, 0xFDCC, 0x7DF6, 0x7F7F, 0xC78A, 0xFFAF, 0x97AE, 0xFED7,
|
||||
0x6BAA, 0x41D9, 0x2CB7, 0x43BB, 0x2DCD, 0x962F, 0x2E97, 0x86DE, 0x5DA5, 0xBFAB, 0x7476, 0x73DE, 0x4F4B, 0x97AE, 0x6F76, 0xE7B6,
|
||||
0x7BEF, 0x76B8, 0x660C, 0x8735, 0xB60C, 0xCE17, 0x96CD, 0xCFF9, 0xBC0B, 0xFD74, 0xADF6, 0xBFFD, 0xF712, 0xFED7, 0xE7B6, 0xFFFF,
|
||||
};
|
||||
|
||||
static const uint32_t mix32[16][16] = {
|
||||
0x00000000, 0x002F564E, 0x00214120, 0x003A684C, 0x003B4120, 0x004F4A47, 0x003E5A2D, 0x00677F67, 0x003D2A1E, 0x007F5651, 0x00393F3B, 0x005E7F74, 0x00736A44, 0x007F6D5E, 0x006E7756, 0x007F7F7F,
|
||||
0x002F564E, 0x00AC114D, 0x00770797, 0x00BE159C, 0x00070A97, 0x004A94A5, 0x005009B0, 0x00BB4DD5, 0x00077893, 0x0028D5C8, 0x00954589, 0x00D53E8C, 0x001D5DC9, 0x003EADD5, 0x004439CD, 0x0075D5C3,
|
||||
0x00214120, 0x00770797, 0x00000883, 0x00430AAA, 0x00007083, 0x00399157, 0x0000419C, 0x003B40C1, 0x00007E2C, 0x001AC128, 0x004C3481, 0x008C2EC1, 0x0011B491, 0x002EC16C, 0x002997B8, 0x0063C160,
|
||||
0x003A684C, 0x00BE159C, 0x00430AAA, 0x00A919D1, 0x000A4FAA, 0x0054B8A0, 0x000D0CC3, 0x008F56E8, 0x000AA582, 0x002EE88C, 0x00904FA8, 0x00E845DD, 0x0022B4DB, 0x0046E8CF, 0x004076DF, 0x0082E7AA,
|
||||
0x003B4120, 0x00070A97, 0x00007083, 0x000A4FAA, 0x0000832D, 0x00609139, 0x00009C7B, 0x003BA9C1, 0x00377E00, 0x0090C11A, 0x00345981, 0x002E44C1, 0x0012B411, 0x0064C12E, 0x0029B868, 0x00B0C160,
|
||||
0x004F4A47, 0x004A94A5, 0x00399157, 0x0054B8A0, 0x00609139, 0x009F967E, 0x0044AA43, 0x0092CFA8, 0x008C7737, 0x00CF9E6E, 0x00738F87, 0x0083CBCF, 0x00AFC25F, 0x00CFC283, 0x0096C67B, 0x00CFC1B9,
|
||||
0x003E5A2D, 0x005009B0, 0x0000419C, 0x000D0CC3, 0x00009C7B, 0x0044AA43, 0x00008AB5, 0x00437DDA, 0x00009700, 0x0050DA1E, 0x003F429A, 0x006434DA, 0x0013CD64, 0x0034DA40, 0x002FD1BE, 0x0096DA6D,
|
||||
0x00677F67, 0x00BB4DD5, 0x003B40C1, 0x008F56E8, 0x003BA9C1, 0x0092CFA8, 0x00437DDA, 0x009D9DFF, 0x003ABC6C, 0x0072FF82, 0x009B89BF, 0x00D98BFF, 0x0062F2D8, 0x008CFFC0, 0x0084D8F6, 0x00CEFFCE,
|
||||
0x003D2A1E, 0x00077893, 0x00007E2C, 0x000AA582, 0x00377E00, 0x008C7737, 0x00009700, 0x003ABC6C, 0x007A5D00, 0x00BC6B1A, 0x00327C68, 0x002DB4BC, 0x0090B010, 0x00BCA52D, 0x0059B428, 0x00BC825E,
|
||||
0x007F5651, 0x0028D5C8, 0x001AC128, 0x002EE88C, 0x0090C11A, 0x00CF9E6E, 0x0050DA1E, 0x0072FF82, 0x00BC6B1A, 0x00FF7146, 0x0068BF90, 0x0060FFDD, 0x00F2E638, 0x00FFBB60, 0x00BAF65A, 0x00FFADA3,
|
||||
0x00393F3B, 0x00954589, 0x004C3481, 0x00904FA8, 0x00345981, 0x00738F87, 0x003F429A, 0x009B89BF, 0x00327C68, 0x0068BF90, 0x0077687F, 0x00BF7BBD, 0x005AA4B2, 0x007CBFB1, 0x00748EB6, 0x00ADBFB3,
|
||||
0x005E7F74, 0x00D53E8C, 0x008C2EC1, 0x00E845DD, 0x002E44C1, 0x0083CBCF, 0x006434DA, 0x00D98BFF, 0x002DB4BC, 0x0060FFDD, 0x00BF7BBD, 0x00FF79D0, 0x0051A3F2, 0x007AEDFF, 0x00727AF6, 0x00BCFFE9,
|
||||
0x00736A44, 0x001D5DC9, 0x0011B491, 0x0022B4DB, 0x0012B411, 0x00AFC25F, 0x0013CD64, 0x0062F2D8, 0x0090B010, 0x00F2E638, 0x005AA4B2, 0x0051A3F2, 0x0070E62B, 0x00C6F251, 0x004BEA58, 0x00F2E090,
|
||||
0x007F6D5E, 0x003EADD5, 0x002EC16C, 0x0046E8CF, 0x0064C12E, 0x00CFC283, 0x0034DA40, 0x008CFFC0, 0x00BCA52D, 0x00FFBB60, 0x007CBFB1, 0x007AEDFF, 0x00C6F251, 0x00FFF47A, 0x0097F673, 0x00FFDBBD,
|
||||
0x006E7756, 0x004439CD, 0x002997B8, 0x004076DF, 0x0029B868, 0x0096C67B, 0x002FD1BE, 0x0084D8F6, 0x0059B428, 0x00BAF65A, 0x00748EB6, 0x00727AF6, 0x004BEA58, 0x0097F673, 0x006BEEB1, 0x00E4F6B3,
|
||||
0x007F7F7F, 0x0075D5C3, 0x0063C160, 0x0082E7AA, 0x00B0C160, 0x00CFC1B9, 0x0096DA6D, 0x00CEFFCE, 0x00BC825E, 0x00FFADA3, 0x00ADBFB3, 0x00BCFFE9, 0x00F2E090, 0x00FFDBBD, 0x00E4F6B3, 0x00FFFFFF,
|
||||
};
|
||||
|
||||
#endif
|
@ -25,24 +25,6 @@ uint16_t *dmaBuffer16 = NULL;
|
||||
#define PIN_MISO 1
|
||||
#define PIN_SCK 27
|
||||
|
||||
const uint16_t loresPixelColors[16] = { 0x0000, // 0 black
|
||||
0xC006, // 1 magenta
|
||||
0x0010, // 2 dark blue
|
||||
0xA1B5, // 3 purple
|
||||
0x0480, // 4 dark green
|
||||
0x6B4D, // 5 dark grey
|
||||
0x1B9F, // 6 med blue
|
||||
0x0DFD, // 7 light blue
|
||||
0x92A5, // 8 brown
|
||||
0xF8C5, // 9 orange
|
||||
0x9555, // 10 light gray
|
||||
0xFCF2, // 11 pink
|
||||
0x07E0, // 12 green
|
||||
0xFFE0, // 13 yellow
|
||||
0x87F0, // 14 aqua
|
||||
0xFFFF // 15 white
|
||||
};
|
||||
|
||||
TeensyDisplay::TeensyDisplay()
|
||||
{
|
||||
driveIndicator[0] = driveIndicator[1] = true; // assume on so they will redraw immediately the first time
|
||||
@ -237,23 +219,19 @@ void TeensyDisplay::drawPixel(uint16_t x, uint16_t y, uint8_t r, uint8_t g, uint
|
||||
|
||||
void TeensyDisplay::clrScr(uint8_t coloridx)
|
||||
{
|
||||
uint16_t color16 = loresPixelColors[coloridx];
|
||||
tft->fillWindow(color16);
|
||||
tft->fillWindow(coloridx);
|
||||
}
|
||||
|
||||
void TeensyDisplay::cachePixel(uint16_t x, uint16_t y, uint8_t color)
|
||||
void TeensyDisplay::cachePixel(uint16_t x, uint16_t y, uint8_t coloridx)
|
||||
{
|
||||
tft->cacheApplePixel(x,y,loresPixelColors[color]);
|
||||
tft->cacheApplePixel(x,y,coloridx);
|
||||
}
|
||||
|
||||
// "DoubleWide" means "please double the X because I'm in low-res
|
||||
// width mode".
|
||||
void TeensyDisplay::cacheDoubleWidePixel(uint16_t x, uint16_t y, uint8_t color)
|
||||
void TeensyDisplay::cacheDoubleWidePixel(uint16_t x, uint16_t y, uint8_t coloridx)
|
||||
{
|
||||
uint16_t color16;
|
||||
color16 = loresPixelColors[(( color & 0x0F ) )];
|
||||
|
||||
tft->cacheDoubleWideApplePixel(x, y, color16);
|
||||
tft->cacheDoubleWideApplePixel(x, y, coloridx);
|
||||
}
|
||||
|
||||
uint32_t TeensyDisplay::frameCount()
|
||||
|
Loading…
Reference in New Issue
Block a user