This is the source code for my custom BLDC controller. I will post a link to a complete tutorial on my homepage soon.