Hall mode for TLE88888 - VRSConfig1 VRSM #915
This commit is contained in:
parent
40ed41c387
commit
df18a37788
|
@ -85,6 +85,7 @@ typedef enum {
|
||||||
#define CMD_LOCK CMD_WR(0x1e, 0x02)
|
#define CMD_LOCK CMD_WR(0x1e, 0x02)
|
||||||
*/
|
*/
|
||||||
#define CMD_UNLOCK CMD_WR(0x1e, 0x01)
|
#define CMD_UNLOCK CMD_WR(0x1e, 0x01)
|
||||||
|
#define CMD_HALL_MODE CMD_WR(0x4a, 0x3 << 2)
|
||||||
#define CMD_INCONFIG(n, d) CMD_WR(0x53 + (n & 0x03), d)
|
#define CMD_INCONFIG(n, d) CMD_WR(0x53 + (n & 0x03), d)
|
||||||
#define CMD_DDCONFIG(n, d) CMD_WR(0x57 + (n & 0x03), d)
|
#define CMD_DDCONFIG(n, d) CMD_WR(0x57 + (n & 0x03), d)
|
||||||
#define CMD_OECONFIG(n, d) CMD_WR(0x5b + (n & 0x03), d)
|
#define CMD_OECONFIG(n, d) CMD_WR(0x5b + (n & 0x03), d)
|
||||||
|
@ -451,6 +452,15 @@ int tle8888SpiStartupExchange(void * data) {
|
||||||
|
|
||||||
/* enable outputs */
|
/* enable outputs */
|
||||||
tle8888_spi_rw(chip, CMD_OE_SET, NULL);
|
tle8888_spi_rw(chip, CMD_OE_SET, NULL);
|
||||||
|
|
||||||
|
if (cfg->hallMode) {
|
||||||
|
/**
|
||||||
|
* By default "auto detection mode for VR sensor signals" is used
|
||||||
|
* We know that for short Hall signals like Miata NB2 crank sensor this does not work well above certain RPM.
|
||||||
|
*/
|
||||||
|
tle8888_spi_rw(chip, CMD_HALL_MODE, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* tle8888.h
|
* @file tle8888.h
|
||||||
*
|
*
|
||||||
* Created on: Mar 25, 2019
|
* Mar 25, 2019
|
||||||
* Author: garage
|
* @author Andrey Belomutskiy, (c) 2012-2019
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HW_LAYER_DRIVERS_GPIO_TLE8888_H_
|
#ifndef HW_LAYER_DRIVERS_GPIO_TLE8888_H_
|
||||||
|
@ -39,6 +39,7 @@ struct tle8888_config {
|
||||||
/* ...used to drive output (starts from 1, as in DS, coders gonna hate) */
|
/* ...used to drive output (starts from 1, as in DS, coders gonna hate) */
|
||||||
int output;
|
int output;
|
||||||
} direct_io[TLE8888_DIRECT_MISC];
|
} direct_io[TLE8888_DIRECT_MISC];
|
||||||
|
bool hallMode;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -179,6 +179,8 @@ void initSmartGpio() {
|
||||||
tle8888_cfg.spi_config.sspad = getHwPin("tle8888 CS", engineConfiguration->tle8888_cs);
|
tle8888_cfg.spi_config.sspad = getHwPin("tle8888 CS", engineConfiguration->tle8888_cs);
|
||||||
tle8888_cfg.spi_bus = getSpiDevice(engineConfiguration->tle8888spiDevice);
|
tle8888_cfg.spi_bus = getSpiDevice(engineConfiguration->tle8888spiDevice);
|
||||||
|
|
||||||
|
tle8888_cfg.hallMode = engineConfiguration->useTLE8888_hall_mode;
|
||||||
|
|
||||||
/* spi_bus == null checked in _add function */
|
/* spi_bus == null checked in _add function */
|
||||||
ret = tle8888_add(0, &tle8888_cfg);
|
ret = tle8888_add(0, &tle8888_cfg);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue