Akizuki 32x16 dot LED Matrix unit (K-03735) control library.

秋月電子の32×16ドットLEDマトリクス表示装置(K-03735)を制御するライブラリです。
バッファの内容をそのままLEDマトリクス装置に送ります。
LEDマトリクス表示装置は最大4台まで接続できるので、接続台数を必ず指定してください。(この台数でバッファのサイズを計算しています。)
行間表示は1msのdelayを入れています。パラメタで変更可能です。
このライブラリの呼び出し元は基本的にwhile()でループしてください。
初めてのライブラリなのでメンバ関数もドキュメントとかまだ最低限です。
おかしなところはぜひコメントをください。

表示例は以下ページをご覧ください。

Files at this revision

API Documentation at this revision

Comitter:
kanpapa
Date:
Wed Jun 05 14:28:10 2013 +0000
Parent:
3:532c50dc800e
Child:
5:c055674c4a0b
Commit message:
change ledunit

Changed in this revision

akiledmatrix.cpp Show annotated file Show diff for this revision Revisions of this file
akiledmatrix.h Show annotated file Show diff for this revision Revisions of this file
--- a/akiledmatrix.cpp	Mon Jun 03 15:52:59 2013 +0000
+++ b/akiledmatrix.cpp	Wed Jun 05 14:28:10 2013 +0000
@@ -7,14 +7,14 @@
                  PinName clock,
                  PinName latch,
                  PinName strobe,
-                 int maxledunit) :
+                 int ledunit) :
                  _sin1(sin1),
                  _sin2(sin2),
                  _sin3(sin3),
                  _clock(clock),
                  _latch(latch),
                  _strobe(strobe),
-                 _maxledunit(maxledunit) {
+                 _ledunit(ledunit) {
                  // initrize
                  _sin1 = 0;
                  _sin2 = 0;
@@ -28,7 +28,7 @@
     int bufp = 0;   // buffer pointer
     
     for (int y = 0; y < 16; y++){
-         for (int ledno = (_maxledunit - 1); ledno >= 0; ledno--){
+         for (int ledno = (_ledunit - 1); ledno >= 0; ledno--){
             uint16_t led1_data = buffer[ledno * 4 + bufp + 0] * 256 + buffer[ledno * 4 + bufp + 1];
             uint16_t led2_data = buffer[ledno * 4 + bufp + 2] * 256 + buffer[ledno * 4 + bufp + 3];
 
@@ -62,8 +62,8 @@
             
         wait_us(delay);
 
-        bufp = bufp + (_maxledunit * 4);
-        if (bufp > (_maxledunit * 64)) {
+        bufp = bufp + (_ledunit * 4);
+        if (bufp > (_ledunit * 64)) {
             bufp = 0;
         }
     }
--- a/akiledmatrix.h	Mon Jun 03 15:52:59 2013 +0000
+++ b/akiledmatrix.h	Wed Jun 05 14:28:10 2013 +0000
@@ -62,7 +62,7 @@
      * @param clock CLOCK IN
      * @param latch LATCH IN
      * @param strobe STROBE IN
-     * @param maxledunit The number of LED units. 
+     * @param ledunit The number of LED units. 
      */
     AkiLedMatrix(PinName sin1,
                  PinName sin2,
@@ -70,7 +70,7 @@
                  PinName clock,
                  PinName latch,
                  PinName strobe,
-                 int maxledunit);
+                 int ledunit);
                                   
      /** Displays the contents of the buffer
       *
@@ -83,7 +83,7 @@
  
 private:
     DigitalOut _sin1,_sin2,_sin3,_clock,_latch,_strobe;
-    int _maxledunit;
+    int _ledunit;
 };
  
 #endif
\ No newline at end of file