Adafruit-RGB_matrix_Panel(32*16)

Dependencies:   Adafruit-GFX

Revision:
13:0ceb1b8893e9
Parent:
12:e632883f319f
--- a/RGBmatrixPanel.h	Sun May 25 13:41:34 2014 +0000
+++ b/RGBmatrixPanel.h	Mon May 26 09:14:54 2014 +0000
@@ -12,7 +12,86 @@
 #endif
 
 /** RGBmatrixPanel is class for full color LED matrix
- *
+* @code
+#include "mbed.h"
+#include "RGBmatrixPanel.h" // Hardware-specific library
+
+PinName ub1=p6;
+PinName ug1=p7;
+PinName ur1=p8;
+PinName lb2=p9;
+PinName lg2=p10;
+PinName lr2=p11;
+RGBmatrixPanel matrix(ur1,ug1,ub1,lr2,lg2,lb2,p12,p13,p14,p15,p16,p17,false);
+//RGBmatrixPanel(r1, g1, b1, r2, g2, b2, a, b, c, sclk, latch, oe, enable double_buffer);
+
+int main()
+{
+    matrix.begin();
+    while(1) {
+        // fill the screen with 'black'
+        matrix.fillScreen(matrix.Color333(0, 0, 0));
+        // draw a pixel in solid white
+        matrix.drawPixel(0, 0, matrix.Color333(7, 7, 7));
+        wait_ms(500);
+
+        // fix the screen with green
+        matrix.fillRect(0, 0, 32, 16, matrix.Color333(0, 7, 0));
+        wait_ms(500);
+
+        // draw a box in yellow
+        matrix.drawRect(0, 0, 32, 16, matrix.Color333(7, 7, 0));
+        wait_ms(500);
+
+        // draw an 'X' in red
+        matrix.drawLine(0, 0, 31, 15, matrix.Color333(7, 0, 0));
+        matrix.drawLine(31, 0, 0, 15, matrix.Color333(7, 0, 0));
+        wait_ms(500);
+
+        // draw a blue circle
+        matrix.drawCircle(7, 7, 7, matrix.Color333(0, 0, 7));
+        wait_ms(500);
+
+        // fill a violet circle
+        matrix.fillCircle(23, 7, 7, matrix.Color333(7, 0, 7));
+        wait_ms(500);
+
+        // fill the screen with 'black'
+        matrix.fillScreen(matrix.Color333(0, 0, 0));
+
+        // draw some text!
+        matrix.setCursor(1, 0);   // start at top left, with one pixel of spacing
+        matrix.setTextSize(1);    // size 1 == 8 pixels high
+
+        // printff each letter with a rainbow color
+        matrix.setTextColor(matrix.Color333(7,0,0));
+        matrix.putc('1');
+        matrix.setTextColor(matrix.Color333(7,4,0));
+        matrix.putc('6');
+        matrix.setTextColor(matrix.Color333(7,7,0));
+        matrix.putc('x');
+        matrix.setTextColor(matrix.Color333(4,7,0));
+        matrix.putc('3');
+        matrix.setTextColor(matrix.Color333(0,7,0));
+        matrix.putc('2');
+
+        matrix.setCursor(1, 9);   // next line
+        matrix.setTextColor(matrix.Color333(0,7,7));
+        matrix.putc('*');
+        matrix.setTextColor(matrix.Color333(0,4,7));
+        matrix.putc('R');
+        matrix.setTextColor(matrix.Color333(0,0,7));
+        matrix.putc('G');
+        matrix.setTextColor(matrix.Color333(4,0,7));
+        matrix.putc('B');
+        matrix.setTextColor(matrix.Color333(7,0,4));
+        matrix.putc('*');
+        wait_ms(500);
+    }
+}
+
+* @endcode
+
  */
 class RGBmatrixPanel : public Adafruit_GFX
 {
@@ -24,9 +103,9 @@
     // Constructor for 32x32 panel (adds 'd' pin):
     RGBmatrixPanel(PinName r1,PinName r2,PinName g1,PinName g2,PinName b1,PinName b2,PinName a,PinName b,PinName c,PinName d,PinName sclk, PinName latch,PinName oe,bool dbuf);
 
-    /** Attach a updateDisplay() to be called by the Ticker(every 100us)
-     *
-     */
+    /** @fn void RGBmatrixPanel::begin(void)
+    *   @bref Attach a updateDisplay() to be called by the Ticker(every 100us)
+    */
     void begin(void);
     /** @fn void RGBmatrixPanel::drawPixel(int16_t x, int16_t y, uint16_t c)
     *   @bref drawPixel
@@ -38,7 +117,7 @@
     */
     virtual void fillScreen(uint16_t c);
     /** @fn void RGBmatrixPanel::updateDisplay(void)
-    *   @param c    updateDisplay\\
+    *   @param c    updateDisplay\n
     *               This method is called by the interrupt start at begin().
     */
     void updateDisplay(void);
@@ -47,34 +126,37 @@
     */
     void swapBuffers(bool copy);
     /** @fn void RGBmatrixPanel::dumpMatrix(void)
-    *   @bref dump to default USB Serial\\
+    *   @bref dump to default USB Serial\n
     *         Declaration is required to use.(#define DEBUG)
     */
     void dumpMatrix(void);
 
     uint8_t *backBuffer(void);
 
-    /** @fn void RGBmatrixPanel::Color333(uint8_t r, uint8_t g, uint8_t b)
+    /** @fn uint16_t RGBmatrixPanel::Color333(uint8_t r, uint8_t g, uint8_t b)
     *   @bref up convert to 16bit color from 9bit color.
     *   @return 16bit(uint16_t) color value
     */
     uint16_t Color333(uint8_t r, uint8_t g, uint8_t b);
-    /** @fn void RGBmatrixPanel::Color444(uint8_t r, uint8_t g, uint8_t b)
+    /** @fn uint16_t RGBmatrixPanel::Color444(uint8_t r, uint8_t g, uint8_t b)
     *   @bref up convert to 16bit color from 12bit color.
+    *   @param r 0~7
+    *   @param g 0~7
+    *   @param b 0~7
     *   @return 16bit(uint16_t) color value
     */
     uint16_t Color444(uint8_t r, uint8_t g, uint8_t b);
-    /** @fn void RGBmatrixPanel::Color888(uint8_t r, uint8_t g, uint8_t b)
+    /** @fn uint16_t RGBmatrixPanel::Color888(uint8_t r, uint8_t g, uint8_t b)
     *   @bref down convert to 16bit color from 24bit color.
     *   @return 16bit(uint16_t) color value
     */
     uint16_t Color888(uint8_t r, uint8_t g, uint8_t b);
-    /** @fn void RGBmatrixPanel::Color888(uint8_t r, uint8_t g, uint8_t b, bool gflag)
+    /** @fn uint16_t RGBmatrixPanel::Color888(uint8_t r, uint8_t g, uint8_t b, bool gflag)
     *   @bref down convert to 16bit color from 24bit color using the gamma value table.
     *   @return 16bit(uint16_t) color value
     */
     uint16_t Color888(uint8_t r, uint8_t g, uint8_t b, bool gflag);
-    /** @fn void RGBmatrixPanel::ColorHSV(long hue, uint8_t sat, uint8_t val, bool gflag)
+    /** @fn uint16_t RGBmatrixPanel::ColorHSV(long hue, uint8_t sat, uint8_t val, bool gflag)
     *   @bref convert to 16bit color from (unsigned integer)HSV color using the gamma value table.
     *   @param hue 0~1536(decimal value)
     *   @param sat 0~255(decimal value) Does not make sense that it is not a multiple of 32.
@@ -83,7 +165,7 @@
     */
     uint16_t ColorHSV(long hue, uint8_t sat, uint8_t val, bool gflag)
     ;
-    /** @fn void RGBmatrixPanel::ColorHSV(float hue, float sat, float val, bool gflag)
+    /** @fn uint16_t RGBmatrixPanel::ColorHSV(float hue, float sat, float val, bool gflag)
     *   @bref convert to 16bit color from (float)HSV color using the gamma value table.
     *   @param hue Normalized value from 0.0 to 1.0
     *   @param sat Normalized value from 0.0 to 1.0