Hardware interface code started, mostly working.