This commit is contained in:
rusefi 2017-08-17 02:56:25 -04:00
parent 8a0e0ff1b3
commit 52544462ec
2 changed files with 14 additions and 1 deletions

View File

@ -43,6 +43,8 @@
#include "HIP9011.h" #include "HIP9011.h"
#endif #endif
#include "mems.h"
#include "custom_engine.h" #include "custom_engine.h"
#include "engine_template.h" #include "engine_template.h"
#include "acura_rsx.h" #include "acura_rsx.h"
@ -933,6 +935,11 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
boardConfiguration->spi1misoPin = GPIOB_4; boardConfiguration->spi1misoPin = GPIOB_4;
boardConfiguration->spi1sckPin = GPIOB_3; // please note that this pin is also SWO/SWD - Single Wire debug Output boardConfiguration->spi1sckPin = GPIOB_3; // please note that this pin is also SWO/SWD - Single Wire debug Output
#if EFI_MEMS || defined(__DOXYGEN__)
// this would override some values from above
initMemsPins(PASS_ENGINE_PARAMETER_SIGNATURE);
#endif
boardConfiguration->spi2mosiPin = GPIOB_15; boardConfiguration->spi2mosiPin = GPIOB_15;
boardConfiguration->spi2misoPin = GPIOB_14; boardConfiguration->spi2misoPin = GPIOB_14;
boardConfiguration->spi2sckPin = GPIOB_13; boardConfiguration->spi2sckPin = GPIOB_13;

View File

@ -15,6 +15,7 @@
#include "mems.h" #include "mems.h"
#include "lis302dl.h" #include "lis302dl.h"
#include "hardware.h"
EXTERN_ENGINE; EXTERN_ENGINE;
@ -26,11 +27,16 @@ void initMemsPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#if EFI_MEMS || defined(__DOXYGEN__) #if EFI_MEMS || defined(__DOXYGEN__)
static SPIDriver *spip = &SPID1; // todo: make this configurable static SPIDriver *spip = &SPID1; // todo: make this configurable
static spi_device_e device = SPI_DEVICE_1;
static OutputPin memsCs; static OutputPin memsCs;
void initMems(DECLARE_ENGINE_PARAMETER_SIGNATURE) { void initMems(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (engineConfiguration->LIS302DLCsPin == GPIOA_0)
return; // temporary code to handle old configurations
if (engineConfiguration->LIS302DLCsPin == GPIO_UNASSIGNED)
return; // not used
engineConfiguration->LIS302DLCsPin = GPIOE_3; // temporary code turnOnSpi(device);
memsCs.initPin("LIS302 CS", engineConfiguration->LIS302DLCsPin); memsCs.initPin("LIS302 CS", engineConfiguration->LIS302DLCsPin);