In this post I explain an asynchronous approach to writing a proximity sensor driver.
I would appreciate constructive feedback on this approach and suggestions of what would work better (or suggestions regarding approaches that you guys use yourselves). Nonetheless this is my personal approach and it works great as an alternative to multitasking for projects that run on the AVR.
I think that on the avr, processor resources are scarce and so we don't want to waste cycles in delay loops using _delay_x() as would be done in a synchronous approach. Instead, it is better to write the whole application in a way that is completely event driven. It is a form of "static" multitasking where different processes are happening "simultaneously" by means of keeping track of the current state of what whatever each part of the application is currently doing.
I'm working also on a completely asynchronous kernel that I will be using in my own projects. It is on github if you follow the link to the code in the post.