Ghz2000's 14Segment LED Display Library

Dependents:   Nucleo_Seg14Display

Ghz2000製 14セグ表示器

http://ghz2000.dip.jp/wordpress/?p=665

mbed用のサンプルプログラムです。 ライブラリ化してあるので、インポートして使用することが出来ます。

注意事項

一度に読み込めるテキストは30文字です。 それを超えると変な文字が表示されます。

今後

スクロールが終わった時のコールバックを作って、30文字以上の文字列も流せるようにしたいです。 スイッチサイエンスほかで販売予定。

Revision:
2:eb91996f0a20
Parent:
0:e64e0d7aad81
--- a/lib14Seg.hpp	Tue Jul 05 05:59:05 2016 +0000
+++ b/lib14Seg.hpp	Wed Jul 06 05:59:18 2016 +0000
@@ -1,6 +1,23 @@
+/* Copyright (c) 2016 Ghz2000, MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute,
+ * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or
+ * substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
+ * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
 
-/***********
-***********/
+
+
 
 #ifndef _lib14Seg_
 #define _lib14Seg_
@@ -118,38 +135,82 @@
 
 #define __LEN 30
 
-class C14Segment{
+/** Ghz2000 LED 14Segment Display
+*
+* http://ghz2000.dip.jp/wordpress/?p=665
+*
+* LED 14セグ表示器用ライブラリです。
+*
+* Used for showing Alphanumelic LED 14 Segment Display.
+* This library comment was written in Japanese.
+* The reason why for Japanese beginner.
+*
+* @attention 
+*  このバージョンでは8桁のみ動作します。カスケードできません。
+*  また輝度も使用できません。
+*
+* Example:
+* @code
+* #include "mbed.h"
+* #include "lib14Seg.hpp"
+*
+* int main(){
+*  LED14Seg.init(SPI_MOSI, SPI_MISO, SPI_SCK, RCK, 0x04, 8);
+*
+*  LED14Seg.setChar("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+*  LED14Seg.showStop();
+*  LED14Seg.setScrollSpeed(300);
+*  while(1){};
+* }
+* @endcode
+*/
+class C14Segment
+{
 private:
-  uint16_t m_view[8];
-  uint16_t m_str[__LEN];
-  static const uint16_t ascii[];
-  PinName m_RCK;
-  PinName m_MOSI;
-  PinName m_MISO;
-  PinName m_SCK;
-  int m_kido;
-  int m_ViewLength;
-  int m_speed;
-  
-  SPI *mp_SPIdevice;
-  DigitalOut *mp_DigitalOutRCK;
-  
+    uint16_t m_view[8];
+    uint16_t m_str[__LEN];
+    static const uint16_t ascii[];
+    PinName m_RCK;
+    PinName m_MOSI;
+    PinName m_MISO;
+    PinName m_SCK;
+    int m_kido;
+    int m_ViewLength;
+    int m_speed;
+
+    SPI *mp_SPIdevice;
+    DigitalOut *mp_DigitalOutRCK;
+
+    void setSPI(PinName MOSI, PinName MISO, PinName SCK, PinName RCK);
+    void setViewLength(int ViewLength);
 
 public:
-  C14Segment();
-  void init(PinName SPI_MOSI, PinName SPI_MISO, PinName SPI_SCK, PinName RCK, int kido, int ViewLength);
-  void update();
-  void setChar(char *);
-  void putnum();
-  void cls();
-  void showStop();
-  void scroll();
-  void setSPI(PinName MOSI, PinName MISO, PinName SCK, PinName RCK);
-  void setBlight(int kido);
-  void setViewLength(int ViewLength);
-  void setScrollSpeed(int scrollSpeed);
-  void showCycleX();
-  void showCycleO();
+    C14Segment();
+
+    /** イニシャライザ 最初に実行してください。
+     *
+     * @note
+     *  輝度は現在使えません。 Lengthは現在8のみです。
+     */
+    void init(  PinName SPI_MOSI,  //!< MOSI 
+                PinName SPI_MISO,  //!< MISO 接続不要
+                PinName SPI_SCK,   //!< SCK 
+                PinName RCK,       //!< Latch 
+                int kido,          //!< 現在使えません 
+                int ViewLength     //!< 8桁のみ
+                );                
+    void setChar(char *);   //!< 文字列をセットします。 30文字まで
+    void showStop();        //!< 格納した文字列を表示する
+    void scroll();          //!< 格納した文字列をスクロール表示する
+    void setScrollSpeed(int scrollSpeed);   //!< スクロールスピードを設定する
+
+    void update();
+
+    void setBlight(int kido);   //4桁モデルのみで有効
+    void putnum(); //未実装
+    void cls(); //未実装
+    void showCycleX();  //未実装
+    void showCycleO();  //未実装
 
 };