-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Description
In my now abandoned project about the HD44780 I tried my luck with the following function to create custom characters. Maybe this is a bit of help to you.
static CGRAM_ADDRESS: u8 = 0x40;
...
/// Creates a new custom character from a bitmap on the given `address`
pub fn create_char(&self, address: u8, bitmap: [u8; 8]) -> Result<u8, &'static str> {
// send new custom character to cgram address
match address {
0...7 => {
// Just send the COMMAND command to the given address
self.command(CGRAM_ADDRESS | address << 3);
for row in &bitmap {
self.send_byte(bitmap[*row as usize], DATA);
}
Ok(address)
},
_ => Err("address must be between 0 and 7"),
}
}
Metadata
Metadata
Assignees
Labels
No labels