Skip to content

Commit

Permalink
Change to embedded-graphics-core and update embedded-hal (#24)
Browse files Browse the repository at this point in the history
* Change to embedded-graphics-core and update embedded-hal

* update to release version of embedded-hal
  • Loading branch information
tarfu authored Mar 14, 2024
1 parent d8477ac commit 9bcaffb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ readme = "README.md"
documentation = "https://docs.rs/st7735-lcd"

[dependencies]
embedded-hal = "0.2"
nb = "0.1"
embedded-hal = "1.0.0"
nb = "1.1.0"

[dependencies.embedded-graphics]
version = "0.8"
[dependencies.embedded-graphics-core]
version = "0.4"
optional = true

[features]
default = ["graphics"]
graphics = ["embedded-graphics"]
graphics = ["embedded-graphics-core"]
22 changes: 11 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ pub mod instruction;

use crate::instruction::Instruction;

use embedded_hal::blocking::delay::DelayMs;
use embedded_hal::blocking::spi;
use embedded_hal::digital::v2::OutputPin;
use embedded_hal::delay::DelayNs;
use embedded_hal::spi;
use embedded_hal::digital::OutputPin;

/// ST7735 driver to connect to TFT displays.
pub struct ST7735<SPI, DC, RST>
where
SPI: spi::Write<u8>,
SPI: spi::SpiDevice,
DC: OutputPin,
RST: OutputPin,
{
Expand Down Expand Up @@ -50,7 +50,7 @@ pub enum Orientation {

impl<SPI, DC, RST> ST7735<SPI, DC, RST>
where
SPI: spi::Write<u8>,
SPI: spi::SpiDevice,
DC: OutputPin,
RST: OutputPin,
{
Expand Down Expand Up @@ -82,7 +82,7 @@ where
/// Runs commands to initialize the display.
pub fn init<DELAY>(&mut self, delay: &mut DELAY) -> Result<(), ()>
where
DELAY: DelayMs<u8>,
DELAY: DelayNs,
{
self.hard_reset(delay)?;
self.write_command(Instruction::SWRESET, &[])?;
Expand Down Expand Up @@ -117,7 +117,7 @@ where

pub fn hard_reset<DELAY>(&mut self, delay: &mut DELAY) -> Result<(), ()>
where
DELAY: DelayMs<u8>,
DELAY: DelayNs,
{
self.rst.set_high().map_err(|_| ())?;
delay.delay_ms(10);
Expand Down Expand Up @@ -245,9 +245,9 @@ where
}

#[cfg(feature = "graphics")]
extern crate embedded_graphics;
extern crate embedded_graphics_core;
#[cfg(feature = "graphics")]
use self::embedded_graphics::{
use self::embedded_graphics_core::{
draw_target::DrawTarget,
pixelcolor::{
raw::{RawData, RawU16},
Expand All @@ -260,7 +260,7 @@ use self::embedded_graphics::{
#[cfg(feature = "graphics")]
impl<SPI, DC, RST> DrawTarget for ST7735<SPI, DC, RST>
where
SPI: spi::Write<u8>,
SPI: spi::SpiDevice,
DC: OutputPin,
RST: OutputPin,
{
Expand Down Expand Up @@ -327,7 +327,7 @@ where
#[cfg(feature = "graphics")]
impl<SPI, DC, RST> OriginDimensions for ST7735<SPI, DC, RST>
where
SPI: spi::Write<u8>,
SPI: spi::SpiDevice,
DC: OutputPin,
RST: OutputPin,
{
Expand Down

0 comments on commit 9bcaffb

Please sign in to comment.