This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/MSP430F5659: MSPWARE GR lib

Part Number: MSP430F5659
Other Parts Discussed in Thread: MSPWARE

Tool/software: Code Composer Studio

Hi,

I'm having a terrible time trying to use your graphics library to draw circles, buttons etc. On a 480x272 pixel display that has a SSD1963 controller. I am using a 16 bit port i/o interface and that works fine. I can draw squares and text on the screen using simple drivers that I wrote to do that.

I  integrated the low level routines such as WriteCommand and WriteData into one of the examples in MSPware GRlib programs so I can use all the prementioned functions. I was able to modify the LCD TemplateDriver.c & TemplateDriver.h in the example that says 'No Driver' and get it to complile using CCS7.

I'm now trying to get one of the simple functions like

void Graphics_drawLineH(const Graphics_Context *context, int32_t x1, int32_t x2, int32_t  y)

void Graphics_drawButton(const Graphics_Context *context,const Graphics_Button *button)

void Graphics_drawCircle(const Graphics_Context *context, int32_t x, int32_t y,int32_t  radius)

to work? My question is what do I put in that first entry (Graphics_Context *context) of the call? Are there files of contexts that I can modify? I cannot find them. I read both the Users manual and the API in still feel lost. Please help.

I have been playing with this software for over a week and would really appreciate your support.

Thanks,

  • The context is a data structure which is required to maintain some data required for the LCD driver and just need to be defined.

    So the code could look like this:

    Graphics_Context g_sContext;

    int main()
    {
        .....


        // the function to init your LCD needs to be called first
        Graphics_initContext(&g_sContext, &g_sharp96x96LCD, &g_sharp96x96LCD_funcs);

      .....

    g_sharp128x128LCD and g_sharp128x128LCD_funcs are structures which needs to be defined in your driver for the LCD. You can check the driver for the Sharp96x96 LCD as a good reference.

  • Thanks for the reply. In the Sharp example, I assume you mean this define;

    const Graphics_Display g_sharp96x96LCD =
    {
    sizeof(tDisplay),
    DisplayBuffer,
    LCD_HORIZONTAL_MAX,
    LCD_VERTICAL_MAX,
    Sharp96x96_PixelDraw, //PixelDraw,
    Sharp96x96_DrawMultiple,
    Sharp96x96_LineDrawH,
    Sharp96x96_LineDrawV, //LineDrawV,
    Sharp96x96_RectFill, //RectFill,
    Sharp96x96_ColorTranslate,
    Sharp96x96_Flush, //Flush
    Sharp96x96_ClearScreen //Clear screen. Contents of display buffer unmodified

    };

    A couple of questions- What is' tDisplay' Couldnt find it defined in entire Sharp example project? My Display is 480x272

    The 'No Driver' example routines require for example data structure definitions such as;

    void Graphics_drawCircle(const Graphics_Context *context, int32_t x, int32_t y, int32_t radius)....This would probably be as Sharp example, but what about 

    void Graphics_drawImageButton(const Graphics_Context *context,const Graphics_ImageButton *imageButton)

    Thanks Again

  • Some further information and questions'??';
    The example 'No Driver" program shows the shell of the context as follows;
    //*****************************************************************************
    //
    //! This structure defines a drawing context to be used to draw onto the
    //! screen. Multiple drawing contexts may exist at any time.
    //
    //*****************************************************************************
    typedef struct Graphics_Context
    {
    int32_t size; //!< The size of this structure. ??
    const Graphics_Display *display; //!< The screen onto which drawing operations are performed. ??
    Graphics_Rectangle clipRegion; //!< The clipping region to be used when drawing onto the screen. format??
    uint32_t foreground; //!< The color used to draw primitives onto the screen.
    uint32_t background; //!< The background color used to draw primitives onto the screen.
    const Graphics_Font *font; //!< The font used to render text onto the screen.
    } Graphics_Context;
  • An easy way to find the definition is to use CTRL and click on the corresponding item.
    This will bring you directly to the definition of this.

    Using this you should be able to find all this information.

    One additional note: Graphics_Context is used for the GRLIB to maintain data. You should not modify this directly but only use the provided API functions.
  • I'm sorry, but I"m a little confused. You are saying don't alter the 'Graphics_Context" which is defined as;
    typedef struct Graphics_Context
    {
    int32_t size; //!< The size of this structure.
    const Graphics_Display *display; //!< The screen onto which drawing operations are performed.
    Graphics_Rectangle clipRegion; //!< The clipping region to be used when drawing onto the screen.
    uint32_t foreground; //!< The color used to draw primitives onto the screen.
    uint32_t background; //!< The background color used to draw primitives onto the screen.
    const Graphics_Font *font; //!< The font used to render text onto the screen.
    } Graphics_Context;

    The API for example drawlineH is;
    void Graphics_drawLineH(const Graphics_Context *context, int32_t x1, int32_t x2,int32_t y)

    What do I modify????
  • in this function you simply pass parameters:

    *context -> struct containing data for the grlib function - you do just pass the pointer to the struct so that the function knows where to get and store the data it needs internally. As you can use grlib to handle multiple displays in one application this data needs to be stored outside the function and passed to all grlib functions so that they know which display currently should be accessed. So you just need to pass the pointer to this structure but all the handling is inside the grlib functions.

    int32_t x1 -> x position of starting point -> you add the data here

    int32_t x2 -> x position of end point -> you add the data here

    int32_t y  -> y position of starting point -> you add the data here

  • Thank you  again,

    I understand the function needs the pointer to locate the structure data. I guess I'm not being clear on my question. I'm only using one display as this is for an embedded OEM product. In defining the structure, I don't know what to put into a couple of the fields, 

    typedef struct Graphics_Context
    {
    int32_t size; //!< The size of this structure. WHAT DO I PUT HERE? What is the size of this structure? 6
    const Graphics_Display *display; //!< The screen onto which drawing operations are performed. WHAT DO I PUT HERE A TEXT NAME OF THE DISPLAY/ a pointer? Please give example
    Graphics_Rectangle clipRegion; //!< The clipping region to be used when drawing onto the screen. Understood
    uint32_t foreground; //!< The color used to draw primitives onto the screen. Understood
    uint32_t background; //!< The background color used to draw primitives onto the screen.Understood
    const Graphics_Font *font; //!< The font used to render text onto the screen.Understood
    } Graphics_Context;

    Also- Is there a private contact where I can ask these questions off line?

  • As already mentioned above - YOU do not need to put any data into this structure. You just need to provide the structure to the underlying functions int the grlib. The functions in grlib can and will than use this structure to store internal data they need to work.

    E.g. when you call the GrContextInit(&g_sContext, &g_sharp96x96LCD); function. The GrContextInit function will then store:

        // Set the size of the context.
        context->size = sizeof(Graphics_Context);
        // Save the pointer to the display.
        context->display = display;

    So just provide the structure the data inside is handled in the grlib functions.

  • Stefan,

    Thanks again and thanks for your patience! I understand what you are saying and maybe I'm making it more difficult then it should be. So I think I just need to add the low level drivers and initialization routine into the TemplateDriver.c and the display size,etc in the TemplateDriver.h file. I tried that and am running into a problem because I will not be using a ram buffer. The buffer size would have to be 480x272= 130K which is much larger then the available ram in the MSP430. The text comments say it is not necessary, but how do I do take it out. The Template_Memory definition sizes the memory, and if I take it out I get errors when the function try to use it? What changes do I need to make in order to not work with a ram buffer?

    Thanks Again,

    Jerry

  • Hi Jerry,

    no problem - good to have that solved.

    I am not sure on all dependencies and what error message you receive.

    But as far as i could see the buffer is only used in the low level driver - i guess this i in your case in the the TemplateDriver.h and TemplateDriver.c files.

    If you do not use the buffer there and directly write into the LCD then it should work.

    In the exmples driver file (e.g. sharp96x96) the pointer to the  buffer is in the called :pvDisplayData.

    So may you check for this.

    (You need the size of the display for the functions to know where it can draw - so this is required.)

    Stefan

  • Hi Jerry,

    sorry for  the late reply the thread did went out of my view.

    When calling the display init function

    functionGraphics_initContext(&g_sContext, &g_sharp96x96LCD);

    use a display buffer size of 0 in the control sturcture

    const Graphics_Display g_sharp96x96LCD =
    {
        sizeof(tDisplay),
        0, //DisplayBuffer,
        LCD_HORIZONTAL_MAX,
        LCD_VERTICAL_MAX,
        ....

    But ensure that your low level driver do then also not work with the buffer but directly write to the display, which would also lead to an empty Flush function for the display as there is not buffer which needs to be written to the display anymore.

  • Thanks- I was able to get it working using a buffer size of 10.

  • Hi Jerry,
    thanks for the feedback and for closing the thread with pushing the resolved button.
    In case you have any additional questions on that topic you and open it anytime again or also open another thread.

    ~ Stefan

**Attention** This is a public forum