Digole UART/I2C/SPI Display Library

RWB, the *data has to be substituted for the pointer to your array containing the start screen data like this:

const uint8_t startscreen{1024] = { ... EXACTLY 1024 bytes of screen data here ...};
    
    ...
void setup() {
...
    digole.uploadStartScreen(1024,startscreen);
    delay(500);  //before you do anything else with the screen, let it finish the operation
...
}

:smile:

1 Like

@peekay123 Ok I have tried to upload the start screen a million times now and get garbled results every time.


Here is the image code from the online Digole conversion software. All my other images show up just fine when created and called from the main loop. See if you can get this image uploaded to your screen successfully.

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x03,0xe0,0x80,0x00,0x03,0x80,0x00,0x02,0x00,0x02,0x00,0x38,0x00,0x00,0x00,0x20
,0x02,0xa0,0x80,0x00,0x02,0x80,0x00,0x02,0x00,0x02,0x00,0x28,0x00,0x00,0x00,0x20
,0x02,0xa0,0x80,0x00,0x02,0x80,0x00,0x02,0x00,0x02,0x00,0x28,0x00,0x00,0x00,0x20
,0x00,0x80,0xe0,0xe0,0x02,0x83,0x83,0x82,0x83,0x83,0x00,0x28,0x38,0x38,0x38,0x20
,0x00,0x80,0xa0,0xa0,0x02,0x82,0x82,0x82,0x82,0x82,0x00,0x28,0x28,0x28,0x28,0x20
,0x00,0x80,0xa0,0xa0,0x03,0x82,0x82,0x03,0x02,0x82,0x00,0x38,0x08,0x28,0x28,0x20
,0x00,0x80,0xa0,0xe0,0x02,0x02,0x82,0x03,0x03,0x82,0x00,0x20,0x38,0x28,0x38,0x20
,0x00,0x80,0xa0,0x80,0x02,0x02,0x82,0x03,0x02,0x02,0x00,0x20,0x28,0x28,0x20,0x20
,0x00,0x80,0xa0,0xa0,0x02,0x02,0x82,0x82,0x82,0x82,0x00,0x20,0x28,0x28,0x28,0x20
,0x00,0x80,0xa0,0xe0,0x02,0x03,0x83,0x82,0x83,0x83,0x00,0x20,0x38,0x28,0x38,0x20
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x07,0xf0,0x02,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x3f,0xfe,0x04,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0xff,0xff,0x88,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xfb,0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xbf,0xee,0xe0,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xff,0x7d,0xf8,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xfb,0xff,0xd8,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x1d,0xff,0xfb,0xfc,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0x7f,0xfc,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xbf,0xef,0xfe,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x3d,0xff,0xff,0xbe,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0xff,0xfe,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x1f,0xbf,0xfd,0xbf,0xfe,0xfc,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x2f,0xbf,0xfb,0xb6,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0x7f,0xfe,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x3d,0xf7,0xff,0xfe,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xff,0xdc,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xdf,0xfc,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0xdf,0xfd,0xf8,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xfe,0xff,0xf8,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xdf,0xf0,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xf7,0xfb,0xe0,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0xff,0xff,0x88,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x3e,0xfe,0x04,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x07,0xf0,0x02,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x04,0x00,0x00,0x44,0x00,0x00,0x70,0x02,0x40,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x04,0x00,0x00,0x44,0x00,0x00,0x50,0x04,0x40,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x04,0x00,0x00,0x40,0x00,0x00,0x50,0x04,0x40,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x04,0x1c,0x71,0xc4,0x71,0xc0,0x41,0xc6,0x65,0x47,0x1c,0x70,0x00,0x00
,0x00,0x00,0x04,0x14,0x51,0x44,0x51,0x40,0x21,0x44,0x45,0x45,0x14,0x50,0x00,0x00
,0x00,0x00,0x04,0x14,0x11,0x44,0x51,0x40,0x21,0x44,0x45,0x41,0x10,0x50,0x00,0x00
,0x00,0x00,0x04,0x14,0x71,0x44,0x51,0x40,0x11,0x44,0x45,0x47,0x10,0x70,0x00,0x00
,0x00,0x00,0x05,0x14,0x51,0x44,0x51,0x40,0x51,0x44,0x45,0x45,0x10,0x40,0x00,0x00
,0x00,0x00,0x05,0x14,0x51,0x44,0x51,0x40,0x51,0x44,0x42,0x85,0x10,0x50,0x00,0x00
,0x00,0x00,0x07,0x1c,0x71,0xc4,0x51,0xc0,0x71,0xc4,0x62,0x87,0x10,0x70,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

RWB, can you post the code you use for initializing the digole and uploading the image please.

I got it working somehow:

Here is the exact code I used to upload the image to Digole:

const uint8_t myBitmap3[] ={ Hex Image Data Goes Between Brackets};

void setup() {
    digole.begin();
    digole.uploadStartScreen(1024,myBitmap3);
    delay(5000);
}

I think its important that when using the Digole Online Image Hex converting software to choose the bottom setting called Other 12864 LCD&Universal Adapter Welcome Screen to get the image to show up correctly.

2 Likes

RWB, thanks for pointing the obvious (that is so easy for us to forget!). :blush:

Update on the digole libraries and other stuff:

  1. Very soon, I will be doing a pull request to timbā€™s digole library to add extra primitives - triangles, rounded boxes, arcs, pies and elipses, both in outlined and filled formats.

  2. I have been working on exploiting the digole font memory to do sprite animations with a lot of success. It is somewhat tricky, however, since the fonts have to be defined with zero ā€œdropā€ and equal ā€œascentsā€ and ā€œdescentsā€ which I have not yet figured out how to do in Fontforge (I had to edit the .bdf font file to do it). Once I figure out how to do this, I will document it all.

So on the sprite bit, my personal requirement is to do instrumentation sprites and icons. For example, sprites for various bar graphs, battery gauge, etc. I also designed some sprites to do a needle meter. For icons, these would be for displaying WiFi status, SD symbol and so on. I would like to know what you the members might be interested in seeing for both the sprites and icons! Please let me know :slight_smile:

By the way, you donā€™t need to do a pull request! Youā€™ve got full access to that repository. So you should be able to clone it directly without forking it. If you use the GitHub app for WIndows/Mac, it should show up under ā€œGITHUB.COMā€ in the lefthand column of the main window. Click that, click the timothybrown/Spark-Core-Sundries repo and clone it. Then you can directly do a commit from the CLI or app!

I was about to ask you where you were at on this Digole stuff.

I think your Sprites that you have shown are pretty cool and will fit most peoples needs.

Iā€™m really interested in learning how you are making them so I can do the same for my own needs. Looking forward to your tutorial.

Iā€™m also interested in how to upload custom font libraries.

Once I learn how to do this and the next Sprint gets releases where I can turn the CC3000 ON/OFF and Power it down in code as needed then Iā€™ll be well on my way to getting the Spark Core to do what Iā€™m needing it to do.

timb, Iā€™ll be honest, Github confuses the crap out of me! Using web-based acces to Github is partially logical though a lot of stuff is not intuitive. Using it, your repository lists as one of mine but the only clone option I see is to my desktop.

Using the Windows version is total crap. I canā€™t even see your stuff so I just removed it.[quote=ā€œtimb, post:350, topic:2392ā€]
Then you can directly do a commit from the CLI or app!
[/quote]
I am not sure what this means. I ā€œthinkā€ it means I modify the files on ā€œmyā€ repository and it will create a new commit. Am I understanding this correctly? :frowning:

Found a LCD Supplier that has more LCD screens than I have ever seen before. They have a USA office also:

http://www.orientlcd.com/default.asp

RWB, lots of LCDā€™s but for the most part, ā€œdumbā€ displays and the prices are not superb. Have you looked at www.buydisplay.com?

Oh gosh this looks tempting to buy and attaching to the :spark: coreā€¦

https://www.kickstarter.com/projects/1516846343/microview-chip-sized-arduino-with-built-in-oled-di?ref=popular

1 Like

Itā€™s cute but not cheap!

@peekay123 based on your experience, is it worth getting?

The OLED display specs are here. I never owned one and would love to buy an OLED to begin with :smile:

Schematic here:

https://www.dropbox.com/s/7azxcfg0m6dw1dv/schematic.png

kennethlimcp, that little unit is actually an oled with an atmega328 processor which is basically an arduino UNO. If you want to play with oled without all the hassles, Digole has this new display that also has the onboard processor. They also have monochrome oled units. Of course, there is the larger 1.8" Digole oled unit which many members have used. You can also find oled displays at Adafruit. Digole and buydisplay.com also have ā€œbareā€ oled displays that will require surface mounting for the connector and some extra components if you want to go that route.

Personally, I really like the Digole smart displays since they handle all the heavy lifting and we have a great library for them. It comes down to effort vs cost for the given purpose. :smile:

2 Likes

Has anyone had any success with the latest version of the library working with I2C? I get the following errors when I try to build the demo.

In file included from ../inc/spark_wiring.h:30:0,
from ../inc/application.h:31,
from DigoleSerialDisp.cpp:10:
../../core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning "Defaulting to Release Build" [-Wcpp]
In file included from DigoleSerialDisp.cpp:11:0:
DigoleSerialDisp.h: In member function 'size_t DigoleSerialDisp::print(const char*)':
DigoleSerialDisp.h:225:5: warning: no return statement in function returning non-void [-Wreturn-type]
DigoleSerialDisp.cpp: In member function 'void DigoleSerialDisp::drawRoundRect(int, int, int, int)':
DigoleSerialDisp.cpp:267:9: warning: unused variable 'tmp' [-Wunused-variable]
DigoleSerialDisp.cpp: In member function 'void DigoleSerialDisp::fillRoundRect(int, int, int, int)':
DigoleSerialDisp.cpp:291:9: warning: unused variable 'tmp' [-Wunused-variable]
DigoleSerialDisp.cpp: In member function 'void DigoleSerialDisp::plot4EllipsePoints(int, int, int, int, int)':
DigoleSerialDisp.cpp:500:25: error: 'max_x' was not declared in this scope
DigoleSerialDisp.cpp:500:47: error: 'max_y' was not declared in this scope
DigoleSerialDisp.cpp:503:43: error: 'max_y' was not declared in this scope
DigoleSerialDisp.cpp:509:25: error: 'max_x' was not declared in this scope
DigoleSerialDisp.cpp:515:19: error: 'max_x' was not declared in this scope
DigoleSerialDisp.cpp:517:19: error: 'max_y' was not declared in this scope
make: *** [DigoleSerialDisp.o] Error 1

If I clean up the compile errors, it just never updates the screen. Any thoughts?

Update on making sprites: I have been trying a bunch of things to create a sprite ā€œfontā€ for the Digole displays. This has been a big pain in my keester since there is no one program to do it all. The biggest issue is getting a u8glib-compatible font that has NO metrics (ascent, descent, etc.) so that each ā€œcharacterā€ or sprite is exactly N by N in size and displays exactly where expected. If you donā€™t know what Iā€™m talking about, check out the u8glib font information.

I first start with GraphicsGale Free Edition to create each of the sprites in the size I need like 32x32 or 16x16 in 1-bit color. The reason I use this program is it has a lot of drawing tools that other programs donā€™t. Once I have drawn my sequence of sprites or ā€œframesā€, I export ā€œmultiple imagesā€ to .png files. As many sprites as needed can be created this way, resulting in a number of .png image files.

Then, I use Fontforge for windows and create a new file, then create a ā€œBitmap Strikes Availableā€ with Pixel Sizes of the size I need (eg 32, 16). I then edit characters starting at the ā€œspaceā€ character where I import the .png sprite images created in GraphicsGale into each subsequent character ā€œcellsā€. Care has to be taken to correctly align the bottom of the imported graphics with the bottom of the FontForge character cell by moving it down when imported. This is to have the bottom of the imported graphic at the lower ā€œdescentā€ position so it displays correctly. Keep in mind that with 32x32 sprites, 32 sprites will take 4KB of digole font space.

Once all my FontForge characters are done, I do a ā€œGenerate Fontsā€ which will create a .BDF font file that can be converted for use with the Digole display. During this step, all the ā€œSFNTā€ options are turned off under the ā€œOptionsā€ menu.

So now we have a .BDF font but FontForge has imbedded some ā€œdescentā€ data we donā€™t want. So now we turn to Fony to fix this last part. I could skip the previous steps and only use Fony but it has poor editing tools. Now, I do an Import ā€œBDF font fileā€ to load the sprite font. To correctly adjust the font size, I select ā€œEdit/Propertiesā€ in the menu. There I change the ā€œAscentā€ value to be the same as the ā€œHeightā€ value and tick the ā€œMonospacedā€ checkbox and hit OK. I answer YES to the convert dialog box and now the font is correctly setup. I then select ā€œFile/Export/BDF fontā€ and save the file back to .BDF format.

Finally (!), the last step is to create a .c file with the array data I need to send to the Digole display. For this I use bdf2u8g.exe to create the .c file. The final step is to cut&paste the array data into a const char array which I then send to the digole using the uploadUserFont() command.

I will be posting a simple font uploading program in my github soon.

Fun eh! Enjoy :open_mouth:

1 Like

jkusnier, my bad! I swear I shouldnā€™t do commits without first topping up on my caffeine! I fixed the bugs and it now compiles just fine. I just did the commits so it should be available. :smile:

1 Like

It does compile now (Thanks!), but still no luck on I2C. I have D0 going to DATA and D1 going to CLK. Am I missing something?

The same display works fine on an Arduino UNO with the Digole libs, but no luck with the spark core.

jkusnier, you need 4.7K ohm pull-up resistors on both I2C lines.