Speeduino
Loading...
Searching...
No Matches
Macros | Functions
init.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define VSS_USES_RPM2()   ((configPage2.vssMode > 1U) && (pinVSS == pinTrigger2) && !BIT_CHECK(decoderState, BIT_DECODER_HAS_SECONDARY))
 
#define FLEX_USES_RPM2()   ((configPage2.flexEnabled > 0U) && (pinFlex == pinTrigger2) && !BIT_CHECK(decoderState, BIT_DECODER_HAS_SECONDARY))
 

Functions

void initialiseAll (void)
 
void initialiseTriggers (void)
 
void setPinMapping (byte boardID)
 
void changeHalfToFullSync (void)
 
void changeFullToHalfSync (void)
 

Macro Definition Documentation

◆ FLEX_USES_RPM2

#define FLEX_USES_RPM2 ( )    ((configPage2.flexEnabled > 0U) && (pinFlex == pinTrigger2) && !BIT_CHECK(decoderState, BIT_DECODER_HAS_SECONDARY))

◆ VSS_USES_RPM2

#define VSS_USES_RPM2 ( )    ((configPage2.vssMode > 1U) && (pinVSS == pinTrigger2) && !BIT_CHECK(decoderState, BIT_DECODER_HAS_SECONDARY))

Function Documentation

◆ changeFullToHalfSync()

void changeFullToHalfSync ( void  )

Change injectors or/and ignition angles to 360deg. In semi sequentiol mode req_fuel size is half. Set number of outputs equal to half cylinder count.

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

◆ changeHalfToFullSync()

void changeHalfToFullSync ( void  )

Change injectors or/and ignition angles to 720deg. Roll back req_fuel size and set number of outputs equal to cylinder count.

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

◆ initialiseAll()

void initialiseAll ( void  )

Initialise Speeduino for the main loop. Top level init entry point for all initialisations:

  • Initialise and set sizes of 3D tables
  • Load config from EEPROM, update config structures to current version of SW if needed.
  • Initialise board (The initBoard() is for board X implemented in board_X.ino file)
  • Initialise timers (See timers.ino)
  • Perform optional SD card and RTC battery inits
  • Load calibration tables from EEPROM
  • Perform pin mapping (calling setPinMapping() based on config2::pinMapping)
  • Stop any coil charging and close injectors
  • Initialise schedulers, Idle, Fan, auxPWM, Corrections, AD-conversions, Programmable I/O
  • Initialise baro (ambient pressure) by reading MAP (before engine runs)
  • Initialise triggers (by initialiseTriggers() )
  • Perform cyl. count based initialisations (config2::nCylinders)
  • Perform injection and spark mode based setup
    • Assign injector open/close and coil charge begin/end functions to their dedicated global vars
  • Perform fuel pressure priming by turning fuel pump on
  • Read CLT and TPS sensors to have cranking pulsewidths computed correctly
  • Mark Initialisation completed (this flag-marking is used in code to prevent after-init changes)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialiseTriggers()

void initialiseTriggers ( void  )

Initialise the chosen trigger decoder.

  • Set Interrupt numbers triggerInterrupt, triggerInterrupt2 and triggerInterrupt3 by pin their numbers (based on board CORE_* define)
  • Call decoder specific setup function triggerSetup_*() (by config4::TrigPattern, set to one of the DECODER_* defines) and do any additional initialisations needed.

    Todo:
    Explain why triggerSetup_*() alone cannot do all the setup, but there's ~10+ lines worth of extra init for each of decoders.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPinMapping()

void setPinMapping ( byte  boardID)

Set board / microcontroller specific pin mappings / assignments. The boardID is switch-case compared against raw boardID integers (not enum or defined label, and probably no need for that either) which are originated from tuning SW (e.g. TS) set values and are available in reference/speeduino.ini (See pinLayout, note also that numbering is not contiguous here).

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