Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ardupilot
GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_DAC/AP_DAC_Params.cpp
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
#include "AP_DAC_Params.h"
17
#include "AP_DAC.h"
18
19
#if AP_DAC_ENABLED
20
21
#ifndef AP_DAC_DEFAULT_BUS
22
#define AP_DAC_DEFAULT_BUS 0
23
#endif
24
25
#ifndef AP_DAC_DEFAULT_ADDR
26
#define AP_DAC_DEFAULT_ADDR 0
27
#endif
28
29
#ifndef AP_DAC_DEFAULT_VREF
30
#define AP_DAC_DEFAULT_VREF 3.3
31
#endif
32
33
#ifndef AP_DAC_DEFAULT_VOLT
34
#define AP_DAC_DEFAULT_VOLT 3.3
35
#endif
36
37
#ifndef AP_DAC_DEFAULT_TYPE
38
#define AP_DAC_DEFAULT_TYPE int8_t(Type::NONE)
39
#endif
40
41
const AP_Param::GroupInfo AP_DAC_Params::var_info[] = {
42
// @Param: TYPE
43
// @DisplayName: DAC Type
44
// @Description: DAC Type
45
// @Values: 0:Disabled, 1:TIx3204, 2:MCP401x
46
// @User: Standard
47
// @RebootRequired: True
48
AP_GROUPINFO_FLAGS("TYPE", 1, AP_DAC_Params, type, AP_DAC_DEFAULT_TYPE, AP_PARAM_FLAG_ENABLE),
49
50
// @Param: BUS
51
// @DisplayName: I2C bus
52
// @Description: I2C bus number
53
// @Range: 0 3
54
// @User: Standard
55
// @RebootRequired: True
56
AP_GROUPINFO("BUS", 2, AP_DAC_Params, bus, AP_DAC_DEFAULT_BUS),
57
58
// @Param: ADDR
59
// @DisplayName: I2C address
60
// @Description: I2C address
61
// @Range: 0 127
62
// @User: Standard
63
// @RebootRequired: True
64
AP_GROUPINFO("ADDR", 3, AP_DAC_Params, bus_address, AP_DAC_DEFAULT_ADDR),
65
66
// @Param: VREF
67
// @DisplayName: Voltage reference
68
// @Description: Voltage reference
69
// @Range: 0 1000
70
// @User: Standard
71
AP_GROUPINFO("VREF", 4, AP_DAC_Params, voltage_reference, AP_DAC_DEFAULT_VREF),
72
73
// @Param: VOLTS
74
// @DisplayName: Voltage
75
// @Description: Voltage
76
// @Range: 0 1000
77
// @User: Standard
78
AP_GROUPINFO("VOLTS", 5, AP_DAC_Params, voltage, AP_DAC_DEFAULT_VOLT),
79
80
AP_GROUPEND
81
};
82
83
AP_DAC_Params::AP_DAC_Params(void)
84
{
85
AP_Param::setup_object_defaults(this, var_info);
86
}
87
88
#endif // AP_DAC_ENABLED
89
90