Source code reference
About console output
ChibiOS/RT role
Working with time
What about the injectors already!?
Working with Timers
Doxygen Reference
TunerStudio integration
Unit tests
Persistent Configuration
https://rusefi.com/docs/html/
General folder structure
config/system: ChibiOS configuration
config: rusEFI configuration
console, console_util: files relayed to serial protocol PC communication
controllers: the main logic lives here, that should be the most interesting folder!
hw_layer: helper files related to lower level work with hardware: ADC, software PWM, inputs, outputs...
util: some general utility files
Everything begins in main() method of main.c where hardware layer and engine controller are initialized.
Sensors, including shaft position sensors, are initialized in initHardware- the most interesting part of which is initInputCapture where we setup an IRQ callback. Actual engine control located inside the controllers folder: onShaftSignal is the method where all the magic happens. onShaftSignal is invoked as part of the position sensors IRQ handling and it controls the engine by scheduling outputs using OutputSignal infrastructure.
![Image](http://rusefi.com/images/state_machine_diagram.png)