rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions
hip9011.h File Reference

Detailed Description

HIP9011/TPIC8101 driver.

Date
Nov 27, 2013
Author
Andrey Belomutskiy, (c) 2012-2020

Definition in file hip9011.h.

Functions

void initHip9011 ()
 
void startHip9011_pins ()
 
void stopHip9011_pins ()
 
void hipAdcCallback (float volts)
 
void hip9011_onFireEvent (uint8_t cylinderNumber, efitick_t nowNt)
 

Function Documentation

◆ hip9011_onFireEvent()

void hip9011_onFireEvent ( uint8_t  cylinderNumber,
efitick_t  nowNt 
)

Ignition callback used to start HIP integration and schedule finish

Definition at line 283 of file hip9011.cpp.

283 {
285 return;
286
287 /* We are not checking here for READY_TO_INTEGRATE state as
288 * previous integration may be still in progress, while
289 * we are scheduling next integration start only
290 * knockDetectionWindowStart from now.
291 * Check for correct state will be done at startIntegration () */
292
293 if (cylinderNumber == instance.expectedCylinderNumber) {
294 /* save currect cylinder */
295 instance.cylinderNumber = cylinderNumber;
296
297 /* smart books says we need to sence knock few degrees after TDC
298 * currently I have no idea how to hook to cylinder TDC in correct way.
299 * So schedule start of integration + knockDetectionWindowStart from fire event
300 * Keep this is mind when setting knockDetectionWindowStart */
301 scheduleByAngle(&hardware.startTimer, nowNt,
303 { startIntegration, &instance });
304
305 scheduleByAngle(&hardware.endTimer, nowNt,
307 { endIntegration, &instance });
308 } else {
309 #if EFI_HIP_9011_DEBUG
310 /* out of sync */
313 #endif
314 /* save currect cylinder */
315 instance.cylinderNumber = cylinderNumber;
316 /* Skip integration, call driver task to prepare for next cylinder */
319 }
320}
int8_t cylinderNumber
int8_t expectedCylinderNumber
hip_state_e state
static constexpr engine_configuration_s * engineConfiguration
static int hip_wake_driver()
Definition hip9011.cpp:213
static Hip9011Hardware hardware
Definition hip9011.cpp:81
@ NOT_READY
efitick_t scheduleByAngle(scheduling_s *timer, efitick_t nowNt, angle_t angle, action_s action)
HIP9011 instance

Referenced by Engine::onSparkFireKnockSense().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hipAdcCallback()

void hipAdcCallback ( float  volts)

Definition at line 322 of file hip9011.cpp.

322 {
323 /* we read in digital mode */
324 if (instance.adv_mode)
325 return;
328 } else if (instance.state == WAITING_FOR_RESULT_ADC) {
329 /* offload calculations to driver thread */
330 if (instance.channelIdx < HIP_INPUT_CHANNELS) {
331 /* normalize to 0..HIP9011_DIGITAL_OUTPUT_MAX */
333 volts * HIP9011_DIGITAL_OUTPUT_MAX / HIP9011_ANALOG_OUTPUT_MAX;
334 }
337 }
338}
uint8_t channelIdx
uint16_t rawValue[HIP_INPUT_CHANNELS]
bool adv_mode
@ WAITING_FOR_RESULT_ADC
@ WAITING_FOR_ADC_TO_SKIP

Referenced by onFastAdcComplete().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initHip9011()

void initHip9011 ( )

Definition at line 564 of file hip9011.cpp.

564 {
566 return;
567
569
570 /* load settings */
572
573 efiPrintf("Starting HIP9011/TPIC8101 driver");
574
575 /* init semaphore */
576 chSemObjectInit(&wake, 10);
577 chThdCreateStatic(hipThreadStack, sizeof(hipThreadStack), PRIO_HIP9011, (tfunc_t)(void*) hipThread, NULL);
578
579 #if EFI_HIP_9011_DEBUG
581 #endif
582}
uint8_t prescaler
void startHip9011_pins()
Definition hip9011.cpp:547
static semaphore_t wake
Definition hip9011.cpp:79
static msg_t hipThread(void *arg)
Definition hip9011.cpp:431
static void hip_addconsoleActions()
Definition hip9011.cpp:689

Referenced by initHardware().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ startHip9011_pins()

void startHip9011_pins ( )

Definition at line 547 of file hip9011.cpp.

547 {
549 intHold.setValue(1);
551 Cs.setValue(1);
552
553#if EFI_PROD_CODE
555 if (spi == NULL) {
556 // error already reported
557 return;
558 }
561#endif /* EFI_PROD_CODE */
562}
void initPin(const char *msg, brain_pin_e brainPin, pin_output_mode_e outputMode, bool forceInitWithFatalError=false)
Definition efi_gpio.cpp:697
void setValue(const char *msg, int logicValue, bool isForce=false)
Definition efi_gpio.cpp:590
ioportid_t getHwPort(const char *msg, brain_pin_e brainPin)
ioportmask_t getHwPin(const char *msg, brain_pin_e brainPin)
SPIDriver * getSpiDevice(spi_device_e spiDevice)
Definition hardware.cpp:143
static NamedOutputPin intHold(PROTOCOL_HIP_NAME)
static SPIConfig hipSpiCfg
Definition hip9011.cpp:97
static SPIDriver * spi
Definition hip9011.cpp:95
static NamedOutputPin Cs(PROTOCOL_HIP_NAME)

Referenced by applyNewHardwareSettings(), and initHip9011().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stopHip9011_pins()

void stopHip9011_pins ( )

Definition at line 538 of file hip9011.cpp.

538 {
539 intHold.deInit();
540 Cs.deInit();
541#if EFI_PROD_CODE
542 spi = NULL;
543 hipSpiCfg.ssport = NULL;
544#endif
545}
void deInit()
Definition efi_gpio.cpp:788

Referenced by applyNewHardwareSettings().

Here is the call graph for this function:
Here is the caller graph for this function:

Go to the source code of this file.