moved to C99
moved the pin definitions to structs to avoid the horrible macro mess, also changed the am driver code to externalize the while loop and support multiple devices