Skip to content

Update to digital v2 since original digital OutputPin has been deprecated #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
//! ```

use hal;
use hal::digital::OutputPin;
use hal::digital::v2::OutputPin;

use crate::displayrotation::DisplayRotation;
use crate::displaysize::DisplaySize;
Expand Down
8 changes: 4 additions & 4 deletions src/interface/spi.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! SSD1306 SPI interface

use hal;
use hal::digital::OutputPin;
use hal::digital::v2::OutputPin;

use super::DisplayInterface;

Expand Down Expand Up @@ -31,18 +31,18 @@ where
DC: OutputPin,
{
fn send_commands(&mut self, cmds: &[u8]) -> Result<(), ()> {
self.dc.set_low();
let _ = self.dc.set_low();

self.spi.write(&cmds).map_err(|_| ())?;

self.dc.set_high();
let _ = self.dc.set_high();

Ok(())
}

fn send_data(&mut self, buf: &[u8]) -> Result<(), ()> {
// 1 = data, 0 = command
self.dc.set_high();
let _ = self.dc.set_high();

self.spi.write(&buf).map_err(|_| ())?;

Expand Down
8 changes: 4 additions & 4 deletions src/mode/graphics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//! ```

use hal::blocking::delay::DelayMs;
use hal::digital::OutputPin;
use hal::digital::v2::OutputPin;

use crate::displayrotation::DisplayRotation;
use crate::displaysize::DisplaySize;
Expand Down Expand Up @@ -68,11 +68,11 @@ where
RST: OutputPin,
DELAY: DelayMs<u8>,
{
rst.set_high();
let _ = rst.set_high();
delay.delay_ms(1);
rst.set_low();
let _ = rst.set_low();
delay.delay_ms(10);
rst.set_high();
let _ = rst.set_high();
}

/// Write out data to display
Expand Down
8 changes: 4 additions & 4 deletions src/mode/terminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use crate::mode::displaymode::DisplayModeTrait;
use crate::properties::DisplayProperties;
use core::fmt;
use hal::blocking::delay::DelayMs;
use hal::digital::OutputPin;
use hal::digital::v2::OutputPin;

/// A trait to convert from a character to 8x8 bitmap
pub trait CharacterBitmap<T> {
Expand Down Expand Up @@ -192,11 +192,11 @@ where
RST: OutputPin,
DELAY: DelayMs<u8>,
{
rst.set_high();
let _ = rst.set_high();
delay.delay_ms(1);
rst.set_low();
let _ = rst.set_low();
delay.delay_ms(10);
rst.set_high();
let _ = rst.set_high();
}

/// Write out data to display. This is a noop in terminal mode.
Expand Down