Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BMI160 max32630hsp3 MemoryLCD USBDevice
HostAccelHelper.h
00001 /******************************************************************************* 00002 * Copyright (C) 2018 Maxim Integrated Products, Inc., All Rights Reserved. 00003 * 00004 * Permission is hereby granted, free of charge, to any person obtaining a 00005 * copy of this software and associated documentation files (the "Software"), 00006 * to deal in the Software without restriction, including without limitation 00007 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00008 * and/or sell copies of the Software, and to permit persons to whom the 00009 * Software is furnished to do so, subject to the following conditions: 00010 * 00011 * The above copyright notice and this permission notice shall be included 00012 * in all copies or substantial portions of the Software. 00013 * 00014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00015 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00016 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00017 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES 00018 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00019 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00020 * OTHER DEALINGS IN THE SOFTWARE. 00021 * 00022 * Except as contained in this notice, the name of Maxim Integrated 00023 * Products, Inc. shall not be used except as stated in the Maxim Integrated 00024 * Products, Inc. Branding Policy. 00025 * 00026 * The mere transfer of this software does not imply any licenses 00027 * of trade secrets, proprietary technology, copyrights, patents, 00028 * trademarks, maskwork rights, or any other form of intellectual 00029 * property whatsoever. Maxim Integrated Products, Inc. retains all 00030 * ownership rights. 00031 ******************************************************************************* 00032 */ 00033 00034 #ifndef _HOST_ACCEL_HELPER_H_ 00035 #define _HOST_ACCEL_HELPER_H_ 00036 00037 #include <stdint.h> 00038 00039 /* Struct defining the sample of accelerometer 00040 * Note: as alogorithms expect data as mg or g ; calculations needs to be done over raws accel sensordata and convert to mg or g 00041 * acceld data is feed to sensor hub in mg or g format for all 3 axis,s data. Float definitions below are for mg and g 00042 * calculations and can be modified to work with fixed point data type. 00043 * 00044 * */ 00045 typedef struct _accel_data_t { 00046 float x; 00047 float y; 00048 float z; 00049 int16_t x_raw; 00050 int16_t y_raw; 00051 int16_t z_raw; 00052 } accel_data_t; 00053 00054 /** 00055 * @brief Initialize the accelerometer on the host device 00056 */ 00057 void CSTMR_SH_HostAccelerometerInitialize(); 00058 00059 /** 00060 * @brief Set default parameters for the accelerometer 00061 */ 00062 void CSTMR_SH_HostAccelerometerSetDefaults(); 00063 00064 /** 00065 * @brief Set the sampling rate of the accelerometer 00066 * 00067 * 00068 * @return 0 on SUCCESS 00069 */ 00070 int CSTMR_SH_HostAccelerometerSetSampleRate(int sampleRate); 00071 00072 /** 00073 * @brief Enable data ready interrupt of the accelerometer 00074 * 00075 * 00076 * @return 0 on SUCCESS 00077 */ 00078 int CSTMR_SH_HostAccelerometerEnableDataReadyInterrupt(); 00079 00080 /** 00081 * @brief Gets a sample from the accelerometer if the sample is ready 00082 * 00083 * 00084 * @return 0 on SUCCESS 00085 */ 00086 int CSTMR_SH_HostAccelerometerGet_sensor_xyz(accel_data_t *accel_data); 00087 00088 /** 00089 * @brief Add the given sample to the accelerometer queue 00090 * 00091 * 00092 * @return 0 on SUCCESS 00093 */ 00094 int CSTMR_SH_HostAccelerometerEnqueueData(accel_data_t *accel_data); 00095 00096 /** 00097 * @brief Get the sample count in the accelerometer queue 00098 * 00099 * 00100 * @return 0 on SUCCESS 00101 */ 00102 int CSTMR_SH_HostAccelerometerGetDataCount(); 00103 00104 /** 00105 * @brief Get a sample from the accelerometer queue 00106 * 00107 * 00108 * @return 0 on SUCCESS 00109 */ 00110 int CSTMR_SH_HostAccelerometerDequeuData(accel_data_t *accel_data); 00111 00112 00113 00114 00115 00116 00117 #endif 00118
Generated on Fri Jul 15 2022 22:42:36 by
