hip9011: allow user to define only clock divider, not SDO mode
Driver needs to read SPI reply, so SDO=1, not supported
This commit is contained in:
parent
a0f7fdeb9c
commit
27afd8fc10
|
@ -46,7 +46,7 @@ static void setHip9011FrankensoPinout() {
|
|||
// engineConfiguration->hip9011CsPin = Gpio::D0; // rev 0.1
|
||||
|
||||
engineConfiguration->isHip9011Enabled = true;
|
||||
engineConfiguration->hip9011PrescalerAndSDO = HIP_8MHZ_PRESCALER; // 8MHz chip
|
||||
engineConfiguration->hip9011Prescaler = HIP_8MHZ_PRESCALER; // 8MHz chip
|
||||
engineConfiguration->is_enabled_spi_2 = true;
|
||||
// todo: convert this to rusEfi, hardware-independent enum
|
||||
#if EFI_PROD_CODE
|
||||
|
|
|
@ -195,7 +195,7 @@ void setBoardDefaultConfiguration() {
|
|||
/* this board has TPIC8101, that supports advanced mode */
|
||||
engineConfiguration->useTpicAdvancedMode = true;
|
||||
/* Chip settings */
|
||||
engineConfiguration->hip9011PrescalerAndSDO = (0x6 << 1); //HIP_16MHZ_PRESCALER;
|
||||
engineConfiguration->hip9011Prescaler = 0x6; //HIP_16MHZ_PRESCALER;
|
||||
engineConfiguration->hip9011Gain = 1.0;
|
||||
engineConfiguration->cylinderBore = 96.9;
|
||||
|
||||
|
|
|
@ -562,7 +562,7 @@ void initHip9011() {
|
|||
startHip9011_pins();
|
||||
|
||||
/* load settings */
|
||||
instance.prescaler = engineConfiguration->hip9011PrescalerAndSDO;
|
||||
instance.prescaler = engineConfiguration->hip9011Prescaler;
|
||||
|
||||
efiPrintf("Starting HIP9011/TPIC8101 driver");
|
||||
|
||||
|
@ -664,8 +664,8 @@ static void showHipInfo() {
|
|||
}
|
||||
}
|
||||
|
||||
static void setPrescalerAndSDO(int value) {
|
||||
engineConfiguration->hip9011PrescalerAndSDO = value;
|
||||
static void setPrescaler(int value) {
|
||||
engineConfiguration->hip9011Prescaler = value;
|
||||
}
|
||||
|
||||
static void setHipGain(float value) {
|
||||
|
@ -676,7 +676,7 @@ static void setHipGain(float value) {
|
|||
static void hip_addconsoleActions() {
|
||||
addConsoleAction("hipinfo", showHipInfo);
|
||||
addConsoleActionF("set_gain", setHipGain);
|
||||
addConsoleActionI("set_hip_prescalerandsdo", setPrescalerAndSDO);
|
||||
addConsoleActionI("set_hip_prescaler", setPrescaler);
|
||||
}
|
||||
|
||||
#endif /* EFI_HIP_9011_DEBUG */
|
||||
|
|
|
@ -159,7 +159,7 @@ void HIP9011::handleSettings(int rpm DEFINE_PARAM_SUFFIX(DEFINE_HIP_PARAMS)) {
|
|||
|
||||
setAngleWindowWidth(FORWARD_HIP_PARAMS);
|
||||
|
||||
int new_prescaler = GET_CONFIG_VALUE(hip9011PrescalerAndSDO);
|
||||
int new_prescaler = GET_CONFIG_VALUE(hip9011Prescaler);
|
||||
int new_integratorIdx = getIntegrationIndexByRpm(rpm);
|
||||
int new_gainIdx = getGainIndex(FORWARD_HIP_PARAMS);
|
||||
int new_bandIdx = getBandIndex(FORWARD_HIP_PARAMS);
|
||||
|
|
|
@ -54,21 +54,21 @@ public:
|
|||
#define PASS_HIP_PARAMS \
|
||||
engineConfiguration->cylinderBore, \
|
||||
engineConfiguration->hip9011Gain, \
|
||||
engineConfiguration->hip9011PrescalerAndSDO, \
|
||||
engineConfiguration->hip9011Prescaler, \
|
||||
engineConfiguration->knockDetectionWindowStart, \
|
||||
engineConfiguration->knockDetectionWindowEnd
|
||||
|
||||
#define FORWARD_HIP_PARAMS \
|
||||
cylinderBore, \
|
||||
hip9011Gain, \
|
||||
hip9011PrescalerAndSDO, \
|
||||
hip9011Prescaler, \
|
||||
knockDetectionWindowStart, \
|
||||
knockDetectionWindowEnd
|
||||
|
||||
#define DEFINE_HIP_PARAMS \
|
||||
float cylinderBore, \
|
||||
float hip9011Gain, \
|
||||
int hip9011PrescalerAndSDO, \
|
||||
uint8_t hip9011Prescaler, \
|
||||
float knockDetectionWindowStart, \
|
||||
float knockDetectionWindowEnd
|
||||
|
||||
|
@ -138,8 +138,8 @@ public:
|
|||
#endif
|
||||
};
|
||||
|
||||
// 0b010x.xxxx
|
||||
#define SET_PRESCALER_CMD(v) (0x40 | ((v) & 0x1f))
|
||||
// 0b010x.xxx0, SDO always active
|
||||
#define SET_PRESCALER_CMD(v) (0x40 | (((v) & 0x0f) << 1) | 0)
|
||||
// 0b1110.000x
|
||||
#define SET_CHANNEL_CMD(v) (0xE0 | ((v) & 0x01))
|
||||
// 0b00xx.xxxx
|
||||
|
@ -160,21 +160,21 @@ public:
|
|||
#define SET_ADVANCED_MODE_REP ((~SET_ADVANCED_MODE_CMD) & 0xff)
|
||||
|
||||
// D[4:1] = 0000 : 4 MHz
|
||||
#define HIP_4MHZ_PRESCALER (0x0 << 1)
|
||||
#define HIP_4MHZ_PRESCALER (0x0)
|
||||
// D[4:1] = 0001 : 5 MHz
|
||||
#define HIP_5MHZ_PRESCALER (0x1 << 1)
|
||||
#define HIP_5MHZ_PRESCALER (0x1)
|
||||
// D[4:1] = 0010 : 6 MHz
|
||||
#define HIP_6MHZ_PRESCALER (0x2 << 1)
|
||||
#define HIP_6MHZ_PRESCALER (0x2)
|
||||
// D[4:1] = 0011 ; 8 MHz
|
||||
#define HIP_8MHZ_PRESCALER (0x3 << 1)
|
||||
#define HIP_8MHZ_PRESCALER (0x3)
|
||||
// D[4:1] = 0100 ; 10 MHz
|
||||
#define HIP_10MHZ_PRESCALER (0x4 << 1)
|
||||
#define HIP_10MHZ_PRESCALER (0x4)
|
||||
// D[4:1] = 0101 ; 12 MHz
|
||||
#define HIP_12MHZ_PRESCALER (0x5 << 1)
|
||||
#define HIP_12MHZ_PRESCALER (0x5)
|
||||
// D[4:1] = 0110 : 16 MHz
|
||||
#define HIP_16MHZ_PRESCALER (0x6 << 1)
|
||||
#define HIP_16MHZ_PRESCALER (0x6)
|
||||
// D[4:1] = 0111 : 20 MHz
|
||||
#define HIP_20MHZ_PRESCALER (0x7 << 1)
|
||||
#define HIP_20MHZ_PRESCALER (0x7)
|
||||
// D[4:1] = 1000 : 24 MHz
|
||||
#define HIP_24MHZ_PRESCALER (0x8 << 1)
|
||||
#define HIP_24MHZ_PRESCALER (0x8)
|
||||
|
||||
|
|
|
@ -538,7 +538,10 @@ ThermistorConf clt;todo: merge with channel settings, use full-scale Thermistor
|
|||
ThermistorConf iat;
|
||||
|
||||
float launchTimingRetard;;"deg", 1, 0, -180, 180, 2
|
||||
int hip9011PrescalerAndSDO;value '6' for 8MHz hw osc\nread hip9011 datasheet for details\ntodo split into two bit fields;"integer", 1, 0, 0, 32, 0
|
||||
uint8_t hip9011Prescaler;value '6' for 8MHz hw osc\nread hip9011 datasheet for details\ntodo split into two bit fields;"integer", 1, 0, 0, 32, 0
|
||||
uint8_t unusedHip0
|
||||
uint8_t unusedHip1
|
||||
uint8_t unusedHip2
|
||||
int16_t alternator_iTermMin;iTerm min value;"", 1, 0, -30000, 30000, 0
|
||||
int16_t alternator_iTermMax;iTerm max value;"", 1, 0, -30000, 30000, 0
|
||||
|
||||
|
|
|
@ -4102,7 +4102,7 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_
|
|||
field = "hip Output/stm input", hipOutputChannel, {isHip9011Enabled == 1}
|
||||
|
||||
dialog = hipSettings
|
||||
field = "prescaler & SDO", hip9011PrescalerAndSDO, {isHip9011Enabled == 1}
|
||||
field = "prescaler", hip9011Prescaler, {isHip9011Enabled == 1}
|
||||
field = "knockDetectionWindowStart", knockDetectionWindowStart, {isHip9011Enabled == 1}
|
||||
field = "knockDetectionWindowEnd", knockDetectionWindowEnd, {isHip9011Enabled == 1}
|
||||
field = "Cylinder bore", cylinderBore, {isHip9011Enabled == 1}
|
||||
|
|
Loading…
Reference in New Issue