Pretty sure I contributed the majority of code you are flagging there, having just reviewed the relevant parts of the datasheet I have to admit that I made bad casts there; would like to believe I...