From 230520587ea299ba146c7f5c810cb0fc1b37597e Mon Sep 17 00:00:00 2001 From: Simon Prickett Date: Thu, 4 Jan 2024 14:38:37 +0000 Subject: [PATCH] Add set_pixel_color_x_y and get_pixel_color_x_y. --- ports/esp32/boards/M5STACK_ATOM/modules/atom.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ports/esp32/boards/M5STACK_ATOM/modules/atom.py b/ports/esp32/boards/M5STACK_ATOM/modules/atom.py index 8f47585f19..700ea37f57 100644 --- a/ports/esp32/boards/M5STACK_ATOM/modules/atom.py +++ b/ports/esp32/boards/M5STACK_ATOM/modules/atom.py @@ -73,3 +73,13 @@ class Matrix(ATOM): # WS2812 number: 25 def __init__(self): super(Matrix, self).__init__(np_n=25) + + def set_pixel_color_x_y(self, x, y, r, g, b): + if (0 <= x < 5) and (0 <= y < 5): + n = (y * 5) + x + self.set_pixel_color(n, r, g, b) + + def get_pixel_color_x_y(self, x, y): + if (0 <= x < 5) and (0 <= y < 5): + n = (y * 5) + x + return self.get_pixel_color(n)