Skip to content

Commit

Permalink
add DisplaySpecs::COLUMN_OFFSET
Browse files Browse the repository at this point in the history
  • Loading branch information
agrif committed May 20, 2024
1 parent a95a1c2 commit 72423a7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ impl DisplaySpecs<132, 32, 4> for DOGM132W5 {
const VOLTAGE_REGULATOR_RESISTOR_RATIO: u8 = 0b011;
const ELECTRONIC_VOLUME: u8 = 0b011111;
const BOOSTER_RATIO: BoosterRatio = BoosterRatio::StepUp2x3x4x;
const COLUMN_OFFSET: u8 = 0;
}
```

Expand Down
3 changes: 3 additions & 0 deletions src/display_specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ pub trait DisplaySpecs<const WIDTH: usize, const HEIGHT: usize, const PAGES: usi

/// The internal booster ratio
const BOOSTER_RATIO: BoosterRatio;

/// The offset of the first column on the display
const COLUMN_OFFSET: u8;
}
3 changes: 3 additions & 0 deletions src/displays/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ impl DisplaySpecs<132, 32, 4> for DOGM132W5 {
const VOLTAGE_REGULATOR_RESISTOR_RATIO: u8 = 0b011;
const ELECTRONIC_VOLUME: u8 = 0b011111;
const BOOSTER_RATIO: BoosterRatio = BoosterRatio::StepUp2x3x4x;
const COLUMN_OFFSET: u8 = 0;
}

/// Display specification for the DOGL128-6 display
Expand All @@ -38,6 +39,7 @@ impl DisplaySpecs<132, 64, 8> for DOGL128_6_EXT12V {
const VOLTAGE_REGULATOR_RESISTOR_RATIO: u8 = 0b100111;
const ELECTRONIC_VOLUME: u8 = 0b010110;
const BOOSTER_RATIO: BoosterRatio = BoosterRatio::StepUp2x3x4x;
const COLUMN_OFFSET: u8 = 0;
}

/// Display specification for the GM12864-06D Ver. 2.2 display.
Expand All @@ -55,4 +57,5 @@ impl DisplaySpecs<132, 64, 8> for GMG12864 {
const VOLTAGE_REGULATOR_RESISTOR_RATIO: u8 = 0b111;
const ELECTRONIC_VOLUME: u8 = 0b010001;
const BOOSTER_RATIO: BoosterRatio = BoosterRatio::StepUp2x3x4x;
const COLUMN_OFFSET: u8 = 0;
}
4 changes: 2 additions & 2 deletions src/driver/mode_graphics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<'a, const WIDTH: usize, const PAGES: usize> GraphicsMode<'a, WIDTH, PAGES>
impl<
'a,
DI: WriteOnlyDataCommand,
SPECS,
SPECS: DisplaySpecs<WIDTH, HEIGHT, PAGES>,
const WIDTH: usize,
const HEIGHT: usize,
const PAGES: usize,
Expand All @@ -49,7 +49,7 @@ impl<
self.interface
.send_command(Command::PageAddressSet { address })?;
self.interface.send_command(Command::ColumnAddressSet {
address: start as u8,
address: SPECS::COLUMN_OFFSET + start as u8,
})?;
self.interface.send_data(U8(&page.data[start..end]))?;
}
Expand Down

0 comments on commit 72423a7

Please sign in to comment.