TMC9660 Driver 0.1.0
API reference
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
tmc9660::BootConfig Class Reference

The 64-byte configuration memory of the bootloader, as 16 little-endian 32-bit words. More...

#include <tmc9660_bootconfig.hpp>

Public Member Functions

constexpr BootConfig () noexcept=default
 All zero. A configuration for the chip comes from BlReadConfig(), not from here.
 
constexpr BootConfig (const std::array< uint32_t, kWords > &words) noexcept
 A configuration from 16 raw words (for example read from the chip).
 
constexpr Error Set (BootField field, uint32_t value) noexcept
 Set a field.
 
constexpr uint32_t Get (BootField field) const noexcept
 The value of a field.
 
constexpr uint32_t Word (std::size_t index) const noexcept
 One raw word.
 
constexpr Error SetWord (std::size_t index, uint32_t value) noexcept
 Replace one raw word.
 
constexpr const std::array< uint32_t, kWords > & Words () const noexcept
 
constexpr Error CheckStart () const noexcept
 Check the rules that make a configuration unsafe to apply: the application must not start with a reserved BOOT_MODE, the motor-control clock must be 40 MHz and the device address odd when it starts.
 

Static Public Member Functions

static constexpr uint32_t MaxOf (BootField field) noexcept
 The largest value a field holds.
 

Static Public Attributes

static constexpr std::size_t kBytes = 64
 Size of the configuration memory in bytes.
 
static constexpr std::size_t kWords = 16
 Number of 32-bit words.
 

Friends

constexpr bool operator== (const BootConfig &lhs, const BootConfig &rhs) noexcept
 Equality of all words.
 

Detailed Description

The 64-byte configuration memory of the bootloader, as 16 little-endian 32-bit words.

Plain data: no I/O. Read it with TMC9660::BlReadConfig(), change fields, write it with TMC9660::BlWriteConfig().

Constructor & Destructor Documentation

◆ BootConfig()

constexpr tmc9660::BootConfig::BootConfig ( const std::array< uint32_t, kWords > &  words)
inlineexplicitconstexprnoexcept

A configuration from 16 raw words (for example read from the chip).

Parameters
wordsThe words, little endian per the manual's byte layout.

Member Function Documentation

◆ CheckStart()

constexpr Error tmc9660::BootConfig::CheckStart ( ) const
inlineconstexprnoexcept

Check the rules that make a configuration unsafe to apply: the application must not start with a reserved BOOT_MODE, the motor-control clock must be 40 MHz and the device address odd when it starts.

Returns
Error::Ok, or Error::Refused.

◆ Get()

constexpr uint32_t tmc9660::BootConfig::Get ( BootField  field) const
inlineconstexprnoexcept

The value of a field.

Parameters
fieldWhich field.
Returns
The value; 0 for a value that is not a BootField.

◆ MaxOf()

static constexpr uint32_t tmc9660::BootConfig::MaxOf ( BootField  field)
inlinestaticconstexprnoexcept

The largest value a field holds.

Parameters
fieldWhich field.
Returns
2^width - 1; 0 for a value that is not a BootField.

◆ Set()

constexpr Error tmc9660::BootConfig::Set ( BootField  field,
uint32_t  value 
)
inlineconstexprnoexcept

Set a field.

Parameters
fieldWhich field.
valueThe new value; at most 2^width - 1.
Returns
Error::InvalidArgument (nothing changed) when field is not a field or value does not fit.

◆ SetWord()

constexpr Error tmc9660::BootConfig::SetWord ( std::size_t  index,
uint32_t  value 
)
inlineconstexprnoexcept

Replace one raw word.

Parameters
indexThe word, 0 to 15.
valueThe new word.
Returns
Ok, or InvalidArgument beyond the end.

◆ Word()

constexpr uint32_t tmc9660::BootConfig::Word ( std::size_t  index) const
inlineconstexprnoexcept

One raw word.

Parameters
indexThe word, 0 to 15.
Returns
The word as stored; 0 beyond the end.

◆ Words()

constexpr const std::array< uint32_t, kWords > & tmc9660::BootConfig::Words ( ) const
inlineconstexprnoexcept
Returns
The 16 raw words.

Friends And Related Symbol Documentation

◆ operator==

constexpr bool operator== ( const BootConfig &  lhs,
const BootConfig &  rhs 
)
friend

Equality of all words.

Parameters
lhsOne configuration.
rhsThe configuration to compare with.
Returns
true when every word is equal.

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