1
0
Fork 0
forked from suyu/suyu

implement GyroscopeCalibrateParam

This commit is contained in:
wwylele 2016-03-25 11:39:59 +03:00
parent db151efd0a
commit 1d2070d0d3
2 changed files with 20 additions and 9 deletions

View file

@ -251,14 +251,13 @@ void GetGyroscopeLowCalibrateParam(Service::Interface* self) {
cmd_buff[1] = RESULT_SUCCESS.raw; cmd_buff[1] = RESULT_SUCCESS.raw;
// currently don't understand the meaning of return value, const s16 param_unit = 6700; // an approximate value taken from hw
// so stubbed these with value from a real console. GyroscopeCalibrateParam param = {
// TODO(wwylele): implement this correctly { 0, param_unit, -param_unit },
cmd_buff[2] = 0x19DDFFDC; { 0, param_unit, -param_unit },
cmd_buff[3] = 0x0002E5DA; { 0, param_unit, -param_unit },
cmd_buff[4] = 0xE5CE1A2D; };
cmd_buff[5] = 0x19C6FFF3; memcpy(&cmd_buff[2], &param, sizeof(param));
cmd_buff[6] = 0x001CE61E;
LOG_WARNING(Service_HID, "(STUBBED) called"); LOG_WARNING(Service_HID, "(STUBBED) called");
} }

View file

@ -160,6 +160,18 @@ struct SharedMem {
} gyroscope; } gyroscope;
}; };
/**
* Structure of calibrate params that GetGyroscopeLowCalibrateParam returns
*/
struct GyroscopeCalibrateParam {
struct {
// TODO (wwylele): figure out the exact meaning of these params
s16 zero_point;
s16 positive_unit_point;
s16 negative_unit_point;
} x, y, z;
};
// TODO: MSVC does not support using offsetof() on non-static data members even though this // TODO: MSVC does not support using offsetof() on non-static data members even though this
// is technically allowed since C++11. This macro should be enabled once MSVC adds // is technically allowed since C++11. This macro should be enabled once MSVC adds
// support for that. // support for that.
@ -284,7 +296,7 @@ void GetGyroscopeLowRawToDpsCoefficient(Service::Interface* self);
* None * None
* Outputs: * Outputs:
* 1 : Result of function, 0 on success, otherwise error code * 1 : Result of function, 0 on success, otherwise error code
* 2~6 : CalibrateParam? * 2~6 (18 bytes) : struct GyroscopeCalibrateParam
*/ */
void GetGyroscopeLowCalibrateParam(Service::Interface* self); void GetGyroscopeLowCalibrateParam(Service::Interface* self);