mirror of https://github.com/rusefi/bldc.git
As5047 encoder fixes
This commit is contained in:
parent
18a683fc7d
commit
5609b31d42
|
@ -147,6 +147,11 @@ void enc_as504x_routine(AS504x_config_t *cfg) {
|
|||
}
|
||||
}
|
||||
|
||||
float enc_as504x_read_angle(AS504x_config_t *cfg) {
|
||||
enc_as504x_routine(cfg);
|
||||
return cfg->state.last_enc_angle;
|
||||
}
|
||||
|
||||
static void long_delay(void) {
|
||||
for (volatile int i = 0; i < 40; i++) {
|
||||
__NOP();
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
bool enc_as504x_init(AS504x_config_t *AS504x_config);
|
||||
void enc_as504x_deinit(AS504x_config_t *cfg);
|
||||
void enc_as504x_routine(AS504x_config_t *cfg);
|
||||
float enc_as504x_read_angle(AS504x_config_t *cfg);
|
||||
|
||||
// Macros
|
||||
#define AS504x_LAST_ANGLE(cfg) ((cfg)->state.last_enc_angle)
|
||||
|
|
|
@ -39,8 +39,8 @@ AS504x_config_t encoder_cfg_as504x = {
|
|||
{
|
||||
HW_HALL_ENC_GPIO3, HW_HALL_ENC_PIN3,
|
||||
HW_HALL_ENC_GPIO1, HW_HALL_ENC_PIN1,
|
||||
#if defined(HW_SPI_PORT_MOSI) && AS504x_USE_SW_MOSI_PIN
|
||||
HW_SPI_PORT_MOSI, HW_SPI_PIN_MOSI,
|
||||
#ifdef AS504x_MOSI_GPIO
|
||||
AS504x_MOSI_GPIO, AS504x_MOSI_PIN,
|
||||
#else
|
||||
0, 0,
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue