Example Host software for integration of MAX3266x chips (, MAX32664GWEB) equipped with Heart Rate from Wrist Algorithm. This is “stand-alone” software that runs on the MAX32630 low-power microcontroller to display heart rate on the display of the MAXREFDES101 reference design. It is intended provide a simple example of how to initialize and communicate with the sensor hub. Windows and Android communications are not supported.
Dependencies: Maxim_Sensor_Hub_Communications BMI160 whrmDemoUI max32630hsp3
Fork of Host_Software_MAX32664GWEB_HR_wrist by
SHMAX8614X_WHRM/HostAccelHelper.h@13:3d1a6b947396, 2019-01-10 (annotated)
- Committer:
- gmehmet
- Date:
- Thu Jan 10 11:06:01 2019 +0300
- Revision:
- 13:3d1a6b947396
Code for evaluating Max3266x Heart Rate from Wrist Agorithm
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gmehmet | 13:3d1a6b947396 | 1 | /******************************************************************************* |
gmehmet | 13:3d1a6b947396 | 2 | * Copyright (C) 2018 Maxim Integrated Products, Inc., All Rights Reserved. |
gmehmet | 13:3d1a6b947396 | 3 | * |
gmehmet | 13:3d1a6b947396 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
gmehmet | 13:3d1a6b947396 | 5 | * copy of this software and associated documentation files (the "Software"), |
gmehmet | 13:3d1a6b947396 | 6 | * to deal in the Software without restriction, including without limitation |
gmehmet | 13:3d1a6b947396 | 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
gmehmet | 13:3d1a6b947396 | 8 | * and/or sell copies of the Software, and to permit persons to whom the |
gmehmet | 13:3d1a6b947396 | 9 | * Software is furnished to do so, subject to the following conditions: |
gmehmet | 13:3d1a6b947396 | 10 | * |
gmehmet | 13:3d1a6b947396 | 11 | * The above copyright notice and this permission notice shall be included |
gmehmet | 13:3d1a6b947396 | 12 | * in all copies or substantial portions of the Software. |
gmehmet | 13:3d1a6b947396 | 13 | * |
gmehmet | 13:3d1a6b947396 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
gmehmet | 13:3d1a6b947396 | 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
gmehmet | 13:3d1a6b947396 | 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
gmehmet | 13:3d1a6b947396 | 17 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
gmehmet | 13:3d1a6b947396 | 18 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
gmehmet | 13:3d1a6b947396 | 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
gmehmet | 13:3d1a6b947396 | 20 | * OTHER DEALINGS IN THE SOFTWARE. |
gmehmet | 13:3d1a6b947396 | 21 | * |
gmehmet | 13:3d1a6b947396 | 22 | * Except as contained in this notice, the name of Maxim Integrated |
gmehmet | 13:3d1a6b947396 | 23 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
gmehmet | 13:3d1a6b947396 | 24 | * Products, Inc. Branding Policy. |
gmehmet | 13:3d1a6b947396 | 25 | * |
gmehmet | 13:3d1a6b947396 | 26 | * The mere transfer of this software does not imply any licenses |
gmehmet | 13:3d1a6b947396 | 27 | * of trade secrets, proprietary technology, copyrights, patents, |
gmehmet | 13:3d1a6b947396 | 28 | * trademarks, maskwork rights, or any other form of intellectual |
gmehmet | 13:3d1a6b947396 | 29 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
gmehmet | 13:3d1a6b947396 | 30 | * ownership rights. |
gmehmet | 13:3d1a6b947396 | 31 | ******************************************************************************* |
gmehmet | 13:3d1a6b947396 | 32 | */ |
gmehmet | 13:3d1a6b947396 | 33 | |
gmehmet | 13:3d1a6b947396 | 34 | #ifndef _HOST_ACCEL_HELPER_H_ |
gmehmet | 13:3d1a6b947396 | 35 | #define _HOST_ACCEL_HELPER_H_ |
gmehmet | 13:3d1a6b947396 | 36 | |
gmehmet | 13:3d1a6b947396 | 37 | #include <stdint.h> |
gmehmet | 13:3d1a6b947396 | 38 | |
gmehmet | 13:3d1a6b947396 | 39 | /* Struct defining the sample of accelerometer |
gmehmet | 13:3d1a6b947396 | 40 | * Note: as alogorithms expect data as mg or g ; calculations needs to be done over raws accel sensordata and convert to mg or g |
gmehmet | 13:3d1a6b947396 | 41 | * 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 |
gmehmet | 13:3d1a6b947396 | 42 | * calculations and can be modified to work with fixed point data type. |
gmehmet | 13:3d1a6b947396 | 43 | * |
gmehmet | 13:3d1a6b947396 | 44 | * */ |
gmehmet | 13:3d1a6b947396 | 45 | typedef struct _accel_data_t { |
gmehmet | 13:3d1a6b947396 | 46 | float x; |
gmehmet | 13:3d1a6b947396 | 47 | float y; |
gmehmet | 13:3d1a6b947396 | 48 | float z; |
gmehmet | 13:3d1a6b947396 | 49 | int16_t x_raw; |
gmehmet | 13:3d1a6b947396 | 50 | int16_t y_raw; |
gmehmet | 13:3d1a6b947396 | 51 | int16_t z_raw; |
gmehmet | 13:3d1a6b947396 | 52 | } accel_data_t; |
gmehmet | 13:3d1a6b947396 | 53 | |
gmehmet | 13:3d1a6b947396 | 54 | /** |
gmehmet | 13:3d1a6b947396 | 55 | * @brief Initialize the accelerometer on the host device |
gmehmet | 13:3d1a6b947396 | 56 | */ |
gmehmet | 13:3d1a6b947396 | 57 | void CSTMR_SH_HostAccelerometerInitialize(); |
gmehmet | 13:3d1a6b947396 | 58 | |
gmehmet | 13:3d1a6b947396 | 59 | /** |
gmehmet | 13:3d1a6b947396 | 60 | * @brief Set default parameters for the accelerometer |
gmehmet | 13:3d1a6b947396 | 61 | */ |
gmehmet | 13:3d1a6b947396 | 62 | void CSTMR_SH_HostAccelerometerSetDefaults(); |
gmehmet | 13:3d1a6b947396 | 63 | |
gmehmet | 13:3d1a6b947396 | 64 | /** |
gmehmet | 13:3d1a6b947396 | 65 | * @brief Set the sampling rate of the accelerometer |
gmehmet | 13:3d1a6b947396 | 66 | * |
gmehmet | 13:3d1a6b947396 | 67 | * |
gmehmet | 13:3d1a6b947396 | 68 | * @return 0 on SUCCESS |
gmehmet | 13:3d1a6b947396 | 69 | */ |
gmehmet | 13:3d1a6b947396 | 70 | int CSTMR_SH_HostAccelerometerSetSampleRate(int sampleRate); |
gmehmet | 13:3d1a6b947396 | 71 | |
gmehmet | 13:3d1a6b947396 | 72 | /** |
gmehmet | 13:3d1a6b947396 | 73 | * @brief Enable data ready interrupt of the accelerometer |
gmehmet | 13:3d1a6b947396 | 74 | * |
gmehmet | 13:3d1a6b947396 | 75 | * |
gmehmet | 13:3d1a6b947396 | 76 | * @return 0 on SUCCESS |
gmehmet | 13:3d1a6b947396 | 77 | */ |
gmehmet | 13:3d1a6b947396 | 78 | int CSTMR_SH_HostAccelerometerEnableDataReadyInterrupt(); |
gmehmet | 13:3d1a6b947396 | 79 | |
gmehmet | 13:3d1a6b947396 | 80 | /** |
gmehmet | 13:3d1a6b947396 | 81 | * @brief Gets a sample from the accelerometer if the sample is ready |
gmehmet | 13:3d1a6b947396 | 82 | * |
gmehmet | 13:3d1a6b947396 | 83 | * |
gmehmet | 13:3d1a6b947396 | 84 | * @return 0 on SUCCESS |
gmehmet | 13:3d1a6b947396 | 85 | */ |
gmehmet | 13:3d1a6b947396 | 86 | int CSTMR_SH_HostAccelerometerGet_sensor_xyz(accel_data_t *accel_data); |
gmehmet | 13:3d1a6b947396 | 87 | |
gmehmet | 13:3d1a6b947396 | 88 | /** |
gmehmet | 13:3d1a6b947396 | 89 | * @brief Add the given sample to the accelerometer queue |
gmehmet | 13:3d1a6b947396 | 90 | * |
gmehmet | 13:3d1a6b947396 | 91 | * |
gmehmet | 13:3d1a6b947396 | 92 | * @return 0 on SUCCESS |
gmehmet | 13:3d1a6b947396 | 93 | */ |
gmehmet | 13:3d1a6b947396 | 94 | int CSTMR_SH_HostAccelerometerEnqueueData(accel_data_t *accel_data); |
gmehmet | 13:3d1a6b947396 | 95 | |
gmehmet | 13:3d1a6b947396 | 96 | /** |
gmehmet | 13:3d1a6b947396 | 97 | * @brief Get the sample count in the accelerometer queue |
gmehmet | 13:3d1a6b947396 | 98 | * |
gmehmet | 13:3d1a6b947396 | 99 | * |
gmehmet | 13:3d1a6b947396 | 100 | * @return 0 on SUCCESS |
gmehmet | 13:3d1a6b947396 | 101 | */ |
gmehmet | 13:3d1a6b947396 | 102 | int CSTMR_SH_HostAccelerometerGetDataCount(); |
gmehmet | 13:3d1a6b947396 | 103 | |
gmehmet | 13:3d1a6b947396 | 104 | /** |
gmehmet | 13:3d1a6b947396 | 105 | * @brief Get a sample from the accelerometer queue |
gmehmet | 13:3d1a6b947396 | 106 | * |
gmehmet | 13:3d1a6b947396 | 107 | * |
gmehmet | 13:3d1a6b947396 | 108 | * @return 0 on SUCCESS |
gmehmet | 13:3d1a6b947396 | 109 | */ |
gmehmet | 13:3d1a6b947396 | 110 | int CSTMR_SH_HostAccelerometerDequeuData(accel_data_t *accel_data); |
gmehmet | 13:3d1a6b947396 | 111 | |
gmehmet | 13:3d1a6b947396 | 112 | |
gmehmet | 13:3d1a6b947396 | 113 | |
gmehmet | 13:3d1a6b947396 | 114 | |
gmehmet | 13:3d1a6b947396 | 115 | |
gmehmet | 13:3d1a6b947396 | 116 | |
gmehmet | 13:3d1a6b947396 | 117 | #endif |