starting with lame analog

only:alphax-4k-gdi
This commit is contained in:
rusefi 2024-08-11 10:16:26 -04:00
parent 3bab7bccf2
commit 01a7a871ed
6 changed files with 75 additions and 9 deletions

View File

@ -7,7 +7,7 @@ BOARDCPPSRC = $(BOARD_DIR)/board_configuration.cpp
DDEFS += -DEFI_MAIN_RELAY_CONTROL=TRUE
DDEFS += -DEFI_MC33816=TRUE
DDEFS += -DBOARD_TLE9104_COUNT=4
DDEFS += -DBOARD_TLE9104_COUNT=1

View File

@ -2,6 +2,7 @@
#include "pch.h"
#include "defaults.h"
#include "hellen_meta.h"
#include "drivers/gpio/tle9104.h"
void setBoardConfigOverrides() {
setHellenSdCardSpi1Hardware();
@ -22,11 +23,12 @@ void setBoardConfigOverrides() {
}
void setBoardDefaultConfiguration() {
engineConfiguration->injectionPins[0] = Gpio::H144_LS_1;
engineConfiguration->injectionPins[1] = Gpio::H144_LS_2;
engineConfiguration->injectionPins[2] = Gpio::H144_LS_3;
engineConfiguration->injectionPins[3] = Gpio::H144_LS_4;
engineConfiguration->injectionPins[0] = Gpio::TLE9104_0_OUT_0;
engineConfiguration->injectionPins[1] = Gpio::TLE9104_0_OUT_1;
engineConfiguration->injectionPins[2] = Gpio::TLE9104_0_OUT_2;
engineConfiguration->injectionPins[3] = Gpio::TLE9104_0_OUT_3;
engineConfiguration->map.sensor.hwChannel = H144_IN_MAP1;
engineConfiguration->clt.adcChannel = H144_IN_CLT;
engineConfiguration->iat.adcChannel = H144_IN_IAT;
engineConfiguration->tps1_1AdcChannel = H144_IN_TPS;
@ -34,6 +36,34 @@ void setBoardDefaultConfiguration() {
setPPSInputs(H144_IN_PPS, H144_IN_PPS2);
}
static const tle9104_config tle9104_cfg[BOARD_TLE9104_COUNT] = {
{
.spi_bus = &SPID2,
.spi_config = {
.circular = false,
.end_cb = NULL,
.ssport = GPIOD,
.sspad = 4,
.cr1 =
SPI_CR1_16BIT_MODE |
SPI_CR1_SSM |
SPI_CR1_SSI |
((3 << SPI_CR1_BR_Pos) & SPI_CR1_BR) | // div = 16
SPI_CR1_MSTR |
SPI_CR1_CPHA |
0,
.cr2 = SPI_CR2_16BIT_MODE
},
.direct_io = {
{ .port = GPIOD, .pad = 3 },
{ .port = GPIOA, .pad = 9 },
{ .port = GPIOG, .pad = 14 },
{ .port = GPIOG, .pad = 5 }
},
.resn = Gpio::Unassigned,
.en = Gpio::Unassigned
}};
/*PUBLIC_API_WEAK*/ void boardInitHardware() {
setHellenMegaEnPin();
{
@ -55,6 +85,16 @@ void setBoardDefaultConfiguration() {
static OutputPin csLs4;
csLs4.initPin("csLs4", Gpio::H144_GP_IO4);
csLs4.setValue(1);
}
{
static OutputPin TleEn;
TleEn.initPin("TLE9104 En", H144_UART8_RX);
TleEn.setValue(1);
}
{
static OutputPin TleReset;
TleReset.initPin("TLE9104 Reset", H144_UART8_TX);
TleReset.setValue(1);
}
{
static OutputPin csDcEtb;
@ -66,5 +106,20 @@ void setBoardDefaultConfiguration() {
csDcAux.initPin("cs-dc-aux", Gpio::H144_GP_IO6);
csDcAux.setValue(1);
}
}
static Gpio OUTPUTS[] = {
Gpio::TLE9104_0_OUT_0,
Gpio::TLE9104_0_OUT_1,
Gpio::TLE9104_0_OUT_2,
Gpio::TLE9104_0_OUT_3,
};
int getBoardMetaOutputsCount() {
return efi::size(OUTPUTS);
}
Gpio* getBoardMetaOutputs() {
return OUTPUTS;
}

View File

@ -91,6 +91,7 @@ pins:
function: TPS 1 signal
ts_name: ___ TPS1
meta: H144_IN_TPS
color: green
type: av
class: analog_inputs
@ -98,12 +99,14 @@ pins:
function: TPS 2 signal
ts_name: ___ TPS2
meta: H144_IN_TPS2
color: blue
type: av
class: analog_inputs
- pin: 21A
function: ECT CLT Coolant
color: grey
type: at
meta: H144_IN_CLT
class: analog_inputs
@ -111,6 +114,7 @@ pins:
- pin: 22A
function: IAT
color: blue
type: at
meta: H144_IN_IAT
class: analog_inputs
@ -118,6 +122,7 @@ pins:
- pin: 23A
function: MAP Signal
type: av
color: yellow
meta: H144_IN_MAP1
class: analog_inputs

View File

@ -6,6 +6,7 @@ pins:
class: outputs
ts_name: ___ Port injector 4
function: Port injector 4
color: orange/brown
type: ls
- pin: 2B
@ -13,6 +14,7 @@ pins:
class: outputs
ts_name: ___ Port injector 3
function: Port injector 3
color: blue
type: ls
- pin: 3B
@ -20,6 +22,7 @@ pins:
class: outputs
ts_name: ___ Port injector 2
function: Port injector 2
color: white
type: ls
- pin: 4B
@ -27,6 +30,7 @@ pins:
class: outputs
ts_name: ___ Port injector 1
function: Port injector 1
color: green
type: ls
- pin: 5B
@ -57,6 +61,7 @@ pins:
meta: H144_IN_PPS
class: analog_inputs
ts_name: ___ PPS1
color: white
- pin: 20B
function: PPS 2
@ -64,6 +69,7 @@ pins:
meta: H144_IN_PPS2
class: analog_inputs
ts_name: ___ PPS2
color: orange/brown
- pin: 26B
function: Power GND

View File

@ -36,8 +36,8 @@ int detectHellenBoardId();
void detectHellenBoardType();
// stm32 UART8
#define H144_UART1_RX Gpio::E0
#define H144_UART1_TX Gpio::E1
#define H144_UART8_RX Gpio::E0
#define H144_UART8_TX Gpio::E1
// stm32 UART2
#define H144_UART2_RX Gpio::D6

View File

@ -25,7 +25,7 @@ void setStepperHw() {
engineConfiguration->stepperDcIo[0].directionPin2 = Gpio::Unassigned;
engineConfiguration->stepperDcIo[0].disablePin = Gpio::H144_GP_IO5; // ETB_DIS
// using 8chan pinout for DC2: A28 (OUT_DC2+ BL pin "A") and A29 (OUT_DC2- BH pin "B")
engineConfiguration->stepperDcIo[1].controlPin = H144_UART1_TX; // DC2_PWM
engineConfiguration->stepperDcIo[1].controlPin = H144_UART8_TX; // DC2_PWM
engineConfiguration->stepperDcIo[1].directionPin1 = H_SPI3_CS; // DC2_DIR
engineConfiguration->stepperDcIo[1].directionPin2 = Gpio::Unassigned;
#endif // HW_HELLEN