steps towards smarter gpio

This commit is contained in:
rusefi 2019-04-13 11:22:40 -04:00
parent c53433801c
commit fb1dd5a3ca
7 changed files with 23 additions and 17 deletions

View File

@ -133,9 +133,6 @@
// todo: move this outside of efifeatures.h // todo: move this outside of efifeatures.h
#define BOARD_EXT_PINREPOPINS 24 #define BOARD_EXT_PINREPOPINS 24
// todo: remove this, use 'BOARD_TLE8888_COUNT'
#define EFI_TLE8888 TRUE
#define EFI_ANALOG_SENSORS TRUE #define EFI_ANALOG_SENSORS TRUE
#ifndef EFI_MAX_31855 #ifndef EFI_MAX_31855

View File

@ -14,7 +14,7 @@
#include "global.h" #include "global.h"
#if EFI_TLE8888 #if (BOARD_TLE6240_COUNT > 0)
/* to be moved to smart_gpio.cpp */ /* to be moved to smart_gpio.cpp */
#include "engine_configuration.h" #include "engine_configuration.h"
@ -597,4 +597,4 @@ void initTle8888(DECLARE_ENGINE_PARAMETER_SIGNATURE)
/*********TO BE REMOVED FROM THIS FILE ENDS***********/ /*********TO BE REMOVED FROM THIS FILE ENDS***********/
#endif /* EFI_TLE8888 */ #endif /* (BOARD_TLE6240_COUNT > 0) */

View File

@ -136,6 +136,7 @@ static void reportPins(void) {
/* here show all pins, unused too */ /* here show all pins, unused too */
if (pin_name != NULL) { if (pin_name != NULL) {
// this probably uses a lot of output buffer!
scheduleMsg(&logger, "ext %s: %s", scheduleMsg(&logger, "ext %s: %s",
pin_name, pin_user ? pin_user : "free"); pin_name, pin_user ? pin_user : "free");
} else { } else {

View File

@ -6,6 +6,8 @@
*/ */
#include "global.h" #include "global.h"
#if EFI_PROD_CODE
#include "smart_gpio.h" #include "smart_gpio.h"
#include "efi_gpio.h" #include "efi_gpio.h"
#include "engine_configuration.h" #include "engine_configuration.h"
@ -14,10 +16,9 @@
#include "drivers/gpio/mc33972.h" #include "drivers/gpio/mc33972.h"
#include "drivers/gpio/tle8888.h" #include "drivers/gpio/tle8888.h"
#if EFI_PROD_CODE
EXTERN_CONFIG; EXTERN_CONFIG;
#if (BOARD_TLE6240_COUNT > 0)
const struct tle6240_config tle6240 = { const struct tle6240_config tle6240 = {
.spi_bus = NULL /* TODO software lookup &SPID4 */, .spi_bus = NULL /* TODO software lookup &SPID4 */,
.spi_config = { .spi_config = {
@ -54,8 +55,9 @@ const struct tle6240_config tle6240 = {
}, },
.reset = {.port = GPIOG, .pad = 3} .reset = {.port = GPIOG, .pad = 3}
}; };
#endif /* (BOARD_TLE6240_COUNT > 0) */
#if (BOARD_MC33972_COUNT > 0)
const struct mc33972_config mc33972 = { const struct mc33972_config mc33972 = {
.spi_bus = NULL /* TODO software lookup &SPID4 */, .spi_bus = NULL /* TODO software lookup &SPID4 */,
.spi_config = { .spi_config = {
@ -75,8 +77,7 @@ const struct mc33972_config mc33972 = {
.cr2 = SPI_CR2_24BIT_MODE .cr2 = SPI_CR2_24BIT_MODE
}, },
}; };
#endif /* (BOARD_MC33972_COUNT > 0) */
#endif /* EFI_PROD_CODE */
void initSmartGpio() { void initSmartGpio() {
@ -85,7 +86,7 @@ void initSmartGpio() {
tle6240_add(0, &tle6240); tle6240_add(0, &tle6240);
#else #else
gpiochip_use_gpio_base(TLE6240_OUTPUTS); gpiochip_use_gpio_base(TLE6240_OUTPUTS);
#endif #endif /* (BOARD_TLE6240_COUNT > 0) */
#if (BOARD_MC33972_COUNT > 0) #if (BOARD_MC33972_COUNT > 0)
mc33972.spi_bus = getSpiDevice(engineConfiguration->mc33972spiDevice); mc33972.spi_bus = getSpiDevice(engineConfiguration->mc33972spiDevice);
@ -93,10 +94,10 @@ void initSmartGpio() {
mc33972_add(0, &mc33972); mc33972_add(0, &mc33972);
#else #else
gpiochip_use_gpio_base(MC33972_INPUTS); gpiochip_use_gpio_base(MC33972_INPUTS);
#endif #endif /* (BOARD_MC33972_COUNT > 0) */
#if EFI_TLE8888 #if (BOARD_TLE6240_COUNT > 0)
if (engineConfiguration->tle8888_cs != GPIO_UNASSIGNED) { if (engineConfiguration->tle8888_cs != GPIO_UNASSIGNED) {
static OutputPin tle8888Cs; static OutputPin tle8888Cs;
// // SPI pins are enabled in initSpiModules() // // SPI pins are enabled in initSpiModules()
@ -105,5 +106,7 @@ void initSmartGpio() {
} }
initTle8888(PASS_ENGINE_PARAMETER_SIGNATURE); initTle8888(PASS_ENGINE_PARAMETER_SIGNATURE);
#endif /* EFI_TLE8888 */ #endif /* (BOARD_TLE6240_COUNT > 0) */
} }
#endif /* EFI_PROD_CODE */

View File

@ -24,7 +24,7 @@ void initSmartGpio(void);
#endif #endif
#if EFI_TLE8888 || (BOARD_TLE6240_COUNT > 0) #if (BOARD_TLE6240_COUNT > 0)
#if defined(STM_F4_FAMILY) #if defined(STM_F4_FAMILY)
#define SPI_CR1_16BIT_MODE SPI_CR1_DFF #define SPI_CR1_16BIT_MODE SPI_CR1_DFF
@ -44,6 +44,6 @@ void initSmartGpio(void);
unexpected platform unexpected platform
#endif #endif
#endif /* EFI_TLE8888 */ #endif /* (BOARD_TLE6240_COUNT > 0) */
#endif /* HW_LAYER_SMART_GPIO_H_ */ #endif /* HW_LAYER_SMART_GPIO_H_ */

View File

@ -179,6 +179,7 @@ INCDIR = . \
$(PROJECT_DIR)/config/engines \ $(PROJECT_DIR)/config/engines \
$(PROJECT_DIR)/ext_algo \ $(PROJECT_DIR)/ext_algo \
$(PROJECT_DIR)/controllers \ $(PROJECT_DIR)/controllers \
$(HW_LAYER_DRIVERS_INC) \
$(PROJECT_DIR)/hw_layer \ $(PROJECT_DIR)/hw_layer \
$(PROJECT_DIR)/hw_layer/algo \ $(PROJECT_DIR)/hw_layer/algo \
$(HW_SENSORS_INC) \ $(HW_SENSORS_INC) \

View File

@ -79,7 +79,11 @@
#define EFI_CJ125 FALSE #define EFI_CJ125 FALSE
#define EFI_CAN_SUPPORT FALSE #define EFI_CAN_SUPPORT FALSE
#define EFI_MAX_31855 FALSE #define EFI_MAX_31855 FALSE
#define EFI_TLE8888 FALSE
#define BOARD_TLE6240_COUNT 0
#define BOARD_MC33972_COUNT 0
#define BOARD_TLE8888_COUNT 0
#define EFI_ELECTRONIC_THROTTLE_BODY FALSE #define EFI_ELECTRONIC_THROTTLE_BODY FALSE
#define EFI_AUX_PID FALSE #define EFI_AUX_PID FALSE
#define EFI_ICU_INPUTS FALSE #define EFI_ICU_INPUTS FALSE