Hmm, I tried to figure out, how to use graphicsInternal, .....
and found only something in lcd_st7789-8bit where setPixel is not set again.
Next try was to add JSGRAPHICSTYPE_OTHERS in JsGraphicsType (graphics.h)
and an if-statement in graphicsSetCallbacks(graphics.c) to skip xxxSetCallbacks.
In my own driver, this worked fine, but in all functions from jswrap_graphics(for example setPixel) I've got runtime error. Looks to me like setCallback is necessary (?)
My actual solution for my problem is to add a weak function for JSGRAPHICSTYPE_OTHERS, which can be overroled in my driver. My driver for ILI9341 now is much faster compared to JS-solution.
See following sources.
If this is of interest for Espruino, I would create a pull request.
graphics.h:
typedef enum {
JSGRAPHICSTYPE_ARRAYBUFFER, ///< Write everything into an ArrayBuffer
JSGRAPHICSTYPE_JS, ///< Call JavaScript when we want to write something
JSGRAPHICSTYPE_FSMC, ///< FSMC (or fake FSMC) ILI9325 16bit-wide LCDs
JSGRAPHICSTYPE_SDL, ///< SDL graphics library for linux
JSGRAPHICSTYPE_SPILCD, ///< SPI LCD library
JSGRAPHICSTYPE_ST7789_8BIT, ///< ST7789 in 8 bit mode
JSGRAPHICSTYPE_MEMLCD, ///< Memory LCD
JSGRAPHICSTYPE_LCD_SPI_UNBUF, ///< LCD SPI unbuffered 16 bit driver
JSGRAPHICSTYPE_OTHERS ///< Driver that support callbacks only
} JsGraphicsType;
bool graphicsSetCallbacksOthers(JsGraphics *gfx);
graphics.c:
/// Set up the callbacks for this graphics instance (usually done by graphicsGetFromVar)
__attribute__((weak))bool graphicsSetCallbacksOthers(JsGraphics *gfx){
return false;
}
bool graphicsSetCallbacks(JsGraphics *gfx) {
if(gfx->data.type >= JSGRAPHICSTYPE_OTHERS){
return graphicsSetCallbacksOthers(gfx);
}
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.
Hmm, I tried to figure out, how to use graphicsInternal, .....
and found only something in lcd_st7789-8bit where setPixel is not set again.
Next try was to add JSGRAPHICSTYPE_OTHERS in JsGraphicsType (graphics.h)
and an if-statement in graphicsSetCallbacks(graphics.c) to skip xxxSetCallbacks.
In my own driver, this worked fine, but in all functions from jswrap_graphics(for example setPixel) I've got runtime error. Looks to me like setCallback is necessary (?)
My actual solution for my problem is to add a weak function for JSGRAPHICSTYPE_OTHERS, which can be overroled in my driver. My driver for ILI9341 now is much faster compared to JS-solution.
See following sources.
If this is of interest for Espruino, I would create a pull request.
graphics.h:
graphics.c:
Last not least in myOwnDriver.c: