Jump to content

Mad River

Members
  • Posts

    47
  • Joined

  • Last visited

Posts posted by Mad River

  1. Hi @Joel Bodenmann,

    Seems like you don't read all the post:

    Quote

    In order to solve the mirrored display problem, I made a few modifications to the pixel drawing function of your library.

    It worked, but I wasn't satisfied. // Because I don't want to change your code!

    So, I started looking in the internet for a way to flip the content of the display through commands.
    I found a function in another library that allows to flip the mirrored display using a command:
     

    I already tested it here and it works perfectly without any modifications to your drawing pixel function.

    I am using your library as it is. // In other words, without any modifications.

     

    Anyway, everything is working now.

    Thank you for the support.

    I will test some more advanced features now.

  2. In the gdispDrawString(), I changed this:

    g->t.clipx1 = 32768; //x + mf_get_string_width(font, str, 0, 0) + font->baseline_x;

    for this:

    g->t.clipx1 =  x + mf_get_string_width(font, str, 0, 0) + font->baseline_x; // 32768;

    And the function started working.

    Is it something to be worried about?

  3. Quote

    Number 2 is overlapping 1

    I copy-pasted it wrong!

    In fact, I tried only one line at a time:

     

     font = gdispOpenFont("DejaVu*");    
        
        line1 = "abcdefghij";
    
        //gdispDrawString(0, 0, line1, font, White); // 1
        gdispFillString(0, 0, line1, font, White, Black); // 2

     

    @Joel Bodenmann

    So, it is exactly how I was expecting it to be.

    But for some reason the gdispDrawString() is not showing anything in the display.

    It is the only function existing in the gdisp that is not working properly.

     

    One quick question: will a horizontal scroll function be included in the library? I only found a vertical one.

  4. What gdispDrawString() is supposed to do?

    I tried the following code:

        font = gdispOpenFont("DejaVu*");    
        
        line1 = "abcdefghij";
    
        gdispDrawString(0, 0, line1, font, White); // 1
        gdispFillString(0, 0, line1, font, White, Black); // 2

    "// 2" Works just fine. "abcdefghij" is shown in the display.

    "// 1" Nothing happens.

     

    Already tried to change between "White" and "Black", still nothing happens when using "// 1".

  5. Hi @Joel Bodenmann,

    In order to solve the mirrored display problem, I made a few modifications to the pixel drawing function of your library.

    It worked, but I wasn't satisfied.

    So, I started looking in the internet for a way to flip the content of the display through commands.

    I found a function in another library that allows to flip the mirrored display using a command:

    /*----------------------------
    Func: view
    Desc: ssets the display viewing direction
    Vars: direction (top view 0xC8, bottom view (default) = 0xC0)
    ------------------------------*/
    void dog_7565R::view(byte direction)  
    {
        if(direction == VIEW_TOP)
        {
            top_view = true;
            command(0xA0);
        }
        else
        {
            top_view = false;
            command(0xA1);
        }
        
        command(direction);
        
        clear(); //Clear screen, as old content is not usable (mirrored)
    }

     

    I already tested it here and it works perfectly without any modifications to your drawing pixel function.

    I am using your library as it is.

    I believe this function can be included in your product.

     

  6. Hi @cpu20,

    Have you finished testing the uGFX in Eclipse?

    I am getting a wierd behaviour from my Eclipse.

    The IDE is graying out code that should be "visible". The wierd thing is that the IDE is doing it to some parts and not for others.

    Below you can see a example of it:

    I have defined:

    #define GDISP_NEED_CLIP                              TRUE
    #define GDISP_NEED_CIRCLE                            TRUE
    #define GDISP_NEED_DUALCIRCLE                        TRUE
    #define GDISP_NEED_ELLIPSE                           TRUE
    #define GDISP_NEED_ARC                               TRUE
    #define GDISP_NEED_ARCSECTORS                        TRUE

    Then, in the gdisp.h, it is showing the GDISP_NEED_CLIP code, but not the others:

    if_error.thumb.JPG.d626cdbcca2bb3bb409d71b0b1579e81.JPG

     

    The program works. I can compile it, load the program and draw boxes and circles.

    But, as it is grayed out, I can't use functions like "go to definition" or even set breakpoints in the grayed code.

    Besides that, it became very hard to scroll trought the code and see whats is really being used and what is not.

  7. Hi @cpu20 and @Joel Bodenmann,

    Is there a way to define where the coordinate (0,0) should be?

    I am running this code here:

        gdispFillString(0, 0, line1, font, White, Black); // Draw a text at coordinate (0,0)
        gdispDrawCircle(width-15, height-15, 10, White); // Draw a circle at the bottom right side of the display
        gdispDrawBox(0, 0, width/2, height/2, White); // Draw a box at coordinate (0,0)

     

    I was expecting to see this:

    expected.thumb.jpg.5ca9cdcbc9958a309c8a05d651583d48.jpg

    But the display shows:

    display.thumb.jpg.ae91bb70027307d28e56fb7f6b054206.jpg

     

    Even if I rotate it 180º it won't be correct:

    display_180.thumb.jpg.a16330fb2ea4788fd6a81ff708bdaae6.jpg

     

  8. @Joel Bodenmann,

    Sorry, I edited my previous post before seeing your reply.

    Anyway, the gfxAlloc works.

     

    I am using monochrome and trying to write Black. Is it correct?

    #define GDISP_PIXELFORMAT                    GDISP_PIXELFORMAT_MONO

    gdispDrawBox(10, 10, width/2, height/2, Black);

  9. Hi @Joel Bodenmann,

     

    LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
        // The private area is the display surface.
        g->priv = gfxAlloc(GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH / 8);
        if (!g->priv) {
            return FALSE;
        }

     

    This gfxAlloc works ok. It allocates 1024 bytes for the display.

     

  10. I checked the signals (RST, CS, A0, Data) and the communication with the display is ok.

    The problem is that the data sent to the display is all zeros.

     

    Is the screen buffer the GDisplay.priv pointer?

    Looking at the memory area pointed for this all is set to zeros.

     

    What can I do to check if the drawing functions are correctly writing to the buffer?

  11. Everything is compiling now.

    width = gdispGetWidth();
    height = gdispGetHeight();

    Above is returning 128 x 64, as expected.

    Now, I added:

    #define GDISP_NEED_AUTOFLUSH                         TRUE

    #define GDISP_NEED_VALIDATION                        TRUE
    #define GDISP_NEED_CLIP                              TRUE

        gdispDrawBox(10, 10, width/2, height/2, Black);
        gdispFillArea(width/2, height/2, width/2-10, height/2-10, Black);
        gdispDrawLine(5, 30, width-50, height-40, Black);

     

    But nothing is shown on the display.

    I tested it again with another library and the hardware is working.

     

    Is any more config needed to show the requested drawings in the display?

     

  12. Well,

    I added _gosHeapInit() to the gos initialization and now it can successfully call gfxAlloc().

    #if GFX_USE_OS_THREADX

    void _gosInit(void)
    {
        #if GFX_OS_NO_INIT && !GFX_OS_INIT_NO_WARNING
            #warning "GOS: Operating System initialization has been turned off. Make sure you call tx_kernel_enter()."
        #endif

        // Set up the heap allocator
        _gosHeapInit();
    }

  13. Hi @cpu20,

    Quote

    Exactly, the only thing you should add is the 'gfx_mk.c' and the drivers you want for your project. So first go back to the initial stat where you excluded everything except that file.

    Done.

    Quote

    Now into your project properties go back to 'Paths and Symbols -> Source location' and edit the uGFX filter you've added.

    Here remove the 'drivers/' entry.

    Now choose 'Add Multiple' again and exclude everything in the 'drivers' folder except for your driver

    Don't forget to exclude ginput, gadc,...

    Done.

    Quote

    The last step to get it working is to add the folder 'drivers/gdisp/ST7565' to your include paths.

    Do this for all three languages!

    Done.

     

    After that, I set the following configs in the gfxconf.h:

    #define GFX_USE_GDISP                                TRUE

    #define GDISP_TOTAL_DISPLAYS                         1

    #define GDISP_DRIVER_LIST                            GDISPVMT_ST7565

    #define GDISP_PIXELFORMAT                    GDISP_PIXELFORMAT_RGB888 (My display is monochrome, but the compiler was demanding some definition here)

     

    After all the steps, the code compiled.

     

    Then, I ran this code:

        gfxInit();

        // Get the screen size
        width = gdispGetWidth();
        height = gdispGetHeight();

     

    Results are:

    width = 28209

    height = 0

     

    As far I could understand, when I am using only one display, the display info is load in the "GDisplay    *GDISP;".

    So, functions like gdispGetWidth() run like this:

    #define gdispGetWidth()                                gdispGGetWidth(GDISP)

     

    But my GDISP variable looks wrong:

    GDISP.JPG.4f7a9ebfc049ad0686e6cedba0cc1c32.JPG

     

    EDIT:

    Debugging the initialization, I realized that the driver register function is returning after trying to alloc.code_return.JPG.b5c3cf53efdc78ab663ea00632680a58.JPG 

     

    Regarding the gfxAlloc(), I have added this to my gos_threadx.h:

    #define GOS_NEED_X_HEAP TRUE
    #include "gos_x_heap.h"

    // #define gfxAlloc(sz)                pvPortMalloc(sz) // COMMENTED!
    // #define gfxFree(ptr)                vPortFree(ptr) // COMMENTED!

    And in the gfxconf.h:

    #define GFX_OS_HEAP_SIZE                         4096

     

    Is anything else needed?

  14. With ONLY gfx_mk.c included, I am getting that error:
    undefined reference to `GDISPVMT_ST7565'    gdisp.c    /ufgx/ugfx/src/gdisp    line 604

     

    Please, can someone run ANY example on Eclipse?

  15. Well,

    I removed all .c or .mk files from the build path.

    The ONLY one left is the gfx_mk.c.

    Now it compiles.

    Run the same code:

        // Initialize and clear the display
        gfxInit();

        // Get the screen size
        width = gdispGetWidth();
        height = gdispGetHeight();

     

    Result:

    width = 31413

    heigth = 0

  16. Removing gdisp.c from the build path did not work.

    So I inserted it back. And inserted gdriver.c and other missing files as well.

    Now, the files which are being compiled are these:

    error.thumb.JPG.04ce6611388f949b0f8b9ddeb166e9ad.JPG

    The include path:

    include_path.JPG.d706bcbdcee1edd799ff8c5aa0dd8d14.JPG

     

    I REALLY don't know what to do anymore.

    I never have that much problems to get a library running...

     

    From one stackoverflow.com thread found this:

    "You are getting multiple definition errors because you are including your .c files in your .c files. It's the linker's job to make sure they come together. Good practice is to only include .h files in your .cfiles, and make sure the .h files don't include function definitions (only function prototypes).

    By #includeing your .c files, you are defining the functions at least twice: once when FIFO.c is compiled, and again when main.c (which #includes FIFO.c, copying it verbatim into the text before compilation) is compiled. When it comes to link time, the linker sees e.g. queue_new() defined in both FIFO.o and main.o and barfs on the multiple definition of all the functions in FIFO.c."

     

    I suppose I am having these problem because of the "#include "gdisp.c" (same logic to the other files) inside the makefiles, but I don't know how to avoid it.

  17. After set the #defines mentioned above, I started getting these errors:

    multiple_definition_error.JPG.e27d3ff385936dc40d5cb156b8c55966.JPG

     

    I already made a full search, and these functions are not defined anywhere else the gdisp.c file.

    What may causing this problem?

     

     

    EDIT:

    I removed the gdisp.c from the build path and the multiple definition problem ended.

    But the code still doesn't work.

  18. Well, I did some more configurations, but it still doesn't work.

    #define GFX_USE_GDISP  TRUE

    #define GDISP_TOTAL_DISPLAYS                         1

    #define GDISP_DRIVER_LIST                            GDISPVMT_ST7565
        #ifdef GDISP_DRIVER_LIST
    //        // For code and speed optimization define as TRUE or FALSE if all controllers have the same capability
    //        #define GDISP_HARDWARE_STREAM_WRITE          FALSE
    //        #define GDISP_HARDWARE_STREAM_READ           FALSE
    //        #define GDISP_HARDWARE_STREAM_POS            FALSE
    //        #define GDISP_HARDWARE_DRAWPIXEL             FALSE
    //        #define GDISP_HARDWARE_CLEARS                FALSE
    //        #define GDISP_HARDWARE_FILLS                 FALSE
    //        #define GDISP_HARDWARE_BITFILLS              FALSE
    //        #define GDISP_HARDWARE_SCROLL                FALSE
    //        #define GDISP_HARDWARE_PIXELREAD             FALSE
    //        #define GDISP_HARDWARE_CONTROL               FALSE
    //        #define GDISP_HARDWARE_QUERY                 FALSE
    //        #define GDISP_HARDWARE_CLIP                  FALSE

            #define GDISP_PIXELFORMAT                    GDISP_PIXELFORMAT_RGB888
        #endif

     

  19. Hi,

     

    I just ported the ThreadX OS and I would like to draw something in a display which have a ST7565 controller.

    I did the following:

    1. Created the board_ST7565.h file (attached)

    2. Set #define GFX_USE_GDISP  TRUE

    3. Added the following code to test:

        coord_t     width, height;

        // Initialize and clear the display
        gfxInit();

        // Get the screen size
        width = gdispGetWidth();
        height = gdispGetHeight();

     

    After running that, width = 30089 and height = 0.

    I am sure I am missing some things.

    Where do I tell the uGFX that I am using a ST7565?

    Which other steps must be made in order to do a simple draw test?

    Is there a tutorial?

     

    board_ST7565.h

  20. Hi @inmarket,

    I started the port again, from scratch.

    Below I listed the remain question.

    I also attached the new files.

     

    (1)

    Quote

    gfxYield() is releases the remaining time slice to another thread. All multi-threaded operating systems will have one.

    I have tx_thread_relinquish(VOID), which does:

    This service relinquishes processor control to other ready-to-run threads at the same or higher priority.

     

    Should it do what is required? (1)

     

    (2)

    About gfxSystemLock() and gfxSystemUnlock(), I have tx_interrupt_control(UINT new_posture), which does:

    This service enables or disables interrupts as specified by the input parameter new_posture.

    tx_interrupt_control(TX_INT_DISABLE);

    /* Perform critical operations that need interrupts locked-out.... */

    /* Restore previous interrupt lockout posture. */

    tx_interrupt_control(TX_INT_ENABLE);

     

    Should it do what is required? (2)

     

    (3)

    About gfxThreadMe(), I have tx_thread_identify(VOID), which does:

    This service returns a pointer to the currently executing thread. If no thread is executing, this service returns a null pointer.

     

    Should it do what is required? (3)

     

    (4)

    void _gosDeinit(void)
    {
        #if !GFX_OS_NO_INIT
            vTaskDelete(0); // TODO! Why 0 is passed as parameter? Shouldn't it be the task handle?
        #endif
    }

    Why 0 is passed as parameter? Shouldn't it be the task handle? (4)

     

    (5)

    // TODO! ThreadX resolution delay is 1ms, is it a problem?
    void gfxSleepMicroseconds(delaytime_t ms)
    {
        // delay milli seconds - microsecond resolution delay is not supported in FreeRTOS
        tx_thread_sleep(gfxMillisecondsToTicks(ms/1000)); // ALTERED! vTaskDelay(gfxMillisecondsToTicks(ms/1000));
        // vUsDelay(ms%1000);
    }

     

    ThreadX resolution delay is 1ms, is it a problem? (5)

     

    (6)

    void gfxMutexInit(gfxMutex *pmutex)
    {
        // TODO! Should I use TX_INHERIT or TX_NO_INHERIT?
        tx_mutex_create(pmutex. "Mutex", TX_INHERIT);

    }

     

    I have a addition parameter, which specifies:

    Specifies whether or not this mutex supports priority inheritance. If this value is TX_INHERIT, then priority inheritance is supported. However, if TX_NO_INHERIT is specified, priority inheritance is not supported by this mutex.

     

    Should I use TX_INHERIT or TX_NO_INHERIT? (6)

     

    (7)

    Quote

    For semaphores - it is VERY important that you implement the limit. Lots of stuff won't work properly without it. Look through the other operating systems to see how they handle it if the operating system doesn't provide that feature.

    I have tx_semaphore_ceiling_put(TX_SEMAPHORE *semaphore_ptr, ULONG ceiling), which does:

    This service puts an instance into the specified counting semaphore, which in reality increments the counting semaphore by one. If the counting semaphore’s current value is greater than or equal to the specified ceiling, the instance will not be put and a TX_CEILING_EXCEEDED error will be returned.

     

    Should it do what is required? (7)

     

    (8)

    Quote

    For gfxSemWaitI() - if your operating system doesn't provide a suitable routine just define it as equivalent to gfxSemWait() with an immediate timeout. Just don't try calling it from an interrupt context. This is largely used by various drivers to signal back to uGFX when an event happens.

     

    The documentation from ThreadX says that the tx_semaphore_get() can be called from a ISR.

    Allowed From

    Initialization, threads, timers, and ISRs

     

    So, my gfxSemWaitI(gfxSem* psem) is (like you suggested) equal to gfxSemWait(gfxSem* psem, delaytime_t ms) but with a immediate timeout.

     

    (9)

    The gfxSemSignal(gfxSem* psem) and gfxSemSignalI(gfxSem* psem) follows the same logic as (8).

     

    (10)

    gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
    {
        gfxThreadHandle task;

        (void) stackarea;

    // uGFX expresses stack size in bytes - TheadX also express it in bytes
    // ALTERED!
    //    // uGFX expresses stack size in bytes - FreeRTOS in "Stack Words"
    //    stacksz /= sizeof(StackType_t);

      if (stacksz < TX_MINIMUM_STACK)
          stacksz = TX_MINIMUM_STACK;
        
    // ALTERED!
    //    if (stacksz < configMINIMAL_STACK_SIZE)
    //        stacksz = configMINIMAL_STACK_SIZE;

      // TODO!  ThreadX can't pass a pointer as argument to the task function.
      //        We can only pass a uint32_t.
      //        Is it a problem?
      if(tx_thread_create(&task, "uGFX_TASK", fn, 0, stackarea, stacksz, prio, 0, 1, 1) != SSP_SUCCESS)
          return 0;

    //    task = 0;
    //    if (xTaskCreate(fn, "uGFX_TASK", stacksz, param, prio, &task) != pdPASS)
    //        return 0;

        return task;
    }

    ThreadX can't pass a pointer as argument to the task function.
    We can only pass a uint32_t.
    Is it a problem? (10)

     

    gos_threadx.c

    gos_threadx.h

×
×
  • Create New...