Tle8888 stepper (#1936)

* TLE8888: enable PP mode for OUT21..24 in case of useTLE8888_stepper

* Lada Kalina is a test mule for stepper idle
This commit is contained in:
Andrey G 2020-11-10 22:16:46 +03:00 committed by GitHub
parent fcf09c3bd6
commit 2f891cc23a
4 changed files with 10 additions and 3 deletions

View File

@ -28,6 +28,7 @@ void setLadaKalina(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->useStepperIdle = true;
engineConfiguration->useHbridges = true;
engineConfiguration->idleMode = IM_AUTO;
engineConfiguration->useTLE8888_stepper = true;
}
#else

View File

@ -1130,9 +1130,10 @@ static int tle8888_chip_init_data(void * data) {
}
}
/* HACK HERE if you want to enable PP for OUT21..OUT24
* without approprirate call to setPinMode */
//chip->o_pp_mask |= BIT(20) | BIT(21) | BIT(22) | BIT(23);
/* Enable Push-Pull mode for OUT21..OUT24 */
if (cfg->stepper) {
chip->o_pp_mask |= BIT(20) | BIT(21) | BIT(22) | BIT(23);
}
/* enable all direct driven */
chip->o_oe_mask |= chip->o_direct_mask;

View File

@ -65,6 +65,9 @@ struct tle8888_config {
uint_fast8_t pad;
} inj_en;
tle8888_mode_e mode;
/* this is workaround to enable PP mode for OUT21..OUT24
* until users won't call setPinMode */
bool stepper;
};
#ifdef __cplusplus

View File

@ -149,6 +149,7 @@ struct tle8888_config tle8888_cfg = {
.ign_en = {.port = GPIOD, .pad = 10},
.inj_en = {.port = GPIOD, .pad = 11},
.mode = TL_AUTO,
.stepper = false
};
#endif
@ -220,6 +221,7 @@ void initSmartGpio() {
tle8888_cfg.spi_bus = getSpiDevice(engineConfiguration->tle8888spiDevice);
tle8888_cfg.mode = engineConfiguration->tle8888mode;
tle8888_cfg.stepper = engineConfiguration->useTLE8888_stepper;
/* spi_bus == null checked in _add function */
ret = tle8888_add(0, &tle8888_cfg);