Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
rusefi committed Aug 17, 2017
1 parent b9546e3 commit d8fca11
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions firmware/controllers/algo/engine_configuration.cpp
Expand Up @@ -43,6 +43,8 @@
#include "HIP9011.h"
#endif

#include "mems.h"

#include "custom_engine.h"
#include "engine_template.h"
#include "acura_rsx.h"
Expand Down Expand Up @@ -933,6 +935,11 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
boardConfiguration->spi1misoPin = GPIOB_4;
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->spi2misoPin = GPIOB_14;
boardConfiguration->spi2sckPin = GPIOB_13;
Expand Down
8 changes: 7 additions & 1 deletion firmware/hw_layer/mems.cpp
Expand Up @@ -15,6 +15,7 @@

#include "mems.h"
#include "lis302dl.h"
#include "hardware.h"

EXTERN_ENGINE;

Expand All @@ -26,11 +27,16 @@ void initMemsPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#if EFI_MEMS || defined(__DOXYGEN__)

static SPIDriver *spip = &SPID1; // todo: make this configurable
static spi_device_e device = SPI_DEVICE_1;
static OutputPin memsCs;

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);

Expand Down

0 comments on commit d8fca11

Please sign in to comment.