Missed autosleep variable input argument in writepwrctrl
moved local variable definition to .c file to maintain consistancy
introduce xyz variable for accelerometer