[sam] Fixed wrap-around bug in delay() (Mark Tillotson)

Fixes #1736