HF-AS5047U Driver  0.1.0-dev
HF-AS5047U C++ Driver
Loading...
Searching...
No Matches
as5047u::AS5047U< SpiType > Class Template Reference

AS5047U magnetic rotary sensor driver class. More...

#include <as5047u.hpp>

Classes

struct  Angle
 Angle conversion helpers. More...
 
struct  Velocity
 Helper constants and methods for velocity unit conversions. More...
 

Public Member Functions

 AS5047U (SpiType &bus, FrameFormat format=AS5047U_CFG::DEFAULT_FRAME_FORMAT) noexcept
 Construct a new AS5047U encoder driver.
 
 ~AS5047U ()=default
 
void SetFrameFormat (FrameFormat format) noexcept
 Set the SPI frame format (16, 24, or 32-bit).
 
uint16_t GetAngle (uint8_t retries=AS5047U_CFG::CRC_RETRIES) const
 Read the 14-bit absolute angle with dynamic compensation (DAEC active).
 
float GetAngle (AngleUnit unit, uint8_t retries=AS5047U_CFG::CRC_RETRIES) const
 Read absolute angle in caller-selected unit.
 
float GetAngleDegrees (uint8_t retries=AS5047U_CFG::CRC_RETRIES) const
 Read absolute angle in degrees.
 
float GetAngleRadians (uint8_t retries=AS5047U_CFG::CRC_RETRIES) const
 Read absolute angle in radians.
 
uint16_t GetRawAngle (uint8_t retries=AS5047U_CFG::CRC_RETRIES) const
 Read the 14-bit absolute angle without dynamic compensation (raw angle).
 
int16_t GetVelocity (uint8_t retries=AS5047U_CFG::CRC_RETRIES) const
 Read the current rotational velocity (signed 14-bit).
 
float GetVelocity (VelocityUnit unit, uint8_t retries=AS5047U_CFG::CRC_RETRIES) const
 Read rotational velocity in caller-selected unit.
 
float GetVelocityDegPerSec (uint8_t retries=AS5047U_CFG::CRC_RETRIES) const
 Get rotational velocity in degrees per second.
 
float GetVelocityRadPerSec (uint8_t retries=AS5047U_CFG::CRC_RETRIES) const
 Get rotational velocity in radians per second.
 
float GetVelocityRPM (uint8_t retries=AS5047U_CFG::CRC_RETRIES) const
 Get rotational velocity in revolutions per minute.
 
uint8_t GetAGC (uint8_t retries=AS5047U_CFG::CRC_RETRIES) const
 Read the current Automatic Gain Control (AGC) value (0-255).
 
uint16_t GetMagnitude (uint8_t retries=AS5047U_CFG::CRC_RETRIES) const
 Read the current magnetic field magnitude (14-bit value).
 
uint16_t GetErrorFlags (uint8_t retries=AS5047U_CFG::CRC_RETRIES) const
 Read and clear error flags.
 
void DumpStatus () const
 Dump formatted status and diagnostics using printf.
 
uint16_t GetZeroPosition (uint8_t retries=AS5047U_CFG::CRC_RETRIES) const
 Get the currently configured soft zero position offset (14-bit).
 
bool SetZeroPosition (uint16_t angle_lsb, uint8_t retries=AS5047U_CFG::CRC_RETRIES)
 Set a new zero reference position (soft offset).
 
bool SetDirection (bool clockwise, uint8_t retries=AS5047U_CFG::CRC_RETRIES)
 Define the rotation direction for increasing angle.
 
bool SetABIResolution (uint8_t resolution_bits, uint8_t retries=AS5047U_CFG::CRC_RETRIES)
 Set the ABI (incremental encoder) resolution.
 
bool SetUVWPolePairs (uint8_t pairs, uint8_t retries=AS5047U_CFG::CRC_RETRIES)
 Set the number of pole pairs for UVW commutation outputs.
 
bool SetIndexPulseLength (uint8_t lsb_len, uint8_t retries=AS5047U_CFG::CRC_RETRIES)
 Set the index pulse width for ABI output.
 
bool ConfigureInterface (bool abi, bool uvw, bool pwm, uint8_t retries=AS5047U_CFG::CRC_RETRIES)
 Configure interface outputs (ABI, UVW) and PWM output.
 
bool SetDynamicAngleCompensation (bool enable, uint8_t retries=AS5047U_CFG::CRC_RETRIES)
 Enable/disable Dynamic Angle Error Compensation (DAEC).
 
bool SetAdaptiveFilter (bool enable, uint8_t retries=AS5047U_CFG::CRC_RETRIES)
 Enable/disable the adaptive filter (Dynamic Filter System).
 
bool SetFilterPreset (FilterPreset preset, uint8_t retries=AS5047U_CFG::CRC_RETRIES)
 Set adaptive filter from a preset (easiest way to configure filter).
 
bool SetFilterParameters (uint8_t k_min, uint8_t k_max, uint8_t retries=AS5047U_CFG::CRC_RETRIES)
 Set adaptive filter parameters (K_min and K_max as 3-bit register codes).
 
bool GetAdaptiveFilterEnabled (uint8_t retries=AS5047U_CFG::CRC_RETRIES) const
 Read whether the adaptive filter is enabled.
 
std::pair< uint8_t, uint8_t > GetFilterParameters (uint8_t retries=AS5047U_CFG::CRC_RETRIES) const
 Read current K_min and K_max register codes (0–7 each).
 
bool Set150CTemperatureMode (bool enable, uint8_t retries=AS5047U_CFG::CRC_RETRIES)
 Set temperature mode for 150°C operation (NOISESET bit).
 
bool ProgramOTP ()
 Permanently program current settings into OTP memory.
 
void SetPad (uint8_t pad) noexcept
 Set the daisy-chain pad byte for 32-bit SPI frames.
 
bool SetHysteresis (AS5047U_REG::SETTINGS3::Hysteresis hysteresis, uint8_t retries=AS5047U_CFG::CRC_RETRIES)
 Set incremental output hysteresis level.
 
AS5047U_REG::SETTINGS3::Hysteresis GetHysteresis () const
 Get current incremental output hysteresis setting.
 
bool SetAngleOutputSource (AS5047U_REG::SETTINGS2::AngleOutputSource source, uint8_t retries=AS5047U_CFG::CRC_RETRIES)
 Select which angle register (0x3FFF) is returned on reads.
 
AS5047U_REG::SETTINGS2::AngleOutputSource GetAngleOutputSource () const
 Get currently selected angle output source for 0x3FFF reads.
 
AS5047U_REG::DIA GetDiagnostics () const
 Read the full diagnostic register (DIA).
 
template<typename RegT >
RegT ReadReg () const
 Reads data from a specified register in the AS5047U sensor.
 
template<typename RegT >
bool WriteReg (const RegT &reg, uint8_t retries=AS5047U_CFG::CRC_RETRIES)
 Writes data to a specified register in the AS5047U sensor.
 
AS5047U_Error GetStickyErrorFlags () const
 Retrieve and clear the accumulated sticky error flags.
 

Static Public Member Functions

static constexpr uint8_t ComputeCRC8 (uint16_t data16)
 
static constexpr const char * GetDriverVersion () noexcept
 Get the compiled driver version string.
 
static constexpr uint8_t GetDriverVersionMajor () noexcept
 Get the compiled driver major version number.
 
static constexpr uint8_t GetDriverVersionMinor () noexcept
 Get the compiled driver minor version number.
 
static constexpr uint8_t GetDriverVersionPatch () noexcept
 Get the compiled driver patch version number.
 

Detailed Description

template<typename SpiType>
class as5047u::AS5047U< SpiType >

AS5047U magnetic rotary sensor driver class.

Provides high-level access to sensor features: reading angle (with or without DAEC compensation), reading rotation velocity, retrieving AGC and magnitude diagnostics, configuring outputs (ABI, UVW, PWM), handling error flags, and performing OTP programming for permanent configuration storage.

Template Parameters
SpiTypeThe SPI bus type (must inherit from as5047u::SpiInterface<SpiType>)
Note
The driver uses CRTP-based SPI interface for zero virtual call overhead. SPI implementations should inherit from as5047u::SpiInterface<DerivedType>
C++17 CTAD allows automatic type deduction: AS5047U encoder(bus, format); // Type deduced automatically

Constructor & Destructor Documentation

◆ AS5047U()

template<typename SpiType >
as5047u::AS5047U< SpiType >::AS5047U ( SpiType & bus,
FrameFormat format = AS5047U_CFG::DEFAULT_FRAME_FORMAT )
explicitnoexcept

Construct a new AS5047U encoder driver.

Parameters
busReference to an SPI interface implementation.
formatSPI frame format to use (16-bit, 24-bit, or 32-bit). Default is 16-bit frames.

◆ ~AS5047U()

template<typename SpiType >
as5047u::AS5047U< SpiType >::~AS5047U ( )
default

Member Function Documentation

◆ ComputeCRC8()

template<typename SpiType >
static constexpr uint8_t as5047u::AS5047U< SpiType >::ComputeCRC8 ( uint16_t data16)
inlinestaticconstexpr

Compute the CRC8 value used by AS5047U SPI frames.

◆ ConfigureInterface()

template<typename SpiType >
bool as5047u::AS5047U< SpiType >::ConfigureInterface ( bool abi,
bool uvw,
bool pwm,
uint8_t retries = AS5047U_CFG::CRC_RETRIES )

Configure interface outputs (ABI, UVW) and PWM output.

Enables/disables ABI and UVW outputs and configures PWM on the available pin:

  • If abi is true and uvw false, ABI outputs are enabled and PWM (if enabled) is on W pin.
  • If uvw is true and abi false, UVW outputs are enabled and PWM (if enabled) is on I pin.
  • If both abi and uvw are true, both interfaces are active (PWM not available in this mode).
  • If both are false, all interfaces are disabled (PWM can still be enabled on W by default).
Parameters
abiEnable ABI (A, B, I) outputs.
uvwEnable UVW commutation outputs.
pwmEnable PWM output on the appropriate pin (W if UVW disabled, I if ABI disabled).

◆ DumpStatus()

template<typename SpiType >
void as5047u::AS5047U< SpiType >::DumpStatus ( ) const

Dump formatted status and diagnostics using printf.

◆ GetAdaptiveFilterEnabled()

template<typename SpiType >
bool as5047u::AS5047U< SpiType >::GetAdaptiveFilterEnabled ( uint8_t retries = AS5047U_CFG::CRC_RETRIES) const

Read whether the adaptive filter is enabled.

◆ GetAGC()

template<typename SpiType >
uint8_t as5047u::AS5047U< SpiType >::GetAGC ( uint8_t retries = AS5047U_CFG::CRC_RETRIES) const

Read the current Automatic Gain Control (AGC) value (0-255).

Parameters
retriesNumber of retries on CRC/framing error (default 0 = no retry).
Returns
The current AGC value.

◆ GetAngle() [1/2]

template<typename SpiType >
float as5047u::AS5047U< SpiType >::GetAngle ( AngleUnit unit,
uint8_t retries = AS5047U_CFG::CRC_RETRIES ) const

Read absolute angle in caller-selected unit.

Parameters
unitOutput unit (LSB / degrees / radians).
retriesNumber of retries on CRC/framing error (default 0 = no retry).
Returns
Angle value in the requested unit.

◆ GetAngle() [2/2]

template<typename SpiType >
uint16_t as5047u::AS5047U< SpiType >::GetAngle ( uint8_t retries = AS5047U_CFG::CRC_RETRIES) const

Read the 14-bit absolute angle with dynamic compensation (DAEC active).

Parameters
retriesNumber of retries on CRC/framing error (default 0 = no retry).
Returns
The current angle in LSB (0-16383).

◆ GetAngleDegrees()

template<typename SpiType >
float as5047u::AS5047U< SpiType >::GetAngleDegrees ( uint8_t retries = AS5047U_CFG::CRC_RETRIES) const

Read absolute angle in degrees.

Parameters
retriesNumber of retries on CRC/framing error (default 0 = no retry).
Returns
Angle in degrees in the range [0, 360).

◆ GetAngleOutputSource()

template<typename SpiType >
AS5047U_REG::SETTINGS2::AngleOutputSource as5047u::AS5047U< SpiType >::GetAngleOutputSource ( ) const

Get currently selected angle output source for 0x3FFF reads.

Returns
AngleOutputSource enum indicating ANGLECOM or ANGLEUNC.

◆ GetAngleRadians()

template<typename SpiType >
float as5047u::AS5047U< SpiType >::GetAngleRadians ( uint8_t retries = AS5047U_CFG::CRC_RETRIES) const

Read absolute angle in radians.

Parameters
retriesNumber of retries on CRC/framing error (default 0 = no retry).
Returns
Angle in radians in the range [0, 2π).

◆ GetDiagnostics()

template<typename SpiType >
AS5047U_REG::DIA as5047u::AS5047U< SpiType >::GetDiagnostics ( ) const

Read the full diagnostic register (DIA).

Returns
DIA register struct containing per-bit calibration and status flags.

◆ GetDriverVersion()

template<typename SpiType >
static constexpr const char * as5047u::AS5047U< SpiType >::GetDriverVersion ( )
inlinestaticconstexprnoexcept

Get the compiled driver version string.

Returns
Null-terminated version string, e.g. "1.0.0".

◆ GetDriverVersionMajor()

template<typename SpiType >
static constexpr uint8_t as5047u::AS5047U< SpiType >::GetDriverVersionMajor ( )
inlinestaticconstexprnoexcept

Get the compiled driver major version number.

◆ GetDriverVersionMinor()

template<typename SpiType >
static constexpr uint8_t as5047u::AS5047U< SpiType >::GetDriverVersionMinor ( )
inlinestaticconstexprnoexcept

Get the compiled driver minor version number.

◆ GetDriverVersionPatch()

template<typename SpiType >
static constexpr uint8_t as5047u::AS5047U< SpiType >::GetDriverVersionPatch ( )
inlinestaticconstexprnoexcept

Get the compiled driver patch version number.

◆ GetErrorFlags()

template<typename SpiType >
uint16_t as5047u::AS5047U< SpiType >::GetErrorFlags ( uint8_t retries = AS5047U_CFG::CRC_RETRIES) const

Read and clear error flags.

Parameters
retriesNumber of retries on CRC/framing error (default 0 = no retry).
Returns
16-bit error flag register (ERRFL). All flags clear after read.

◆ GetFilterParameters()

template<typename SpiType >
std::pair< uint8_t, uint8_t > as5047u::AS5047U< SpiType >::GetFilterParameters ( uint8_t retries = AS5047U_CFG::CRC_RETRIES) const

Read current K_min and K_max register codes (0–7 each).

◆ GetHysteresis()

template<typename SpiType >
AS5047U_REG::SETTINGS3::Hysteresis as5047u::AS5047U< SpiType >::GetHysteresis ( ) const

Get current incremental output hysteresis setting.

Returns
Current Hysteresis enum value (0b00–0b11).

◆ GetMagnitude()

template<typename SpiType >
uint16_t as5047u::AS5047U< SpiType >::GetMagnitude ( uint8_t retries = AS5047U_CFG::CRC_RETRIES) const

Read the current magnetic field magnitude (14-bit value).

Parameters
retriesNumber of retries on CRC/framing error (default 0 = no retry).
Returns
The current magnetic field magnitude in LSB (0-16383).

◆ GetRawAngle()

template<typename SpiType >
uint16_t as5047u::AS5047U< SpiType >::GetRawAngle ( uint8_t retries = AS5047U_CFG::CRC_RETRIES) const

Read the 14-bit absolute angle without dynamic compensation (raw angle).

Parameters
retriesNumber of retries on CRC/framing error (default 0 = no retry).
Returns
The current raw angle in LSB (0-16383).

◆ GetStickyErrorFlags()

template<typename SpiType >
AS5047U_Error as5047u::AS5047U< SpiType >::GetStickyErrorFlags ( ) const

Retrieve and clear the accumulated sticky error flags.

Returns
Bitwise OR of AS5047U_Error enum flags since last call.

◆ GetVelocity() [1/2]

template<typename SpiType >
int16_t as5047u::AS5047U< SpiType >::GetVelocity ( uint8_t retries = AS5047U_CFG::CRC_RETRIES) const

Read the current rotational velocity (signed 14-bit).

Parameters
retriesNumber of retries on CRC/framing error (default 0 = no retry).
Returns
The current velocity in LSB (signed 14-bit).

◆ GetVelocity() [2/2]

template<typename SpiType >
float as5047u::AS5047U< SpiType >::GetVelocity ( VelocityUnit unit,
uint8_t retries = AS5047U_CFG::CRC_RETRIES ) const

Read rotational velocity in caller-selected unit.

Parameters
unitOutput unit (LSB / deg/s / rad/s / RPM).
retriesNumber of retries on CRC/framing error (default 0 = no retry).
Returns
Velocity in the requested unit.

◆ GetVelocityDegPerSec()

template<typename SpiType >
float as5047u::AS5047U< SpiType >::GetVelocityDegPerSec ( uint8_t retries = AS5047U_CFG::CRC_RETRIES) const

Get rotational velocity in degrees per second.

Parameters
retriesNumber of retries on CRC/framing error (default 0 = no retry).

◆ GetVelocityRadPerSec()

template<typename SpiType >
float as5047u::AS5047U< SpiType >::GetVelocityRadPerSec ( uint8_t retries = AS5047U_CFG::CRC_RETRIES) const

Get rotational velocity in radians per second.

Parameters
retriesNumber of retries on CRC/framing error (default 0 = no retry).

◆ GetVelocityRPM()

template<typename SpiType >
float as5047u::AS5047U< SpiType >::GetVelocityRPM ( uint8_t retries = AS5047U_CFG::CRC_RETRIES) const

Get rotational velocity in revolutions per minute.

Parameters
retriesNumber of retries on CRC/framing error (default 0 = no retry).

◆ GetZeroPosition()

template<typename SpiType >
uint16_t as5047u::AS5047U< SpiType >::GetZeroPosition ( uint8_t retries = AS5047U_CFG::CRC_RETRIES) const

Get the currently configured soft zero position offset (14-bit).

Parameters
retriesNumber of retries on CRC/framing error (default 0 = no retry).
Returns
The current zero position in LSB (0-16383).

◆ ProgramOTP()

template<typename SpiType >
bool as5047u::AS5047U< SpiType >::ProgramOTP ( )

Permanently program current settings into OTP memory.

Performs the full OTP programming sequence:

  • Writes current configuration (zero position, settings registers) to volatile registers.
  • Reads current angle and sets it as zero reference.
  • Enables ECC, reads and writes ECC checksum.
  • Triggers OTP burn and waits for completion.
  • Performs guard-band verification (clears registers, refreshes from OTP, verifies content).
Returns
True if programming and verification succeeded, false otherwise.
Warning
OTP can be programmed only once. Ensure proper supply voltage (3.3-3.5V for 3V mode, ~5V for 5V mode) and desired configuration before use.

◆ ReadReg()

template<typename SpiType >
template<typename RegT >
RegT as5047u::AS5047U< SpiType >::ReadReg ( ) const
inline

Reads data from a specified register in the AS5047U sensor.

Template Parameters
RegTThe register type which must have an ADDRESS static member and be decodable
Returns
RegT The register object populated with the data read from the sensor

This method reads the raw value from the specified register address and decodes it into a strongly-typed register object.

◆ Set150CTemperatureMode()

template<typename SpiType >
bool as5047u::AS5047U< SpiType >::Set150CTemperatureMode ( bool enable,
uint8_t retries = AS5047U_CFG::CRC_RETRIES )

Set temperature mode for 150°C operation (NOISESET bit).

When enabled, the sensor supports full 150°C range (NOISESET=1), but with increased noise. When disabled, lower noise but max 125°C.

Parameters
enableTrue for 150°C mode (NOISESET=1), false for low-noise (NOISESET=0).

◆ SetABIResolution()

template<typename SpiType >
bool as5047u::AS5047U< SpiType >::SetABIResolution ( uint8_t resolution_bits,
uint8_t retries = AS5047U_CFG::CRC_RETRIES )

Set the ABI (incremental encoder) resolution.

Parameters
resolution_bitsResolution in bits (10 to 14 bits).

◆ SetAdaptiveFilter()

template<typename SpiType >
bool as5047u::AS5047U< SpiType >::SetAdaptiveFilter ( bool enable,
uint8_t retries = AS5047U_CFG::CRC_RETRIES )

Enable/disable the adaptive filter (Dynamic Filter System).

◆ SetAngleOutputSource()

template<typename SpiType >
bool as5047u::AS5047U< SpiType >::SetAngleOutputSource ( AS5047U_REG::SETTINGS2::AngleOutputSource source,
uint8_t retries = AS5047U_CFG::CRC_RETRIES )

Select which angle register (0x3FFF) is returned on reads.

Controls the Data_select bit in SETTINGS2.

Parameters
sourceAngle output source:
  • SETTINGS2::AngleOutputSource::UseANGLECOM: read compensated angle (ANGLECOM)
  • SETTINGS2::AngleOutputSource::UseANGLEUNC: read raw angle (ANGLEUNC)

◆ SetDirection()

template<typename SpiType >
bool as5047u::AS5047U< SpiType >::SetDirection ( bool clockwise,
uint8_t retries = AS5047U_CFG::CRC_RETRIES )
inline

Define the rotation direction for increasing angle.

Writes SETTINGS2 (0x0019) bit 2 (DIR) per datasheet Fig.47: 0 = CW default, 1 = invert direction.

Parameters
clockwiseIf true, clockwise yields increasing angle (DIR=0). If false, invert direction (DIR=1).
retriesNumber of retries on CRC/framing error (default 0 = no retry).
Returns
true if register write succeeded.

◆ SetDynamicAngleCompensation()

template<typename SpiType >
bool as5047u::AS5047U< SpiType >::SetDynamicAngleCompensation ( bool enable,
uint8_t retries = AS5047U_CFG::CRC_RETRIES )

Enable/disable Dynamic Angle Error Compensation (DAEC).

◆ SetFilterParameters()

template<typename SpiType >
bool as5047u::AS5047U< SpiType >::SetFilterParameters ( uint8_t k_min,
uint8_t k_max,
uint8_t retries = AS5047U_CFG::CRC_RETRIES )

Set adaptive filter parameters (K_min and K_max as 3-bit register codes).

Both arguments are 0–7 (register codes). See SETTINGS1::AdaptiveFilterKmin and AdaptiveFilterKmax for mapping to effective K (datasheet Figure 17). For a single effective K, use SetFilterPreset() instead.

◆ SetFilterPreset()

template<typename SpiType >
bool as5047u::AS5047U< SpiType >::SetFilterPreset ( FilterPreset preset,
uint8_t retries = AS5047U_CFG::CRC_RETRIES )

Set adaptive filter from a preset (easiest way to configure filter).

Enables the filter and sets K_min/K_max to match the preset. See FilterPreset and datasheet Figure 17 (velocity RMS noise vs K).

◆ SetFrameFormat()

template<typename SpiType >
void as5047u::AS5047U< SpiType >::SetFrameFormat ( FrameFormat format)
noexcept

Set the SPI frame format (16, 24, or 32-bit).

Parameters
formatThe desired SPI frame format.

◆ SetHysteresis()

template<typename SpiType >
bool as5047u::AS5047U< SpiType >::SetHysteresis ( AS5047U_REG::SETTINGS3::Hysteresis hysteresis,
uint8_t retries = AS5047U_CFG::CRC_RETRIES )

Set incremental output hysteresis level.

Controls the HYS field in SETTINGS3 to add output deadband and reduce chatter.

Parameters
hysteresisHysteresis level:
  • SETTINGS3::Hysteresis::LSB_1 (0b00): 1 LSB deadband (~0.17°, default)
  • SETTINGS3::Hysteresis::LSB_2 (0b01): 2 LSB deadband (~0.35°)
  • SETTINGS3::Hysteresis::LSB_3 (0b10): 3 LSB deadband (~0.52°)
  • SETTINGS3::Hysteresis::NONE (0b11): No hysteresis

◆ SetIndexPulseLength()

template<typename SpiType >
bool as5047u::AS5047U< SpiType >::SetIndexPulseLength ( uint8_t lsb_len,
uint8_t retries = AS5047U_CFG::CRC_RETRIES )

Set the index pulse width for ABI output.

Parameters
lsb_lenIndex pulse length in LSB periods (3 or 1).

◆ SetPad()

template<typename SpiType >
void as5047u::AS5047U< SpiType >::SetPad ( uint8_t pad)
noexcept

Set the daisy-chain pad byte for 32-bit SPI frames.

In 32-bit frame mode, the first byte is used as a pad to allow multiple devices on the same bus.

Parameters
padPad byte value (0x00–0xFF) to send as the MSB of each 32-bit transfer.

◆ SetUVWPolePairs()

template<typename SpiType >
bool as5047u::AS5047U< SpiType >::SetUVWPolePairs ( uint8_t pairs,
uint8_t retries = AS5047U_CFG::CRC_RETRIES )

Set the number of pole pairs for UVW commutation outputs.

Parameters
pairsNumber of pole pairs (1-7).

◆ SetZeroPosition()

template<typename SpiType >
bool as5047u::AS5047U< SpiType >::SetZeroPosition ( uint16_t angle_lsb,
uint8_t retries = AS5047U_CFG::CRC_RETRIES )

Set a new zero reference position (soft offset).

Parameters
angle_lsb14-bit angle value that should be treated as 0°.

◆ WriteReg()

template<typename SpiType >
template<typename RegT >
bool as5047u::AS5047U< SpiType >::WriteReg ( const RegT & reg,
uint8_t retries = AS5047U_CFG::CRC_RETRIES )
inline

Writes data to a specified register in the AS5047U sensor.

Template Parameters
RegTThe register type which must have an ADDRESS static member and be encodable
Parameters
regThe register object containing the data to be written
retriesNumber of retries on CRC/framing error (default 0 = no retry)
Returns
true if write succeeded, false on CRC/framing error

The documentation for this class was generated from the following files: