mirror of https://github.com/JorjBauer/aiie.git
working on drive activity
This commit is contained in:
parent
8cd2bc24ab
commit
ec691374ea
|
@ -117,6 +117,7 @@ void AppleUI::blit()
|
||||||
redrawDriveLatches = false;
|
redrawDriveLatches = false;
|
||||||
g_display->drawUIImage(driveInserted[0] ? IMG_D1CLOSED : IMG_D1OPEN);
|
g_display->drawUIImage(driveInserted[0] ? IMG_D1CLOSED : IMG_D1OPEN);
|
||||||
g_display->drawUIImage(driveInserted[1] ? IMG_D2CLOSED : IMG_D2OPEN);
|
g_display->drawUIImage(driveInserted[1] ? IMG_D2CLOSED : IMG_D2OPEN);
|
||||||
|
redrawDriveActivity = true; // these overlap
|
||||||
}
|
}
|
||||||
|
|
||||||
if (redrawDriveActivity) {
|
if (redrawDriveActivity) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const static uint8_t image_d1_open[] PROGMEM = {
|
const static uint8_t image_d1_closed[] PROGMEM = {
|
||||||
0xCE,0x37, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1,
|
0xCE,0x37, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1,
|
||||||
0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1,
|
0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1,
|
||||||
0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1,
|
0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1,
|
||||||
|
@ -87,7 +87,7 @@ const static uint8_t image_d1_open[] PROGMEM = {
|
||||||
0x58,0xA2, 0xCD,0xD5,
|
0x58,0xA2, 0xCD,0xD5,
|
||||||
};
|
};
|
||||||
|
|
||||||
const static uint8_t image_d1_closed[] PROGMEM = {
|
const static uint8_t image_d1_open[] PROGMEM = {
|
||||||
0xCE,0x37, 0x31,0x23, 0x10,0x81, 0x18,0x81, 0x20,0xC1, 0x29,0x02, 0x28,0xE2, 0x28,0xC2,
|
0xCE,0x37, 0x31,0x23, 0x10,0x81, 0x18,0x81, 0x20,0xC1, 0x29,0x02, 0x28,0xE2, 0x28,0xC2,
|
||||||
0x31,0x01, 0x29,0x01, 0x20,0xC1, 0x28,0xE1, 0x31,0x42, 0x28,0xC1, 0x20,0xA0, 0x31,0x22,
|
0x31,0x01, 0x29,0x01, 0x20,0xC1, 0x28,0xE1, 0x31,0x42, 0x28,0xC1, 0x20,0xA0, 0x31,0x22,
|
||||||
0x31,0x01, 0x28,0xE1, 0x31,0x02, 0x30,0xE1, 0x20,0xA0, 0x20,0xA0, 0x20,0xA0, 0x28,0xC1,
|
0x31,0x01, 0x28,0xE1, 0x31,0x02, 0x30,0xE1, 0x20,0xA0, 0x20,0xA0, 0x20,0xA0, 0x28,0xC1,
|
||||||
|
@ -176,7 +176,7 @@ const static uint8_t image_d1_closed[] PROGMEM = {
|
||||||
0x58,0xA2, 0xCD,0xD5,
|
0x58,0xA2, 0xCD,0xD5,
|
||||||
};
|
};
|
||||||
|
|
||||||
const static uint8_t image_d2_open[] PROGMEM = {
|
const static uint8_t image_d2_closed[] PROGMEM = {
|
||||||
0xCE,0x37, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1,
|
0xCE,0x37, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1,
|
||||||
0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1,
|
0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1,
|
||||||
0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1,
|
0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1, 0x20,0xC1,
|
||||||
|
@ -265,7 +265,7 @@ const static uint8_t image_d2_open[] PROGMEM = {
|
||||||
0x58,0xA2, 0xCD,0xD5,
|
0x58,0xA2, 0xCD,0xD5,
|
||||||
};
|
};
|
||||||
|
|
||||||
const static uint8_t image_d2_closed[] PROGMEM = {
|
const static uint8_t image_d2_open[] PROGMEM = {
|
||||||
0xCE,0x37, 0x31,0x23, 0x10,0x81, 0x18,0x81, 0x20,0xC1, 0x29,0x02, 0x28,0xE2, 0x28,0xC2,
|
0xCE,0x37, 0x31,0x23, 0x10,0x81, 0x18,0x81, 0x20,0xC1, 0x29,0x02, 0x28,0xE2, 0x28,0xC2,
|
||||||
0x31,0x01, 0x29,0x01, 0x20,0xC1, 0x28,0xE1, 0x31,0x42, 0x28,0xC1, 0x20,0xA0, 0x31,0x22,
|
0x31,0x01, 0x29,0x01, 0x20,0xC1, 0x28,0xE1, 0x31,0x42, 0x28,0xC1, 0x20,0xA0, 0x31,0x22,
|
||||||
0x31,0x01, 0x28,0xE1, 0x31,0x02, 0x30,0xE1, 0x20,0xA0, 0x20,0xA0, 0x20,0xA0, 0x28,0xC1,
|
0x31,0x01, 0x28,0xE1, 0x31,0x02, 0x30,0xE1, 0x20,0xA0, 0x20,0xA0, 0x20,0xA0, 0x28,0xC1,
|
||||||
|
|
7
images.h
7
images.h
|
@ -20,6 +20,13 @@
|
||||||
#define LED1_Y_8875 68
|
#define LED1_Y_8875 68
|
||||||
#define LED2_Y_8875 117
|
#define LED2_Y_8875 117
|
||||||
|
|
||||||
|
#define LED_HEIGHT_9341 1
|
||||||
|
#define LED_WIDTH_9341 6
|
||||||
|
#define LED1_X_9341 125
|
||||||
|
#define LED2_X_9341 (125+135)
|
||||||
|
#define LED1_Y_9341 213
|
||||||
|
#define LED2_Y_9341 213
|
||||||
|
|
||||||
// These are the ABSTRACTED constants that AppleUI uses to tell the
|
// These are the ABSTRACTED constants that AppleUI uses to tell the
|
||||||
// display what it wants redrawn via drawUIImage(uint8_t imageIdx)
|
// display what it wants redrawn via drawUIImage(uint8_t imageIdx)
|
||||||
enum {
|
enum {
|
||||||
|
|
|
@ -44,6 +44,8 @@ SDLDisplay::SDLDisplay()
|
||||||
{
|
{
|
||||||
memset(videoBuffer, 0, sizeof(videoBuffer));
|
memset(videoBuffer, 0, sizeof(videoBuffer));
|
||||||
|
|
||||||
|
driveIndicator[0] = driveIndicator[1] = false;
|
||||||
|
|
||||||
shellImage = NULL;
|
shellImage = NULL;
|
||||||
d1OpenImage = d1ClosedImage = d2OpenImage = d2ClosedImage = NULL;
|
d1OpenImage = d1ClosedImage = d2OpenImage = d2ClosedImage = NULL;
|
||||||
appleImage = NULL;
|
appleImage = NULL;
|
||||||
|
@ -111,6 +113,30 @@ void SDLDisplay::drawUIImage(uint8_t imageIdx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SDLDisplay::drawDriveActivity(bool drive0, bool drive1)
|
||||||
|
{
|
||||||
|
if (drive0 != driveIndicator[0]) {
|
||||||
|
printf("change d0\n");
|
||||||
|
for (int y=0; y<LED_HEIGHT_8875; y++) {
|
||||||
|
for (int x=0; x<LED_WIDTH_8875; x++) {
|
||||||
|
// FIXME this isn't working, not sure why
|
||||||
|
drawPixel(x+LED1_X_8875, y+LED1_Y_8875, 0xFF, 0, 0); ///*drive0 ?*/ 0xFA00/* : 0x0000*/);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
driveIndicator[0] = drive0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (drive1 != driveIndicator[1]) {
|
||||||
|
for (int y=0; y<LED_HEIGHT_8875; y++) {
|
||||||
|
for (int x=0; x<LED_WIDTH_8875; x++) {
|
||||||
|
drawPixel(x+LED2_X_8875, y+LED2_Y_8875, drive0 ? 0xFA00 : 0x0000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
driveIndicator[1] = drive1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SDLDisplay::drawImageOfSizeAt(const uint8_t *img,
|
void SDLDisplay::drawImageOfSizeAt(const uint8_t *img,
|
||||||
uint16_t sizex, uint16_t sizey,
|
uint16_t sizex, uint16_t sizey,
|
||||||
uint16_t wherex, uint16_t wherey)
|
uint16_t wherex, uint16_t wherey)
|
||||||
|
@ -158,17 +184,13 @@ void SDLDisplay::drawPixel(uint16_t x, uint16_t y, uint16_t color)
|
||||||
g = (color & 0x7E0) >> 3,
|
g = (color & 0x7E0) >> 3,
|
||||||
b = (color & 0x1F) << 3;
|
b = (color & 0x1F) << 3;
|
||||||
|
|
||||||
for (int yoff=0; yoff<2; yoff++) {
|
putpixel(renderer, x, y, r, g, b);
|
||||||
putpixel(renderer, x, (y*2)+yoff, r, g, b);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLDisplay::drawPixel(uint16_t x, uint16_t y, uint8_t r, uint8_t g, uint8_t b)
|
void SDLDisplay::drawPixel(uint16_t x, uint16_t y, uint8_t r, uint8_t g, uint8_t b)
|
||||||
{
|
{
|
||||||
for (int yoff=0; yoff<2; yoff++) {
|
if (x < SDL_WIDTH && y < SDL_HEIGHT) {
|
||||||
if (x < SDL_WIDTH && y < SDL_HEIGHT) {
|
putpixel(renderer, x, y, r, g, b);
|
||||||
putpixel(renderer, x, (y*2)+yoff, r, g, b);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@ class SDLDisplay : public PhysicalDisplay {
|
||||||
virtual void flush();
|
virtual void flush();
|
||||||
|
|
||||||
virtual void drawUIImage(uint8_t imageIdx);
|
virtual void drawUIImage(uint8_t imageIdx);
|
||||||
|
virtual void drawDriveActivity(bool drive0, bool drive1);
|
||||||
|
|
||||||
virtual void drawImageOfSizeAt(const uint8_t *img, uint16_t sizex, uint16_t sizey, uint16_t wherex, uint16_t wherey);
|
virtual void drawImageOfSizeAt(const uint8_t *img, uint16_t sizex, uint16_t sizey, uint16_t wherex, uint16_t wherey);
|
||||||
|
|
||||||
virtual void drawPixel(uint16_t x, uint16_t y, uint16_t color);
|
virtual void drawPixel(uint16_t x, uint16_t y, uint16_t color);
|
||||||
|
@ -52,6 +54,8 @@ class SDLDisplay : public PhysicalDisplay {
|
||||||
uint8_t *d2ClosedImage;
|
uint8_t *d2ClosedImage;
|
||||||
uint8_t *appleImage;
|
uint8_t *appleImage;
|
||||||
uint16_t appleImageWidth, appleImageHeight;
|
uint16_t appleImageWidth, appleImageHeight;
|
||||||
|
|
||||||
|
bool driveIndicator[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -46,7 +46,6 @@ const uint16_t loresPixelColors[16] = { 0x0000, // 0 black
|
||||||
TeensyDisplay::TeensyDisplay()
|
TeensyDisplay::TeensyDisplay()
|
||||||
{
|
{
|
||||||
driveIndicator[0] = driveIndicator[1] = false;
|
driveIndicator[0] = driveIndicator[1] = false;
|
||||||
driveIndicatorDirty = true;
|
|
||||||
|
|
||||||
shellImage = NULL;
|
shellImage = NULL;
|
||||||
d1OpenImage = d1ClosedImage = d2OpenImage = d2ClosedImage = NULL;
|
d1OpenImage = d1ClosedImage = d2OpenImage = d2ClosedImage = NULL;
|
||||||
|
@ -158,27 +157,24 @@ void TeensyDisplay::drawUIImage(uint8_t imageIdx)
|
||||||
|
|
||||||
void TeensyDisplay::drawDriveActivity(bool drive0, bool drive1)
|
void TeensyDisplay::drawDriveActivity(bool drive0, bool drive1)
|
||||||
{
|
{
|
||||||
// FIXME port constants for 9341
|
// FIXME this could be much more efficient; it's doing a lot of checking use8875 in the middle of a loop
|
||||||
|
|
||||||
if (drive0 != driveIndicator[0]) {
|
if (drive0 != driveIndicator[0]) {
|
||||||
if (use8875) {
|
for (int y=0; y<(use8875 ? LED_HEIGHT_8875 : LED_HEIGHT_9341); y++) {
|
||||||
for (int y=0; y<LED_HEIGHT_8875; y++) {
|
for (int x=0; x<(use8875 ? LED_WIDTH_8875 : LED_WIDTH_9341); x++) {
|
||||||
for (int x=0; x<LED_WIDTH_8875; x++) {
|
drawPixel(x+(use8875 ? LED1_X_8875 : LED1_X_9341), y+(use8875 ? LED1_Y_8875 : LED1_Y_9341), drive0 ? 0xFA00 : 0x0000);
|
||||||
drawPixel(x+LED1_X_8875, y+LED1_Y_8875, drive0 ? 0xFA00 : 0x0000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
driveIndicator[0] = drive0;
|
driveIndicator[0] = drive0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drive1 != driveIndicator[1]) {
|
if (drive1 != driveIndicator[1]) {
|
||||||
if (use8875) {
|
for (int y=0; y<(use8875 ? LED_HEIGHT_8875 : LED_HEIGHT_9341); y++) {
|
||||||
for (int y=0; y<LED_HEIGHT_8875; y++) {
|
for (int x=0; x<(use8875 ? LED_WIDTH_8875 : LED_WIDTH_9341); x++) {
|
||||||
for (int x=0; x<LED_WIDTH_8875; x++) {
|
drawPixel(x+(use8875 ? LED2_X_8875 : LED2_X_9341), y+(use8875 ? LED2_Y_8875 : LED2_Y_9341), drive0 ? 0xFA00 : 0x0000);
|
||||||
drawPixel(x+LED2_X_8875, y+LED2_Y_8875, drive1 ? 0xFA00 : 0x0000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// FIXME also 9341
|
|
||||||
driveIndicator[1] = drive1;
|
driveIndicator[1] = drive1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,7 @@ class TeensyDisplay : public PhysicalDisplay {
|
||||||
virtual void drawPixel(uint16_t x, uint16_t y, uint16_t color);
|
virtual void drawPixel(uint16_t x, uint16_t y, uint16_t color);
|
||||||
virtual void drawPixel(uint16_t x, uint16_t y, uint8_t r, uint8_t g, uint8_t b);
|
virtual void drawPixel(uint16_t x, uint16_t y, uint8_t r, uint8_t g, uint8_t b);
|
||||||
|
|
||||||
bool needsRedraw;
|
|
||||||
bool driveIndicator[2];
|
bool driveIndicator[2];
|
||||||
bool driveIndicatorDirty;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const uint8_t *shellImage;
|
const uint8_t *shellImage;
|
||||||
|
|
Loading…
Reference in New Issue