Skip to content

Commit

Permalink
Remove matrix version support for now
Browse files Browse the repository at this point in the history
Need to map the LEDs properly to positions.

Signed-off-by: Daniel Schaefer <[email protected]>
  • Loading branch information
JohnAZoidberg committed Oct 9, 2023
1 parent c67479b commit c6e0710
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 45 deletions.
48 changes: 4 additions & 44 deletions src/devices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,48 +12,6 @@ pub struct UnknownDevice<I2C> {
pub device: IS31FL3743<I2C>,
}

#[cfg(feature = "embedded_graphics")]
use embedded_graphics_core::{pixelcolor::Rgb888, prelude::*, primitives::Rectangle};

#[cfg(feature = "embedded_graphics")]
impl<I2C, I2cError> Dimensions for UnknownDevice<I2C>
where
I2C: Write<Error = I2cError>,
I2C: Read<Error = I2cError>,
{
fn bounding_box(&self) -> Rectangle {
Rectangle::new(Point::zero(), Size::new(13, 9))
}
}

#[cfg(feature = "embedded_graphics")]
impl<I2C, I2cError> DrawTarget for UnknownDevice<I2C>
where
I2C: Write<Error = I2cError>,
I2C: Read<Error = I2cError>,
I2cError:,
{
type Color = Rgb888;
type Error = Error<I2cError>;

fn draw_iter<I>(&mut self, pixels: I) -> Result<(), Self::Error>
where
I: IntoIterator<Item = Pixel<Self::Color>>,
{
for Pixel(coord, color) in pixels.into_iter() {
// Check if the pixel coordinates are out of bounds (negative or greater than
// (63,63)). `DrawTarget` implementation are required to discard any out of bounds
// pixels without returning an error or causing a panic.
if let Ok((x @ 0..=13, y @ 0..=9)) = coord.try_into() {
// Calculate the index in the framebuffer.
self.pixel_rgb(x as u8, y as u8, color.r(), color.g(), color.b())?
}
}

Ok(())
}
}

impl<I2C, I2cError> UnknownDevice<I2C>
where
I2C: Write<Error = I2cError>,
Expand All @@ -72,11 +30,13 @@ where
device: IS31FL3743 {
i2c,
address: 0b0100000,
// Dummy values, not used
width: 18 * 11,
// Dummy values, not used
height: 1,
calc_pixel: |x: u8, y: u8| -> u8 {
calc_pixel: |_x: u8, _y: u8| -> u8 {
// Dummy value, don't use this function
0x00
unimplemented!("No Matrix support yet")
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![no_std]
#![doc = include_str!("../README.md")]
/// Preconfigured devices
//pub mod devices;
pub mod devices;
use embedded_hal::blocking::delay::DelayMs;
use embedded_hal::blocking::i2c::Read;
use embedded_hal::blocking::i2c::Write;
Expand Down

0 comments on commit c6e0710

Please sign in to comment.