mirror of https://github.com/FOME-Tech/fome-fw.git
we need TLE8888 driver #714
This commit is contained in:
parent
e84ad495db
commit
259ff0141a
|
@ -319,6 +319,7 @@ void setTle8888TestConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
engineConfiguration->crankingInjectionMode = IM_SEQUENTIAL;
|
engineConfiguration->crankingInjectionMode = IM_SEQUENTIAL;
|
||||||
|
|
||||||
engineConfiguration->tle8888_cs = GPIOD_5;
|
engineConfiguration->tle8888_cs = GPIOD_5;
|
||||||
|
engineConfiguration->tle8888_csPinMode = OM_OPENDRAIN;
|
||||||
engineConfiguration->directSelfStimulation = true;
|
engineConfiguration->directSelfStimulation = true;
|
||||||
|
|
||||||
boardConfiguration->ignitionPins[0] = GPIOG_3;
|
boardConfiguration->ignitionPins[0] = GPIOG_3;
|
||||||
|
@ -333,6 +334,11 @@ void setTle8888TestConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
engineConfiguration->tle8888spiDevice = SPI_DEVICE_1;
|
engineConfiguration->tle8888spiDevice = SPI_DEVICE_1;
|
||||||
|
|
||||||
boardConfiguration->is_enabled_spi_1 = true;
|
boardConfiguration->is_enabled_spi_1 = true;
|
||||||
|
engineConfiguration->debugMode = DBG_TLE8888;
|
||||||
|
|
||||||
|
engineConfiguration->spi1MosiMode = PO_OPENDRAIN;
|
||||||
|
engineConfiguration->spi1MisoMode = PO_PULLUP;
|
||||||
|
engineConfiguration->spi1SckMode = PO_OPENDRAIN;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
|
|
||||||
#if EFI_TUNER_STUDIO
|
#if EFI_TUNER_STUDIO
|
||||||
#include "tunerstudio_configuration.h"
|
#include "tunerstudio_configuration.h"
|
||||||
#include "engine.h"
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int queryCommandCounter;
|
int queryCommandCounter;
|
||||||
|
|
|
@ -10,6 +10,12 @@
|
||||||
#ifndef CONTROLLERS_CORE_COMMON_HEADERS_H_
|
#ifndef CONTROLLERS_CORE_COMMON_HEADERS_H_
|
||||||
#define CONTROLLERS_CORE_COMMON_HEADERS_H_
|
#define CONTROLLERS_CORE_COMMON_HEADERS_H_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define EXTERNC extern "C"
|
||||||
|
#else
|
||||||
|
#define EXTERNC
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "efifeatures.h"
|
#include "efifeatures.h"
|
||||||
#include "rusefi_types.h"
|
#include "rusefi_types.h"
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ typedef uint8_t fatal_msg_t[200];
|
||||||
*
|
*
|
||||||
* see also warning()
|
* see also warning()
|
||||||
*/
|
*/
|
||||||
void firmwareError(obd_code_e code, const char *fmt, ...);
|
EXTERNC void firmwareError(obd_code_e code, const char *fmt, ...);
|
||||||
|
|
||||||
#define hasFirmwareError() hasFirmwareErrorFlag
|
#define hasFirmwareError() hasFirmwareErrorFlag
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,6 @@
|
||||||
#ifndef GLOBAL_H_
|
#ifndef GLOBAL_H_
|
||||||
#define GLOBAL_H_
|
#define GLOBAL_H_
|
||||||
|
|
||||||
// todo: move this magic to somewhere shared between firmware and simulator?
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#define EXTERNC extern "C"
|
|
||||||
#else
|
|
||||||
#define EXTERNC
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,6 +24,11 @@ EXTERN_CONFIG;
|
||||||
#include "gpio/tle8888.h"
|
#include "gpio/tle8888.h"
|
||||||
#include "pin_repository.h"
|
#include "pin_repository.h"
|
||||||
|
|
||||||
|
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
||||||
|
#include "tunerstudio.h"
|
||||||
|
extern TunerStudioOutputChannels tsOutputChannels;
|
||||||
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
|
|
||||||
/* TODO: move to board.h file */
|
/* TODO: move to board.h file */
|
||||||
#define BOARD_TLE8888_COUNT 1
|
#define BOARD_TLE8888_COUNT 1
|
||||||
|
|
||||||
|
@ -115,6 +120,14 @@ static int tle8888_spi_rw(struct tle8888_priv *chip, uint16_t tx, uint16_t *rx)
|
||||||
/* Ownership release. */
|
/* Ownership release. */
|
||||||
spiReleaseBus(spi);
|
spiReleaseBus(spi);
|
||||||
|
|
||||||
|
#if EFI_TUNER_STUDIO || defined(__DOXYGEN__)
|
||||||
|
if (engineConfiguration->debugMode == DBG_TLE8888) {
|
||||||
|
tsOutputChannels.debugIntField1++;
|
||||||
|
tsOutputChannels.debugIntField2 = tx;
|
||||||
|
tsOutputChannels.debugIntField3 = rxb;
|
||||||
|
}
|
||||||
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
|
|
||||||
if (rx)
|
if (rx)
|
||||||
*rx = rxb;
|
*rx = rxb;
|
||||||
|
|
||||||
|
@ -138,14 +151,16 @@ static int tle8888_spi_rw(struct tle8888_priv *chip, uint16_t tx, uint16_t *rx)
|
||||||
int tle8888_chip_init(void * data)
|
int tle8888_chip_init(void * data)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int ret;
|
|
||||||
struct tle8888_priv *chip = (struct tle8888_priv *)data;
|
struct tle8888_priv *chip = (struct tle8888_priv *)data;
|
||||||
const struct tle8888_config *cfg = chip->cfg;
|
const struct tle8888_config *cfg = chip->cfg;
|
||||||
|
efiAssert(OBD_PCM_Processor_Fault, cfg != NULL, "8888CFG", 0)
|
||||||
uint8_t dd[4] = {0, 0, 0, 0};
|
uint8_t dd[4] = {0, 0, 0, 0};
|
||||||
uint8_t oe[4] = {0, 0, 0, 0};
|
uint8_t oe[4] = {0, 0, 0, 0};
|
||||||
|
|
||||||
|
int ret = 0;
|
||||||
/* mark pins used */
|
/* mark pins used */
|
||||||
ret = markUsed(cfg->spi_config.ssport, cfg->spi_config.sspad, DRIVER_NAME " CS");
|
// we do not initialize CS pin so we should not be marking it used
|
||||||
|
// ret = markUsed(cfg->spi_config.ssport, cfg->spi_config.sspad, DRIVER_NAME " CS");
|
||||||
if (cfg->reset.port != NULL)
|
if (cfg->reset.port != NULL)
|
||||||
ret |= markUsed(cfg->reset.port, cfg->reset.pad, DRIVER_NAME " RST");
|
ret |= markUsed(cfg->reset.port, cfg->reset.pad, DRIVER_NAME " RST");
|
||||||
/*
|
/*
|
||||||
|
@ -247,6 +262,7 @@ int tle8888_add(unsigned int index, const struct tle8888_config *cfg)
|
||||||
/* already initted? */
|
/* already initted? */
|
||||||
if (chip->cfg != NULL)
|
if (chip->cfg != NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
chip->cfg = cfg;
|
||||||
|
|
||||||
/* TODO: remove this when gpiochips integrated */
|
/* TODO: remove this when gpiochips integrated */
|
||||||
return tle8888_chip_init(chip);
|
return tle8888_chip_init(chip);
|
||||||
|
|
|
@ -10,13 +10,6 @@
|
||||||
#ifndef GLOBAL_H_
|
#ifndef GLOBAL_H_
|
||||||
#define GLOBAL_H_
|
#define GLOBAL_H_
|
||||||
|
|
||||||
// todo: move this magic to somewhere shared between firmware and simulator?
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#define EXTERNC extern "C"
|
|
||||||
#else
|
|
||||||
#define EXTERNC
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <ch.h>
|
#include <ch.h>
|
||||||
#include <hal.h>
|
#include <hal.h>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue