DP

Dependencies:   FastAnalogIn mbed-rtos mbed

Fork of dipl_prace_v10 by Roman Krejci

ultrasonic.h

Committer:
romankrej
Date:
2015-04-28
Revision:
1:28d74f044818
Parent:
0:f3b355df6f26

File content as of revision 1:28d74f044818:

#ifndef _ULTRASONIC_H
#define _ULTRASONIC_H

#include "mbed.h"
#include "rtos.h"

class cUltrasonic {
    public:     
        cUltrasonic(PinName pinEcho, PinName pinTrig);
        
        /* This method set trigger */
        void setTrig();
        
        /* This method returns width of received pulse*/
        int getPulseWidth();
        
        /* Pointer to thread*/
        Thread* thread;
    
    private:
        DigitalOut trig;
        InterruptIn echo;
        
        Timer timer;
        float pulseWidth;
        
        /* ISR of rising edge */
        void riseEdge(void);
        
        /* ISR of falling edge*/
        void fallEdge(void);
    

};
#endif