cansat_B 2019 / Mbed 2 deprecated US015sb612

Dependencies:   mbed

Committer:
KINU
Date:
Wed Nov 13 05:12:54 2019 +0000
Revision:
0:2acb3f965991
US015sb612 1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
KINU 0:2acb3f965991 1 #ifndef __US015_H
KINU 0:2acb3f965991 2 #define __US015_H
KINU 0:2acb3f965991 3
KINU 0:2acb3f965991 4 #include "mbed.h"
KINU 0:2acb3f965991 5
KINU 0:2acb3f965991 6
KINU 0:2acb3f965991 7 //====================================
KINU 0:2acb3f965991 8 // define定義
KINU 0:2acb3f965991 9 //====================================
KINU 0:2acb3f965991 10 #define US015_TRIGER_ON 1 // トリガーON
KINU 0:2acb3f965991 11 #define US015_TRIGER_OFF 0 // トリガーOFF
KINU 0:2acb3f965991 12 #define US015_TRIGER_PALUSE_WIDTH 10 // トリガーの幅
KINU 0:2acb3f965991 13 #define US015_PERIODIC_TRIGER 100000 // 音響測距トリガー
KINU 0:2acb3f965991 14 #define US015_SOUND_OF_SPEED 0.340 // 音速[mm/us]
KINU 0:2acb3f965991 15
KINU 0:2acb3f965991 16
KINU 0:2acb3f965991 17 //====================================
KINU 0:2acb3f965991 18 // 音響測距センサ(US015)の制御クラス
KINU 0:2acb3f965991 19 //====================================
KINU 0:2acb3f965991 20 class US015
KINU 0:2acb3f965991 21 {
KINU 0:2acb3f965991 22 public:
KINU 0:2acb3f965991 23 US015(PinName trg, PinName ech);
KINU 0:2acb3f965991 24 US015(PinName trg, PinName ech, float tkTime);
KINU 0:2acb3f965991 25 float GetDistance();
KINU 0:2acb3f965991 26 void TrigerOut(); // トリガー出力
KINU 0:2acb3f965991 27
KINU 0:2acb3f965991 28 private:
KINU 0:2acb3f965991 29 DigitalOut _trigerOut; // U015トリガー出力
KINU 0:2acb3f965991 30 InterruptIn _interruptEcho; // U015エコー入力
KINU 0:2acb3f965991 31 Timer timer; // 時間計測用のタイマ
KINU 0:2acb3f965991 32 Ticker tk; // 周期処理用のチッカー
KINU 0:2acb3f965991 33 float tmBegin; // エコーの立ち上がり時間
KINU 0:2acb3f965991 34 float tmEnd; // エコーの立ち下がり時間
KINU 0:2acb3f965991 35 float distance; // 距離測定
KINU 0:2acb3f965991 36 void EchoFall(); // エコーの立ち下がり処理
KINU 0:2acb3f965991 37 void EchoRise(); // エコーの立ち上がり処理
KINU 0:2acb3f965991 38 };
KINU 0:2acb3f965991 39
KINU 0:2acb3f965991 40 #endif