Reads the block of _registers from addresses 08 - 0F in order to figure out the CRC. ATTENTION: You need a memory chunk of unit16_t * CRC Registers + 1 * uint16_t for the safety word.
General read function for reading _registers from the Tle5012b.
structure of command word, the numbers represent the bit position of the 2 byte command 15 - 0 write, 1 read 14:11 - 0000 for default operational access for addresses between 0x00 - 0x04, 1010 for configuration access for addresses between 0x05 - 0x11 10 - 0 access to current value, 1 access to value in update buffer 9:4 - access to 6 bit register address 3:0 - 4 bit number of data words.
Parameters:
command – [in] the command for reading
data – [out] where the data received from the _registers will be stored
upd – [in] read from update (UPD_high) register or directly (default, UPD_low)
safe – [in] generate safety word (default, SAFE_high) or not (SAFE_low)
Can be used to read 1 or more consecutive _registers, and the values used to read 1 or more than 1 consecutive _registers. The maximum amount of registers are limited by the bit 3-0 of the command word, which means you can read max 15 registers and one safety word at once.
Parameters:
command – [in] the command for reading
data – [out] where the data received from the _registers will be stored
upd – [in] read from update (UPD_high) register or directly (default, UPD_low)
safe – [in] generate safety word (default, SAFE_high) or no (SAFE_low)
Returns the number of revolutions done from the angle value which is a 9 bit signed integer. However, the register returns 16 bits, so we need to do some bit arithmetic. Therefore the resulting revolution can b only between -256 < numRev < 256 and it will switch from positive to negative and vice versa values at the borders.
Parameters:
numRev – [inout] pointer to 16bit word for the number of revolutions
upd – [in] read from update (UPD_high) register or directly (default, UPD_low)
safe – [in] generate safety word (default, SAFE_high) or no (SAFE_low)
Returns the calculated angle speed. The angle speed is a 15 bit signed integer, however, the register returns 16 bits, so we need to do some bit arithmetic.
Parameters:
angleSpeed – [inout] pointer to 16bit double value
General write function for writing registers to the Tle5012b. The safety flag will be set always and only some of all registers are writable. See documentation for further information.
Parameters:
command – [in] the command to execute the write
dataToWrite – [in] the new data that will be written to the register
changeCRC – [in] the registerIndex helps figure out in which register the value changed, so that we don’t need to read all the register again to calculate the CRC
Functions switches between all possible interface types. ATTENTION: The different interfaces support not always all values, see documentation for the ability of each interface. If you want to be save, than choose the default SSC interface which always supports all possible parameter.
Function set the sensors calibration mode. Keep in mind, not all Sensor interface setups have the auto calibration switched on, so maybe you have to set it explicitly.
Offset for the slave number register to identify the right selected slave. Max 4 slaves with separated CSQ lines are possible. If more than one sensor is used on the SPI interface, than the SNR register must we written with the correct slave number
The next functions are used primarily for storing the parameters and control of how the sensor works. The values stored in them are used to calculate the CRC, and their values are stored in the private component of the class, _registers.
Parameters:
data – [out] where the data received from the _registers will be stored