Merge pull request #7 from WallyWalrick/AEAT

AEAT-8800
This commit is contained in:
Paul Guenette
2019-10-26 14:03:27 -04:00
committed by GitHub
3 changed files with 11 additions and 3 deletions
+9 -3
View File
@@ -339,7 +339,9 @@ bool Encoder::abs_spi_init() {
spi->Init.TIMode = SPI_TIMODE_DISABLE;
spi->Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
spi->Init.CRCPolynomial = 10;
if (config_.mode == MODE_SPI_ABS_AEAT) {
spi->Init.CLKPolarity = SPI_POLARITY_HIGH;
}
HAL_SPI_DeInit(spi);
HAL_SPI_Init(spi);
//stash our configuration
@@ -390,7 +392,10 @@ void Encoder::abs_spi_cb() {
abs_spi_pos_updated_ = true;
}
} break;
case MODE_SPI_ABS_AEAT: {
pos_abs_ = abs_spi_dma_rx_[0];
abs_spi_pos_updated_ = true;
} break;
default: {
set_error(ERROR_UNSUPPORTED_ENCODER_MODE);
} break;
@@ -455,7 +460,8 @@ bool Encoder::update() {
} break;
case MODE_SPI_ABS_AMS:
case MODE_SPI_ABS_CUI: {
case MODE_SPI_ABS_CUI:
case MODE_SPI_ABS_AEAT: {
if (abs_spi_pos_updated_ == false && abs_spi_pos_init_once_) {
// Low pass filter the error
spi_error_rate_ += current_meas_period * (1.0f - spi_error_rate_);
+1
View File
@@ -26,6 +26,7 @@ class Encoder {
MODE_SINCOS,
MODE_SPI_ABS_CUI = 0x100,
MODE_SPI_ABS_AMS = 0x101,
MODE_SPI_ABS_AEAT = 0x102,
};
const uint32_t MODE_FLAG_ABS = 0x100;
+1
View File
@@ -84,3 +84,4 @@ ENCODER_MODE_HALL = 0x01
ENCODER_MODE_SINCOS = 0x02
ENCODER_MODE_SPI_ABS_CUI = 0x100
ENCODER_MODE_SPI_ABS_AMS = 0x101
ENCODER_MODE_SPI_ABS_AEAT = 0x102