Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ardupilot
GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_DAC/AP_DAC.h
4182 views
1
/*
2
This program is free software: you can redistribute it and/or modify
3
it under the terms of the GNU General Public License as published by
4
the Free Software Foundation, either version 3 of the License, or
5
(at your option) any later version.
6
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
11
12
You should have received a copy of the GNU General Public License
13
along with this program. If not, see <http://www.gnu.org/licenses/>.
14
*/
15
/*
16
digital to analog support, for control of an analog output voltage
17
*/
18
#pragma once
19
20
#include "AP_DAC_config.h"
21
22
#if AP_DAC_ENABLED
23
24
#include "AP_DAC_Params.h"
25
#include "AP_DAC_Backend.h"
26
27
class AP_DAC
28
{
29
public:
30
// Constructor
31
AP_DAC();
32
33
CLASS_NO_COPY(AP_DAC);
34
35
// detect and initialise any available DACs
36
void init();
37
38
// update all of the backends
39
void update();
40
41
// set voltage for a channel
42
bool set_voltage(uint8_t instance, uint8_t chan, float v);
43
44
static const struct AP_Param::GroupInfo var_info[];
45
46
private:
47
AP_DAC_Params params[AP_DAC_MAX_INSTANCES];
48
AP_DAC_Backend *backends[AP_DAC_MAX_INSTANCES];
49
};
50
51
#endif // AP_DAC_ENABLED
52
53