From 926c5af0712b12441e9a7c6c7dba4104f8b2f2aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20St=C3=B6r?= Date: Sun, 15 Oct 2017 23:03:45 +0200 Subject: [PATCH] Revert "Swap reading y and z values (#2133)" (#2135) This reverts commit 92b6bad1e429db389419be46bd608ea37829f123. --- app/modules/hmc5883l.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/modules/hmc5883l.c b/app/modules/hmc5883l.c index e441b23553..210e5e0f7e 100644 --- a/app/modules/hmc5883l.c +++ b/app/modules/hmc5883l.c @@ -44,6 +44,7 @@ static int hmc5883_setup(lua_State* L) { if ((devid_a != 0x48) || (devid_b != 0x34) || (devid_c != 0x33)) { return luaL_error(L, "device not found"); } + // 8 sample average, 15 Hz update rate, normal measurement w8u(hmc5883_i2c_id, 0x00, 0x70); @@ -59,6 +60,7 @@ static int hmc5883_setup(lua_State* L) { <<<<<<< HEAD ======= static int hmc5883_init(lua_State* L) { + uint32_t sda; uint32_t scl; @@ -97,8 +99,8 @@ static int hmc5883_read(lua_State* L) { platform_i2c_send_stop(hmc5883_i2c_id); x = (int16_t) ((data[0] << 8) | data[1]); - z = (int16_t) ((data[2] << 8) | data[3]); - y = (int16_t) ((data[4] << 8) | data[5]); + y = (int16_t) ((data[2] << 8) | data[3]); + z = (int16_t) ((data[4] << 8) | data[5]); lua_pushinteger(L, x); lua_pushinteger(L, y);