progress
This commit is contained in:
parent
1c4488d930
commit
a08a6cebff
|
@ -17,11 +17,13 @@
|
|||
|
||||
EXTERN_ENGINE;
|
||||
|
||||
#if EFI_CJ125 && HAL_USE_SPI
|
||||
#if EFI_CJ125
|
||||
|
||||
#include "adc_inputs.h"
|
||||
|
||||
#if HAL_USE_SPI
|
||||
#include "mpu_util.h"
|
||||
#endif /* HAL_USE_SPI */
|
||||
|
||||
//#define CJ125_DEBUG
|
||||
//#define CJ125_DEBUG_SPI
|
||||
|
@ -39,6 +41,8 @@ static CJ125 globalInstance;
|
|||
|
||||
static THD_WORKING_AREA(cj125ThreadStack, UTILITY_THREAD_STACK_SIZE);
|
||||
|
||||
#if HAL_USE_SPI
|
||||
|
||||
static SPIDriver *driver;
|
||||
|
||||
static SPIConfig cj125spicfg = {
|
||||
|
@ -53,6 +57,8 @@ static SPIConfig cj125spicfg = {
|
|||
SPI_CR2_8BIT_MODE
|
||||
};
|
||||
|
||||
#endif /* HAL_USE_SPI */
|
||||
|
||||
static volatile int lastSlowAdcCounter = 0;
|
||||
|
||||
// LSU conversion tables. See cj125_sensor_type_e
|
||||
|
@ -165,7 +171,9 @@ static void cjPrintState() {
|
|||
|
||||
static void cjInfo() {
|
||||
cjPrintState();
|
||||
#if HAL_USE_SPI
|
||||
printSpiConfig(logger, "cj125", CONFIG(cj125SpiDevice));
|
||||
#endif /* HAL_USE_SPI */
|
||||
}
|
||||
|
||||
static void cjPrintData(void) {
|
||||
|
@ -334,7 +342,8 @@ void CJ125::setError(cj125_error_e errCode DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
cjWriteRegister(INIT_REG2_WR, CJ125_INIT2_RESET);
|
||||
}
|
||||
|
||||
static void cjStartSpi(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
static bool cjStartSpi(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
#if HAL_USE_SPI
|
||||
globalInstance.cj125Cs.initPin("cj125 CS", CONFIG(cj125CsPin),
|
||||
&engineConfiguration->cj125CsPinMode);
|
||||
// Idle CS pin - SPI CS is high when idle
|
||||
|
@ -347,10 +356,12 @@ static void cjStartSpi(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
driver = getSpiDevice(engineConfiguration->cj125SpiDevice);
|
||||
if (driver == NULL) {
|
||||
// error already reported
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
scheduleMsg(logger, "cj125: Starting SPI driver %s", getSpi_device_e(engineConfiguration->cj125SpiDevice));
|
||||
spiStart(driver, &cj125spicfg);
|
||||
#endif /* HAL_USE_SPI */
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -568,11 +579,8 @@ void initCJ125(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
}
|
||||
|
||||
globalInstance.cjInitPid(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
cjStartSpi(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
if (driver == NULL) {
|
||||
// error already reported
|
||||
if (!cjStartSpi(PASS_ENGINE_PARAMETER_SIGNATURE))
|
||||
return;
|
||||
}
|
||||
scheduleMsg(logger, "cj125: Starting heater control");
|
||||
globalInstance.StartHeaterControl((pwm_gen_callback*)applyPinState PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
cjStart(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#define DL_OUTPUT_BUFFER 9000
|
||||
|
||||
#define CCM_OPTIONAL
|
||||
#define NO_CACHE
|
||||
|
||||
#define EFI_CUSTOM_PANIC_METHOD 1
|
||||
|
||||
|
|
Loading…
Reference in New Issue