This commit is contained in:
rusefi 2017-08-17 02:49:07 -04:00
parent 67986f74f6
commit b9546e3596
3 changed files with 31 additions and 2 deletions

View File

@ -116,6 +116,10 @@
#define EFI_CJ125 TRUE
#if !defined(EFI_MEMS) || defined(__DOXYGEN__)
#define EFI_MEMS TRUE
#endif
#define EFI_INTERNAL_ADC TRUE
#define EFI_DENSO_ADC FALSE

View File

@ -14,10 +14,35 @@
*/
#include "mems.h"
#include "lis302dl.h"
EXTERN_ENGINE;
void initMemsPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->LIS302DLCsPin = GPIOE_3;
boardConfiguration->is_enabled_spi_1 = true;
}
#if EFI_MEMS || defined(__DOXYGEN__)
static SPIDriver *spip = &SPID1; // todo: make this configurable
static OutputPin memsCs;
void initMems(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->LIS302DLCsPin = GPIOE_3; // temporary code
memsCs.initPin("LIS302 CS", engineConfiguration->LIS302DLCsPin);
/* LIS302DL initialization.*/
lis302dlWriteRegister(spip, LIS302DL_CTRL_REG1, 0x43);
lis302dlWriteRegister(spip, LIS302DL_CTRL_REG2, 0x00);
lis302dlWriteRegister(spip, LIS302DL_CTRL_REG3, 0x00);
int8_t x = (int8_t)lis302dlReadRegister(spip, LIS302DL_OUTX);
int8_t y = (int8_t)lis302dlReadRegister(spip, LIS302DL_OUTY);
}
#endif /* EFI_MEMS */

View File

@ -9,7 +9,7 @@
#define HW_LAYER_MEMS_H_
#include "main.h"
#include "engine_configuration.h"
#include "engine.h"
void initMemsPins(DECLARE_ENGINE_PARAMETER_SIGNATURE);