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