UC8159: Fix nibble order properly this time.

This commit is contained in:
Phil Howard 2022-03-29 10:03:40 +01:00
parent c428329a19
commit f1f3d55a8c
1 changed files with 3 additions and 3 deletions

View File

@ -200,9 +200,9 @@ namespace pimoroni {
// pointer to byte in framebuffer that contains this pixel
uint8_t *p = &frame_buffer[(x / 2) + (y * width / 2)];
uint8_t o = (x & 0b1) * 4; // bit offset within byte
uint8_t m = ~(0b1111 << !o); // bit mask for byte
uint8_t b = v << o; // bit value shifted to position
uint8_t o = (~x & 0b1) * 4; // bit offset within byte
uint8_t m = ~(0b1111 << o); // bit mask for byte
uint8_t b = v << o; // bit value shifted to position
*p &= m; // clear bits
*p |= b; // set value