|
MCP9700 Driver 0.1.0
API reference
|
The ADC port of the MCP970x driver: the CRTP base, its pin enums, the AdcPort concept and the output-load limits a port must respect.
More...
Go to the source code of this file.
Classes | |
| class | mcp9700::AdcInterface< Derived > |
| CRTP base of the platform ADC port. More... | |
Namespaces | |
| namespace | mcp9700 |
The MCP970x driver: everything it declares lives here; internals in detail. | |
Concepts | |
| concept | mcp9700::AdcPort |
Satisfied by a class that derives from AdcInterface<Port> and implements the required hooks with exactly the types above, noexcept and returning bool (handbook KB-CPP20-006). | |
Enumerations | |
| enum class | mcp9700::CtrlPin : uint8_t { mcp9700::Enable = 0 } |
Control pins the port may drive through the optional GpioSet() hook. More... | |
| enum class | mcp9700::GpioSignal : uint8_t { mcp9700::INACTIVE = 0 , mcp9700::ACTIVE = 1 } |
| Logical level of a control pin; the port maps it to the physical polarity. More... | |
Variables | |
| constexpr uint32_t | mcp9700::kMaxOutputCurrentUa = 100U |
| constexpr uint32_t | mcp9700::kMaxLoadCapacitancePf = 1000U |
| constexpr uint32_t | mcp9700::kOutputImpedanceOhm = 20U |
| Typical output impedance, ohms, at 100 uA and 500 Hz (Z_OUT, p.4). | |
| constexpr uint32_t | mcp9700::kPowerOnTypicalUs = 800U |
The ADC port of the MCP970x driver: the CRTP base, its pin enums, the AdcPort concept and the output-load limits a port must respect.
The sensor has an analog output read through an ADC channel of your MCU. The driver calls hooks on a class you derive from mcp9700::AdcInterface<Self>:
Required: bool EnsureInitialized() noexcept (bring the ADC up on the first call) and bool ReadVoltageMv(uint8_t channel, uint32_t& voltage_mv) noexcept (one calibrated conversion in millivolts at the ADC pin; false on any failure). void DelayUs(uint32_t us) noexcept is required in effect: the first wait is a compile error without it. Optional: bool GpioSet(CtrlPin, GpioSignal) noexcept (powers the sensor from an MCU pin, DS20001942L Section 4.2, p.11; idle INACTIVE before the output is enabled) and void Log(LogLevel, const
char*) noexcept (plain text, never a format). The full contract of each hook is the table in docs/porting.md.
The hook is the standard millivolt hook of the driver contract, so one ADC port serves every analog-input driver. The port exposes no raw counts; the application declares the port's full scale and resolution in Config.