µGUI

μGUI

wpid-20150110_195355.jpgwpid-20150316_212829.jpg

Video_lowres

Open Source GUI module
for embedded systems

NEWS Approve and Reply

Date Event
06.08.17 Website moved to a new host. Further updates are in progress
13.9.15 Forum added for discussions 🙂
22.3.15 µGUI is now available on GitHub: https://github.com/achimdoebler/UGUI

What is μGUI

µGUI is a free and open source graphic library for embedded systems. It is platform-independent and can be easily ported to almost any microcontroller system. As long as the display is capable of showing graphics, µGUI is not restricted to a certain display technology. Therefore, display technologies such as LCD, TFT, E-Paper, LED or OLED are supported. The whole module consists of two files: ugui.c and ugui.h.

μGUI Features

  • μGUI supports any color, grayscale or monochrome display
  • μGUI supports any display resolution
  • μGUI supports multiple different displays
  • μGUI supports any touch screen technology (e.g. AR, PCAP)
  • μGUI supports windows and objects (e.g. button, textbox)
  • 16 different fonts available
  • integrated and free scalable system console
  • basic geometric functions (e.g. line, circle, frame etc.)
  • can be easily ported to almost any microcontroller system
  • no risky dynamic memory allocation required

μGUI Requirements
μGUI is platform-independent, so there is no need to use a certain embedded
system. In order to use μGUI, only two requirements are necessary:

  • a C-function which is able to control pixels of the target display.
  • integer types for the target platform have to be adjusted in ugui.h.

Example Projects
Various example projects can be found on my YouTube channel:
http://www.youtube.com/playlist?list=PLn9k3eL_sqV1Y1FwUu0qFC6u7m6rQe9_V

ToDo List
The following features are on my ToDo list:

  • Demo files for different platforms
  • Mouse support
  • Touchscreen support
  • Window support
  • Objects
  • Multi-Layer support
  • Support for hardware acceleration
  • Alpha channel support
  • Anti-Aliasing
  • Center String function

Support

I've spent a lot of time writing µGUI. If you like this project, please support it!

Feel free to…

  • report bugs
  • send suggestions for upcoming features
  • share µGUI
  • send me pictures of your application using µGUI
  • help me to keep this project alive: Donate 1€
 

 

 

Download

Reference Guide

Download 2.10 MB 18152 downloads

 

Latest version:

µGUI v0.3

Download 650.26 KB 11464 downloads

Older versions:

µGUI v0.2

Download 319.80 KB 2059 downloads

µGUI v0.1

Download 211.61 KB 1215 downloads

 

Example Projects

STM32F429 Discovery

Download 601.49 KB 12092 downloads

 

Companies Using µGUI

141 thoughts on “µGUI

  1. Hello, 

    Seems interesting UGUI. However for example for the controller ST7586S have any examples of LCD functions to associate with UGUI? If you have made and canst send to me … 

    regards 
    Vitor Aquino

    • Hi Vitor,

      I hope this helps!

      //#define H_BYTE_CNT      80       // 240×160
      #define H_BYTE_CNT      43       // 128×160

      unsigned char display_buff[H_BYTE_CNT*160];

      void st7586s_pset(UG_S16 x, UG_S16 y, UG_COLOR c)
      {
         unsigned int pos;
         unsigned char b;

         switch( x%3 )
         {
            case 2: b = 0x03; break;
            case 1: b = 0x81; break;
            case 0: b = 0xC0; break;
         }

         pos = (x / 3) + y * H_BYTE_CNT;

         if ( !c )
         {
            display_buff[ pos ] |= b;
         }
         else
         {
            display_buff[ pos ] &= ~b;
         }
      }

      void st7586s_update(void)
      {
         unsigned int i;
         send_cmd( 0x2C );
         for(i=0; i
         {
            send_data( display_buff[i] );
         }
      }

      • Hello,

        Thanks for the extensive library. I see you already used a ST7586S in one of your videos demonstrations. I have a similar display but it draws 2 pixel per byte and not 3 pixel as the datasheet . Can you help me with this ? below is the initialization code i used

            // Display OFF
            GLCD_Command( 0x28);
            
            // Delay 50 ms
            //currentTime = G_SystemTime1ms;
            //while(!(IsTimeUp(&currentTime, 50)));
            delay(80);
            
            // Vop = B9h
            GLCD_Command(0xC0);
            GLCD_Data(0x45);
            GLCD_Data(0x01);
            
            // BIAS = 1/14
            GLCD_Command(0xC3);
            GLCD_Data(0x00);
            
            // Booster = x8
            GLCD_Command(0xC4); 
            GLCD_Data(0x07);
            
            // Enable Analog Circuit
            GLCD_Command(0xD0); 
            GLCD_Data(0x1D);
            
            // N-Line = 0
            GLCD_Command(0xB5); 
            GLCD_Data(0x00);
            
            // Monochrome Mode
            GLCD_Command(0x39);
            
            // Enable DDRAM Interface
            GLCD_Command(0x3A); 
            GLCD_Data(0x02);
            
            // Scan Direction Setting
            GLCD_Command(0x36); 
            GLCD_Data(0x00);       //COM:C160–C1   SEG: SEG384-SEG1
            
            // Duty Setting
            GLCD_Command(0xB0); 
            GLCD_Data(0x9F);
            
        //    // Partial Display
        //    #ifdef PARTIAL_DISP
        //    GLCD_Command(0xB40);
        //    GLCD_Data(A0);
        //    GLCD_Command(0x30); // Partial Display Area = COM0 ~ COM119
        //    GLCD_DATA(0x00);
        //    GLCD_DATA(0x00);
        //    GLCD_Data(0x00);
        //    GLCD_Data(0x77);
        //    #endif
            
            // Display Inversion 
            GLCD_Command(0x20); // OFF
            
            // Column Address Setting
            GLCD_Command(0x2A); 
            GLCD_Data(0x00); // SEG0 -> SEG384
            GLCD_Data(0x00);
            GLCD_Data(0x00);
            GLCD_Data(0x7F);
            // Row Address Setting
            GLCD_Command(0x2B); 
            GLCD_Data(0x00); // COM0 -> COM160
            GLCD_Data(0x00);
            GLCD_Data(0x00);
            GLCD_Data(0x9F);

        • Hi Mesbah,

          I’m quite sure that there is something wrong with your mapping.

          Have you selected monochrome mode or grayscale mode?

          Maybe page 18/19 of the datasheet helps you?

          Which display do you use?

          BR,

          Achim

          • Hi Andrey, yes! In order to use this feature you have to use a “read – modify – write” pset function which reads data from the display, changes it and writes it back to the display. BR Achim

          • Hi! I have the same problem with the pixels. Could you show me a example about the use of the "Read Modify Write" function to write 3 pixels per byte?. I did not understand this command on the datasheet. When this command is enabled, is it necessary to do the algorithm on the diagram at page 37 of the datasheet every time when i want write data to the display? Or is it only necessary one time on the initialization process?
            I hope that you can help me.

            Thanks!
            Best Regards Emmanuel

    • Hi Jack,

      µGUI does not officially support Arduino so far.

      To be honest: I presume that it runs on Arduino without any problem, but I have not tested it 🙂

      I’ll keep you updated regarding Arduino-related examples.

      BR,

      Achim

  2. Can you provide code for the dsPic33 with the SSD1322 driver?  That is the exact setup I am trying to run for a project of mine.  I am using the Blue Display.  Thank you so much!!!!

      • As we're already talking Microchip, what would be necessary to get a Pic32MZ2048ECH144 and HX8238-A based display to use µGUI?

        • First of all you have to connect the TFT DPI Interface to the PIC. Then initialize the internal DPI Interface of the PIC. After that you only have to write a Pset-function to use uGUI. Hope this helps! By the way: which hardware platform do you use? BR Achim

  3. Another significant improvement to the framework would be adding events from windows (you seem to do this according to a TODO comment in the code). If one want to extend window look he/she needs something like OnRender event to draw when window is updated.

  4. Thanks for posting this.

    I really like the design of your code. I was able to get it up and running on a PSOC5 with no problems on a 128×64 newhaven display in so little time I was surprised!

    Have you thought about how to implement screen rotation? I am wondering how to change to portrait from landscape on my display (at compile time, not run time)
    thanks, Cris

    • Hi Cris,

      thanks for the commendation!

      It is very easy to realize screen rotation:

      Rotation:

       

      Your display has 128×64 pixels, right?

      Just pretend it has 64×128, use UG_Init(…64,128…) and you get a rotation by 90 degree. Of course you have to swap x and y INSIDE your pset function.

      Flip the screen:

      In order to flip the screen horizontally and/or vertically just use the following trick at the beginning of your pset function:

      x = 127 – x; // Flip the screen horizontally

      y = 63 – y; // Flip the screen vertically

      BR,

      Achim

       

       

       

  5. Hello Achim,

    I was wondering if you could please provide some example code interfacing with the Raspberry Pi and 1.5" OLED – SSD1351.

    Thanks!

    • Hi Paul, unfortunately I don’t have such example code. Maybe I can help you to write your own implementation? BR Achim

      • Hi!

        I'm also interested in getting a 1.5" OLED SSD1351 running on a Raspberry Pi 2 Model B. In fact, I want to run 3 displays from that Pi (without exhausting the GPIO either–it'll be running 3 sensors too).

        I have some resources where I work, but any other help you can give would be much appreciated!

        Cheers,
        Spencer

        • Hi Spencer!
          Interesting project – please share some more details on the forum!
          I would use SPI for all OLEDs. µGUI is ideally suited to handle all of them in parallel!
          At the forum you will find an example for the SSD1351!
          BR, Achim

  6. Hello,

    At first i would like to congratulate you for this great library/project. I tested it in the STM32F429 Discovery and liked a lot. So, I would ask if you are interested in creating an adaptation layer for an event manager based on RTOS services. I beleive that through RTOS semaphores, queues and timers it is possible to better manage the CPU resources. I started myself a GUI event handler, as you can see here:

    https://www.youtube.com/watch?v=B2LuqMpjoIU

    The code is available here:

    https://brtos.googlecode.com/files/BRTOS_STM32F4x_GUI.rar

    However, i´m not a great GUI designer. I just have a RTOS project and i would like to disseminate the use of such a great tool for embedded software development. Even, i developed a demo based in your code using RTOS services. Doing that i realized a excessive CPU usage for the touch screen reading (like 10%). I just raised the I2C clock to 250khz, droping the CPU usage for less than 1%.

    If you are interested, i can send you my modified project in order to you evaluate if its possible to implement such event handler mechanism.

    I wish you all the best,

    Best regards,

    Gustavo Denardin

  7. Hello Achim,

    Nice work with the library.

    I see on the youtube channel that you used it with 7 inch tft (both uGUI and STemWin). Is there a chance to share the source code ?

    I've got a problem with the refresh rate. Some times a flicker line appear on the middle of the screen. The flicker will occurs rarely if I lower the PCLK to 16MHz, but it still appears.

    Thanks,

    Alin

  8. First, I want to thank you for this library. I've used 0.2 version successfully with an OLED with SSD1322 controller on PIC32. Are the window and button functions work on OLED? I haven't had success with the example code.

    • Hi Andre,

      yes, µGUI v0.3 works perfectly fine on OLEDs!

      Could you share some pictures and your source code on the forum?

      BR, Achim

  9. void UG_WaitForUpdate( void )
    {
       gui->state |= UG_SATUS_WAIT_FOR_UPDATE;
       while ( (volatile UG_U8)gui->state & UG_SATUS_WAIT_FOR_UPDATE )
            {
                if(gui->touch.state == 1)
                    return;
                osDelay(50);
            };
    }

  10. Hi  Achim,
    before everything i want to thank you so much for the outstanding library!

    I'm using an "ER-TFT070-4" from BuyDisplay 7" with OTA7001A Driver, no init code, just a DPI interface to be used with LTDC interface.
    Starting with your example of uGFX 3.0 on Stm32f429-Discovery (embd LCD removed) i have changed only screen dimensions to the ltdc.h in order to make it all work and so on it's a really good result.

    [code] 

    #define  THS                     10
    #define  THB                     20
    #define  THD                     800
    #define  THF                     10
    #define  TVS                     2
    #define  TVB                     2
    #define  TVD                     480
    #define  TVF                     4

    [/code]

    The problem is that i don't understand what THB, THS, THF, TVS, TVB, TVF means and what i have to use in order to optimize a little bit my code.. can you suggest me about that, or maybe a "programmers note" where it's all explained? 
    Thank you so much, and sorry but i'm nearly new to program things with this complexity.

    Davide 

    PS. if you want i can send you my entire project, i'm aslo using Coocox IDE!!

    • Hi Davide, I’m glad that you like uGUI 🙂
      Yes, please send me the project. I’ll reply with some informations regarding DPI. Best regards, Achim

  11. Hi Achim,

    I am from Taiwan.

    I am a college student.

    So,My English is poor.sorry.

    Your Library is my best tutorial.  Thank you.

    I have some question about images.

    1.If i want to use an images for  a button.

    How could i do?

    or

    2.Can i put an images on the button?? 

    • Hi Chen,

      I’m glad that you like µGUI.

      Unfortunately pictures inside buttons are not supported by µGUI v0.3 🙁

      µGUI v0.4 will be able to do that!

      BR, Achim

  12. Hi

     

    Very nice project!

     

    I am having trouble setting the STM32F429 (discovery) to use a larger display.

    Can you please send me your initialization code of your 800×480 display?

    Thanks

    nimi

  13. Hi. This looks very nice

    I see you have a driver for the 1.54 OLED SSD1305Z 126×64 Mono as per your UTube demo

    Would you mind sharing the Init Driver commands for this display So I can try out your Library

    Thanks

    Brett

     

  14. Hello Achim
    Can I use ugui with STM32F4-Discovery + ssd1963 fsmc module? I have ssd1963 library. I can run the screen but do not know how I could combine seamlessly with ugui. Can you help with this?

  15. Can you provide code for the MSP430 with the SSD1322 driver? I can't understand how can i use your library. Pleas help me!

  16. Pingback: [General] Free or low cost GUI Development Software

  17. Hi there i am after a oled display for a pure evoke flow radio and have been told it is a       pmo 19301 and is 2.7" diagonaly my question is do you know where i can buy one of these units.

    Regards Phil

     

  18. Hi Achim

    Nice job on the uGUI! I'm currently experimenting with it, I had an stm32f429 discovery board so could start right away with your example project in CoIDE.

    I drew a window because I need some buttons. However I also need some rectangles so I drew 2 of them with the intention to draw them on top of my main window. This clearly does not work… What I try to do is have 2  measured values shown in those rectangles (voltage and current), all on top of the window.

    So I need a window, with buttons to push but also 2 areas on the window to show some measured values. Can you give me a hint how to do it or do you have somewhere an example?

    Cheers!

    Dennis

    • Hi Dennis,

      you could use a textbox and UG_TextboxSetText() function.

      I hope this helps. Please post further questions on the forum.

      BR, Achim

      • Could you possibly put all of your example PSET function up on GIT with the source code.

        I am specifically looking for the ST75256 driver (there is a youtube video of this) and the uc1618T (I haven't seen any support for this chipset).

        Thank you for your efforts, they are appreciated.

  19. Hi

    I was wondering if I can use this library to get SSD1322 work with xmegaA3AU ? Can you help with some sample code, that would be great! Looking forward to your reply.

    Cheers

    • Hi Shree,

      I have added a example pset function for the SSD1322 driver on my forum!

      Please use a correct initialization sequence for your display!

      BR,

      Achim

  20. Dear Sir,

    We are using Tiny6410 stamp module. It is restricted to using only friendlyarm display. We need to interface resistive touchscreen display of 5 inch & 7 inch of our choice. Please give steps how we can use your library.

    Thank you.

  21. Hi achim,

    i really wonder about  your gui. it is very simple to use. i want to draw a image on my lcd. i also done by using your library with given example image. now i want to convert image to header file. can you suggest any software to do  that.

    • Hi Arun, I think there is a conversion utility on the ST microelectronics page. I can’t remember the name, but I’m sure there is one. BR Achim

  22. Hi  Achim,

    I have a small display with no touchscreen. However I want to use windows with GUI buttons and use up/down buttons (physical buttons) to select GUI buttons on the screen (and use an enter button to simulate pressing a GUI button). Is it possible to do this with ugui, to select GUI buttons and generate GUI button clicks programmatically without toutchscreen?

    Regards,

    Jan

    • Hi Jan, yes this is possible. Just implement a fake touch function, which returns coordinates which are inside the area of a button. That’s it 🙂
      BR Achim

    • Hi, yes I’m going to write an example for the STM32F7. Unfortunately I’m very busy right now, so please be patient…

  23. hello! thanks for the hardwork! 😀

    well, this is my first time using STM. i'm using stm32f407 by the way. i really want to use ugui with my stm and ssd1289. do you have any project example that i can use as refrence? it would be really helpful. thanks!

  24. Dear Sir

    I need to use your UGUI with ATMEGA AVR & 7" ER-TFT070-4 TFT LCD in 16it parallel mode.

    Kindly share any example so that i can use your Ugui with my compiler. I am using CodevisionAVR.

    Thanks for your cooperation.

    Regards

     

    • Hi Ahmed, currently I don’t have any example for Codevision. Please have a look at my example projects. It should be quite easy to port them to your platform. BR Achim

  25. Hi Achim!

    Super nice library. It's very well coded and easy to use. I've began developing on it a couple of days ago and will probably go with your library for the rest of my project.

    I've noticed that drawing bitmaps could easily be accerelerated with a hardware driver for controllers like the SEPS525:

    1) Prepare peripherals for data transfer.

    2) Setup X start, Y start, X end and Y end according to the bitmap size and position.

    3) Use a pointer to the bitmap array and increment the pointer after each color sent.

    This allows you to write the whole bitmap in one shot with all the right colors (you don't have to write it pixel by pixel).

    With this in mind, I believe it would be fairly easy to add a supported hardware driver to be used by the drapBMP() function.

    Cheers!

    • Hi Jonathan.
      thank you very much for the feedback! Good idea! There will be some more new acceleration functions available in 0.4…Please post your project at the forum!
      BR Achim

  26. Hi!

    First of all – great job!

    And thank you for making it free 🙂

    I've set it up on an STM32L100RCT6 with an 128×64 glcd, and everything works like a charm, except the UG_DrawLine() function, which seems to always draw a falling line, no matter how the arguments are arranged 🙁
    This:

    UG_DrawLine(10,60,120,20,C_BLACK);  //falling line 60->20
    UG_DrawLine(10,10,120,50,C_BLACK);  //rising line 10->50 (but is falling)

    produces two prallel lines, while they should intersect.
    Is there something I'm doing wrong, or it just doesn't work this way?
    Best Regards, and thank you in advance.

    Krzysztof
     

     

    • Hi Krzysztof, thanks for the feedback. I’m glad that you like ugui. Please post your source code on the forum. I will have a look at it. In general it should work! Best regards, Achim

      • Hi Achim, 

        I'we find a bug. 
        if ( x2 < x1 )
           {
              n = x2;
              x2 = x1;
              x1 = n;
           }
           if ( y2 < y1 )
           {
              n = y2;
              y2 = y1;
              y1 = n;
           }
        These conditions swaps the endpoints of a line.
        [x1y1,x2y2]=>[x2y1,x1y2]      [x1y1,x2y2]=>[x1y2,x2y1]

        Best regards, Ondrej

  27. Hi.

    Any chance this could be ported to the Teensy (3.2) with the ILI9341?

    I could probably give it a go to see if I can get it working, but unsure how to do this exaclty as it's a bit out reach for me at the moment.

    Looks awesome!

    Good work 😀

  28. This is interesting.

     

    I am working on TI-AM4379 processor with Fema GM12864D-27-O3CY OLED which has SSD1325.

     

    Can I use uGUI ?

     

    Thanks,

    Kris

  29. Hello, I am using your ugui. I use Psoc5 communicate with LCD TFT lil9341. Some funtion as UG DrawLine(), UG DrawArc()…run good on LCD. but some funtion about window not run on LCD. I dont understand about them. Examble funtion: UG WindowShow() {

       if ( wnd != NULL )
       {
          /* Force an update, even if this is the active window! */
          wnd->state |= WND_STATE_VISIBLE | WND_STATE_UPDATE;
          wnd->state &= ~WND_STATE_REDRAW_TITLE;
          gui->next_window = wnd;
          return UG_RESULT_OK;
       }
       return UG_RESULT_FAIL;

    }

    I dont see them send data for LCD from microchip.

     

  30. Hi,

    Will you please share source code for  OTA7001A (7" lcd ER-TFT070-4 from buydisplay) Driver for Stm32f429-Discovery and uGFX 3.0. ?

  31. Hello Achim Döbler, thank you very much for your library, how can i used your libary with st75256 controler ? do i need to write first the driver ? can you help me please about that ?

    Thank you very much i'm waiting your help.

  32. Achime,

    Just want to thank you for your effort and great framework that is easy to use but also very powerful. I am using it extensivly on STM32F429I-DISC1 board.

    Thanks,

    Momcilo

  33. Hello,

    I see you have a youtube video of a 256×64 PM OLED 5.5\” GREEN | SSD1322 | 8080 / 68xx / SPI using a dsPIC33 controller. I what to do the same with a PIC32. Can you send me the code and schematic? I am currently using the MikroC complier, 

     Thanks in advance…..

  34. Hi, thanks for the library, but my buttons have no surrounding box.  Can you tell me if there is a method I should call?  Or is it something else?

  35. Hello, Thanks for the great library, i'am actually using uGUI to design my application. i just want ask you some question, the interface i am going to design is composed mainly with 3 parts :

    1-High Right corner : shows the battery level.

    2- High Left corner : Time and date 

    3- In the middle : the main Menu, a dynamic Menu for configuration and showing the app features. 

    My idea was to use an image to draw the battery level in the right corner, but here, i find that to use UG_ImageCreate i have to create a window at first and then attach the image, the library don't provide  a much easier function to draw an image in coordiantes (x,y), for me using windows is for managing dynamic things, things that are hidden and shown again in Runtime in fact I will use windows to manage tha main menu . I'am very interseted to know your opinion here 

    thanks in advance

    • The only way to do that is to remove folowing code from the UG_DrawLine function:

         if ( x2 < x1 )
         {
            n = x2;
            x2 = x1;
            x1 = n;
         }
         if ( y2 < y1 )
         {
            n = y2;
            y2 = y1;
            y1 = n;
         }

      Is there any particular reason to keep this code?

  36. Hi, is there any library for driving SSD1322 based oled's for STM32F4 or some sample code? I need it to drive one of those OLED's for my custom PC project ;)

  37. We are using uGui Library with BuyDisplays ER-TFT050-3 800×480 with OTA7001A LCD controller and STM32F4 platform .

    We are facing some flickering issues with current code. We think that the problem is with LTDC peripheral and SD-RAM configuration.

    Please see if there is any reference code or information available for this combination. Please share.

     

    • Dear Christian,

      nice! Yes, please upload the project so that other guys in the forum can also use it.

      Again, great job!

      BR, Achim

  38. Great library! Unbelievably quick time to get it up and running on my Cypress PSoC4.  Any chance you're planning on or are working on variable width fonts?

    • uGUI actually supports variable width fonts via the "widths" array though there are no variable width fonts included with uGUI out the chute.

  39. Dear Achim

    You have done a wonderfull work – keep up the good work

    Do you have a working driver for the SH1122G? as shown in your Youtube channel

    Can you please provide source code?

    Thank you

    Bobi

     

     

     

     

  40. Hello. Just found your library the other day. Love it due to the ease of porting and simplicity. Will likely never return to my old graphics library.

    I just can't figure out how to make two windows show, and get one inactive and one active. Could you please respond here or email me?

    Thank you,

    Mark

  41. Hi Achim,

                  I am completely new to this embedded system.

    I am trying to build a system that display the surrounding temperature in C or F , the user can select using a touch sensitive display.

    Components i am using is MAX31855 thermocople for temperature sensing. I have a Raspberry Pi 2 Model B at home i'm using.

    I have a C program to sense temperature from this chip. which i got from Github.

     

    I want a 3.5 to 5 inch touch display with hdmi connectivity so that i can use GPIO pins later in future for other purpose.

     

    I am getting confused as to how to proceed with this small project of mine.

     

    Which display to select? How to proceed with GUI programming using UGUI? I saw the reference guide but i'm totally new to this i'm getting extermely confused.

    could you please put up a demo video or  a new page on the your website for beginners like me.

     

    Thanks & Regards,

    Santhosh

  42. Hi,

    I am using this GLCD(240×160) using st7586S driver. I have interfaced it via 4 wire SPI interface.

    I am able to init the GLCD and able to run command All Pixel ON, All Pixel OFF. but when i am writing data to DDRAM i am not abl to get anything on the display could you please help.

     

    my code is following:

    void glcdInit(void)
    {
        delay(DELAY_1MS*5);
        SETBIT(GPIOF, 6); // Chip select high
        
        SETBIT(GPIOA, 12); // RESET high
        delay(DELAY_1MS*5);
        
        CLRBIT(GPIOA, 12); // RESET low
        delay(DELAY_1MS*10);
        
        SETBIT(GPIOA, 12); // RESET high
        delay(DELAY_50MS*4); // >120msec
        
        glcdSendbyte(COMMAND, 0x11); // Sleep Out
        glcdSendbyte(COMMAND, 0x28); // Display OFF
        delay(DELAY_50MS);
        
        glcdSendbyte(COMMAND, 0xC0); // Vop = B9h
        glcdSendbyte(DATA,0x45);
        glcdSendbyte(DATA,0x01);
        glcdSendbyte(COMMAND, 0xC3); // BIAS = 1/14
        glcdSendbyte(DATA,0x00);
        glcdSendbyte(COMMAND, 0xC4); // Booster = x8
        glcdSendbyte(DATA,0x07);

    // as per driver datasheet
    //    glcdSendbyte(COMMAND, 0xC0); // Vop = B9h
    //    glcdSendbyte(DATA,0xB9);
    //    glcdSendbyte(DATA,0x00);
    //    glcdSendbyte(COMMAND, 0xC3); // BIAS = 1/14
    //    glcdSendbyte(DATA,0x05);
    //    glcdSendbyte(COMMAND, 0xC4); // Booster = x8
    //    glcdSendbyte(DATA,0x07);
        
        glcdSendbyte(COMMAND, 0xD0); // Enable Analog Circuit
        glcdSendbyte(DATA,0x1D);
            glcdSendbyte(COMMAND, 0xB5); // N-Line = 0
        glcdSendbyte(DATA,0x00);
        glcdSendbyte(COMMAND, 0x39); // Monochrome Mode
        glcdSendbyte(COMMAND, 0x3A); // Enable DDRAM Interface
        glcdSendbyte(DATA,0x02);
        glcdSendbyte(COMMAND, 0x36); // Scan Direction Setting
        glcdSendbyte(DATA,0x00);   //COM:C160–C1   SEG: SEG384-SEG1
        glcdSendbyte(COMMAND, 0xB0); // Duty Setting
        glcdSendbyte(DATA,0x9F);

    //    glcdSendbyte(COMMAND, 0xB4); // Partial display
    //    glcdSendbyte(DATA,0x9F);
    //    glcdSendbyte(COMMAND, 0x30); // Partial display Area COM0-119
    //    glcdSendbyte(DATA,0x00);
    //    glcdSendbyte(DATA,0x00);
    //    glcdSendbyte(DATA,0x00);
    //    glcdSendbyte(DATA,0x77);
        
        glcdSendbyte(COMMAND, 0x20); // Display Inversion OFF
        glcdSendbyte(COMMAND, 0x2A); // Column Address Setting
        glcdSendbyte(DATA,0x00); // SEG0 -> SEG384
        glcdSendbyte(DATA,0x00);
        glcdSendbyte(DATA,0x00);
        glcdSendbyte(DATA,0x7F);
        
        glcdSendbyte(COMMAND, 0x2B); // Row Address Setting
        glcdSendbyte(DATA,0x00); // COM0 -> COM160
        glcdSendbyte(DATA,0x00);
        glcdSendbyte(DATA,0x00);
        glcdSendbyte(DATA,0x9F);    
        
        glcdSendbyte(COMMAND, 0x29); // Display ON
        
    }

    void glcdSendbyte(unsigned char byteType, unsigned char data)
    {
        unsigned char count = 0;
        
        // pin for selecting command or data
        if(byteType == COMMAND)
            {
                CLRBIT(GPIOA, 9);
            }        
        else
            {
                SETBIT(GPIOA, 9);
            }

            CLRBIT(GPIOF, 6); // Chip select low
        for(count = 0; count < 8; count++)
        {
            if(data & (0x80 >> count))
            {
                SETBIT(GPIOA, 11);//DATA
            }
            else
            {
                CLRBIT(GPIOA, 11);//DATA
            }
            SETBIT(GPIOA, 10);//SCK
            delay(10);//2.5uSec
            CLRBIT(GPIOA, 10);//SCK
            delay(10);//2.5uSec
        }          
            SETBIT(GPIOF, 6); // Chip select high
            delay(1600);//1000uSec
    }

    void display_address(unsigned char  x,unsigned char  y)
    {

        glcdSendbyte(COMMAND, 0x2A); // Column Address Setting
        glcdSendbyte(DATA, 0x00); // SEG0 -> SEG240
        glcdSendbyte(DATA, x+8);// SEG8*3=24
        glcdSendbyte(DATA,0x00);
        glcdSendbyte(DATA, 0x7f); // SEG128*3=384  seg x(dont use)  seg n  seg n
        
        glcdSendbyte(COMMAND, 0x2B); // Row Address Setting
        glcdSendbyte(DATA,0x00); // COM0 -> COM160
        glcdSendbyte(DATA, y);
        glcdSendbyte(DATA, 0x00);
        glcdSendbyte(DATA, 0x9F);      

    }

    void display_black(void)  //all  display
    {
      unsigned int i,j;
           glcdSendbyte(COMMAND, 0x2C);
      for(i=0;i<160;i++)
         {       
            for(j=0;j<120;j++)        //1byte data or 2 dot  120*2=240dot
            {
                glcdSendbyte(DATA, 0xFF);

            }
         }
    }

     

     

    Main function calls are like following:

            glcdInit();
            while(1)
            {
              
              display_address(0,0);
                delay(DELAY_50MS);
                display_black();
                delay(DELAY_50MS);

    }

    could you please help in pointing out where i am doing wrong?

    Regards/Pallav

     

    • Dear Pallav,

      sorry, but I don’t have the time to review your code right now. The only thing you need to do is to be able to toggle a single bit inside the display memory. After that the PSET-function will do the job.

      BR Achim

  43. Dear Achim Döbler;

    It's a nice work and thanks for sharing.

    I'd like to ask that is it possible to use uGUI with one of the Atmega ARM based MPUs that is AT91SAM9x35. It has own LCD controller and library but i did not figure out how to connect uGUI with this controller. 

    I'll be glad if you have an idea or suggestion on this issue.

    Regards,

    jS

    • Dear Jack,

      it’s basically just one function that you need: PSET(). Please have a look at the reference manual.

      BR Achim

  44. I use pic32mz with ili9341 and I would take advantage dma to accelerate.
    I am not able to exploit the DMA module, how can I do?
    I can have an example already tested?

  45. Hello Achim ,

    the GUI looks very nice and its look  easy to implement it!

    Is the Projekt still allive ?

    I am searching for a library for my home project  and  my question is:  It is useful to start with when the project seems to go on nothing more ?

    Best regards,

    Peter

     

     

  46. Hello, i have one problem, 

     if( ((UG_RESULT(*)(UG_S16 x1, UG_S16 y1, UG_S16 x2, UG_S16 y2, UG_COLOR c))gui …

    number of arguments passed to function "indirect" does not match functions prototype ,in hardware acceleration. I just pass the library to my project with pic32

    Some help or support?

    thanks.

    • Hi Tom,

      well, this depends on your display. The GRAM must be located either in the display or in the MCU. You can use µGUI in both cases.

      BR Achim

  47. First, I would like to thank you for making this library available and, most importantly, the pdf for each function.
    Libraries for lcds, we have many online, more documented are few.
    However I noticed in the compilation that there were significant changes between the documentation and the v0.30 library in UGUI-master, to the point that the compilation after some adjustments in the example "uGui_STM32F429_Discovery" was running fine, and compilation with substitution by the files UGUI-master, have made so many mistakes that you want to be able to track.
    Whatever is possible, you could update your example with the files in UGUI-master, but keep the previous one so that you can understand the changes.

    Thank you very much in advance.

    Ib

    • To be able to help the recurring error is:
      "
      Description Resource Path Location Type
      #include nested too deeply STM32F429_Disco_uGUI line 1x… C / C ++ Problem
      "

    • Hi Ivan,

      thanks a lot for the positive feedback.

      I need to do some updates regarding GitHub.

      Will get back to you regarding this!

      BR Achim

  48. Hi, I'm trying to setup an ST75256 based LCD display to a Raspberry Pi as 240×160 X-Windows active display. Is this possible and can you help me please?

    Regards,

    Martin

  49. Hi Achim,

    Very nice project. I've got an OLED display with SSD1322 controller and I was wondering if I can use your uGUI library on my STM32F407 connected to the LCD via the 8080 parallel interface through the FSMC peripheral. 

    Thanks,

    Marcos

Leave a Reply to meet shah Cancel reply

Your email address will not be published. Required fields are marked *