Skip to content
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

Fix scaling of last LED in page #3

Merged
merged 1 commit into from
Aug 29, 2023
Merged
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
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ where
/// Fill the display with a single brightness. The brightness should range from 0 to 255.
pub fn fill(&mut self, brightness: u8) -> Result<(), I2cError> {
self.bank(Page::Pwm1)?;
let mut buf = [brightness; 0xB4];
let mut buf = [brightness; 0xB5];
buf[0] = 0x00; // set the initial address
self.write(&buf)?;
self.bank(Page::Pwm2)?;
self.write(&buf[..=0xAA])?;
self.write(&buf[..=0xAB])?;
Ok(())
}

Expand Down Expand Up @@ -89,11 +89,11 @@ where
/// Set the current available to each LED. 0 is none, 255 is the maximum available
pub fn set_scaling(&mut self, scale: u8) -> Result<(), I2cError> {
self.bank(Page::Scale1)?;
let mut buf = [scale; 0xB4];
let mut buf = [scale; 0xB5];
buf[0] = 0x00; // set the initial address
self.write(&buf)?;
self.bank(Page::Scale2)?;
self.write(&buf[..=0xAA])?;
self.write(&buf[..=0xAB])?;
Ok(())
}

Expand Down
Loading