rust-embedded-community / ssd1306

SSD1306 OLED driver
Apache License 2.0
283 stars 69 forks source link

How to change addressing mode? #136

Closed nebelgrau77 closed 3 years ago

nebelgrau77 commented 3 years ago

How to use addressing mode?

I'm experimenting with sending images over serial to the board. I'm using the .draw method like in the white noise example, sending the serial RX buffer to the display. I noticed that the bits of the bytes are written top to bottom, but then the bytes are in horizontal order. So basically for each byte I get 8 vertical pixels until the end of the row, and so on. Which is different from what I imagined :) I understand this is the the default page mode? How can I change it to Horizontal, or in other words, how do I use init_with_mode or change_mode?

jamwaffles commented 3 years ago

I understand this is the the default page mode?

That's correct. It's been a while since I looked at the datasheet but IIRC there's no way to change this behaviour - the display only works with 8 pixel high pages. What order are the pixels from the serial buffer in? You'll probably have to do some transformations to turn them into the correct format to write to the raw display.

nebelgrau77 commented 3 years ago

Ok gotcha. At the moment they're in simple line-after-line order: 8 pixels, another 8 pixels, etc. until the end of the row, then anothe row and so on. I will need to change my code to make my bytes be in the expected order, then. No problem :) Thanks!