igelbox/tm1637-rs

[Feature request] Display strings and the Colon

Opened this issue · 2 comments

Feature request.

Please add strings and the colon support to the crate.

Thank you!

Thank you for proposing ideas/features.

What do you mean by strings support? Could you please provide some useful example?
I cannot imaging how 4 characters displays could be useful to display strings.

As for the colon support - yeah it seems useful.

But, to be honest, I'm not sure when I will recreate the circuit to test the code afterwards. Probably, it would be better/faster if you just define some ALPHABET array (like DIGITS) and write something like print_hex in your code for now.
Also, for column workaround - you could try adding 0x80 to the code (but without a circuit I cannot tell it for sure).

Got it working.

   SEG_8 = 0b10000000;

    pub fn print_hex(&mut self, address: u8, digits: &[u8], show_colon: bool) -> Res<E> {
        self.print_raw_iter(
            address,
            digits.iter().map(|digit| {
                let mut d = DIGITS[(digit & 0xf) as usize];

                if address == 1 && show_colon {
                    d |= SEG_8 as u8;
                }

                d
            }),
        )
    }