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

Functions

void initSmartGpio ()
 
void startSmartCsPins ()
 
void stopSmartCsPins ()
 
void tle8888startup ()
 

Function Documentation

◆ initSmartGpio()

void initSmartGpio ( )

Definition at line 252 of file smart_gpio.cpp.

252 {
254#if EFI_PROD_CODE
255#if (BOARD_TLE6240_COUNT > 0)
261
262 criticalAssertVoid(ret == (int)Gpio::TLE6240_PIN_1, "tle6240");
263 }
264#endif /* (BOARD_TLE6240_COUNT > 0) */
265
266#if (BOARD_MC33972_COUNT > 0)
268 // todo: reuse initSpiCs method?
272 // todo: propogate 'basePinOffset' parameter
274
275 criticalAssertVoid(ret == (int)Gpio::MC33972_PIN_1, "mc33972");
276 }
277#endif /* (BOARD_MC33972_COUNT > 0) */
278
279#if (BOARD_L9779_COUNT > 0)
281 // todo: reuse initSpiCs method?
285 // todo: propogate 'basePinOffset' parameter
286 int ret = l9779_add(Gpio::L9779_IGN_1, 0, &l9779_cfg);
287
288 criticalAssertVoid(ret == (int)Gpio::L9779_IGN_1, "l9779");
289 }
290#endif /* (BOARD_L9779_COUNT > 0) */
291
292#if (BOARD_TLE8888_COUNT > 0)
294 // todo: reuse initSpiCs method?
298
301
302 /* spi_bus == null checked in _add function */
304
305 criticalAssertVoid(ret == (int)Gpio::TLE8888_PIN_1, "tle8888");
306 }
307#endif /* (BOARD_TLE8888_COUNT > 0) */
308
309#if EFI_PROD_CODE && (BOARD_DRV8860_COUNT > 0)
315
316 criticalAssertVoid(ret == (int)Gpio::DRV8860_PIN_1, "drv8860");
317 }
318#endif /* (BOARD_DRV8860_COUNT > 0) */
319
320#if EFI_CAN_GPIO
322#endif // EFI_CAN_GPIO
323
324#if (BOARD_MC33810_COUNT > 0)
325 /* none of official boards has this IC */
326#endif /* (BOARD_MC33810_COUNT > 0) */
327
328#if (BOARD_TLE9104_COUNT > 0)
329 // No official boards have this IC
330#endif
331
332#endif // EFI_PROD_CODE
333
334 /* external chip init */
336}
void initCanGpioMsiobox()
@ L9779_IGN_1
@ TLE6240_PIN_1
@ DRV8860_PIN_1
@ TLE8888_PIN_1
@ MC33972_PIN_1
int gpiochips_init(void)
Init all registered gpiochips.
Definition core.cpp:284
int drv8860_add(brain_pin_e base, unsigned int index, const drv8860_config *cfg)
DRV8860 driver add.
Definition drv8860.cpp:235
ioportid_t getHwPort(const char *msg, brain_pin_e brainPin)
ioportmask_t getHwPin(const char *msg, brain_pin_e brainPin)
static constexpr engine_configuration_s * engineConfiguration
SPIDriver * getSpiDevice(spi_device_e spiDevice)
Definition hardware.cpp:149
int l9779_add(brain_pin_e base, unsigned int index, const l9779_config *cfg)
L9779 driver add.
Definition l9779.cpp:733
int mc33972_add(brain_pin_e base, unsigned int index, const struct mc33972_config *cfg)
MC33972 driver add.
Definition mc33972.cpp:414
bool isBrainPinValid(brain_pin_e brainPin)
struct drv8860_config drv8860
struct tle6240_config tle6240
struct tle8888_config tle8888_cfg
void startSmartCsPins()
struct mc33972_config mc33972
struct l9779_config l9779_cfg
SPIDriver * spi_bus
Definition drv8860.h:24
SPIConfig spi_config
Definition drv8860.h:25
SPIConfig spi_config
Definition l9779.h:27
SPIDriver * spi_bus
Definition l9779.h:26
SPIConfig spi_config
Definition mc33972.h:23
SPIDriver * spi_bus
Definition mc33972.h:22
SPIConfig spi_config
Definition tle6240.h:24
SPIDriver * spi_bus
Definition tle6240.h:23
SPIConfig spi_config
Definition tle8888.h:44
tle8888_mode_e mode
Definition tle8888.h:69
SPIDriver * spi_bus
Definition tle8888.h:43
int tle6240_add(brain_pin_e base, unsigned int index, const tle6240_config *cfg)
TLE6240 driver add.
Definition tle6240.cpp:450
int tle8888_add(brain_pin_e base, unsigned int index, const tle8888_config *cfg)
TLE8888 driver add.
Definition tle8888.cpp:1228

Referenced by initHardware().

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

◆ startSmartCsPins()

void startSmartCsPins ( )

Definition at line 380 of file smart_gpio.cpp.

380 {
381#if EFI_PROD_CODE
382#if (BOARD_TLE8888_COUNT > 0)
385 tle8888Cs.setValue(true);
386#endif /* BOARD_TLE8888_COUNT */
387#if (BOARD_TLE6240_COUNT > 0)
388 // todo: any way to reduce copy-paste? some convention between pin property name and pin mode property name?
391 tle6240Cs.setValue(true);
392#endif /* BOARD_TLE6240_COUNT */
393#if (BOARD_MC33972_COUNT > 0)
394 // todo: any way to reduce copy-paste? some convention between pin property name and pin mode property name?
397 mc33972Cs.setValue(true);
398#endif /* BOARD_MC33972_COUNT */
399#if (BOARD_DRV8860_COUNT > 0)
400 // todo: any way to reduce copy-paste? some convention between pin property name and pin mode property name?
403 drv8860Cs.setValue(true);
404#endif /* BOARD_DRV8860_COUNT */
405#if (BOARD_MC33810_COUNT > 0)
406 for (size_t i = 0;i<C_MC33810_COUNT;i++) {
407 // huh?! most boards are NOT using mc33810_cs we are directly initializing CS pin(s)?!
408 mc33810Cs[i].initPin("mc33810 CS", engineConfiguration->mc33810_cs[i],
410 mc33810Cs[i].setValue(true);
411 }
412#endif /* (BOARD_MC33810_COUNT > 0) */
413#if (BOARD_TLE9104_COUNT > 0)
414 // todo: no official boards have this IC yet
415#endif
416#if (BOARD_L9779_COUNT > 0)
417 // todo: use existing l9779_cs and l9779_csPinMode settings
418 // todo: no official boards have this IC yet
419#endif
420#endif // EFI_PROD_CODE
421}
void initPin(const char *msg, brain_pin_e brainPin, pin_output_mode_e outputMode, bool forceInitWithFatalError=false)
Definition efi_gpio.cpp:711
void setValue(const char *msg, int logicValue, bool isForce=false)
Definition efi_gpio.cpp:604
static OutputPin mc33972Cs
static OutputPin tle8888Cs
static OutputPin mc33810Cs[C_MC33810_COUNT]
static OutputPin drv8860Cs
static OutputPin tle6240Cs

Referenced by applyNewHardwareSettings(), and initSmartGpio().

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

◆ stopSmartCsPins()

void stopSmartCsPins ( )

Definition at line 355 of file smart_gpio.cpp.

355 {
356#if EFI_PROD_CODE
357#if (BOARD_TLE8888_COUNT > 0)
359#endif /* BOARD_TLE8888_COUNT */
360#if (BOARD_TLE6240_COUNT > 0)
362#endif /* BOARD_TLE6240_COUNT */
363#if (BOARD_MC33972_COUNT > 0)
365#endif /* BOARD_MC33972_COUNT */
366#if (BOARD_DRV8860_COUNT > 0)
367
368#endif /* BOARD_DRV8860_COUNT */
369#if (BOARD_MC33810_COUNT > 0)
370 for (size_t i = 0;i<C_MC33810_COUNT;i++) {
372 }
373#endif /* (BOARD_MC33810_COUNT > 0) */
374#if (BOARD_TLE9104_COUNT > 0)
375 // No official boards have this IC
376#endif
377#endif // EFI_PROD_CODE
378}
engine_configuration_s & activeConfiguration
void efiSetPadUnused(brain_pin_e brainPin)
Definition io_pins.cpp:20

Referenced by stopHardware().

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

◆ tle8888startup()

void tle8888startup ( )

Definition at line 338 of file smart_gpio.cpp.

338 {
339#if EFI_PROD_CODE && (BOARD_TLE8888_COUNT > 0)
340 // TODO: use a timer instead
341 static efitick_t tle8888CrankingResetTime = 0;
342
344 efitick_t nowNt = getTimeNowNt();
345 if (nowNt - tle8888CrankingResetTime > MS2NT(300)) {
347 // let's reset TLE8888 every 300ms while cranking since that's the best we can do to deal with undervoltage reset
348 // PS: oh yes, it's a horrible design! Please suggest something better!
349 tle8888CrankingResetTime = nowNt;
350 }
351 }
352#endif /* BOARD_TLE8888_COUNT */
353}
RpmCalculator rpmCalculator
Definition engine.h:306
bool isCranking() const override
efitick_t getTimeNowNt()
Definition efitime.cpp:19
static EngineAccessor engine
Definition engine.h:413
void tle8888_req_init()
Definition tle8888.cpp:1272

Referenced by Engine::periodicSlowCallback().

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

Go to the source code of this file.