rusEFI
The most advanced open source ECU
Functions | Variables
sent_hw_icu.cpp File Reference

Functions

static void icuperiodcb_in1 (ICUDriver *icup)
 
void startSent ()
 
void stopSent ()
 

Variables

static ICUConfig icucfg [SENT_INPUT_COUNT]
 

Function Documentation

◆ icuperiodcb_in1()

static void icuperiodcb_in1 ( ICUDriver *  icup)
static

Definition at line 29 of file sent_hw_icu.cpp.

30 {
31  SENT_ISR_Handler(0, icuGetPeriodX(icup) * SENT_TIMER_CLOCK_DIV);
32 }
void SENT_ISR_Handler(uint8_t channel, uint16_t clocks)
Definition: sent.cpp:548
Here is the call graph for this function:

◆ startSent()

void startSent ( )

Definition at line 49 of file sent_hw_icu.cpp.

49  {
50  for (int i = 0; i < SENT_INPUT_COUNT; i++) {
52 
53  if (!isBrainPinValid(sentPin)) {
54  continue;
55  }
56 
57  ICUConfig *cfg = &icucfg[i];
58  ICUDriver *icu;
59  iomode_t pinAF;
60  uint32_t baseClock;
61 
62  if (getIcuParams(sentPin, &pinAF, &icu, &cfg->channel, &baseClock) != true) {
63  /* this pin has no ICU functionality, of ICU driver is not enabled for TIM on this pin */
64  criticalError("No ICU on selected SENT pin");
65  continue;
66  }
67 
68  efiSetPadMode("SENT", sentPin, PAL_MODE_ALTERNATE(pinAF));
69 
70  icuStart(icu, cfg);
71  icuStartCapture(icu);
72  icuEnableNotifications(icu);
73  }
74 }
void efiSetPadMode(const char *msg, brain_pin_e brainPin, iomode_t mode)
Gpio
uint32_t iomode_t
Digital I/O modes.
Definition: hal_pal_lld.h:83
bool getIcuParams(brain_pin_e hwPin, iomode_t *af_ptr, ICUDriver **icu_ptr, icuchannel_t *channel_ptr, uint32_t *clock_ptr)
Definition: stm32_icu.cpp:122
engine_configuration_s * engineConfiguration
bool isBrainPinValid(brain_pin_e brainPin)
static ICUConfig icucfg[SENT_INPUT_COUNT]
Definition: sent_hw_icu.cpp:35

Referenced by applyNewHardwareSettings(), and initSent().

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

◆ stopSent()

void stopSent ( )

Definition at line 76 of file sent_hw_icu.cpp.

76  {
77  for (int i = 0; i < SENT_INPUT_COUNT; i++) {
79 
80  if (!isBrainPinValid(sentPin)) {
81  continue;
82  }
83 
84  ICUDriver *icu;
85 
86  if (getIcuParams(sentPin, NULL, &icu, NULL, NULL) != true) {
87  /* this pin has no ICU functionality, of ICU driver is not enabled for TIM on this pin */
88  /* throw error? */
89  continue;
90  }
91 
92  icuDisableNotifications(icu);
93  icuStopCapture(icu);
94  icuStop(icu);
95 
96  efiSetPadUnused(sentPin);
97  }
98 }
engine_configuration_s & activeConfiguration
void efiSetPadUnused(brain_pin_e brainPin)
Definition: io_pins.cpp:20

Referenced by applyNewHardwareSettings().

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

Variable Documentation

◆ icucfg

ICUConfig icucfg[SENT_INPUT_COUNT]
static
Initial value:
=
{
{
.mode = ICU_INPUT_ACTIVE_LOW,
.frequency = SENT_ICU_FREQ,
.width_cb = NULL,
.period_cb = icuperiodcb_in1,
.overflow_cb = NULL,
.channel = ICU_CHANNEL_1,
.dier = 0U,
.arr = 0xFFFFFFFFU,
}
}
static void icuperiodcb_in1(ICUDriver *icup)
Definition: sent_hw_icu.cpp:29

Definition at line 35 of file sent_hw_icu.cpp.

Referenced by startSent().

Go to the source code of this file.