]> Chaos Git - corbenik/ctrulib.git/commitdiff
Added 2 hid functions
authorAurelio Mannara <aurelio.mannara@gmail.com>
Sat, 13 Dec 2014 12:10:54 +0000 (13:10 +0100)
committerAurelio Mannara <aurelio.mannara@gmail.com>
Sat, 13 Dec 2014 12:10:54 +0000 (13:10 +0100)
-Added HIDUSER_GetGyroscopeRawToDpsCoefficient(float *coeff)
-Added HIDUSER_GetSoundVolume(u8 *volume)

libctru/include/3ds/services/hid.h
libctru/source/services/hid.c

index 4ba6aa746d2b1cb3f684b8e121cf7c6cc974483f..87a99cf9c745f8ae35dadde4360c3105e138ff8d 100644 (file)
@@ -102,4 +102,5 @@ Result HIDUSER_EnableAccelerometer();
 Result HIDUSER_DisableAccelerometer();
 Result HIDUSER_EnableGyroscope();
 Result HIDUSER_DisableGyroscope();
-
+Result HIDUSER_GetGyroscopeRawToDpsCoefficient(float *coeff);
+Result HIDUSER_GetSoundVolume(u8 *volume); //Return the volume slider value (0-63)
index d48f30c91f3401e8e0fa4116fe39785589c9288d..2379151afa8a84d669aa2371aac071818fb0b7eb 100644 (file)
@@ -245,3 +245,28 @@ Result HIDUSER_DisableGyroscope()
        return cmdbuf[1];
 }
 
+Result HIDUSER_GetGyroscopeRawToDpsCoefficient(float *coeff)
+{
+       u32* cmdbuf=getThreadCommandBuffer();
+       cmdbuf[0]=0x150000; //request header code
+
+       Result ret=0;
+       if((ret=svcSendSyncRequest(hidHandle)))return ret;
+
+       *coeff = (float)cmdbuf[2];
+
+       return cmdbuf[1];
+}
+
+Result HIDUSER_GetSoundVolume(u8 *volume)
+{
+       u32* cmdbuf=getThreadCommandBuffer();
+       cmdbuf[0]=0x170000; //request header code
+
+       Result ret=0;
+       if((ret=svcSendSyncRequest(hidHandle)))return ret;
+
+       *volume = (u8)cmdbuf[2];
+
+       return cmdbuf[1];
+}