HELP: Discrepancy in GFX MONO between ASF3 and ASF4 (OLED)

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

 

Im new to the community. I was trying to use my OLED Board attached to ATSAMC21N18A. Unforuntately, I could not figure out how to use it since the GFX library available on Atmel Start is that of ASF4 which changed since ASF3. This also means that the documentation available for that library is only that of ASF 3. 

One of the problems Im facing right now is trying to type out a string.

In ASF3, the following line of code is used:  

gfx_mono_draw_string("Hello world!",0, 0, &sysfont)

; where the function in plain form is 

void gfx_mono_draw_string(const char *str, const gfx_coord_t x, const gfx_coord_t y, const struct font *font);

 

However, in ASF4, the function is

 void gfx_mono_text_draw_string(const struct gfx_mono_text *const me, const uint8_t *str, const gfx_coord_t x, const gfx_coord_t y, const struct font *font);

  which is quite similar to the previous one except for the first input to the function shown below

const struct gfx_mono_text *const me

What do I type in here when using an instance of the function? Any ideas or examples in mind?

 

I would appreciate any tips or feedback. Again, Im new to this and all the links that relate to the mono gfx documentation no longer exist or are outdated.

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can't you just look at the GFX Mono Text Example for SAMD21?

/Lars

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Im assuming youre referring to this  http://asf.atmel.com/docs/latest/samd21/html/asfdoc_common2_gfx_mono_quickstart.html . Ive tried it already. Unfortunately it applies the previous syntax (ASF3). The functions used in that example are not similar to ASF 4's functions. Just like Ive explained, -aside from the subtle change in the function name- there's that additional pointer input to the function which I do not understand. The subfolders document the function as follows:

/**
 * \brief Draws a string to the display
 *
 * This function will draw a string located in memory to the display.
 *
 * \param[in] me   The pointer to GFX mono text instance
 * \param[in] str  Pointer to string
 * \param[in] x    X coordinate on screen
 * \param[in] y    Y coordinate on screen
 * \param[in] font Font to draw string in
 */
void gfx_mono_text_draw_string(const struct gfx_mono_text *const me, const uint8_t *str, const gfx_coord_t x,
                               const gfx_coord_t y, const struct font *font);

 

Thanks

Last Edited: Fri. Sep 13, 2019 - 03:56 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No I think you can just load the example in start.atmel.com, it exists for SAMD21 (and others but not for SAMC21). Export it for Atmel Studio and look at the code.

/Lars

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Since its not available for SAMC21, would it mean, by any chance, that SAMC21 does not support OLED?

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bump

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No. You just can't expect the examples exist for every board. Did you try adding the driver(s) in a project for your C21?

/Lars

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I did not. Its difficult because the drivers and the syntax used in examples is different than what I need to use on the long term. All of the examples use ASF3, but the code im preparing (for educational purposes) has to be on ASF4. 

Thank you though..

Thanks