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

Committer:
cdupaty
Date:
2021-10-05
Revision:
0:10ce458ab6fa

File content as of revision 0:10ce458ab6fa:

/*
  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