Jump to content

crteensy

Members
  • Posts

    111
  • Joined

  • Last visited

Posts posted by crteensy

  1. When implementing send_data(uint16_t data) for the ILI9341, is it supposed to send just 8 bits? If so, should the 8 MSBs or the 8 LSBs be sent?

    The encoding of the comments for that function and write_index() seems to be broken.

    and please please please turn off that filter:

    The following words in your search query were ignored because they are too common words: ili9341

    Regards,

    Christoph

  2. I tried to convert a ttf font file using the online converter both as bit font and as RLE font, with the custom range 'H'-'H' (only one character). I want the glyph to be about 96x96 pixels, so I had to pick 168 pt for the font size. Compiling resulted in the following error:

    logo_cropped_1_font168_rle.c:11:2: error: #error The font file is not compatible with this version of mcufont.

    What can I do?

    Attaching the ttf was not possible because the extension ttf seems to be forbidden.

  3. When compiling for teensyduino (os=arduino, arm-gcc) I get an error for a typedef:

    "/home/buffi/builds/arduino/arduino-1.6.6/hardware/tools/avr/../arm/bin/arm-none-eabi-gcc" -c -O -g -Wall -ffunction-sections -fdata-sections -MMD -nostdlib  -mthumb -mcpu=cortex-m4 -fsingle-precision-constant -D__MK20DX256__ -DTEENSYDUINO=126 -DARDUINO=10606 -DF_CPU=96000000 -DARDUINO_ARCH_AVR -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-I/home/buffi/builds/arduino/arduino-1.6.6/hardware/teensy/avr/cores/teensy3" "-I/home/buffi/Arduino/libraries/teensy3.1-ssd1351-ugfx-config" "-I/home/buffi/Arduino/libraries/ugfx-arduino" "-I/home/buffi/Arduino/libraries/ugfx-ssd1351" "-I/home/buffi/Arduino/libraries/ugfx-repo" "/home/buffi/Arduino/libraries/ugfx-arduino/ugfx-arduino.c" -o "/tmp/build4292d6e9cc31a53e6836e8e33f99359d.tmp/libraries/ugfx-arduino/ugfx-arduino.c.o"
    In file included from /home/buffi/Arduino/libraries/ugfx-repo/src/../src/gos/gos.h:476:0,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/../gfx.h:191,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/gfx.c:16,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/gfx_mk.c:8,
    from /home/buffi/Arduino/libraries/ugfx-arduino/ugfx-arduino.c:1:
    /home/buffi/Arduino/libraries/ugfx-repo/src/../src/gos/gos_arduino.h:34:1: error: unknown type name 'bool'
    typedef bool bool_t;

    third line from end: ugfx-arduino.c includes ugfx/src/gfx_mk.c and does nothing else.

    gos_arduino.h has this typedef (line 34):

    typedef bool	bool_t;

    bool, however, is a C++ type and a strict compiler doesn't know it when compiling C code, which gfx_mk is. Turning ugfx-arduino.c into a C++ file by chaning the extension doesn't solve the problem:

    In file included from /home/buffi/Arduino/libraries/ugfx-repo/src/gos/gos_mk.c:8:0,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/gfx_mk.c:9,
    from /home/buffi/Arduino/libraries/ugfx-arduino/ugfx-arduino.cpp:1:
    /home/buffi/Arduino/libraries/ugfx-repo/src/gos/gos_arduino.c:28:4: warning: #warning "GOS: Arduino - Make sure you initialize your hardware and the C runtime before calling gfxInit() in your application!" [-Wcpp]
    #warning "GOS: Arduino - Make sure you initialize your hardware and the C runtime before calling gfxInit() in your application!"
    ^
    In file included from /home/buffi/Arduino/libraries/ugfx-repo/src/gos/gos_mk.c:18:0,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/gfx_mk.c:9,
    from /home/buffi/Arduino/libraries/ugfx-arduino/ugfx-arduino.cpp:1:
    /home/buffi/Arduino/libraries/ugfx-repo/src/gos/gos_x_threads.c: In function 'void _gfxXSwitch(thread*, thread*, bool_t)':
    /home/buffi/Arduino/libraries/ugfx-repo/src/gos/gos_x_threads.c:378:25: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
    if (CXT_SAVE(oldt->cxt)) return;
    ^
    In file included from /home/buffi/builds/arduino/arduino-1.6.6/hardware/tools/arm/arm-none-eabi/include/stdlib.h:11:0,
    from /home/buffi/builds/arduino/arduino-1.6.6/hardware/teensy/avr/cores/teensy3/WProgram.h:4,
    from /home/buffi/builds/arduino/arduino-1.6.6/hardware/teensy/avr/cores/teensy3/Arduino.h:1,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/../src/gos/gos_arduino.h:28,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/../src/gos/gos.h:476,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/../gfx.h:191,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/gfx.c:16,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/gfx_mk.c:8,
    from /home/buffi/Arduino/libraries/ugfx-arduino/ugfx-arduino.cpp:1:
    /home/buffi/builds/arduino/arduino-1.6.6/hardware/tools/arm/arm-none-eabi/include/setjmp.h:15:5: error: initializing argument 1 of 'int setjmp(int*)' [-fpermissive]
    int _EXFUN(setjmp,(jmp_buf __jmpb));
    ^
    In file included from /home/buffi/Arduino/libraries/ugfx-repo/src/gos/gos_mk.c:18:0,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/gfx_mk.c:9,
    from /home/buffi/Arduino/libraries/ugfx-arduino/ugfx-arduino.cpp:1:
    /home/buffi/Arduino/libraries/ugfx-repo/src/gos/gos_x_threads.c:385:26: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
    if (CXT_SAVE(newt->cxt)) {
    ^
    In file included from /home/buffi/builds/arduino/arduino-1.6.6/hardware/tools/arm/arm-none-eabi/include/stdlib.h:11:0,
    from /home/buffi/builds/arduino/arduino-1.6.6/hardware/teensy/avr/cores/teensy3/WProgram.h:4,
    from /home/buffi/builds/arduino/arduino-1.6.6/hardware/teensy/avr/cores/teensy3/Arduino.h:1,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/../src/gos/gos_arduino.h:28,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/../src/gos/gos.h:476,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/../gfx.h:191,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/gfx.c:16,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/gfx_mk.c:8,
    from /home/buffi/Arduino/libraries/ugfx-arduino/ugfx-arduino.cpp:1:
    /home/buffi/builds/arduino/arduino-1.6.6/hardware/tools/arm/arm-none-eabi/include/setjmp.h:15:5: error: initializing argument 1 of 'int setjmp(int*)' [-fpermissive]
    int _EXFUN(setjmp,(jmp_buf __jmpb));
    ^
    In file included from /home/buffi/Arduino/libraries/ugfx-repo/src/gos/gos_mk.c:18:0,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/gfx_mk.c:9,
    from /home/buffi/Arduino/libraries/ugfx-arduino/ugfx-arduino.cpp:1:
    /home/buffi/Arduino/libraries/ugfx-repo/src/gos/gos_x_threads.c:403:27: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
    CXT_RESTORE(newt->cxt, 1);
    ^
    In file included from /home/buffi/builds/arduino/arduino-1.6.6/hardware/tools/arm/arm-none-eabi/include/stdlib.h:11:0,
    from /home/buffi/builds/arduino/arduino-1.6.6/hardware/teensy/avr/cores/teensy3/WProgram.h:4,
    from /home/buffi/builds/arduino/arduino-1.6.6/hardware/teensy/avr/cores/teensy3/Arduino.h:1,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/../src/gos/gos_arduino.h:28,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/../src/gos/gos.h:476,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/../gfx.h:191,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/gfx.c:16,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/gfx_mk.c:8,
    from /home/buffi/Arduino/libraries/ugfx-arduino/ugfx-arduino.cpp:1:
    /home/buffi/builds/arduino/arduino-1.6.6/hardware/tools/arm/arm-none-eabi/include/setjmp.h:14:6: error: initializing argument 1 of 'void longjmp(int*, int)' [-fpermissive]
    void _EXFUN(longjmp,(jmp_buf __jmpb, int __retval));
    ^
    In file included from /home/buffi/Arduino/libraries/ugfx-repo/src/gos/gos_mk.c:18:0,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/gfx_mk.c:9,
    from /home/buffi/Arduino/libraries/ugfx-arduino/ugfx-arduino.cpp:1:
    /home/buffi/Arduino/libraries/ugfx-repo/src/gos/gos_x_threads.c: In function 'threadreturn_t gfxThreadWait(gfxThreadHandle)':
    /home/buffi/Arduino/libraries/ugfx-repo/src/gos/gos_x_threads.c:650:4: error: invalid conversion from 'gfxThreadHandle {aka void*}' to 'thread*' [-fpermissive]
    t = th;
    ^
    In file included from /home/buffi/Arduino/libraries/ugfx-repo/src/gdriver/gdriver.c:12:0,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/gdriver/gdriver_mk.c:8,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/gfx_mk.c:10,
    from /home/buffi/Arduino/libraries/ugfx-arduino/ugfx-arduino.cpp:1:
    /home/buffi/Arduino/libraries/ugfx-repo/src/gdriver/gdriver.h: At global scope:
    /home/buffi/Arduino/libraries/ugfx-repo/src/gdriver/gdriver.h:90:33: error: duplicate 'const'
    typedef const struct GDriverVMT const GDriverVMTList[1];
    ^
    In file included from /home/buffi/Arduino/libraries/ugfx-repo/src/gdriver/gdriver_mk.c:8:0,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/gfx_mk.c:10,
    from /home/buffi/Arduino/libraries/ugfx-arduino/ugfx-arduino.cpp:1:
    /home/buffi/Arduino/libraries/ugfx-repo/src/gdriver/gdriver.c: In function 'GDriver* gdriverRegister(const GDriverVMT*, void*)':
    /home/buffi/Arduino/libraries/ugfx-repo/src/gdriver/gdriver.c:45:28: error: invalid conversion from 'void*' to 'GDriver*' [-fpermissive]
    pd = gfxAlloc(vmt->objsize);
    ^
    In file included from /home/buffi/Arduino/libraries/ugfx-repo/src/gdisp/gdisp_mk.c:21:0,
    from /home/buffi/Arduino/libraries/ugfx-repo/src/gfx_mk.c:12,
    from /home/buffi/Arduino/libraries/ugfx-arduino/ugfx-arduino.cpp:1:
    /home/buffi/Arduino/libraries/ugfx-repo/src/gdisp/gdisp.c: In function 'void _gdispInit()':
    /home/buffi/Arduino/libraries/ugfx-repo/src/gdisp/gdisp.c:585:26: error: duplicate 'const'
    extern const GDISPVMT const GDISPVMT_OnlyOne[1];
    ^

    Tons of invalid pointer-to-pointer conversion errors.

    I got better results when compiling for os RAW32. In that case only a few utility functions aren't known to the linker (like gfxSleepMilliseconds). RAW32 uses unsigned char as bool_t. Using unsigned char as bool_t in gos_arduino.h seems to be fine, the code compiles. I haven't tested it with hardware yet.

    So there should be a way of either using gfx_mk.c included in a C++ file to get access to bool, or change the bool_t typedef for os arduino.

    Regards

    Christoph

  4. I've tried it and it basically works (compiles, that is). However, in order to be able to keep ugfx configurations for different projects separated, Arduino must be tricked into selecting the right "installation" of ugfx. Some remarks about that are here (posts #20 and #21): https://forum.pjrc.com/threads/26535-uG ... #post88929

    It might be possible to make an even cleaner approach by separating ugfx from a project-specific configuration and the low-level drivers. I'll try that later.

    Regards

    Christoph

  5. Hi,

    I checked out ugfx yesterday and first tried the new "single file" mode of compilation, which worked great. Thanks for that! However, some problems:

    • I'm compiling for an STM32F030F4P6, which has only 16kB flash. With ugfx 2.3, it's almost full. With the latest github (checked out 20150615) I can't squeeze it below some 70 kB (!). It's well possible that there's something wrong with my compiler and linker setup, though, but it happens when compiling ugfx as a single file and in the "old" way with many individual source files.
    • When including ugfx in a C++ project, it redefines types such as uint16_t. I had to comment that out. With 2.3, I could solve that by simply rearranging headers, but not any more. I found a suspicious commit here: https://bitbucket.org/Tectu/ugfx/diff/src/gos/gos_raw32.h?diff2=81850ade15e7&at=master.

    Regards

    Christoph

  6. So here's my gdispGSetClip():

    #if GDISP_NEED_CLIP || GDISP_NEED_VALIDATION
    void gdispGSetClip(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy) {
    MUTEX_ENTER(g);

    // Best is using hardware clipping
    #if GDISP_HARDWARE_CLIP
    #if GDISP_HARDWARE_CLIP == HARDWARE_AUTODETECT
    if (gvmt(g)->setclip)
    #endif
    {
    g->p.x = x;
    g->p.y = y;
    g->p.cx = cx;
    g->p.cy = cy;
    gdisp_lld_set_clip(g);
    }
    #if GDISP_HARDWARE_CLIP == HARDWARE_AUTODETECT
    else
    #endif
    #endif

    // Worst is using software clipping
    #if GDISP_HARDWARE_CLIP != TRUE
    {
    if (x < 0) { cx += x; x = 0; }
    if (y < 0) { cy += y; y = 0; }
    /** MODIFIED BY CHRISTOPH **/
    // if (cx <= 0 || cy <= 0 || x >= g->g.Width || y >= g->g.Height) { MUTEX_EXIT(g); return; }
    if (cx < 0 || cy < 0 || x >= g->g.Width || y >= g->g.Height) { MUTEX_EXIT(g); return; }
    g->clipx0 = x;
    g->clipy0 = y;
    g->clipx1 = x+cx; if (g->clipx1 > g->g.Width) g->clipx1 = g->g.Width;
    g->clipy1 = y+cy; if (g->clipy1 > g->g.Height) g->clipy1 = g->g.Height;
    }
    #endif
    MUTEX_EXIT(g);
    }
    #endif

    And my test code:

    #include "gfx.h"
    void draw()
    {
    static font_t font = gdispOpenFont("UI2 Narrow");
    if(font == NULL)
    {
    printf("could not open font\n");
    while(1);
    }
    coord_t width = gdispGGetWidth(GDISP);
    coord_t height = gdispGGetHeight(GDISP);
    gdispGDrawPixel(GDISP, -10, -10, Black); // off screen
    gdispGDrawPixel(GDISP, 10, 10, Black); // on screen
    gdispGDrawPixel(GDISP, width, height, Black); // off screen

    // lines, on screen
    coord_t x0 = 20, y0 = 20;
    gdispGDrawLine(GDISP, x0, y0, x0+14, y0-0, Black);
    gdispGDrawLine(GDISP, x0, y0, x0+10, y0-10, Black);
    gdispGDrawLine(GDISP, x0, y0, x0+0, y0-14, Black);
    gdispGDrawLine(GDISP, x0, y0, x0-10, y0-10, Black);
    gdispGDrawLine(GDISP, x0, y0, x0-14, y0-0, Black);
    gdispGDrawLine(GDISP, x0, y0, x0-10, y0+10, Black);
    gdispGDrawLine(GDISP, x0, y0, x0-0, y0+14, Black);
    gdispGDrawLine(GDISP, x0, y0, x0+10, y0+10, Black);

    // lines, off screen
    x0 = -20; y0 = -20;
    gdispGDrawLine(GDISP, x0, y0, x0+14, y0-0, Black);
    gdispGDrawLine(GDISP, x0, y0, x0+10, y0-10, Black);
    gdispGDrawLine(GDISP, x0, y0, x0+0, y0-14, Black);
    gdispGDrawLine(GDISP, x0, y0, x0-10, y0-10, Black);
    gdispGDrawLine(GDISP, x0, y0, x0-14, y0-0, Black);
    gdispGDrawLine(GDISP, x0, y0, x0-10, y0+10, Black);
    gdispGDrawLine(GDISP, x0, y0, x0-0, y0+14, Black);
    gdispGDrawLine(GDISP, x0, y0, x0+10, y0+10, Black);

    // lines, off screen
    x0 = width+20; y0 = height+20;
    gdispGDrawLine(GDISP, x0, y0, x0+14, y0-0, Black);
    gdispGDrawLine(GDISP, x0, y0, x0+10, y0-10, Black);
    gdispGDrawLine(GDISP, x0, y0, x0+0, y0-14, Black);
    gdispGDrawLine(GDISP, x0, y0, x0-10, y0-10, Black);
    gdispGDrawLine(GDISP, x0, y0, x0-14, y0-0, Black);
    gdispGDrawLine(GDISP, x0, y0, x0-10, y0+10, Black);
    gdispGDrawLine(GDISP, x0, y0, x0-0, y0+14, Black);
    gdispGDrawLine(GDISP, x0, y0, x0+10, y0+10, Black);

    // circle, on screen
    x0 = 50; y0 = 20;
    gdispGDrawCircle(GDISP, x0, y0, 14, Black);
    // circle, off screen
    x0 = -50; y0 = -20;
    gdispGDrawCircle(GDISP, x0, y0, 14, Black);
    // circle, off screen
    x0 = width+50; y0 = height+20;
    gdispGDrawCircle(GDISP, x0, y0, 14, Black);

    // string, on screen
    x0 = 80; y0 = 20;
    gdispGDrawString(GDISP, x0, y0, "asdf", font, Black);
    // string, off screen
    x0 = -80; y0 = -20;
    gdispGDrawString(GDISP, x0, y0, "asdf", font, Black);
    // string, off screen
    x0 = width+80; y0 = height+20;
    gdispGDrawString(GDISP, x0, y0, "asdf", font, Black);

    // filled string, on screen
    x0 = 120; y0 = 20;
    gdispGFillString(GDISP, x0, y0, "asdf", font, Black, Green);
    // filled string, off screen
    x0 = -120; y0 = -20;
    gdispGFillString(GDISP, x0, y0, "asdf", font, Black, Green);
    // filled string, off screen
    x0 = width+120; y0 = height+20;
    gdispGFillString(GDISP, x0, y0, "asdf", font, Black, Green);

    }

    int main(int argc, char** argv)
    {
    gfxInit();
    gdispClear(White);
    while(1)
    {
    gdispGUnsetClip(GDISP);
    draw();
    gdispGSetClip(GDISP, 50, 50, 0, 0);
    draw();

    printf("not crashed yet\n");
    gfxSleepMilliseconds(100);
    }
    }

    and the output is

    not crashed yet
    not crashed yet
    not crashed yet
    not crashed yet
    not crashed yet
    (... and so on ...)

    Basically everything that uses drawpixel_clip() seems to work fine, as well as the string drawing function I've tested. This is really just a tiny bit of coverage, but it's promising given that so many functions just use drawpixel_clip() to draw pixels.

    Regards

    Christoph

  7. In src/gdisp/gdisp.c:

    #if GDISP_NEED_CLIP || GDISP_NEED_VALIDATION
    void gdispGSetClip(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy) {
    MUTEX_ENTER(g);

    // Best is using hardware clipping
    #if GDISP_HARDWARE_CLIP
    #if GDISP_HARDWARE_CLIP == HARDWARE_AUTODETECT
    if (gvmt(g)->setclip)
    #endif
    {
    g->p.x = x;
    g->p.y = y;
    g->p.cx = cx;
    g->p.cy = cy;
    gdisp_lld_set_clip(g);
    }
    #if GDISP_HARDWARE_CLIP == HARDWARE_AUTODETECT
    else
    #endif
    #endif

    // Worst is using software clipping
    #if GDISP_HARDWARE_CLIP != TRUE
    {
    if (x < 0) { cx += x; x = 0; }
    if (y < 0) { cy += y; y = 0; }
    if (cx <= 0 || cy <= 0 || x >= g->g.Width || y >= g->g.Height) { MUTEX_EXIT(g); return; }
    g->clipx0 = x;
    g->clipy0 = y;
    g->clipx1 = x+cx; if (g->clipx1 > g->g.Width) g->clipx1 = g->g.Width;
    g->clipy1 = y+cy; if (g->clipy1 > g->g.Height) g->clipy1 = g->g.Height;
    }
    #endif
    MUTEX_EXIT(g);
    }
    #endif

    As I understand it, the software clipping does not clip at all when cx or cy is zero. Why? Any why does hardware clipping not check for zero width/height? I'm in a situation where the intersection of two rectangles is the clipping region, which may be empty.

    Regards

    Christoph

  8. In ugfx.c then #include all the relevant source files from the real repository subdirectory.

    In ugfx.h just #include the real ugfx.h from the real ugfx subdirectory.

    Regarding including all source files in a single one: Doesn't that result in one huge compilation unit for ugfx and cause optimization problems?

    I already tried wrapping gfx.h in ugfx.h so that arduino can find the library header, but didn't get any further because I couldn't think of a convenient way to guide arduino to gfxconf.h.

  9. I see arduino is now supported as an OS, but how are we supposed to use it? As far as I can tell it's not possible to add ugfx (in its current form) as an arduino library. Has anyone done this, or even packaged it in an arduino-friendly form?

  10. Yup, doesn't hang any more in both 32- and 64-bit build. Thank you!

    Regarding fonts: I tried using a user-supplied font I converted with your online font converter, and it does show up on the button just like UI2 narrow. The fixed-width fonts (5x8, 7x14, 10x20) still don't show up on the button. This is fine for me now, but you should probably have a look for potential problems with the fixed-width fonts.

×
×
  • Create New...