I’ve seen in another thread (the only one about the 128x128 i could found) in they were complaining that they couldnt “write to pixel”, but write to the ram, and the controller would draw them, thus agreeing in what you said and i dont know if thats good or bad though. It is stated on the DS that it has “programable framerate”, though i cant find on the datasheet how to achieve that.
I found out too that it supports 256 color mode, that would mean that only one byte would be used on the transfer?
As for the adafruit one ive seen that it has an “hardware accelerated drawing” that help drawing lines, squares, etc… That feature would help?
As i will try to port the existing raycast code, the author, after casting the rays he calls this function:
OLED_Slice(ray,SCREEN_HEIGHT,buffer,(u8*)palette);
Which is a wrapper to another function
void OLED_Slice(u8 x, u8 height, u8* buffer, u8 *palette)
{
FillBlit(0,height,buffer,palette);
}
And fillBlit
void FillBlit(u32 color, u32 count, const u8* data = 0, const u8* palette = 0)
{
SPSR |= 1; // 2x clock
u8 a,b;
// Handle 16 bit blits and index mode
signed char x = 0;
u8 y;
const u8* p = 0;
if (data)
{
a = *data++;
x = 1;
if (palette)
{
p = palette + (a << 1);
a = pgm_read_byte(&p[0]);
b = pgm_read_byte(&p[1]);
x = -1;
y = 0;
}
}
else
{
a = color >> 8;
b = color;
}
count <<= 1;
int loop = count >> 8;
u8 c = count;
if (c)
loop++;
SPCR = _BV(MSTR) | _BV(SPE); // SPI Master ... get it?
while (loop)
{
// up to 256 per loop
for (;;)
{
SPDR = a; // Now we have 16 clocks to kill
// 16 clocks to do fill, blit or indexed blit
// Indexed blit - 380k
if (x < 0)
{
if ((y^=1))
{
a = b;
p = palette + ((*data++) << 1);
if (--c)
continue; // Early out
} else {
#ifdef OLED96 // shameful hack TODO
a = p[0];
b = p[1];
nop();
nop();
#else
a = pgm_read_byte(&p[0]);
b = pgm_read_byte(&p[1]);
#endif
if (--c)
continue; // Early out
}
break;
}
if (x)
{
// Blit
a = *data++;
nop();
nop(); // 400k
}
else
{
// Solid Fill
u8 t = a; // swap pixel halves
a = b;
b = t;
nop();
nop(); // 400k
}
if (!--c)
break; // 5
}; // loop takes 3 clocks
c = 0;
loop--;
while (!(SPSR & _BV(SPIF))); // wait for last pixel
}
SPCR = 0;
}
This last function im not certain of what it does, i think it fills a buffer of a single slice of raycast, maybe im wrong, so i think i would have to make it write to the controllers RAM.