Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ardupilot
GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_DAC/AP_DAC_Backend.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
digitial 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
class AP_DAC_Backend
25
{
26
public:
27
AP_DAC_Backend(const AP_DAC_Params &_params) :
28
params(_params) {}
29
30
// initialise backend
31
virtual void init(void) = 0;
32
33
// update backend
34
virtual void update(void) {};
35
36
// set voltage for a channel
37
virtual bool set_voltage(uint8_t chan, float v) = 0;
38
39
protected:
40
const AP_DAC_Params &params;
41
};
42
43
#endif // AP_DAC_ENABLED
44
45