Arduino Library, C/C++ integration in AS7 for OLED

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

Ok here is the part I am playing with:

 

https://www.uctronics.com/displa...

 

There is an Arduino Library that does all the heavy work for me.  I tested it out and it's super easy to use.  heres my rub...

 

I want to use the library in my project in AS7.  From what I have read here I should be able to massage it in, but I need to modify the library as I would prefer not to use WIRE.x to run my I2C bus, but it looks like theres more hiding in teh .h/.c files than just the WIRE.x stuff.

 

Has anyone ever been able to get this working without the need for Arduino's IDE?

 

I see my version of Codevision as something to drive these that I am looking at now, but I would like to be able to use teh Arduino library if at all possible.

 

Link to the OLED arduino library:

https://github.com/olikraus/U8g2...

 

I see David has provided some alternatives in other forums that I will have to look into.  Thing is, this library hs the ability to draw bars across the screen and other basic graphics rather easily so if I can make this work all teh better.

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

What do you actually want to do ?

Which target AVR do you want to run on ?

 

Most libraries will do most graphics e.g. lines, circles, bitmaps, ...

Most libraries will print Ascii text in a 5x7 font.

 

Unusual graphics shapes or fancy Chinese fonts are less well supported.

 

ASF or Start can drive SSD1306 with SPI interface.   Probably not I2C.

 

Arduino libraries in the Arduino IDE is the easiest way to do most things.

Codevision libraries are easy if you prefer C.

 

David.

 

 

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

david.prentice wrote:
What do you actually want to do ?

jgmdesign wrote:
I want to use the library in my project in AS7.

 

david.prentice wrote:
Which target AVR do you want to run on ?

Doesnt matter really.  Mega328 to start, then move to others.  THey all have the same TWI for the most part.

 

david.prentice wrote:

Most libraries will do most graphics e.g. lines, circles, bitmaps, ...

Most libraries will print Ascii text in a 5x7 font.

Yes, and I am looking for other options that are not bound to the Arduino IDE

 

david.prentice wrote:
Unusual graphics shapes or fancy Chinese fonts are less well supported.

Not interested in either

 

david.prentice wrote:
ASF or Start can drive SSD1306 with SPI interface.   Probably not I2C.

I prefer I2C.

 

david.prentice wrote:
Arduino libraries in the Arduino IDE is the easiest way to do most things.

Agreed.  Hence why I am looking to mod the one I posted about.

 

david.prentice wrote:
Codevision libraries are easy if you prefer C.

Yes, and I paid for my license and am looking at it now.

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

The great thing about Arduino is that encourages modular code. So, yeah, the GLCD driver may "sit on top" of a library like Wire but the boundary is well defined (in Wire.h) so the easiest option is probably to create a "shim" between the functionality of Wire and whatever I2C you want to use (Fleury?). At the end of the day the API is probably very similar : init, start, read, write, etc so the shim probably just involves getting the parameters to similar functions into the right parameter order.

 

https://en.m.wikipedia.org/wiki/Shim_(computing)

Last Edited: Fri. Oct 29, 2021 - 03:43 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The U8g2 library that Jim is referring to is actually written in C.

It just has a C++ wrapper for Arduino.

 

Oh,  the C version example I2C code uses Fleury.

 

Life is much easier withe the Arduino C++ class.    It comes with many examples and excellent documentation.
Likewise,   the Codevision C libraries have examples and built-in help.

 

There are many, many other SSD1306 libraries.   But you have to find them,   decipher any documentation,   struggle with code, ...

 

The underlying U8g2 C library code is documented but there is no "example C projects".

I have translated several of the Arduinp examples into C.   I keep threatening to post an AS7.0 Solution containing different C projects.

 

David.