diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2013-12-28 11:51:03 +0100 |
---|---|---|
committer | Jookia <166291@gmail.com> | 2016-11-05 16:19:31 +1100 |
commit | 16753d39744b496b3eeeea896eed7def57fdf67a (patch) | |
tree | 5670e235a25f12ca3b25dbfa1de731af0891b086 /sensors/akmdfs/AKFS_Disp.c | |
parent | e5d2aee9fb44d1fa695c44d332443f6e0d3899c5 (diff) | |
download | device_samsung_i9100-16753d39744b496b3eeeea896eed7def57fdf67a.zip device_samsung_i9100-16753d39744b496b3eeeea896eed7def57fdf67a.tar.gz device_samsung_i9100-16753d39744b496b3eeeea896eed7def57fdf67a.tar.bz2 |
SMDK4210 Sensors
Cherry-picked!
Conflict: "initial L bringup" changes sensor API, follow suit.
Conflict: libsensors changes, doesn't matter, just delete it.
Diffstat (limited to 'sensors/akmdfs/AKFS_Disp.c')
-rw-r--r-- | sensors/akmdfs/AKFS_Disp.c | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/sensors/akmdfs/AKFS_Disp.c b/sensors/akmdfs/AKFS_Disp.c new file mode 100644 index 0000000..4e7c501 --- /dev/null +++ b/sensors/akmdfs/AKFS_Disp.c @@ -0,0 +1,89 @@ +/****************************************************************************** + * + * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ******************************************************************************/ +#include "AKFS_Disp.h" +#include "AKFS_Common.h" + +/*! + Print startup message to Android Log daemon. + */ +void Disp_StartMessage(void) +{ + ALOGI("AK8975 Daemon for Open Source v20120329."); + ALOGI("Debug: %s", ((ENABLE_AKMDEBUG)?("ON"):("OFF"))); + ALOGI("Debug level: %d", DBG_LEVEL); +} + +/*! + Print ending message to Android Log daemon. + */ +void Disp_EndMessage(int ret) +{ + ALOGI("AK8975 for Android end (%d).", ret); +} + +/*! + Print result + */ +void Disp_Result(int buf[YPR_DATA_SIZE]) +{ + AKMDEBUG(DBG_LEVEL1, + "Flag=%d\n", buf[0]); + AKMDEBUG(DBG_LEVEL1, + "Acc(%d):%8.2f, %8.2f, %8.2f\n", + buf[4], REVERT_ACC(buf[1]), REVERT_ACC(buf[2]), REVERT_ACC(buf[3])); + AKMDEBUG(DBG_LEVEL1, + "Mag(%d):%8.2f, %8.2f, %8.2f\n", + buf[8], REVERT_MAG(buf[5]), REVERT_MAG(buf[6]), REVERT_MAG(buf[7])); + AKMDEBUG(DBG_LEVEL1, + "Ori(%d)=%8.2f, %8.2f, %8.2f\n", + buf[8], REVERT_ORI(buf[9]), REVERT_ORI(buf[10]), REVERT_ORI(buf[11])); +} + +/*! + Output main menu to stdout and wait for user input from stdin. + @return Selected mode. + */ +MODE Menu_Main(void) +{ + char msg[20]; + memset(msg, 0, sizeof(msg)); + + AKMDEBUG(DBG_LEVEL1, + " -------------------- AK8975 Console Application -------------------- \n" + " 1. Start measurement. \n" + " 2. Self-test. \n" + " Q. Quit application. \n" + " --------------------------------------------------------------------- \n" + " Please select a number.\n" + " ---> "); + fgets(msg, 10, stdin); + AKMDEBUG(DBG_LEVEL1, "\n"); + + /* BUG : If 2-digits number is input, */ + /* only the first character is compared. */ + if (!strncmp(msg, "1", 1)) { + return MODE_Measure; + } else if (!strncmp(msg, "2", 1)) { + return MODE_SelfTest; + } else if (strncmp(msg, "Q", 1) == 0 || strncmp(msg, "q", 1) == 0) { + return MODE_Quit; + } else { + return MODE_ERROR; + } +} + |