only:alphax-4k-gdi
This commit is contained in:
rusefi 2024-08-11 12:34:12 -04:00
parent b6aa1f23f5
commit 24d87f7a27
4 changed files with 15 additions and 9 deletions

View File

@ -106,6 +106,8 @@ static const tle9104_config tle9104_cfg[BOARD_TLE9104_COUNT] = {
csDcAux.initPin("cs-dc-aux", Gpio::H144_GP_IO6); csDcAux.initPin("cs-dc-aux", Gpio::H144_GP_IO6);
csDcAux.setValue(1); csDcAux.setValue(1);
} }
initAll9104(tle9104_cfg);
} }
static Gpio OUTPUTS[] = { static Gpio OUTPUTS[] = {

View File

@ -143,15 +143,7 @@ static void board_init_ext_gpios() {
TleEn.setValue(1); TleEn.setValue(1);
} }
int ret = tle9104_add(Gpio::TLE9104_0_OUT_0, 0, &tle9104_cfg[0]); initAll9104(tle9104_cfg);
if (ret < 0) {
/* error */
}
ret = tle9104_add(Gpio::TLE9104_1_OUT_0, 1, &tle9104_cfg[1]);
if (ret < 0) {
/* error */
}
} }
/** /**

View File

@ -4,6 +4,8 @@
#if defined(BOARD_TLE9104_COUNT) && BOARD_TLE9104_COUNT > 0 #if defined(BOARD_TLE9104_COUNT) && BOARD_TLE9104_COUNT > 0
#define TLE9204_OUT_COUNT 4
/* /*
* TODO list: * TODO list:
* - support driving outputs over SPI * - support driving outputs over SPI
@ -551,6 +553,15 @@ int tle9104_add(Gpio base, int index, const tle9104_config* cfg) {
return gpiochip_register(base, DRIVER_NAME, chip, 4); return gpiochip_register(base, DRIVER_NAME, chip, 4);
} }
void initAll9104(const tle9104_config *configs) {
for (int chipIndex = 0;chipIndex < BOARD_TLE9104_COUNT;chipIndex++) {
int ret = tle9104_add((Gpio)(Gpio::TLE9104_0_OUT_0 + TLE9204_OUT_COUNT * chipIndex), chipIndex, &configs[chipIndex]);
if (ret < 0) {
criticalError("tle9104_add");
}
}
}
#else // BOARD_TLE9104_COUNT > 0 #else // BOARD_TLE9104_COUNT > 0
int tle9104_add(Gpio, int, const tle9104_config*) { int tle9104_add(Gpio, int, const tle9104_config*) {

View File

@ -20,6 +20,7 @@ struct tle9104_config {
Gpio en; Gpio en;
}; };
void initAll9104(const tle9104_config *configs);
int tle9104_add(Gpio base, int index, const tle9104_config* cfg); int tle9104_add(Gpio base, int index, const tle9104_config* cfg);
// This example config worked on the bench! // This example config worked on the bench!