got it working, last catch was lsb to msb conversion (did via table, named M2L in code below)
function createFont(off,bs,w,h,c,isprop){
var ptr=0x60000000+off;
var f=require("Flash");
var hbytes=h>>3;
var bmp=new Uint8Array(w*hbytes*c);
var widths=isprop ? Uint8Array(c) : w;
var bmpidx=0;
for (var i=0;i<c;i++){
var buff=f.read(bs,ptr+i*bs);
var wprop=w;
if (isprop){wprop=1+buff[0];widths[i]=wprop;buff[0]=0;}
var x,y;bi=0;
for(y=0;y<hbytes;y++){
for(x=0;x<wprop;x++)
bmp[bmpidx+x*hbytes+y]=M2L[buff[bi+x]];
bi+=w;
}
bmpidx+=wprop*hbytes;
E.kickWatchdog();
}
if (isprop){
return { font: E.toString(Uint8Array(bmp.buffer,0,bmpidx)), widths: E.toString(widths)};
}
return { font: E.toString(bmp), widths: w};
}
however the code is a bit slow for fonts with more characters so I need to ping the watchdog
and BTW found out that GT24L24A2Y is otherwise pretty normal 2MB SPI flash that I can write and erase and space over 0x1A3000 is empty so I could perhaps convert those fonts once and write back in better format to load them directly next time
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
got it working, last catch was lsb to msb conversion (did via table, named M2L in code below)
then to set font https://github.com/RichardBsolut/GT24L24A2Y#font-clock-2-34x48 I use it like
however the code is a bit slow for fonts with more characters so I need to ping the watchdog
and BTW found out that GT24L24A2Y is otherwise pretty normal 2MB SPI flash that I can write and erase and space over 0x1A3000 is empty so I could perhaps convert those fonts once and write back in better format to load them directly next time