satnogs-rotator-firmware
|
Class that functions for interacting with AS5601 magnetic rotary position sensor. More...
#include <as5601.h>
Public Member Functions | |
void | Begin () |
Initialize the I2C bus. More... | |
uint8_t | get_pos (double *new_pos) |
Calculate an unwrap the position. More... | |
uint8_t | get_agc () |
Calculate the automatic gain control (AGC) More... | |
uint16_t | get_magnitude () |
Get the magnitude value of the internal CORDIC output. More... | |
uint16_t | get_conf () |
Get the configuration register. More... | |
uint8_t | set_zero () |
Set zero by setting offset angle. More... | |
void | init_zero () |
Reset zero position set the offset to zero. More... | |
void | set_gear_ratio (uint8_t enc_ratio) |
Set the gear ratio between encoder and measure axis. More... | |
Private Member Functions | |
uint8_t | i2c_byte_transaction (uint8_t i2c_address, uint8_t i2c_register) |
uint16_t | i2c_word_transaction (uint8_t i2c_address, uint8_t i2c_register) |
Private Attributes | |
double | _angle_offset = 0 |
int32_t | _n = 0 |
float | _raw_prev_pos = 0 |
uint8_t | _enc_ratio = 0 |
Class that functions for interacting with AS5601 magnetic rotary position sensor.
|
inline |
|
inline |
Calculate the automatic gain control (AGC)
Definition at line 96 of file as5601.h.
References AGC, AS5601_ID, and i2c_byte_transaction().
|
inline |
Get the configuration register.
Definition at line 116 of file as5601.h.
References AS5601_ID, CONF_HIGH, and i2c_word_transaction().
|
inline |
Get the magnitude value of the internal CORDIC output.
Definition at line 106 of file as5601.h.
References AS5601_ID, i2c_word_transaction(), and MAGNITUDE_HIGH.
|
inline |
Calculate an unwrap the position.
new_pos | Calculate the current position of the sensor |
Definition at line 59 of file as5601.h.
References _angle_offset, _enc_ratio, _n, _raw_prev_pos, AS5601_ID, i2c_byte_transaction(), i2c_word_transaction(), RAW_ANG_HIGH, and STATUS_REG.
Referenced by homing(), loop(), and set_zero().
|
inlineprivate |
Definition at line 162 of file as5601.h.
Referenced by get_agc(), get_pos(), and i2c_word_transaction().
|
inlineprivate |
Definition at line 172 of file as5601.h.
References i2c_byte_transaction().
Referenced by get_conf(), get_magnitude(), and get_pos().
|
inline |
Reset zero position set the offset to zero.
Definition at line 141 of file as5601.h.
References _angle_offset.
Referenced by homing().
|
inline |
Set the gear ratio between encoder and measure axis.
enc_ratio | An uitn8_t, that represents the gear ratio |
Definition at line 152 of file as5601.h.
References _enc_ratio.
Referenced by setup().
|
inline |
|
private |
Definition at line 157 of file as5601.h.
Referenced by get_pos(), init_zero(), and set_zero().
|
private |
Definition at line 160 of file as5601.h.
Referenced by get_pos(), and set_gear_ratio().
|
private |