Just as software code is not patentable, because there are so many ways to write code that does the same thing, you should be patenting the application, the method for doing something, not a specific relationship between hardware and software.
FORBES: The Big Fix #3: How To Untangle The Mess With Software Patents