Davide Gironi has written an article detailing his brushless sensored motor driver for AVR Atmega:
For this project, I’ve implemented a simple brushless sensored motor driver for AVR Atmega. The code i propose it’s not perfect, and can be improved, but for the needs i had it works.
Using this library, the motor can be controlled in speed and direction (clockwise and anti-clockwise).
The running step for the motor are defined as default, anyway user can change it to fit any motor. Below you can find the commutation sequence (for clockwise and anti-clockwise rotation) i’ve used
Check out the video after the break.