NXP’s accelerometer chip MMA8450Q, provides orientation detection on handheld devices. Link here (PDF)
This application note targets the portrait/landscape orientation detection feature which has become standard in many hand-held electronic devices. Additionally, this application note aims to explain uses as well as highlight some of the challenges of designing an embedded algorithm into the sensor. Included in content, the embedded settings of the MMA8450Q are explained and detailed for implementation.
Read more Here