fn update_buffer_with_char(&mut self, index: Index, value: AsciiChar) -> Result<(), Error> {
        if value.is_ascii_hexdigit() {
            let val: u8;
            if value.is_ascii_digit() {
                // 0-9 converted to hex value
                val = value.as_byte() - b'0';
            } else {
                // a-f or A-F converted to hex value
                val = 0x0A + (value.to_ascii_uppercase().as_byte() - b'A');
            }
            let val = val as usize;
            assert!(val < HEX_NUMBER_FONT_TABLE.len());
            let bits = HEX_NUMBER_FONT_TABLE[val];
            update_bits(self, index, bits);
        } else if value == '-' {
            update_bits(self, index, MINUS_SIGN);
        } else {
            return Err(Error::NotValidChar);
        }

        Ok(())
    }
/// Update the buffer with an ascii character at the specified index.
/// # Arguments
///
/// * `index` - Digit index.
/// * `value` - Ascii character.
///
/// # Examples
///
/// ```
/// use ht16k33::i2c_mock::I2cMock;
/// use ht16k33::HT16K33;
/// use adafruit_7segment::{SevenSegment, Index, AsciiChar};
///
/// // Create an I2C device.
/// let mut i2c = I2cMock::new();
///
/// // The I2C device address.
/// const DISP_I2C_ADDR: u8 = 112;
///
/// let mut ht16k33 = HT16K33::new(i2c, DISP_I2C_ADDR);
///
/// // Set first digit to 'c'.
/// ht16k33.update_buffer_with_char(Index::One, AsciiChar::new('c')).expect("Failed to encode char to buffer!");
/// ```
Update the buffer with an ascii character at the specified index.
Update the buffer with an ascii character at the specified index .
fn update_buffer_with_char(&mut self, index: Index, value: AsciiChar) -> Result<(), Error> {
        if value.is_ascii_hexdigit() {
            let val: u8;
            if value.is_ascii_digit() {
                // 0-9 converted to hex value
                val = value.as_byte() - b'0';
            } else {
                // a-f or A-F converted to hex value
                val = 0x0A + (value.to_ascii_uppercase().as_byte() - b'A');
            }
            let val = val as usize;
            assert!(val < HEX_NUMBER_FONT_TABLE.len());
            let bits = HEX_NUMBER_FONT_TABLE[val];
            update_bits(self, index, bits);
        } else if value == '-' {
            update_bits(self, index, MINUS_SIGN);
        } else {
            return Err(Error::NotValidChar);
        }
        Ok(())
    }
fn update_buffer_with_char ( & mut self , index : Index , value : AsciiChar ) -> Result < ( ) , Error > { if value . is_ascii_hexdigit ( ) { let val : u8 ; if value . is_ascii_digit ( ) { // 0-9 converted to hex value val = value . as_byte ( ) - b'0' ; } else { // a-f or A-F converted to hex value val = 0x0A + ( value . to_ascii_uppercase ( ) . as_byte ( ) - b'A' ) ; } let val = val as usize ; assert ! ( val HEX_NUMBER_FONT_TABLE len ( ) ) ; let bits = HEX_NUMBER_FONT_TABLE [ val ] ; update_bits ( self , index , bits ) ; } else if value == '-' { update_bits ( self , index , MINUS_SIGN ) ; } else { return Err ( Error :: NotValidChar ) ; } Ok ( ( ) ) }
Update the buffer with an ascii character at the specified index.
Update the buffer with an ascii character at the specified index .
&mut self
index
Index
value
AsciiChar
&mut self
index
Index
value
AsciiChar
examples
```
use ht16k33::i2c_mock::I2cMock;
use ht16k33::HT16K33;
use adafruit_7segment::{SevenSegment, Index, AsciiChar}.

Create an I2C device.
let mut i2c = I2cMock::new().

The I2C device address.



Set first digit to 'c'.
ht16k33.update_buffer_with_char(Index::One, AsciiChar::new('c')).expect("Failed to encode char to buffer!");
```
` ` ` use ht16k33 :: i2c_mock :: I2cMock ; use ht16k33 :: HT16K33 ; use adafruit_7segment :: { SevenSegment Index AsciiChar } . Create an I2C device . let mut i2c = I2cMock :: new () . The I2C device address . Set first digit to ' c ' . ht16k33 . update_buffer_with_char ( Index :: One AsciiChar :: new ( ' c ' )) . expect ( " Failed to encode char to buffer! " ) ; ` ` `