ArduinoLibs
|
00001 /* 00002 * Copyright (C) 2012 Southern Storm Software, Pty Ltd. 00003 * 00004 * Permission is hereby granted, free of charge, to any person obtaining a 00005 * copy of this software and associated documentation files (the "Software"), 00006 * to deal in the Software without restriction, including without limitation 00007 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00008 * and/or sell copies of the Software, and to permit persons to whom the 00009 * Software is furnished to do so, subject to the following conditions: 00010 * 00011 * The above copyright notice and this permission notice shall be included 00012 * in all copies or substantial portions of the Software. 00013 * 00014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00015 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00016 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00017 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00018 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00019 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00020 * DEALINGS IN THE SOFTWARE. 00021 */ 00022 00023 #ifndef DMD_h 00024 #define DMD_h 00025 00026 #include "Bitmap.h" 00027 00028 class DMD : public Bitmap 00029 { 00030 public: 00031 explicit DMD(int widthPanels = 1, int heightPanels = 1); 00032 ~DMD(); 00033 00034 bool doubleBuffer() const { return _doubleBuffer; } 00035 void setDoubleBuffer(bool doubleBuffer); 00036 void swapBuffers(); 00037 void swapBuffersAndCopy(); 00038 00039 void loop(); 00040 void refresh(); 00041 00042 void enableTimer1(); 00043 void disableTimer1(); 00044 00045 void enableTimer2(); 00046 void disableTimer2(); 00047 00048 static Color fromRGB(uint8_t r, uint8_t g, uint8_t b); 00049 00050 private: 00051 // Disable copy constructor and operator=(). 00052 DMD(const DMD &other) : Bitmap(other) {} 00053 DMD &operator=(const DMD &) { return *this; } 00054 00055 bool _doubleBuffer; 00056 uint8_t phase; 00057 uint8_t *fb0; 00058 uint8_t *fb1; 00059 uint8_t *displayfb; 00060 unsigned long lastRefresh; 00061 }; 00062 00063 #endif