Closed kunerd closed 6 years ago
CGRAM is devided into two address rooms, the first one for characters itself and the other for each pixel line of a character. See Table 5, Datasheet page 19-20.
5x8 dot characters:
7 | 6 | 5 \ | 4 \ | 3 | 2 \ | 1 \ | 0 |
---|---|---|---|---|---|---|---|
r | r | char addr | line addr |
5x10 dot characters:
7 | 6 | 5 \ | 4 | 3 \ | 2 \ | 1 \ | 0 |
---|---|---|---|---|---|---|---|
r | r | char addr | line addr |
Implementation proposal:
pub struct CharacterAddress(u8);
pub struct CharacterLineAddress(u8);
pub enum SeekCgRamFrom<T> {
Home(T),
Current(T),
}
impl<P, U> Display<P, U, CgRam>
where
U: Into<Address> + Home,
P: Send,
{
pub fn seek_character(&self, pos: SeekCgRamFrom<CharacterAddress>) {
// ...
}
pub fn seek_character_line(
&self,
char_pos: SeekCgRamFrom<CharacterAddress>,
line_pos: SeekCgRamFrom<CharacterLineAddress>,
) {
// ...
}
// ...
}
fixed by #29
CGRAM has different size than DDRAM.
CGRAM = 64 byte DDRAM = 128 byte (2 line version)