rust-embedded-community / ssd1306

SSD1306 OLED driver
Apache License 2.0
301 stars 68 forks source link

Use with a ssd1305 chip, and display size 132x64. #76

Closed everett1992 closed 5 years ago

everett1992 commented 5 years ago

I have this display from adafruit. It's a ssd1305 but in adafruit's circuit python tutorials they use a ssd1306 driver. I ran out of memory programming the chip in python so I'm switching to rust and found this library.

In python I had to define the display size as 132x64, despite being advertised as 128x32. With this display size the top left pixel is 32x4. If I use a display size of 128x32 then every other line is disabled (looks like an old crt).

I see the same behavior with your library, if I use a TerminalMode driver with DisplaySize::Display128x32 then every other line is disabled. If I use 128x64 the display is much better, each character looks correct, but the text starts off screen. The last columns of the display also do not work, it will show random pixels when the display is initialized and they will not change or clear.

everett1992 commented 5 years ago

I closed the PR because I think it's too heavy weight right now.

I reverted all changes in the PR back to master. Here is my display code, and photo of the display using the crate.

 let mut disp: GraphicsMode<_> = Builder::new()                              
         .with_size(DisplaySize::Display128x32)                                                                     
         .connect_spi(spi, dc)                                              
         .into();                                                           

    disp.reset(&mut rst, &mut delay);                                       
    disp.init().unwrap();                                                   
    disp.clear();                                                           

    disp.draw(                                                              
        Rect::new(Coord::new(0,0), Coord::new(127,31))                      
        .with_stroke(Some(1u8.into()))                                      
        .with_fill(Some(0u8.into()))                                        
        .into_iter()                                                        
    );                                                                                                     

    disp.flush().unwrap();                                                      
    loop {}              

Display128x32

If I enable scanline on Display128x32 the scanline issue does go away but the rectangle is offset, it looks like it starts left of the screen. (0,0) is in the top-left direction, TerminalMode supports this.

-            DisplaySize::Display128x32 => Command::ComPinConfig(false, false).send(&mut self.iface),
+            DisplaySize::Display128x32 => Command::ComPinConfig(true, false).send(&mut self.iface)

scanline fixed

terminal mode

jamwaffles commented 5 years ago

Hi, just bumping this old issue. Did you ever get any further in your investigations?

everett1992 commented 5 years ago

I never solved the offset issue.