mirror of
https://github.com/yuri91/ili9341-rs.git
synced 2024-11-21 22:30:59 +00:00
Upgrade to embedded-graphics 0.6.0-alpha.2
This commit is contained in:
parent
54d5381ec4
commit
905a1c8406
2 changed files with 12 additions and 12 deletions
|
@ -14,7 +14,7 @@ embedded-hal = "0.2.2"
|
||||||
|
|
||||||
[dependencies.embedded-graphics]
|
[dependencies.embedded-graphics]
|
||||||
optional = true
|
optional = true
|
||||||
version = "0.4.7"
|
version = "0.6.0-alpha.2"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["graphics"]
|
default = ["graphics"]
|
||||||
|
|
22
src/lib.rs
22
src/lib.rs
|
@ -5,13 +5,13 @@ extern crate embedded_hal as hal;
|
||||||
#[cfg(feature = "graphics")]
|
#[cfg(feature = "graphics")]
|
||||||
extern crate embedded_graphics;
|
extern crate embedded_graphics;
|
||||||
|
|
||||||
use hal::blocking::spi;
|
|
||||||
use hal::blocking::delay::DelayMs;
|
use hal::blocking::delay::DelayMs;
|
||||||
use hal::spi::{Mode, Phase, Polarity};
|
use hal::blocking::spi;
|
||||||
use hal::digital::OutputPin;
|
use hal::digital::OutputPin;
|
||||||
|
use hal::spi::{Mode, Phase, Polarity};
|
||||||
|
|
||||||
use core::iter::IntoIterator;
|
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
|
use core::iter::IntoIterator;
|
||||||
|
|
||||||
/// SPI mode
|
/// SPI mode
|
||||||
pub const MODE: Mode = Mode {
|
pub const MODE: Mode = Mode {
|
||||||
|
@ -279,10 +279,10 @@ where
|
||||||
#[cfg(feature = "graphics")]
|
#[cfg(feature = "graphics")]
|
||||||
use embedded_graphics::drawable;
|
use embedded_graphics::drawable;
|
||||||
#[cfg(feature = "graphics")]
|
#[cfg(feature = "graphics")]
|
||||||
use embedded_graphics::{drawable::Pixel, pixelcolor::PixelColorU16, Drawing};
|
use embedded_graphics::{drawable::Pixel, pixelcolor::Rgb565, Drawing};
|
||||||
|
|
||||||
#[cfg(feature = "graphics")]
|
#[cfg(feature = "graphics")]
|
||||||
impl<E, SPI, CS, DC, RESET> Drawing<PixelColorU16> for Ili9341<SPI, CS, DC, RESET>
|
impl<E, SPI, CS, DC, RESET> Drawing<Rgb565> for Ili9341<SPI, CS, DC, RESET>
|
||||||
where
|
where
|
||||||
SPI: spi::Transfer<u8, Error = E> + spi::Write<u8, Error = E>,
|
SPI: spi::Transfer<u8, Error = E> + spi::Write<u8, Error = E>,
|
||||||
CS: OutputPin,
|
CS: OutputPin,
|
||||||
|
@ -292,15 +292,15 @@ where
|
||||||
{
|
{
|
||||||
fn draw<T>(&mut self, item_pixels: T)
|
fn draw<T>(&mut self, item_pixels: T)
|
||||||
where
|
where
|
||||||
T: Iterator<Item = drawable::Pixel<PixelColorU16>>,
|
T: IntoIterator<Item = drawable::Pixel<Rgb565>>,
|
||||||
{
|
{
|
||||||
for Pixel(pos, color) in item_pixels {
|
for Pixel(pos, color) in item_pixels {
|
||||||
self.draw_raw(
|
self.draw_raw(
|
||||||
pos.0 as u16,
|
pos.x as u16,
|
||||||
pos.1 as u16,
|
pos.y as u16,
|
||||||
pos.0 as u16,
|
pos.x as u16,
|
||||||
pos.1 as u16,
|
pos.y as u16,
|
||||||
if color == PixelColorU16(0) {
|
if color == Rgb565::new(0, 0, 0) {
|
||||||
&[0xff, 0xff]
|
&[0xff, 0xff]
|
||||||
} else {
|
} else {
|
||||||
&[0, 0]
|
&[0, 0]
|
||||||
|
|
Loading…
Reference in a new issue