Arduino as Ignition sequencer

This summer I want to swap the carburetor on my 2 stroke supermoto for a fuel injection system. untill I have the complete EFI system working I want to use the coil (which I already have), as a programmable ignition driven by Arduino. It's a LS2 type coil that uses 12V for the primary coil and a 5V logic signal to control the dwell and spark.

When the signal from the sequencer is high (3 to 5 Volts, with very little current from the controller - a few dozen milliamps), the coil current will be building. When the signal from the sequencer is pulled low, the coil will spark. The duration of the signal from the sequencer determines the dwell. The timing will be supplied by a hall effect sensor at the flywheel (at ~40 degree BTDC).

All this seemed relatively simple to me: when the magnet passes the hall sensor pin 2 gets interrupted, a delay is added, the signal to the coil goes high, after 4ms (ideal dwell time) the signal goes low and we have spark. Just one Arduino and no other parts :D.

This is my first project using interrupts, and it isn't as simple as I expected. I have to add hardware interrupts and a timer, but I can't figure out how this is done. I have been searching on the internet for quite some time now but I hardly made any progress. I want to use a given amount of advance for low, mid and high RPM, and the last 4ms of the advance the coil must be charged and then fired. I'll also need to calculate the time it takes for the crank to move one degree.

This is how far I got :(

int seq = 4;
volatile int adv = [calculation here]

void setup() 
  pinMode(seq, OUTPUT);
  pinMode(2, INPUT);
  attachInterrupt(0, spark, RISING);

void loop()

void spark()
  digitalWrite(seq, HIGH);
  digitalWrite(seq, LOW);