SlaveRegisters.cpp
Go to the documentation of this file.
1 #include "SlaveRegisters.h"
2 
4 {
5  std::size_t
7  {
8  static constexpr std::size_t byteSize = 8;
9  std::size_t bitLength = datatypes::registerMap.at(reg).bitLength;
10  if (bitLength < byteSize)
11  {
12  bitLength = byteSize;
13  }
14  return bitLength / byteSize;
15  }
16 
17 } // namespace armarx::control::ethercat
armarx::control::ethercat::getRegisterByteLength
std::size_t getRegisterByteLength(datatypes::RegisterEnum reg)
Get the length of a register in bytes, rounded up.
Definition: SlaveRegisters.cpp:6
armarx::control::ethercat::datatypes::registerMap
const std::unordered_map< RegisterEnum, RegisterInfo > registerMap
Holds additional information on all defined registers.
Definition: SlaveRegisters.h:182
armarx::control::ethercat::datatypes::RegisterEnum
RegisterEnum
The RegisterEnum enum encodes the slave registers that every slave offers.
Definition: SlaveRegisters.h:37
SlaveRegisters.h
armarx::control::ethercat
Definition: Bus.cpp:24
armarx::control::ethercat::datatypes::EtherCATDataType::bitLength
constexpr int bitLength
Defines the length of the various EtherCATDataTypes in bits.
Definition: EtherCATDataTypes.h:104