tle8888: on MRE 0.5.0 we can drive ING_EN and INJ_EN from STM (#1407)
Do it!
This commit is contained in:
parent
62e95ad799
commit
d0d5cdd4dd
|
@ -850,6 +850,8 @@ static brain_pin_diag_e tle8888_getDiag(void *data, unsigned int pin)
|
||||||
* @return 0 for valid configuration, -1 for invalid configuration
|
* @return 0 for valid configuration, -1 for invalid configuration
|
||||||
*/
|
*/
|
||||||
int tle8888SpiStartupExchange(struct tle8888_priv *chip) {
|
int tle8888SpiStartupExchange(struct tle8888_priv *chip) {
|
||||||
|
const struct tle8888_config *cfg = chip->cfg;
|
||||||
|
|
||||||
tle8888reinitializationCounter++;
|
tle8888reinitializationCounter++;
|
||||||
tle8888initResponsesAccumulator = 0;
|
tle8888initResponsesAccumulator = 0;
|
||||||
|
|
||||||
|
@ -882,6 +884,12 @@ int tle8888SpiStartupExchange(struct tle8888_priv *chip) {
|
||||||
|
|
||||||
startupConfiguration(chip);
|
startupConfiguration(chip);
|
||||||
|
|
||||||
|
/* enable pins */
|
||||||
|
if (cfg->ign_en.port)
|
||||||
|
palSetPort(cfg->ign_en.port, PAL_PORT_BIT(cfg->ign_en.pad));
|
||||||
|
if (cfg->inj_en.port)
|
||||||
|
palSetPort(cfg->inj_en.port, PAL_PORT_BIT(cfg->inj_en.pad));
|
||||||
|
|
||||||
if (CONFIG(verboseTLE8888)) {
|
if (CONFIG(verboseTLE8888)) {
|
||||||
tle8888_dump_regs();
|
tle8888_dump_regs();
|
||||||
}
|
}
|
||||||
|
@ -899,6 +907,10 @@ static int tle8888_chip_init(void * data) {
|
||||||
//ret = gpio_pin_markUsed(cfg->spi_config.ssport, cfg->spi_config.sspad, DRIVER_NAME " CS");
|
//ret = gpio_pin_markUsed(cfg->spi_config.ssport, cfg->spi_config.sspad, DRIVER_NAME " CS");
|
||||||
if (cfg->reset.port != NULL)
|
if (cfg->reset.port != NULL)
|
||||||
ret |= gpio_pin_markUsed(cfg->reset.port, cfg->reset.pad, DRIVER_NAME " RST");
|
ret |= gpio_pin_markUsed(cfg->reset.port, cfg->reset.pad, DRIVER_NAME " RST");
|
||||||
|
if (cfg->ign_en.port != NULL)
|
||||||
|
ret |= gpio_pin_markUsed(cfg->ign_en.port, cfg->ign_en.pad, DRIVER_NAME " IGN EN");
|
||||||
|
if (cfg->inj_en.port != NULL)
|
||||||
|
ret |= gpio_pin_markUsed(cfg->inj_en.port, cfg->inj_en.pad, DRIVER_NAME " INJ EN");
|
||||||
for (int i = 0; i < TLE8888_DIRECT_MISC; i++)
|
for (int i = 0; i < TLE8888_DIRECT_MISC; i++)
|
||||||
if (cfg->direct_io[i].port)
|
if (cfg->direct_io[i].port)
|
||||||
ret |= gpio_pin_markUsed(cfg->direct_io[i].port, cfg->direct_io[i].pad, DRIVER_NAME " DIRECT IO");
|
ret |= gpio_pin_markUsed(cfg->direct_io[i].port, cfg->direct_io[i].pad, DRIVER_NAME " DIRECT IO");
|
||||||
|
@ -912,6 +924,10 @@ static int tle8888_chip_init(void * data) {
|
||||||
err_gpios:
|
err_gpios:
|
||||||
/* unmark pins */
|
/* unmark pins */
|
||||||
//gpio_pin_markUnused(cfg->spi_config.ssport, cfg->spi_config.sspad);
|
//gpio_pin_markUnused(cfg->spi_config.ssport, cfg->spi_config.sspad);
|
||||||
|
if (cfg->inj_en.port != NULL)
|
||||||
|
gpio_pin_markUnused(cfg->inj_en.port, cfg->inj_en.pad);
|
||||||
|
if (cfg->ign_en.port != NULL)
|
||||||
|
gpio_pin_markUnused(cfg->ign_en.port, cfg->ign_en.pad);
|
||||||
if (cfg->reset.port != NULL)
|
if (cfg->reset.port != NULL)
|
||||||
gpio_pin_markUnused(cfg->reset.port, cfg->reset.pad);
|
gpio_pin_markUnused(cfg->reset.port, cfg->reset.pad);
|
||||||
for (int i = 0; i < TLE8888_DIRECT_MISC; i++)
|
for (int i = 0; i < TLE8888_DIRECT_MISC; i++)
|
||||||
|
@ -958,9 +974,16 @@ static int tle8888_init(void * data)
|
||||||
|
|
||||||
static int tle8888_deinit(void *data)
|
static int tle8888_deinit(void *data)
|
||||||
{
|
{
|
||||||
(void)data;
|
struct tle8888_priv *chip = (struct tle8888_priv *)data;
|
||||||
|
const struct tle8888_config *cfg = chip->cfg;
|
||||||
|
|
||||||
/* TODO: set all pins to inactive state, stop task? */
|
/* disable pins */
|
||||||
|
if (cfg->ign_en.port)
|
||||||
|
palClearPort(cfg->ign_en.port, PAL_PORT_BIT(cfg->ign_en.pad));
|
||||||
|
if (cfg->inj_en.port)
|
||||||
|
palClearPort(cfg->inj_en.port, PAL_PORT_BIT(cfg->inj_en.pad));
|
||||||
|
|
||||||
|
/* TODO: stop task? */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,14 @@ struct tle8888_config {
|
||||||
/* ...used to drive output (starts from 1, as in DS, coders gonna hate) */
|
/* ...used to drive output (starts from 1, as in DS, coders gonna hate) */
|
||||||
int output;
|
int output;
|
||||||
} direct_io[TLE8888_DIRECT_MISC];
|
} direct_io[TLE8888_DIRECT_MISC];
|
||||||
|
struct {
|
||||||
|
ioportid_t port;
|
||||||
|
uint_fast8_t pad;
|
||||||
|
} ign_en;
|
||||||
|
struct {
|
||||||
|
ioportid_t port;
|
||||||
|
uint_fast8_t pad;
|
||||||
|
} inj_en;
|
||||||
tle8888_mode_e mode;
|
tle8888_mode_e mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -131,6 +131,8 @@ struct tle8888_config tle8888_cfg = {
|
||||||
[3] = {.port = NULL, .pad = 0, .output = 12},
|
[3] = {.port = NULL, .pad = 0, .output = 12},
|
||||||
*/
|
*/
|
||||||
},
|
},
|
||||||
|
.ign_en = {.port = GPIOD, .pad = 10},
|
||||||
|
.inj_en = {.port = GPIOD, .pad = 11},
|
||||||
.mode = TL_AUTO,
|
.mode = TL_AUTO,
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue