D:/DRISSI/arduino-0022/arduino-0022/libraries/Matrix/Matrix.h
00001 /*
00002   Matrix.h - Max7219 LED Matrix library for Arduino & Wiring
00003   Copyright (c) 2006 Nicholas Zambetti.  All right reserved.
00004 
00005   This library is free software; you can redistribute it and/or
00006   modify it under the terms of the GNU Lesser General Public
00007   License as published by the Free Software Foundation; either
00008   version 2.1 of the License, or (at your option) any later version.
00009 
00010   This library is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013   Lesser General Public License for more details.
00014 
00015   You should have received a copy of the GNU Lesser General Public
00016   License along with this library; if not, write to the Free Software
00017   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 */
00019 
00020 #ifndef Matrix_h
00021 #define Matrix_h
00022 
00023 #include <inttypes.h>
00024 
00025 class Sprite;
00026 
00027 class Matrix
00028 {
00029   private:
00030     uint8_t _pinData;
00031     uint8_t _pinClock;
00032     uint8_t _pinLoad;
00033 
00034     uint8_t* _buffer;
00035     uint8_t _screens;
00036     uint8_t _maximumX;
00037 
00038     void putByte(uint8_t);
00039     void setRegister(uint8_t, uint8_t);
00040     void syncRow(uint8_t);
00041 
00042     void setScanLimit(uint8_t);
00043 
00044     void buffer(uint8_t, uint8_t, uint8_t);
00045   public:
00046     Matrix(uint8_t, uint8_t, uint8_t, uint8_t = 1);
00047     void setBrightness(uint8_t);
00048     void write(uint8_t, uint8_t, uint8_t);
00049     void write(uint8_t, uint8_t, Sprite);
00050     void clear(void);
00051 };
00052 
00053 #endif
00054