• 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.


    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);


    /// 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);

    Last not least in myOwnDriver.c:

    bool graphicsSetCallbacksOthers(JsGraphics *gfx){
      gfx->setPixel = myOwnCallbackSetPixel;
      gfx->fillRect = myOwnCallbackFillRect;
      return true;

Avatar for JumJum @JumJum started