Skip to content

Custom Characters #8

@h4llow3En

Description

@h4llow3En

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions