no thread

Dependents:   200_yotuba_21_uiChange

Revision:
4:004bdb88ab3e
Parent:
2:35b3dd6f7f17
Child:
5:f5d9f079d17d
--- a/IRsensor.h	Thu Aug 22 06:14:12 2019 +0000
+++ b/IRsensor.h	Thu Aug 29 02:20:25 2019 +0000
@@ -1,14 +1,68 @@
-#ifndef IRSENSOR_H
-#define IRSENSOR_H
+/**
+* @file IRsensor.h
+* @brief SHARP 2Y0A21を使ったIR距離測定
+*
+* Example :
+* @code
+* #include"mbed.h"
+* #include"IRsensor.h"
+* 
+* IRsensor ir1(PC_1);
+*
+* Serial pc(USBTX,USBRX,115200);
+*
+* int main()
+* {
+*    ir1.startAveraging(255);
+*    while(1){
+*        float dis = ir1.getDistance();
+*        float ave_dis = ir1.get_Averagingdistance();
+*        pc.printf("dis:%4.4f[cm]||ave_dis:%4.4f[cm]\n\r",dis,ave_dis);
+*        
+*    }   
+* }
+* @endcode
+*/
 
-#include "mbed.h"
+#ifndef IRSENSOR_H
+#define IRSENSOE_H
 
+#include"mbed.h"
+
+/**
+* @brief SHARP 2Y0A21を使ったIR距離測定のクラス
+*/
 class IRsensor{
  public:
+    /**
+     * @brief コンストラクタ
+     * @param pin Pint that can do analogin
+     */
     IRsensor(PinName pin);
+    
+    /**
+    * @brief センサの値を取得
+    * @return voltage
+    */
+    float getVoltage();
+    
+    /**
+    * @brief センサの値を距離変換し取得
+    * @return originaldistance
+    */
     float getDistance();
+    
+    /**
+    * @brief 距離の平均化設定
+    * @param averaging_range averaging range 1~255
+    */
+    void startAveraging(uint8_t averaging_range);
+    
+    /**
+    * @brief 平均化した距離を取得
+    * @return distance_average
+    */
     float get_Averagingdistance();
-    void startAveraging(uint8_t averaging_range);
 
 private:
     void threadloop_get_distance();