Line data Source code
1 : // SPDX-FileCopyrightText: 2022-2024 Paul Colby <git@colby.id.au>
2 : // SPDX-License-Identifier: LGPL-3.0-or-later
3 :
4 : /*!
5 : * \file
6 : * Declares the PokitPro namespace.
7 : */
8 :
9 : #ifndef QTPOKIT_POKITPRO_H
10 : #define QTPOKIT_POKITPRO_H
11 :
12 : #include "qtpokit_global.h"
13 :
14 : #include <QVariant>
15 :
16 : QTPOKIT_BEGIN_NAMESPACE
17 :
18 : /// Encapsulates details specific to Pokit Pro devices.
19 : namespace PokitPro {
20 :
21 : /// Values supported by the Pokit Pro's `Range` attributes in `Capacitance` mode.
22 : enum class CapacitanceRange : quint8 {
23 : _100nF = 0, ///< Up 100nF.
24 : _10uF = 1, ///< Up 10μF.
25 : _1mF = 2, ///< Up 1mF.
26 : AutoRange = 255 ///< Auto-range.
27 : };
28 : QTPOKIT_EXPORT QString toString(const CapacitanceRange &range);
29 : QTPOKIT_EXPORT QVariant maxValue(const CapacitanceRange &range);
30 :
31 :
32 : /// Values supported by the Pokit Pro's `Range` attributes in `*Current` modes.
33 : enum class CurrentRange : quint8 {
34 : _500uA = 0, ///< Up to 5µA.
35 : _2mA = 1, ///< Up to 2mA.
36 : _10mA = 2, ///< Up to 10mA.
37 : _125mA = 3, ///< Up to 125mA.
38 : _300mA = 4, ///< Up to 300mA.
39 : _3A = 5, ///< Up to 3A.
40 : _10A = 6, ///< Up to 10A.
41 : AutoRange = 255 ///< Auto-range.
42 : };
43 : QTPOKIT_EXPORT QString toString(const CurrentRange &range);
44 : QTPOKIT_EXPORT QVariant maxValue(const CurrentRange &range);
45 :
46 : /// Values supported by the Pokit Pro's `Range` attributes in `Resistance` mode.
47 : enum class ResistanceRange : quint8 {
48 : _30 = 0, ///< Up to 30Ω.
49 : _75 = 1, ///< Up to 75Ω.
50 : _400 = 2, ///< Up to 400Ω.
51 : _5K = 3, ///< Up to 5KΩ.
52 : _10K = 4, ///< Up to 10KΩ.
53 : _15K = 5, ///< Up to 15KΩ.
54 : _40K = 6, ///< Up to 40KΩ.
55 : _500K = 7, ///< Up to 500KΩ.
56 : _700K = 8, ///< Up to 700KΩ.
57 : _1M = 9, ///< Up to 1MΩ.
58 : _3M = 10, ///< Up to 3MΩ.
59 : AutoRange = 255 ///< Auto-range.
60 : };
61 : QTPOKIT_EXPORT QString toString(const ResistanceRange &range);
62 : QTPOKIT_EXPORT QVariant maxValue(const ResistanceRange &range);
63 :
64 : /// Values supported by the Pokit Pro's `Range` attributes in `*Voltage` modes.
65 : enum class VoltageRange : quint8 {
66 : _250mV = 0, ///< Up to 250mV.
67 : _2V = 1, ///< Up to 2V.
68 : _10V = 2, ///< Up to 10V.
69 : _30V = 3, ///< Up to 30V.
70 : _60V = 4, ///< Up to 60V.
71 : _125V = 5, ///< Up to 125V.
72 : _400V = 6, ///< Up to 400V.
73 : _600V = 7, ///< Up to 600V.
74 : AutoRange = 255 ///< Auto-range.
75 : };
76 : QTPOKIT_EXPORT QString toString(const VoltageRange &range);
77 : QTPOKIT_EXPORT QVariant maxValue(const VoltageRange &range);
78 :
79 : }
80 :
81 : /// Returns \a range as a `quint8` as a convenience for assigning to services' `settings.range` members.
82 484 : constexpr quint8 operator+(PokitPro::CapacitanceRange range) noexcept { return static_cast<quint8>(range); }
83 :
84 : /// Returns \a range as a `quint8` as a convenience for assigning to services' `settings.range` members.
85 748 : constexpr quint8 operator+(PokitPro::CurrentRange range) noexcept { return static_cast<quint8>(range); }
86 :
87 : /// Returns \a range as a `quint8` as a convenience for assigning to services' `settings.range` members.
88 748 : constexpr quint8 operator+(PokitPro::ResistanceRange range) noexcept { return static_cast<quint8>(range); }
89 :
90 : /// Returns \a range as a `quint8` as a convenience for assigning to services' `settings.range` members.
91 792 : constexpr quint8 operator+(PokitPro::VoltageRange range) noexcept { return static_cast<quint8>(range); }
92 :
93 : QTPOKIT_END_NAMESPACE
94 :
95 : #endif // QTPOKIT_POKITPRO_H
|