tarask
6 days ago 532005c6573d95199ce0ffbc33df4c7a0a4c3ef9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef ALTIMETER_H
#define ALTIMETER_H
 
#include <Wire.h>
#include <Arduino.h>
 
/**
 * @brief Pin number for the I2C data line (SDA).
 */
#define SDA_PIN (16)
 
/**
 * @brief Pin number for the I2C clock line (SCL).
 */
#define SCL_PIN (17)
 
/**
 * @brief The Altimiter class represents an altimeter device.
 * 
 * This class provides a singleton instance of the altimeter and 
 * methods to manage its functionality.
 * 
 * @author Zheludchenko Yehor (17.04.2024)
 */
 
 #define RANGEFINDER_SF30_MAX_DISTANCE (20000)
class Altimiter
{
public:
    /**
     * @brief Default constructor for the Altimiter class.
     */
    Altimiter() {}
    
    /**
     * @brief Destructor for the Altimiter class.
     */
    ~Altimiter() {}
    
    /**
     * @brief Task function for handling altimeter data reception.
     * 
     * This function is intended to be run as a task to handle altimeter data reception.
     * 
     * @param pvParameters Pointer to task parameters.
     */
    static void AltimiterRxTask(void *pvParameters);
 
    /**
     * @brief Variable to store the distance measured by the altimeter.
     * 
     * This variable stores the distance measured by the altimeter device.
     */
    static double distance;
 
private:
    
    /**
     * @brief I2C address of the altimeter device.
     */
    static uint8_t address;
    /**
     * @brief Scan method to check if the altimeter device is present on the I2C bus.
     */
    bool scan(byte adress);
};
 
#endif // ALTIMETER_H