source/sinobit/sinobitdisplay.cpp
void framebuffer_set(uint8_t x, uint8_t y, bool value) {
    // Ignore values that are out of bounds of the 12x12 portion of display.
    if ((x > 11) || (y > 11)) {
      return;
    }
    // Calculate bit position of this pixel within framebuffer.
    uint8_t bit = y*16+x;
    uint8_t byte_pos = bit / 8;
    uint8_t byte_offset = bit % 8;
    // Invert position within each 4 bit nibble to match order of bits for
    // HT1632 display memory.
    if (byte_offset < 4) {
        // 0 1 2 3 -> 3 2 1 0
        byte_offset = 3 - byte_offset;
    }
    else {
        // 4 5 6 7 -> 7 6 5 4
        byte_offset = 11 - byte_offset;
    }
    // Turn on or off the appropriate bit depending on the value.
    if (value) {
        framebuffer[byte_pos] |= (1 << byte_offset);
    }
    else {
        framebuffer[byte_pos] &= ~(1 << byte_offset);
    }
}
// Set a pixel at the specified x, y position to the provided value.
// True turns on a pixel and false turns it off.
Set a pixel at the specified x, y position to the provided value.
True turns on a pixel and false turns it off.
Set a pixel at the specified x y position to the provided value . True turns on a pixel and false turns it off .
void framebuffer_set(uint8_t x, uint8_t y, bool value) {
    if ((x > 11) || (y > 11)) {
      return;
    }
    uint8_t bit = y*16+x;
    uint8_t byte_pos = bit / 8;
    uint8_t byte_offset = bit % 8;
    if (byte_offset < 4) {
        byte_offset = 3 - byte_offset;
    }
    else {
        byte_offset = 11 - byte_offset;
    }
    if (value) {
        framebuffer[byte_pos] |= (1 << byte_offset);
    }
    else {
        framebuffer[byte_pos] &= ~(1 << byte_offset);
    }
}
void framebuffer_set ( uint8_t x , uint8_t y , bool value ) { if ( ( x > 11 ) || ( y > 11 ) ) { return ; } uint8_t bit = y * 16 + x ; uint8_t byte_pos = bit / 8 ; uint8_t byte_offset = bit % 8 ; if ( byte_offset < 4 ) { byte_offset = 3 - byte_offset ; } else { byte_offset = 11 - byte_offset ; } if ( value ) { framebuffer [ byte_pos ] |= ( 1 << byte_offset ) ; } else { framebuffer [ byte_pos ] &= ~ ( 1 << byte_offset ) ; } }
Set a pixel at the specified x, y position to the provided value.
Set a pixel at the specified x y position to the provided value .
// Ignore values that are out of bounds of the 12x12 portion of display. // Calculate bit position of this pixel within framebuffer. // Invert position within each 4 bit nibble to match order of bits for // HT1632 display memory. // 0 1 2 3 -> 3 2 1 0 // 4 5 6 7 -> 7 6 5 4 // Turn on or off the appropriate bit depending on the value.