mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-02 14:13:42 -04:00
66ecda2544
This commit changes the way libraries headers are included in source files: - If the header is in the same directory the source belongs to, so the notation '#include ""' is used with the path relative to the directory containing the source. - If the header is outside the directory containing the source, then we use the notation '#include <>' with the path relative to libraries folder. Some of the advantages of such approach: - Only one search path for libraries headers. - OSs like Windows may have a better lookup time.
48 lines
870 B
C++
48 lines
870 B
C++
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
|
#ifndef __AP_ADC_ADS1115_H__
|
|
#define __AP_ADC_ADS1115_H__
|
|
|
|
|
|
#include <inttypes.h>
|
|
#include "AP_ADC.h"
|
|
#include <AP_HAL/AP_HAL.h>
|
|
|
|
|
|
struct adc_report_s
|
|
{
|
|
uint8_t id;
|
|
float data;
|
|
};
|
|
|
|
class AP_ADC_ADS1115
|
|
{
|
|
public:
|
|
AP_ADC_ADS1115();
|
|
|
|
bool init();
|
|
size_t read(adc_report_s *report, size_t length) const;
|
|
|
|
uint8_t get_channels_number() const
|
|
{
|
|
return _channels_number;
|
|
}
|
|
|
|
private:
|
|
static const uint8_t _channels_number;
|
|
|
|
AP_HAL::Semaphore* _i2c_sem;
|
|
|
|
uint32_t _last_update_timestamp;
|
|
uint16_t _gain;
|
|
int _channel_to_read;
|
|
adc_report_s *_samples;
|
|
|
|
|
|
void _update();
|
|
bool _start_conversion(uint8_t channel);
|
|
|
|
float _convert_register_data_to_mv(int16_t word) const;
|
|
};
|
|
|
|
#endif
|