MCP9700 Driver 0.1.0
API reference
Loading...
Searching...
No Matches
mcp9700_adc_interface.hpp
Go to the documentation of this file.
1
24#ifndef MCP9700_ADC_INTERFACE_HPP
25#define MCP9700_ADC_INTERFACE_HPP
26
27#include <concepts>
28#include <cstdint>
29
30#include "mcp9700_detail.hpp"
31
32namespace mcp9700 {
33
37inline constexpr uint32_t kMaxOutputCurrentUa = 100U;
40inline constexpr uint32_t kMaxLoadCapacitancePf = 1000U;
42inline constexpr uint32_t kOutputImpedanceOhm = 20U;
45inline constexpr uint32_t kPowerOnTypicalUs = 800U;
46
49enum class CtrlPin : uint8_t {
50 Enable = 0,
52};
53
56enum class GpioSignal : uint8_t {
57 INACTIVE = 0,
58 ACTIVE = 1,
59};
60
70template <typename Derived>
72public:
74 AdcInterface(const AdcInterface&) = delete;
77
78protected:
80 AdcInterface() noexcept = default;
82 ~AdcInterface() noexcept = default;
83};
84
91template <typename Port>
92concept AdcPort = std::derived_from<Port, AdcInterface<Port>> && requires {
93 detail::ExactHook<Port, bool() noexcept>::Take(&Port::EnsureInitialized);
94 detail::ExactHook<Port, bool(uint8_t, uint32_t&) noexcept>::Take(&Port::ReadVoltageMv);
95};
96
97} // namespace mcp9700
98
99#endif // MCP9700_ADC_INTERFACE_HPP
CRTP base of the platform ADC port.
Definition mcp9700_adc_interface.hpp:71
AdcInterface & operator=(const AdcInterface &)=delete
Ports are not copied: the driver holds a reference.
AdcInterface() noexcept=default
Only the derived port is constructed.
AdcInterface(const AdcInterface &)=delete
Ports are not copied: the driver holds a reference.
Satisfied by a class that derives from AdcInterface<Port> and implements the required hooks with exac...
Definition mcp9700_adc_interface.hpp:92
Compile-time helpers of the MCP9700 driver: typed integer literals, exact hook matching,...
The MCP970x driver: everything it declares lives here; internals in detail.
Definition mcp9700.hpp:24
constexpr uint32_t kMaxLoadCapacitancePf
Definition mcp9700_adc_interface.hpp:40
GpioSignal
Logical level of a control pin; the port maps it to the physical polarity.
Definition mcp9700_adc_interface.hpp:56
@ ACTIVE
The pin function is asserted.
@ INACTIVE
The pin function is deasserted.
constexpr uint32_t kMaxOutputCurrentUa
Definition mcp9700_adc_interface.hpp:37
constexpr uint32_t kOutputImpedanceOhm
Typical output impedance, ohms, at 100 uA and 500 Hz (Z_OUT, p.4).
Definition mcp9700_adc_interface.hpp:42
CtrlPin
Control pins the port may drive through the optional GpioSet() hook.
Definition mcp9700_adc_interface.hpp:49
constexpr uint32_t kPowerOnTypicalUs
Definition mcp9700_adc_interface.hpp:45