This is a little funny to set all the registers here and then immediately set them again in the function on the next line. Maybe the SetSampleRate function should read the register and then modify only the necessary bits instead of redefining all bits.