we need TLE8888 driver #714

This commit is contained in:
rusefi 2019-04-04 23:03:32 -04:00
parent 4ed4fb9483
commit 0aac3c8f41
7 changed files with 31 additions and 18 deletions

View File

@ -319,6 +319,7 @@ void setTle8888TestConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->crankingInjectionMode = IM_SEQUENTIAL;
engineConfiguration->tle8888_cs = GPIOD_5;
engineConfiguration->tle8888_csPinMode = OM_OPENDRAIN;
engineConfiguration->directSelfStimulation = true;
boardConfiguration->ignitionPins[0] = GPIOG_3;
@ -333,6 +334,11 @@ void setTle8888TestConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->tle8888spiDevice = SPI_DEVICE_1;
boardConfiguration->is_enabled_spi_1 = true;
engineConfiguration->debugMode = DBG_TLE8888;
engineConfiguration->spi1MosiMode = PO_OPENDRAIN;
engineConfiguration->spi1MisoMode = PO_PULLUP;
engineConfiguration->spi1SckMode = PO_OPENDRAIN;
}

View File

@ -13,7 +13,6 @@
#if EFI_TUNER_STUDIO
#include "tunerstudio_configuration.h"
#include "engine.h"
typedef struct {
int queryCommandCounter;

View File

@ -10,6 +10,12 @@
#ifndef 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 "rusefi_types.h"

View File

@ -31,7 +31,7 @@ typedef uint8_t fatal_msg_t[200];
*
* 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

View File

@ -15,13 +15,6 @@
#ifndef 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
extern "C"
{

View File

@ -24,6 +24,11 @@ EXTERN_CONFIG;
#include "gpio/tle8888.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 */
#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. */
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)
*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 i;
int ret;
struct tle8888_priv *chip = (struct tle8888_priv *)data;
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 oe[4] = {0, 0, 0, 0};
int ret = 0;
/* 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)
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? */
if (chip->cfg != NULL)
return -1;
chip->cfg = cfg;
/* TODO: remove this when gpiochips integrated */
return tle8888_chip_init(chip);

View File

@ -10,13 +10,6 @@
#ifndef 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 <hal.h>