PF1550 Driver 0.1.0
API reference
Loading...
Searching...
No Matches
Namespaces | Functions | Variables
pf1550_codec.hpp File Reference

Register codecs of the PF1550: voltage and current grids of the data sheet tables, as constexpr functions that are total only over the documented codes. More...

#include <array>
#include <cstddef>
#include <cstdint>
#include "pf1550_detail.hpp"
#include "pf1550_types.hpp"

Go to the source code of this file.

Namespaces

namespace  pf1550
 The PF1550 driver: everything it declares lives here; internals in detail.
 

Functions

constexpr Result< uint8_t > pf1550::ChargeVoltageCode (uint32_t mv) noexcept
 CHGCV code for a charge voltage.
 
constexpr uint32_t pf1550::ChargeVoltageMv (uint32_t code) noexcept
 The charge voltage a CHGCV code stands for.
 
constexpr Result< uint8_t > pf1550::ChargeCurrentCode (uint32_t ma) noexcept
 CHG_CC code for a charge current.
 
constexpr Result< uint32_t > pf1550::ChargeCurrentMa (uint32_t code) noexcept
 The current of a CHG_CC code.
 
constexpr Result< uint8_t > pf1550::TerminationCode (uint32_t ma) noexcept
 IEOC code for a termination current.
 
constexpr Result< uint32_t > pf1550::TerminationMa (uint32_t code) noexcept
 The termination current of an IEOC code.
 
constexpr Result< uint8_t > pf1550::InputLimitCode (uint32_t ma) noexcept
 VBUS_LIN_ILIM code for an input current limit.
 
constexpr Result< uint32_t > pf1550::InputLimitMa (uint32_t code) noexcept
 The limit of a VBUS_LIN_ILIM code.
 
constexpr Result< uint8_t > pf1550::BuckDvsCode (uint32_t uv) noexcept
 DVS-mode buck code for a voltage (SW1, SW2: 0.6 V + 12.5 mV x code).
 
constexpr uint32_t pf1550::BuckDvsUv (uint32_t code) noexcept
 The voltage of a DVS-mode buck code.
 
constexpr uint32_t pf1550::BuckFixedUvOf (uint32_t code) noexcept
 The voltage of a buck code in the non-DVS table (Table 31): codes 0 to 6, 3.3 V above.
 
constexpr uint32_t pf1550::Sw3Uv (uint32_t code) noexcept
 The voltage of an SW3 code (1.80 V + 100 mV x code, Table 37).
 
constexpr Result< uint8_t > pf1550::LdoCode (Rail rail, uint32_t uv) noexcept
 LDO voltage code.
 
constexpr uint32_t pf1550::LdoUv (Rail rail, uint32_t code) noexcept
 The voltage of an LDO code.
 
constexpr Result< uint8_t > pf1550::CoinVoltageCode (uint32_t mv) noexcept
 VCOIN code for a coin cell charge voltage (1.8 V + 100 mV x code, ambiguity C40).
 
constexpr PowerState pf1550::DecodePowerState (uint32_t code) noexcept
 The 4-bit power-state code of STATE_INFO (Table 146) as a PowerState.
 
constexpr Option pf1550::DecodeOption (uint32_t flavor) noexcept
 The option an OTP_FLAVOR byte names (Table 87 lists 0 to 3 and then "continues": a larger byte is Unknown, ambiguity C10, and the part's Table 85 profile is not assumed for it).
 

Variables

constexpr uint32_t pf1550::kChargeVoltageMinMv = 3500
 Lowest charge voltage (CHGCV code 8), mV (Table 160).
 
constexpr uint32_t pf1550::kChargeVoltageMaxMv = 4440
 Highest charge voltage (CHGCV code 55), mV.
 
constexpr uint32_t pf1550::kChargeCurrentMinMa = 100
 Charge current range, mA (Table 159: codes 0 to 18).
 
constexpr uint32_t pf1550::kChargeCurrentMaxMa = 1000
 Highest charge current, mA.
 
constexpr uint32_t pf1550::kBuckDvsMinUv = 600000
 DVS buck lowest voltage, uV (Table 31).
 
constexpr uint32_t pf1550::kBuckDvsStepUv = 12500
 DVS buck step, uV.
 
constexpr std::size_t pf1550::kInputLimitCodes = 21
 Number of VBUS_LIN_ILIM codes the data sheet defines (Table 163).
 
constexpr std::array< uint16_t, kInputLimitCodes > pf1550::kInputLimitMa
 The VBUS_LIN_ILIM table, mA, indexed by code (Table 163, Table 58).
 
constexpr std::array< uint32_t, 7 > pf1550::kBuckFixedUv
 The fixed (DVS disabled) buck table, uV, codes 0 to 6; every code above is 3.3 V (Table 31).
 

Detailed Description

Register codecs of the PF1550: voltage and current grids of the data sheet tables, as constexpr functions that are total only over the documented codes.

Every encoder returns InvalidArgument for a value that is off the grid or in a code the data sheet labels Reserved; every decoder returns InvalidArgument for a reserved code. The anchors of each table are proved with static_assert at the end of the file (KB-CPP20-012).