updated sams functions to use builtin HAL. not tested but it at least compiles. will require testing