|
AS5047U Driver 0.1.0
API reference
|
Everything EnsureInitialized() and ApplyConfig() write to the chip.
More...
#include <as5047u_types.hpp>
Public Attributes | |
| FrameFormat | frame {FrameFormat::Bits24} |
| uint8_t | pad_byte {0} |
| Driver side: the pad byte of 32-bit frames (the daisy-chain address). | |
| bool | write_settings {true} |
| uint32_t | startup_timeout_ms {kPowerOnTimeMs} |
| Direction | direction {Direction::Clockwise} |
| SETTINGS2.DIR. | |
| uint16_t | zero_position {0} |
| ZPOSM/ZPOSL, counts 0 to 16383. | |
| bool | dynamic_compensation {true} |
| DAEC on (SETTINGS2.DAECDIS = 0). | |
| bool | adaptive_filter {true} |
| Velocity filter on (DISABLE bit 6 = 0). | |
| uint8_t | filter_k_min_code {0} |
| SETTINGS1.K_min code, 0 to 7. | |
| uint8_t | filter_k_max_code {0} |
| SETTINGS1.K_max code, 0 to 7. | |
| IncrementalOutput | incremental {IncrementalOutput::Abi} |
| SETTINGS2.UVW_ABI. | |
| bool | abi_enable {true} |
| A/B/I pins driven (DISABLE.ABI_off = 0). | |
| bool | uvw_enable {true} |
| U/V/W pins driven (DISABLE.UVW_off = 0). | |
| bool | pwm_enable {false} |
| SETTINGS2.PWMon. | |
| uint8_t | abi_resolution_code {0} |
| SETTINGS3.ABIRES, 0 to 7. | |
| bool | abi_decimal {false} |
| SETTINGS2.ABI_DEC. | |
| IndexWidth | index_width {IndexWidth::ThreeLsb} |
| SETTINGS2.IWIDTH. | |
| uint8_t | uvw_pole_pairs {1} |
| SETTINGS3.UVWPP + 1, 1 to 7. | |
| uint8_t | hysteresis_code {0} |
| SETTINGS3.HYS, 0 to 3. | |
| bool | high_temperature_noise {false} |
| bool | uncompensated_at_angle_register {false} |
| SETTINGS2.Data_select: address 0x3FFF (and the PWM output) carry the angle without DAEC. | |
Friends | |
| constexpr bool | operator== (const Config &lhs, const Config &rhs) noexcept=default |
| Field by field; every member is an integer, a bool or an enumeration, so equality is exact (KB-CPP20-033). A hidden friend, so both operands are treated alike. | |
Everything EnsureInitialized() and ApplyConfig() write to the chip.
The register defaults are the reset values of an unprogrammed part, so Config{} changes nothing on such a chip. Codes are the raw register field values; the datasheet section of each field gives the table.
Field by field; every member is an integer, a bool or an enumeration, so equality is exact (KB-CPP20-033). A hidden friend, so both operands are treated alike.
| lhs | One configuration. |
| rhs | The other. |
| FrameFormat as5047u::Config::frame {FrameFormat::Bits24} |
Driver side: the frame length of every read (writes are always CRC-protected). **Bits16 reads carry no CRC**: a corrupted reply goes unnoticed, and MISO stuck low (or a chip that hears MOSI as all zeros) reads as angle 0 with no flag bit. Keep the default Bits24 wherever a stuck line must never read as a position (docs/limitations.md).
| bool as5047u::Config::high_temperature_noise {false} |
SETTINGS2.NOISESET (150 °C at 3.3 V).
| uint32_t as5047u::Config::startup_timeout_ms {kPowerOnTimeMs} |
Driver side: how long EnsureInitialized() polls DIA, once per millisecond, for every loop to report finished before it fails with NotReady (or NoDevice when DIA never read anything but 0). 0 to kStartupTimeoutMaxMs; 0 checks once and never waits. The default t_pon covers a start made the moment the supply comes up (handbook KB-CPP-124).
| bool as5047u::Config::write_settings {true} |
Driver side: write the settings below in EnsureInitialized(). False leaves the chip as it is, for a part whose OTP is burned: EnsureInitialized() reads the settings back into GetConfig(), so a later setter changes only the field it names.