This example demonstrates how to draw on the MKR RGB shield. The circuit: - Arduino MKR board - Arduino MKR RGB shield attached This example code is in the public domain. Orginal code for Arduino - Adaption for ARM MBED compiler (tested on NUCLEO L073RZ and NUCLEO F411RE) - Christian Dupaty
This example demonstrates how to draw on the arduino MKR RGB shield
Orginal code for Arduino : https://docs.arduino.cc/hardware/mkr-rgb-shield
Adaption for ARM MBED compiler (tested on NUCLEO L073RZ and NUCLEO F411RE)
Christian Dupaty oct 2021 see http://genelaix.free.fr
Diff: MKRRGBMatrix.h
- Revision:
- 0:10ce458ab6fa
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MKRRGBMatrix.h Tue Oct 05 16:07:13 2021 +0000 @@ -0,0 +1,50 @@ +/* + This file is part of the Arduino_MKRRGB library. + Copyright (c) 2019 Arduino SA. All rights reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef _MKR_RGB_MATRIX_H +#define _MKR_RGB_MATRIX_H + +#include <ArduinoGraphics.h> + +#define RGB_MATRIX_WIDTH 12 +#define RGB_MATRIX_HEIGHT 7 + +class RGBMatrixClass : public ArduinoGraphics { +public: + RGBMatrixClass(); + virtual ~RGBMatrixClass(); +// ajout virtual pour begin et end + virtual int begin(); + virtual void end(); + + void brightness(uint8_t brightness); + + virtual void beginDraw(); + virtual void endDraw(); + + virtual void set(int x, int y, uint8_t r, uint8_t g, uint8_t b); + +private: + uint8_t _buffer[4 + 4 * RGB_MATRIX_WIDTH * RGB_MATRIX_HEIGHT + ((RGB_MATRIX_WIDTH * RGB_MATRIX_HEIGHT + 15) / 16)]; + uint8_t _bufferReception[4 + 4 * RGB_MATRIX_WIDTH * RGB_MATRIX_HEIGHT + ((RGB_MATRIX_WIDTH * RGB_MATRIX_HEIGHT + 15) / 16)]; +}; + +extern RGBMatrixClass MATRIX; + +#endif