jm6wud

Files at this revision

API Documentation at this revision

Comitter:
jm6wud
Date:
Thu Oct 22 13:36:12 2020 +0000
Parent:
2:ed37eac35bf2
Commit message:
jm6wud

Changed in this revision

us015.cpp Show annotated file Show diff for this revision Revisions of this file
us015.h Show annotated file Show diff for this revision Revisions of this file
--- a/us015.cpp	Thu Oct 22 13:14:43 2020 +0000
+++ b/us015.cpp	Thu Oct 22 13:36:12 2020 +0000
@@ -7,6 +7,8 @@
 #include "mbed.h"
 #include "us015.h"
 
+
+
 //*********************************
 // コンストラクタ
 //*********************************
@@ -22,8 +24,8 @@
     _interruptEcho.rise(this,&US015::EchoRise);
 }
 // End of Constructor
- 
- 
+
+
 //*********************************
 //  トリガー信号を出力する
 //*********************************
@@ -35,8 +37,8 @@
     _trigerOut = US015_TRIGER_OFF;
 }
 // End of TrigerOut
- 
- 
+
+
 //*********************************
 // 距離情報の取得
 //*********************************
@@ -45,8 +47,8 @@
     return distance;    
 }
 // End of GetDistance
- 
- 
+
+
 //*********************************
 // エコーの信号の立ち下がり
 //*********************************
@@ -54,14 +56,14 @@
 {   
     //エコー信号の立ち下がり時間を取得
     tmEnd=timer.read_us();
- 
+
     // 反射面距離の計算(往復の距離を音速と経過時間から求め、その半分を片道の距離とする)
     // (エコー受信時間 - トリガー発信時間)* 音速0.340[mm/us]/2
     distance = ((tmEnd-tmBegin)*(0.340))/2;
 }
 // End of EchoFall
- 
- 
+
+
 //*********************************
 // エコーの信号の立ち上がり処理
 //*********************************
--- a/us015.h	Thu Oct 22 13:14:43 2020 +0000
+++ b/us015.h	Thu Oct 22 13:36:12 2020 +0000
@@ -1,18 +1,19 @@
- 
 #ifndef __US015_H
 #define __US015_H
- 
+
 #include "mbed.h"
 
+
 //====================================
 // define定義
 //====================================
 #define US015_TRIGER_ON             1    // トリガーON
 #define US015_TRIGER_OFF            0    // トリガーOFF
 #define US015_TRIGER_PALUSE_WIDTH   10   // トリガーの幅
-#define US015_PERIODIC_TRIGER 100000     // 音響測距トリガー
-#define US015_SOUND_OF_SPEED  0.340      // 音速[mm/us]
- 
+#define US015_PERIODIC_TRIGER 100000    // 音響測距トリガー
+#define US015_SOUND_OF_SPEED  0.340           // 音速[mm/us]
+
+
 //====================================
 // 音響測距センサ(US015)の制御クラス
 //====================================
@@ -35,4 +36,5 @@
         void EchoFall();                        // エコーの立ち下がり処理
         void EchoRise();                        // エコーの立ち上がり処理
 };
+
 #endif