Wide-pixel mode

Question to @spinal and @FManga

Could you collaborate on a 110x176 mode? I have use for it, I know @spinal is doing something. But I’d like to use 110x176x256 also for an idea but I have no time to develop the screenmode. Or perhaps @dmarschal could also pitch in?

110x176x256? Wouldn’t that need a huge buffer?
I went with 110x176x16 so that I could use the same buffer as mode13.

I guess the buffer is as big as the one used in mode 15 (220x176x16) so it is possible…

The idea I have in mind requires an alpha channel (256 levels of opacity) so 16 colors is not enough. Maybe.

how about 4 or 8 levels of opacity? have you considered something like masks but stacked up to mix the colour at draw time?

Well, I think both wide pixel modes would be nice to have, 8-bit (256) and 4-bit (16)

I was planning on using colour ramps for lighting effects. In 16 colors you can get 4x4 ramps so I guess its ok.

@jonne: Check your PRs :wink:

2 Likes

I don’t really want to derail this thread, but I noticed on my mixed mode screen update, I seem to be 1 pixel out when rendering the screen. This applies to all 3 of my modes (110x88, 110x176 and 220x176). Can anyone see here what I’m doing wrong?
I only noticed when I put a single pixel border around my images.

You haven’t updated your PokittoLib in a while.
If you prefer patching it, replace TGL_WR/TGL_WR_OP in HWLCD.h with these:

#define TGL_WR_OP(OP)							\
  LPC_GPIO_PORT->CLR[LCD_WR_PORT] = 1 << LCD_WR_PIN;			\
  OP;									\
  LPC_GPIO_PORT->SET[LCD_WR_PORT] = 1 << LCD_WR_PIN;			

#define TGL_WR								\
  LPC_GPIO_PORT->CLR[LCD_WR_PORT] = 1 << LCD_WR_PIN;			\
  __asm("nop");								\
  LPC_GPIO_PORT->SET[LCD_WR_PORT] = 1 << LCD_WR_PIN;			

1 Like

Cool, thanks. I thought I had a quite recent version, maybe not.

1 Like

I would like to add a font overlay to wide pixel mode, sot hat I can keep a hi-res font. Is it possible to draw the Display::font in HWLCD.cpp instead of PokittoDisplay.cpp ?
Somehow add it to –

if(subMode==1){ /* 110x176x4bpp */

        uint32_t x,y;
        uint32_t scanline[110]; // read two nibbles = pixels at a time
        uint8_t *d;

        write_command(0x03); write_data(0x1038);
        write_command(0x20);  // Horizontal DRAM Address
        write_data(0);  // 0
        write_command(0x21);  // Vertical DRAM Address
        write_data(0);
        write_command(0x22); // write data to DRAM
        CLR_CS_SET_CD_RD_WR;
        SET_MASK_P2;
        volatile uint32_t *LCD = reinterpret_cast< volatile uint32_t * >(0xA0002188);

        d = scrbuf;// point to beginning of line in data
          for(y=0;y<176;y++)
          {

            /** find colours in one scanline **/
            uint8_t s=0;
            for(x=0;x<110;)
            {
              uint8_t t = *d++;
              uint32_t color;

              color = uint32_t(paletteptr[t>>4])<<3;   scanline[s++]=color; x++;
              color = uint32_t(paletteptr[t&0xF])<<3;  scanline[s++]=color; x++;
              t = *d++;
              color = uint32_t(paletteptr[t>>4])<<3;   scanline[s++]=color; x++;
              color = uint32_t(paletteptr[t&0xF])<<3;  scanline[s++]=color; x++;
              t = *d++;
              color = uint32_t(paletteptr[t>>4])<<3;   scanline[s++]=color; x++;
              color = uint32_t(paletteptr[t&0xF])<<3;  scanline[s++]=color; x++;
              t = *d++;
              color = uint32_t(paletteptr[t>>4])<<3;   scanline[s++]=color; x++;
              color = uint32_t(paletteptr[t&0xF])<<3;  scanline[s++]=color; x++;
              t = *d++;
              color = uint32_t(paletteptr[t>>4])<<3;   scanline[s++]=color; x++;
              color = uint32_t(paletteptr[t&0xF])<<3;  scanline[s++]=color; x++;
              t = *d++;
              color = uint32_t(paletteptr[t>>4])<<3;   scanline[s++]=color; x++;
              color = uint32_t(paletteptr[t&0xF])<<3;  scanline[s++]=color; x++;
              t = *d++;
              color = uint32_t(paletteptr[t>>4])<<3;   scanline[s++]=color; x++;
              color = uint32_t(paletteptr[t&0xF])<<3;  scanline[s++]=color; x++;
              t = *d++;
              color = uint32_t(paletteptr[t>>4])<<3;   scanline[s++]=color; x++;
              color = uint32_t(paletteptr[t&0xF])<<3;  scanline[s++]=color; x++;
              t = *d++;
              color = uint32_t(paletteptr[t>>4])<<3;   scanline[s++]=color; x++;
              color = uint32_t(paletteptr[t&0xF])<<3;  scanline[s++]=color; x++;
              t = *d++;
              color = uint32_t(paletteptr[t>>4])<<3;   scanline[s++]=color; x++;
              color = uint32_t(paletteptr[t&0xF])<<3;  scanline[s++]=color; x++;
              t = *d++;
              color = uint32_t(paletteptr[t>>4])<<3;   scanline[s++]=color; x++;
              color = uint32_t(paletteptr[t&0xF])<<3;  scanline[s++]=color; x++;
            }

            s=0;
            for (s=0;s<110;) {
              *LCD = (scanline[s]);TGL_WR;TGL_WR;s++;
              *LCD = (scanline[s]);TGL_WR;TGL_WR;s++;
              *LCD = (scanline[s]);TGL_WR;TGL_WR;s++;
              *LCD = (scanline[s]);TGL_WR;TGL_WR;s++;
              *LCD = (scanline[s]);TGL_WR;TGL_WR;s++;
              *LCD = (scanline[s]);TGL_WR;TGL_WR;s++;
              *LCD = (scanline[s]);TGL_WR;TGL_WR;s++;
              *LCD = (scanline[s]);TGL_WR;TGL_WR;s++;
              *LCD = (scanline[s]);TGL_WR;TGL_WR;s++;
              *LCD = (scanline[s]);TGL_WR;TGL_WR;s++;
              *LCD = (scanline[s]);TGL_WR;TGL_WR;s++;
            }

          }

         CLR_MASK_P2;
} // subMode 1

It would be faster/easier to use a hi-res mode and use a drawBitmapData variant that stretches your graphics.
Wouldn’t it produce the same effect?

Higher resolution would need a bigger buffer. I feel an extra 22x27 bytes is more acceptable than an extra 110x176.