Mercurial > micropython-ht16k33
changeset 14:8ec76a6b0661
Fix coordinates for the 16x8 matrix
| author | Radomir Dopieralski <sheep-devel@sheep.art.pl> |
|---|---|
| date | Wed, 29 Jun 2016 11:43:28 +0200 |
| parents | 96520f002017 |
| children | 4e29ef2ed337 |
| files | ht16k33_matrix.py |
| diffstat | 1 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/ht16k33_matrix.py Tue Jun 21 18:01:17 2016 +0200 +++ b/ht16k33_matrix.py Wed Jun 29 11:43:28 2016 +0200 @@ -62,16 +62,19 @@ self.buffer[y * 2 + 1] &= ~(mask >> 8) -class Matrix8x16(HT16K33): +class Matrix16x8(HT16K33): """The double matrix.""" def pixel(self, x, y, color=None): """Set a single pixel in the frame buffer to specified color.""" if not 0 <= x <= 15: return - if not 0 <= y <= 8: + if not 0 <= y <= 7: return - return super()._pixel(x, y, color) + if x >= 8: + x -= 8 + y += 8 + return super()._pixel(y, x, color) class Matrix8x8(HT16K33): @@ -79,9 +82,9 @@ def pixel(self, x, y, color=None): """Set a single pixel in the frame buffer to specified color.""" - if not 0 <= x <= 8: + if not 0 <= x <= 7: return - if not 0 <= y <= 8: + if not 0 <= y <= 7: return x = (x - 1) % 8 return super()._pixel(x, y, color)
