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
MKRRGBMatrix.h@0:10ce458ab6fa, 2021-10-05 (annotated)
- Committer:
- cdupaty
- Date:
- Tue Oct 05 16:07:13 2021 +0000
- Revision:
- 0:10ce458ab6fa
This example demonstrates how to draw on the; MKR RGB shield ; https://store.arduino.cc/products/arduino-mkr-rgb-shield?selectedStore=eu; Orginal code for Arduino; - Adaption for ARM MBED compiler (tested on NUCLEO L073RZ and NUCLEO F411RE); - ...
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cdupaty | 0:10ce458ab6fa | 1 | /* |
cdupaty | 0:10ce458ab6fa | 2 | This file is part of the Arduino_MKRRGB library. |
cdupaty | 0:10ce458ab6fa | 3 | Copyright (c) 2019 Arduino SA. All rights reserved. |
cdupaty | 0:10ce458ab6fa | 4 | |
cdupaty | 0:10ce458ab6fa | 5 | This library is free software; you can redistribute it and/or |
cdupaty | 0:10ce458ab6fa | 6 | modify it under the terms of the GNU Lesser General Public |
cdupaty | 0:10ce458ab6fa | 7 | License as published by the Free Software Foundation; either |
cdupaty | 0:10ce458ab6fa | 8 | version 2.1 of the License, or (at your option) any later version. |
cdupaty | 0:10ce458ab6fa | 9 | |
cdupaty | 0:10ce458ab6fa | 10 | This library is distributed in the hope that it will be useful, |
cdupaty | 0:10ce458ab6fa | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
cdupaty | 0:10ce458ab6fa | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
cdupaty | 0:10ce458ab6fa | 13 | Lesser General Public License for more details. |
cdupaty | 0:10ce458ab6fa | 14 | |
cdupaty | 0:10ce458ab6fa | 15 | You should have received a copy of the GNU Lesser General Public |
cdupaty | 0:10ce458ab6fa | 16 | License along with this library; if not, write to the Free Software |
cdupaty | 0:10ce458ab6fa | 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
cdupaty | 0:10ce458ab6fa | 18 | */ |
cdupaty | 0:10ce458ab6fa | 19 | |
cdupaty | 0:10ce458ab6fa | 20 | #ifndef _MKR_RGB_MATRIX_H |
cdupaty | 0:10ce458ab6fa | 21 | #define _MKR_RGB_MATRIX_H |
cdupaty | 0:10ce458ab6fa | 22 | |
cdupaty | 0:10ce458ab6fa | 23 | #include <ArduinoGraphics.h> |
cdupaty | 0:10ce458ab6fa | 24 | |
cdupaty | 0:10ce458ab6fa | 25 | #define RGB_MATRIX_WIDTH 12 |
cdupaty | 0:10ce458ab6fa | 26 | #define RGB_MATRIX_HEIGHT 7 |
cdupaty | 0:10ce458ab6fa | 27 | |
cdupaty | 0:10ce458ab6fa | 28 | class RGBMatrixClass : public ArduinoGraphics { |
cdupaty | 0:10ce458ab6fa | 29 | public: |
cdupaty | 0:10ce458ab6fa | 30 | RGBMatrixClass(); |
cdupaty | 0:10ce458ab6fa | 31 | virtual ~RGBMatrixClass(); |
cdupaty | 0:10ce458ab6fa | 32 | // ajout virtual pour begin et end |
cdupaty | 0:10ce458ab6fa | 33 | virtual int begin(); |
cdupaty | 0:10ce458ab6fa | 34 | virtual void end(); |
cdupaty | 0:10ce458ab6fa | 35 | |
cdupaty | 0:10ce458ab6fa | 36 | void brightness(uint8_t brightness); |
cdupaty | 0:10ce458ab6fa | 37 | |
cdupaty | 0:10ce458ab6fa | 38 | virtual void beginDraw(); |
cdupaty | 0:10ce458ab6fa | 39 | virtual void endDraw(); |
cdupaty | 0:10ce458ab6fa | 40 | |
cdupaty | 0:10ce458ab6fa | 41 | virtual void set(int x, int y, uint8_t r, uint8_t g, uint8_t b); |
cdupaty | 0:10ce458ab6fa | 42 | |
cdupaty | 0:10ce458ab6fa | 43 | private: |
cdupaty | 0:10ce458ab6fa | 44 | uint8_t _buffer[4 + 4 * RGB_MATRIX_WIDTH * RGB_MATRIX_HEIGHT + ((RGB_MATRIX_WIDTH * RGB_MATRIX_HEIGHT + 15) / 16)]; |
cdupaty | 0:10ce458ab6fa | 45 | uint8_t _bufferReception[4 + 4 * RGB_MATRIX_WIDTH * RGB_MATRIX_HEIGHT + ((RGB_MATRIX_WIDTH * RGB_MATRIX_HEIGHT + 15) / 16)]; |
cdupaty | 0:10ce458ab6fa | 46 | }; |
cdupaty | 0:10ce458ab6fa | 47 | |
cdupaty | 0:10ce458ab6fa | 48 | extern RGBMatrixClass MATRIX; |
cdupaty | 0:10ce458ab6fa | 49 | |
cdupaty | 0:10ce458ab6fa | 50 | #endif |