• 0
KingJL

Pmod OLEDrgb really OLEDgrb???

Question

I have just got the Pmod OLEDrgb running on my Cmod-A7_35t. in a microblaze application.  During testing I have noticed that the OLEDrgb_BuildRGB( R, G, B )  function is building a u16 that really results in GRB being displayed.  I assume this is related to the endianess assumed by the function.  It is no big deal... for my purposes, I can deal with it in my code, but someone might want to change the demo and documentation .

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hi @KingJL,

Welcome to the Digilent forum!

We have contacted our content team and they are looking into this. Thank you for the input.

best regards,

Jon

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)

I just verified that it an endianess issue.  I modified the function OLEDrgb_BuildRGB( R, G, B ) in PmodOLEDrgb.c from:

u16 OLEDrgb_BuildRGB(u8 R, u8 G, u8 B) {
   return ((R >> 3) << 11) | ((G >> 2) << 5) | (B >> 3);
}
to:

u16 OLEDrgb_BuildRGB(u8 R, u8 G, u8 B) {
    u16 rgb_tmp;
    rgb_tmp = ((R >> 3) << 11) | ((G >> 2) << 5) | (B >> 3);
   return ((((rgb_tmp) >> 8 & 0xff) | (((rgb_tmp) & 0xff) << 8));
}
 Now the output colors follow what was specified in RGB order.

The code probably could use a "#ifdef { endianess }" for conditional code.

Edited by KingJL

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now