rusEFI
The most advanced open source ECU
|
#include <hip9011_logic.h>
Public Member Functions | |
HIP9011 (Hip9011HardwareInterface *hardware) | |
int | sendCommand (uint8_t cmd) |
int | sendCommandGetReply (uint8_t cmd, uint8_t *reply) |
float | getRpmByAngleWindowAndTimeUs (int timeUs, float angleWindowWidth) |
void | prepareRpmLookup (void) |
void | setAngleWindowWidth (DEFINE_HIP_PARAMS) |
void | handleSettings (int rpm DEFINE_PARAM_SUFFIX(DEFINE_HIP_PARAMS)) |
int | cylinderToChannelIdx (int cylinder) |
int | handleChannel (DEFINE_HIP_PARAMS) |
int | readValueAndHandleChannel (DEFINE_HIP_PARAMS) |
float | getBand (DEFINE_HIP_PARAMS) |
int | getIntegrationIndexByRpm (float rpm) |
int | getIntegrationTimeByIndex (int index) |
int | getBandIndex (DEFINE_HIP_PARAMS) |
int | getGainIndex (DEFINE_HIP_PARAMS) |
Data Fields | |
uint8_t | intergratorIdx = 0xff |
uint8_t | bandIdx = 0xff |
uint8_t | prescaler = 0xff |
uint8_t | gainIdx = 0xff |
uint8_t | channelIdx = 0xff |
float | angleWindowWidth = - 1 |
Hip9011HardwareInterface * | hw |
bool | adv_mode = false |
hip_state_e | state |
int8_t | cylinderNumber = -1 |
int8_t | expectedCylinderNumber = -1 |
uint16_t | rawValue [HIP_INPUT_CHANNELS] |
uint16_t | rpmLookup [INT_LOOKUP_SIZE] |
efitick_t | knockSampleTimestamp = 0 |
int | correctResponsesCount = 0 |
int | invalidResponsesCount = 0 |
int | samples = 0 |
int | overrun = 0 |
int | unsync = 0 |
Definition at line 80 of file hip9011_logic.h.
|
explicit |
Definition at line 64 of file hip9011_logic.cpp.
int HIP9011::cylinderToChannelIdx | ( | int | cylinder | ) |
Definition at line 191 of file hip9011_logic.cpp.
Referenced by handleChannel(), and readValueAndHandleChannel().
float HIP9011::getBand | ( | DEFINE_HIP_PARAMS | ) |
Definition at line 79 of file hip9011_logic.cpp.
Referenced by getBandIndex(), and showHipInfo().
int HIP9011::getBandIndex | ( | DEFINE_HIP_PARAMS | ) |
Definition at line 83 of file hip9011_logic.cpp.
Referenced by handleSettings().
int HIP9011::getGainIndex | ( | DEFINE_HIP_PARAMS | ) |
Definition at line 94 of file hip9011_logic.cpp.
Referenced by handleSettings().
int HIP9011::getIntegrationIndexByRpm | ( | float | rpm | ) |
Definition at line 135 of file hip9011_logic.cpp.
Referenced by handleSettings().
int HIP9011::getIntegrationTimeByIndex | ( | int | index | ) |
Definition at line 140 of file hip9011_logic.cpp.
Referenced by showHipInfo().
'TC is typically TINT/(2*Pi*VOUT)' Knock Sensor Training TPIC8101, page 24
TINT = TC * 2 * PI * VOUT
rpm = 60 seconds / time '60000000' because revolutions per MINUTE in uS conversion
Definition at line 109 of file hip9011_logic.cpp.
Referenced by prepareRpmLookup().
int HIP9011::handleChannel | ( | DEFINE_HIP_PARAMS | ) |
Definition at line 196 of file hip9011_logic.cpp.
Referenced by hipThread().
void HIP9011::handleSettings | ( | int rpm | DEFINE_PARAM_SUFFIXDEFINE_HIP_PARAMS | ) |
Definition at line 159 of file hip9011_logic.cpp.
Referenced by hipThread().
void HIP9011::prepareRpmLookup | ( | void | ) |
We know the set of possible integration times, we know the knock detection window width
out binary search method needs increasing order thus the reverse order here
Definition at line 126 of file hip9011_logic.cpp.
Referenced by setAngleWindowWidth().
int HIP9011::readValueAndHandleChannel | ( | DEFINE_HIP_PARAMS | ) |
Definition at line 220 of file hip9011_logic.cpp.
Referenced by hipThread().
int HIP9011::sendCommand | ( | uint8_t | cmd | ) |
Definition at line 68 of file hip9011_logic.cpp.
Referenced by handleChannel(), handleSettings(), and readValueAndHandleChannel().
int HIP9011::sendCommandGetReply | ( | uint8_t | cmd, |
uint8_t * | reply | ||
) |
Definition at line 72 of file hip9011_logic.cpp.
Referenced by readValueAndHandleChannel().
void HIP9011::setAngleWindowWidth | ( | DEFINE_HIP_PARAMS | ) |
Definition at line 144 of file hip9011_logic.cpp.
Referenced by handleSettings().
bool HIP9011::adv_mode = false |
Definition at line 109 of file hip9011_logic.h.
Referenced by endIntegration(), hip_init(), hipAdcCallback(), hipThread(), and showHipInfo().
float HIP9011::angleWindowWidth = - 1 |
Definition at line 106 of file hip9011_logic.h.
Referenced by prepareRpmLookup(), and setAngleWindowWidth().
uint8_t HIP9011::bandIdx = 0xff |
Definition at line 101 of file hip9011_logic.h.
Referenced by handleSettings(), and showHipInfo().
uint8_t HIP9011::channelIdx = 0xff |
Definition at line 104 of file hip9011_logic.h.
Referenced by handleChannel(), hipAdcCallback(), hipThread(), readValueAndHandleChannel(), and showHipInfo().
int HIP9011::correctResponsesCount = 0 |
Definition at line 133 of file hip9011_logic.h.
Referenced by hip_init(), and showHipInfo().
int8_t HIP9011::cylinderNumber = -1 |
Definition at line 121 of file hip9011_logic.h.
Referenced by handleChannel(), hip9011_onFireEvent(), hipThread(), readValueAndHandleChannel(), and showHipInfo().
int8_t HIP9011::expectedCylinderNumber = -1 |
Definition at line 122 of file hip9011_logic.h.
Referenced by handleChannel(), hip9011_onFireEvent(), hipThread(), readValueAndHandleChannel(), and showHipInfo().
uint8_t HIP9011::gainIdx = 0xff |
Definition at line 103 of file hip9011_logic.h.
Referenced by handleSettings(), and showHipInfo().
Hip9011HardwareInterface* HIP9011::hw |
Definition at line 108 of file hip9011_logic.h.
Referenced by HIP9011(), hip_init(), hip_testAdvMode(), sendCommand(), and sendCommandGetReply().
uint8_t HIP9011::intergratorIdx = 0xff |
Definition at line 100 of file hip9011_logic.h.
Referenced by handleSettings(), and showHipInfo().
int HIP9011::invalidResponsesCount = 0 |
Definition at line 134 of file hip9011_logic.h.
Referenced by hip_init(), showHipInfo(), and updateTunerStudioState().
efitick_t HIP9011::knockSampleTimestamp = 0 |
Definition at line 129 of file hip9011_logic.h.
Referenced by endIntegration(), and hipThread().
int HIP9011::overrun = 0 |
Definition at line 138 of file hip9011_logic.h.
Referenced by hip_init(), showHipInfo(), and startIntegration().
uint8_t HIP9011::prescaler = 0xff |
Definition at line 102 of file hip9011_logic.h.
Referenced by handleSettings(), hip_init(), initHip9011(), readValueAndHandleChannel(), and showHipInfo().
uint16_t HIP9011::rawValue[HIP_INPUT_CHANNELS] |
Definition at line 123 of file hip9011_logic.h.
Referenced by hipAdcCallback(), hipThread(), and showHipInfo().
uint16_t HIP9011::rpmLookup[INT_LOOKUP_SIZE] |
Definition at line 126 of file hip9011_logic.h.
Referenced by getIntegrationIndexByRpm(), prepareRpmLookup(), and showHipInfo().
int HIP9011::samples = 0 |
Definition at line 137 of file hip9011_logic.h.
Referenced by hip_init(), hipThread(), and showHipInfo().
hip_state_e HIP9011::state |
Int/Hold pin is controlled from scheduler call-backs which are set according to current RPM
The following state makes sure that we only have SPI communication while not integrating and that we take a good ADC reading after integrating.
Once integration window is over, we wait for the 2nd ADC callback and then initiate SPI communication if needed
hipOutput should be set to used FAST adc device
Definition at line 120 of file hip9011_logic.h.
Referenced by endIntegration(), hip9011_onFireEvent(), hip_init(), hipAdcCallback(), hipThread(), showHipInfo(), and startIntegration().
int HIP9011::unsync = 0 |
Definition at line 139 of file hip9011_logic.h.
Referenced by hip9011_onFireEvent(), hip_init(), and showHipInfo().