protheus

Forum Replies Created

Viewing 4 posts - 16 through 19 (of 19 total)
  • Author
    Posts
  • in reply to: Nokia PCD8544 (5110 LCD display) is a little strange #20741
    protheus
    Participant

    I should also note that the least significant bit of the number seems to become the top of the column, and then following pixels proceed downward to the most significant bit.

    Chris

    in reply to: Nokia PCD8544 (5110 LCD display) is a little strange #20740
    protheus
    Participant

    So, after going back and looking at the library, things are slightly stranger than I thought.  The drawBitmap function assumes that each byte
    you hand it is a column (yes, really) of 8 bits, but the columns are
    written out from left to right, then top to bottom.  So the first byte
    represents the top, left column of 8 bits.  The second represents the
    one to the right of it, and so on.  It’s quite odd.  It draws it back
    out with this code:

    void Adafruit_GFX::drawBitmap(int16_t x, int16_t y,
    const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color) {
    for (int16_t j=0; j<h; j++) {
    for (int16_t i=0; i<w; i++ ) {
    if (pgm_read_byte(bitmap + i + (j/8)*w) & _BV(j%8)) {
    drawPixel(x+i, y+j, color);
    }
    }
    }
    }

    Anyway, once you arrange your pixels in this way, they do show up in the correct spot on the screen.

    Chris

    in reply to: Nokia PCD8544 (5110 LCD display) is a little strange #20739
    protheus
    Participant

    Thanks Windell.  I did go through the tutorial, and everything works as advertised, but it doesn’t seem to cover this subject.  I haven’t tried their forum, but I did look through it to see if anyone else was talking about this, which they werent.  I’ve looked over the library several times and the impression it gives me is that this is all a straightforward matter of packing bits row wise into a byte array, but I haven’t been able to get that to work as well as it should except in that one case I mention above.  Now there are two special things about that case.  First, the other images are larger than the test image that worked.  Next, I actually did the conversion by hand instead of using some scripts that _should_ do the same work.  To make a long story short, I’m beginning to suspect that the code that’s supposed to build the array isn’t doing what it’s supposed to.  Maybe it’s insisting on using signed values, or who knows.. I’m thinking about going through and writing a conversion script that does a little debugging.  That or something in c where I can guarantee the behavior.

    Chris

    in reply to: New Diavolino #20736
    protheus
    Participant

    Beautiful.  I hadn’t thought of that (obviously…), but you’re absolutely right.  One source of power at any given time should be enough. :)

    Chris

Viewing 4 posts - 16 through 19 (of 19 total)