diff --git a/README.md b/README.md index a1fe446..18d6c7a 100644 --- a/README.md +++ b/README.md @@ -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; } ``` diff --git a/src/display_specs.rs b/src/display_specs.rs index c53404c..a61f79d 100644 --- a/src/display_specs.rs +++ b/src/display_specs.rs @@ -35,4 +35,7 @@ pub trait DisplaySpecs 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 @@ -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. @@ -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; } diff --git a/src/driver/mode_graphics.rs b/src/driver/mode_graphics.rs index 9ab895f..103837d 100644 --- a/src/driver/mode_graphics.rs +++ b/src/driver/mode_graphics.rs @@ -31,7 +31,7 @@ impl<'a, const WIDTH: usize, const PAGES: usize> GraphicsMode<'a, WIDTH, PAGES> impl< 'a, DI: WriteOnlyDataCommand, - SPECS, + SPECS: DisplaySpecs, const WIDTH: usize, const HEIGHT: usize, const PAGES: usize, @@ -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]))?; }