Rev | Line | |
---|
[4] | 1 | // %flair:license{
|
---|
[13] | 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
[4] | 4 | // %flair:license}
|
---|
| 5 | /*!
|
---|
| 6 | * \file Srf08.h
|
---|
| 7 | * \brief Class for ultra sonic SRF08
|
---|
| 8 | * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 9 | * \date 2011/05/01
|
---|
| 10 | * \version 4.0
|
---|
| 11 | */
|
---|
| 12 |
|
---|
| 13 | #ifndef SRF08_H
|
---|
| 14 | #define SRF08_H
|
---|
| 15 |
|
---|
| 16 | #include <Thread.h>
|
---|
| 17 | #include <UsRangeFinder.h>
|
---|
| 18 |
|
---|
[13] | 19 | namespace flair {
|
---|
| 20 | namespace core {
|
---|
| 21 | class FrameworkManager;
|
---|
| 22 | class I2cPort;
|
---|
[4] | 23 | }
|
---|
[13] | 24 | namespace gui {
|
---|
| 25 | class SpinBox;
|
---|
| 26 | ;
|
---|
| 27 | }
|
---|
| 28 | }
|
---|
[4] | 29 |
|
---|
[13] | 30 | namespace flair {
|
---|
| 31 | namespace sensor {
|
---|
| 32 | /*! \class Srf08
|
---|
| 33 | *
|
---|
| 34 | * \brief Class for ultra sonic SRF08
|
---|
| 35 | */
|
---|
| 36 | class Srf08 : public core::Thread, public UsRangeFinder {
|
---|
[4] | 37 |
|
---|
[13] | 38 | public:
|
---|
| 39 | /*!
|
---|
| 40 | * \brief Constructor
|
---|
| 41 | *
|
---|
[32] | 42 | * Construct a SRF08 sensor
|
---|
[13] | 43 | *
|
---|
| 44 | * \param parent parent
|
---|
| 45 | * \param name name
|
---|
| 46 | * \param i2cport i2c port
|
---|
| 47 | * \param address i2c slave address
|
---|
| 48 | * \param priority priority of the Thread
|
---|
| 49 | */
|
---|
| 50 | Srf08(const core::FrameworkManager *parent, std::string name,
|
---|
| 51 | core::I2cPort *i2cport, uint16_t address, uint8_t priority);
|
---|
[4] | 52 |
|
---|
[13] | 53 | /*!
|
---|
| 54 | * \brief Destructor
|
---|
| 55 | *
|
---|
| 56 | */
|
---|
| 57 | ~Srf08();
|
---|
[4] | 58 |
|
---|
[13] | 59 | /*!
|
---|
| 60 | * \brief Set Range
|
---|
| 61 | *
|
---|
| 62 | * check datasheet for values
|
---|
| 63 | */
|
---|
| 64 | void SetRange(void);
|
---|
[4] | 65 |
|
---|
[13] | 66 | /*!
|
---|
| 67 | * \brief Set Max Gain
|
---|
| 68 | *
|
---|
| 69 | * check datasheet for values
|
---|
| 70 | */
|
---|
| 71 | void SetMaxGain(void);
|
---|
[4] | 72 |
|
---|
[13] | 73 | private:
|
---|
| 74 | /*!
|
---|
| 75 | * \brief Update using provided datas
|
---|
| 76 | *
|
---|
| 77 | * Reimplemented from IODevice.
|
---|
| 78 | *
|
---|
| 79 | * \param data data from the parent to process
|
---|
| 80 | */
|
---|
| 81 | void UpdateFrom(const core::io_data *data){};
|
---|
[4] | 82 |
|
---|
[13] | 83 | /*!
|
---|
| 84 | * \brief Run function
|
---|
| 85 | *
|
---|
| 86 | * Reimplemented from Thread.
|
---|
| 87 | *
|
---|
| 88 | */
|
---|
| 89 | void Run(void);
|
---|
[4] | 90 |
|
---|
[13] | 91 | void SendEcho(void);
|
---|
| 92 | void GetEcho(void);
|
---|
[4] | 93 |
|
---|
[13] | 94 | bool is_init;
|
---|
| 95 | core::Time echo_time;
|
---|
| 96 | float z_1, z_2;
|
---|
| 97 | gui::SpinBox *gain, *range;
|
---|
| 98 | uint16_t address;
|
---|
| 99 | core::I2cPort *i2cport;
|
---|
| 100 | };
|
---|
[4] | 101 | } // end namespace sensor
|
---|
| 102 | } // end namespace flair
|
---|
| 103 | #endif // SRF08_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.