Interface class for the Max Botix ultrasonic range finder model 1210. It includes input methods for PWM, Analog, and Serial. A PwmIn class was created to allow the PWM input to be read. Now includes automatic range update via interrupts.

Dependencies:   mbed

Committer:
Blaze513
Date:
Sun Aug 22 21:18:20 2010 +0000
Revision:
0:3d969e0b4ca0
Child:
2:997b4057c879

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Blaze513 0:3d969e0b4ca0 1 #ifndef PwmInLibrary
Blaze513 0:3d969e0b4ca0 2 #define PwmInLibrary
Blaze513 0:3d969e0b4ca0 3
Blaze513 0:3d969e0b4ca0 4 #include "stdint.h"
Blaze513 0:3d969e0b4ca0 5 #include "mbed.h"
Blaze513 0:3d969e0b4ca0 6
Blaze513 0:3d969e0b4ca0 7 class PwmIn : private InterruptIn, Timer
Blaze513 0:3d969e0b4ca0 8 {
Blaze513 0:3d969e0b4ca0 9 private:
Blaze513 0:3d969e0b4ca0 10 unsigned int PeriodMeasurement;
Blaze513 0:3d969e0b4ca0 11 unsigned int PulseWidthMeasurement;
Blaze513 0:3d969e0b4ca0 12
Blaze513 0:3d969e0b4ca0 13 void PulseStart();
Blaze513 0:3d969e0b4ca0 14 void PulseStop();
Blaze513 0:3d969e0b4ca0 15
Blaze513 0:3d969e0b4ca0 16 public:
Blaze513 0:3d969e0b4ca0 17 PwmIn(PinName pwi);
Blaze513 0:3d969e0b4ca0 18 float read();
Blaze513 0:3d969e0b4ca0 19 float period();
Blaze513 0:3d969e0b4ca0 20 int period_ms();
Blaze513 0:3d969e0b4ca0 21 int period_us();
Blaze513 0:3d969e0b4ca0 22 float pulsewidth();
Blaze513 0:3d969e0b4ca0 23 int pulsewidth_ms();
Blaze513 0:3d969e0b4ca0 24 int pulsewidth_us();
Blaze513 0:3d969e0b4ca0 25 };
Blaze513 0:3d969e0b4ca0 26
Blaze513 0:3d969e0b4ca0 27 #endif