Need some help to control camera 6 axis by iPhone motion event

Using Get Rotation Rate is not accurate, So I try to use Get Gravity to rotate camera pitch and roll

This is how I convert Gravity to roll and pitch

But how to convert yaw by using Tilt or Acceleration?
Tilt seems like only detect 0 to 180 degrees
Or is it possible to read iPhone Attitude sensor using C++?