1 /*---------------------------------------------------------------------------*
2 Project: Horizon
3 File: acc.cpp
4
5 Copyright (C)2009-2012 Nintendo Co., Ltd. All rights reserved.
6
7 These coded instructions, statements, and computer programs contain
8 proprietary information of Nintendo of America Inc. and/or Nintendo
9 Company Ltd., and are protected by Federal copyright law. They may
10 not be disclosed to third parties or copied or duplicated in any form,
11 in whole or in part, without the prior written consent of Nintendo.
12
13 $Rev: 46365 $
14 *---------------------------------------------------------------------------*/
15
16 #include <nn/os.h>
17 #include <nn/hid.h>
18 #include "acc.h"
19
DrawFrame(void)20 void AccDemo::DrawFrame(void)
21 {
22 mp_RenderSystem->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
23
24 // Gets most recent accelerometer data
25 nn::hid::AccelerometerStatus accStatus;
26 m_AccReader.ReadLatest(&accStatus);
27 // Converts accelerometer value units to "G"
28 nn::hid::AccelerationFloat accFloat;
29 m_AccReader.ConvertToAcceleration(&accFloat, 1, &accStatus);
30
31 mp_RenderSystem->DrawText(0, 200, "Gx : % .2lf", accFloat.x);
32 mp_RenderSystem->DrawText(0, 210, "Gy : % .2lf", accFloat.y);
33 mp_RenderSystem->DrawText(0, 220, "Gz : % .2lf", accFloat.z);
34 }
35
GetLatestAccStatus(void)36 nn::hid::AccelerometerStatus AccDemo::GetLatestAccStatus(void)
37 {
38 // Gets most recent accelerometer data
39 nn::hid::AccelerometerStatus accStatus;
40 m_AccReader.ReadLatest(&accStatus);
41
42 return accStatus;
43 }
44
45 /*---------------------------------------------------------------------------*
46 End of file
47 *---------------------------------------------------------------------------*/
48