we need TLE8888 driver #714

This commit is contained in:
rusefi 2019-03-25 20:30:36 -04:00
parent fb860c37cb
commit 1f81aa169a
8 changed files with 51 additions and 14 deletions

View File

@ -1,4 +1,4 @@
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon Mar 25 14:42:37 EDT 2019
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon Mar 25 20:15:52 EDT 2019
// begin
#ifndef ENGINE_CONFIGURATION_GENERATED_H_
#define ENGINE_CONFIGURATION_GENERATED_H_
@ -2218,7 +2218,11 @@ typedef struct {
/**
* offset 3130
*/
uint8_t unusedTest55[2];
pin_output_mode_e tle8888_csPinMode;
/**
* offset 3131
*/
uint8_t unusedTest55;
/**
* Optional timing advance table for Cranking (see useSeparateAdvanceForCranking)
* offset 3132
@ -2615,4 +2619,4 @@ typedef struct {
#endif
// end
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon Mar 25 14:42:37 EDT 2019
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon Mar 25 20:15:52 EDT 2019

View File

@ -1584,8 +1584,10 @@
#define stepperEnablePin_offset_hex c38
#define tle8888_cs_offset 3129
#define tle8888_cs_offset_hex c39
#define unusedTest55_offset 3130
#define unusedTest55_offset_hex c3a
#define tle8888_csPinMode_offset 3130
#define tle8888_csPinMode_offset_hex c3a
#define unusedTest55_offset 3131
#define unusedTest55_offset_hex c3b
#define crankingAdvanceBins_offset 3132
#define crankingAdvanceBins_offset_hex c3c
#define crankingAdvance_offset 3148

View File

@ -778,5 +778,5 @@ int getRusEfiVersion(void) {
if (initBootloader() != 0)
return 123;
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
return 20190312;
return 20190324;
}

View File

@ -1,10 +1,16 @@
/**
*
* TLE8888 driver
*
* at the moment only Enable Outputs is implemented - this command is needed to get parallel control pins
*
* @date Mar 25, 2019
* @author Andrey Belomutskiy, (c) 2012-2019
*/
#include "engine.h"
#include "tle8888.h"
#include "hardware.h"
/**
* 15.2 SPI Frame Definition
@ -12,7 +18,7 @@
*/
#define Cmd_write_access 1
#define CmdOE 0x1C
#define DATA_OE_ENABLE 00000010b
#define DATA_OE_ENABLE 0b00000010
static unsigned char tx_buff[2];
@ -20,11 +26,31 @@ EXTERN_ENGINE;
static SPIDriver *driver;
static SPIConfig spiConfig;
static OutputPin tle8888Cs;
static SPIConfig spiConfig = { NULL,
/* HW dependent part.*/
NULL, 0, SPI_CR1_MSTR | SPI_CR1_CPHA | SPI_CR1_BR_0 | SPI_CR1_BR_1 | SPI_CR1_BR_2 };
void initTle8888(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (engineConfiguration->tle8888_cs == GPIO_UNASSIGNED) {
return;
}
tle8888Cs.initPin("tle8888 CS", engineConfiguration->tle8888_cs,
&engineConfiguration->tle8888_csPinMode);
//spiConfig.cr1 = SPI_BaudRatePrescaler_8;
driver = getSpiDevice(engineConfiguration->tle8888spiDevice);
spiConfig.ssport = getHwPort("tle8888", engineConfiguration->tle8888_cs);
spiConfig.sspad = getHwPin("tle8888", engineConfiguration->tle8888_cs);
spiStart(driver, &spiConfig);
tx_buff[0] = Cmd_write_access + CmdOE;
tx_buff[1] = DATA_OE_ENABLE;
// todo: extract 'sendSync' method?
spiSelect(driver);
spiSend(driver, 2, tx_buff);
spiUnselect(driver);
}

View File

@ -90,14 +90,14 @@ static int cjReadRegister(unsigned char regAddr) {
#endif /* EFI_UNIT_TEST */
}
static void cjWriteRegister(unsigned char regAddr, unsigned char regValue) {
tx_buff[0] = regAddr;
tx_buff[1] = regValue;
#ifdef CJ125_DEBUG_SPI
scheduleMsg(logger, "cjWriteRegister: addr=%d value=%d", regAddr, regValue);
#endif /* CJ125_DEBUG_SPI */
// todo: extract 'sendSync' method?
spiSelect(driver);
tx_buff[0] = regAddr;
tx_buff[1] = regValue;
spiSend(driver, 2, tx_buff);
spiUnselect(driver);
}

View File

@ -945,7 +945,8 @@ float[MAP_ACCEL_TAPER] mapAccelTaperMult;;"mult", 1, 0, 0.0, 300,
adc_channel_e externalKnockSenseAdc;
brain_pin_e stepperEnablePin;
brain_pin_e tle8888_cs;
uint8_t[2] unusedTest55;
pin_output_mode_e tle8888_csPinMode;
uint8_t[1] unusedTest55;
float[CRANKING_ADVANCE_CURVE_SIZE] crankingAdvanceBins;Optional timing advance table for Cranking (see useSeparateAdvanceForCranking);"RPM", 1, 0, 0.0, 18000, 2
float[CRANKING_ADVANCE_CURVE_SIZE] crankingAdvance ;Optional timing advance table for Cranking (see useSeparateAdvanceForCranking);"deg", 1, 0, -20, 90, 2

View File

@ -1639,6 +1639,7 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
field = "comm status light", communicationLedPin
field = "running status light", runningLedPin
field = "TLE8888 Chip Select", tle8888_cs
field = "TLE8888 CS Mode", tle8888_csPinMode
dialog = allPins1_2, "", xAxis

View File

@ -1,6 +1,6 @@
package com.rusefi.config;
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon Mar 25 14:42:37 EDT 2019
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon Mar 25 20:16:49 EDT 2019
public class Fields {
public static final int LE_COMMAND_LENGTH = 200;
public static final int BLOCKING_FACTOR = 400;
@ -1009,7 +1009,8 @@ public class Fields {
public static final int externalKnockSenseAdc_offset = 3127;
public static final int stepperEnablePin_offset = 3128;
public static final int tle8888_cs_offset = 3129;
public static final int unusedTest55_offset = 3130;
public static final int tle8888_csPinMode_offset = 3130;
public static final int unusedTest55_offset = 3131;
public static final int crankingAdvanceBins_offset = 3132;
public static final int crankingAdvance_offset = 3148;
public static final int servoOutputPins1_offset = 3164;
@ -1889,6 +1890,8 @@ public class Fields {
public static final Field EXTERNALKNOCKSENSEADC = Field.create("EXTERNALKNOCKSENSEADC", 3127, FieldType.INT, adc_channel_e);
public static final Field STEPPERENABLEPIN = Field.create("STEPPERENABLEPIN", 3128, FieldType.INT, brain_pin_e);
public static final Field TLE8888_CS = Field.create("TLE8888_CS", 3129, FieldType.INT, brain_pin_e);
public static final Field TLE8888_CSPINMODE = Field.create("TLE8888_CSPINMODE", 3130, FieldType.INT, pin_output_mode_e);
public static final Field UNUSEDTEST55 = Field.create("UNUSEDTEST55", 3131, FieldType.INT);
public static final Field SERVOOUTPUTPINS1 = Field.create("SERVOOUTPUTPINS1", 3164, FieldType.INT, brain_pin_e);
public static final Field SERVOOUTPUTPINS2 = Field.create("SERVOOUTPUTPINS2", 3165, FieldType.INT, brain_pin_e);
public static final Field SERVOOUTPUTPINS3 = Field.create("SERVOOUTPUTPINS3", 3166, FieldType.INT, brain_pin_e);