HAHA
Dependencies: ST_INTERFACES X_NUCLEO_COMMON
Dependents: b_NYP_humanoid a_NYP_humanoid_copy
Fork of LSM6DSL by
LSM6DSL_acc_gyro_driver.c@3:20ccff7dd652, 2017-10-03 (annotated)
- Committer:
- mapellil
- Date:
- Tue Oct 03 14:04:56 2017 +0200
- Revision:
- 3:20ccff7dd652
- Parent:
- 0:704c89673b57
Added support for targets SensorTile (through define; set target NUCLEO_L476RG), DISCO_L475VG_IOT01A, Nucleoxx+IKS01A2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nikapov | 0:704c89673b57 | 1 | /** |
nikapov | 0:704c89673b57 | 2 | ****************************************************************************** |
nikapov | 0:704c89673b57 | 3 | * @file LSM6DSL_acc_gyro_driver.c |
nikapov | 0:704c89673b57 | 4 | * @author MEMS Application Team |
nikapov | 0:704c89673b57 | 5 | * @version V1.5 |
nikapov | 0:704c89673b57 | 6 | * @date 17-May-2016 |
nikapov | 0:704c89673b57 | 7 | * @brief LSM6DSL driver file |
nikapov | 0:704c89673b57 | 8 | ****************************************************************************** |
nikapov | 0:704c89673b57 | 9 | * @attention |
nikapov | 0:704c89673b57 | 10 | * |
nikapov | 0:704c89673b57 | 11 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
nikapov | 0:704c89673b57 | 12 | * |
nikapov | 0:704c89673b57 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
nikapov | 0:704c89673b57 | 14 | * are permitted provided that the following conditions are met: |
nikapov | 0:704c89673b57 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
nikapov | 0:704c89673b57 | 16 | * this list of conditions and the following disclaimer. |
nikapov | 0:704c89673b57 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
nikapov | 0:704c89673b57 | 18 | * this list of conditions and the following disclaimer in the documentation |
nikapov | 0:704c89673b57 | 19 | * and/or other materials provided with the distribution. |
nikapov | 0:704c89673b57 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
nikapov | 0:704c89673b57 | 21 | * may be used to endorse or promote products derived from this software |
nikapov | 0:704c89673b57 | 22 | * without specific prior written permission. |
nikapov | 0:704c89673b57 | 23 | * |
nikapov | 0:704c89673b57 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
nikapov | 0:704c89673b57 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
nikapov | 0:704c89673b57 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
nikapov | 0:704c89673b57 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
nikapov | 0:704c89673b57 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
nikapov | 0:704c89673b57 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
nikapov | 0:704c89673b57 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
nikapov | 0:704c89673b57 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
nikapov | 0:704c89673b57 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
nikapov | 0:704c89673b57 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
nikapov | 0:704c89673b57 | 34 | * |
nikapov | 0:704c89673b57 | 35 | ****************************************************************************** |
nikapov | 0:704c89673b57 | 36 | */ |
nikapov | 0:704c89673b57 | 37 | |
nikapov | 0:704c89673b57 | 38 | /* Includes ------------------------------------------------------------------*/ |
nikapov | 0:704c89673b57 | 39 | #include "LSM6DSL_acc_gyro_driver.h" |
nikapov | 0:704c89673b57 | 40 | |
nikapov | 0:704c89673b57 | 41 | /* Imported function prototypes ----------------------------------------------*/ |
nikapov | 0:704c89673b57 | 42 | extern uint8_t LSM6DSL_io_write(void *handle, uint8_t WriteAddr, uint8_t *pBuffer, uint16_t nBytesToWrite); |
nikapov | 0:704c89673b57 | 43 | extern uint8_t LSM6DSL_io_read(void *handle, uint8_t ReadAddr, uint8_t *pBuffer, uint16_t nBytesToRead); |
nikapov | 0:704c89673b57 | 44 | |
nikapov | 0:704c89673b57 | 45 | /* Private typedef -----------------------------------------------------------*/ |
nikapov | 0:704c89673b57 | 46 | |
nikapov | 0:704c89673b57 | 47 | /* Private define ------------------------------------------------------------*/ |
nikapov | 0:704c89673b57 | 48 | |
nikapov | 0:704c89673b57 | 49 | /* Private macro -------------------------------------------------------------*/ |
nikapov | 0:704c89673b57 | 50 | |
nikapov | 0:704c89673b57 | 51 | /* Private variables ---------------------------------------------------------*/ |
nikapov | 0:704c89673b57 | 52 | |
nikapov | 0:704c89673b57 | 53 | /* Private functions ---------------------------------------------------------*/ |
nikapov | 0:704c89673b57 | 54 | |
nikapov | 0:704c89673b57 | 55 | /* Exported functions ---------------------------------------------------------*/ |
nikapov | 0:704c89673b57 | 56 | |
nikapov | 0:704c89673b57 | 57 | /************** Generic Function *******************/ |
nikapov | 0:704c89673b57 | 58 | |
nikapov | 0:704c89673b57 | 59 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 60 | * Function Name : LSM6DSL_ACC_GYRO_read_reg |
nikapov | 0:704c89673b57 | 61 | * Description : Generic Reading function. It must be fullfilled with either |
nikapov | 0:704c89673b57 | 62 | * : I2C or SPI reading functions |
nikapov | 0:704c89673b57 | 63 | * Input : Register Address, length of buffer |
nikapov | 0:704c89673b57 | 64 | * Output : Data REad |
nikapov | 0:704c89673b57 | 65 | * Return : None |
nikapov | 0:704c89673b57 | 66 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 67 | mems_status_t LSM6DSL_ACC_GYRO_read_reg(void *handle, u8_t Reg, u8_t* Data, u16_t len) |
nikapov | 0:704c89673b57 | 68 | { |
nikapov | 0:704c89673b57 | 69 | if (LSM6DSL_io_read(handle, Reg, Data, len)) |
nikapov | 0:704c89673b57 | 70 | { |
nikapov | 0:704c89673b57 | 71 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 72 | } |
nikapov | 0:704c89673b57 | 73 | else |
nikapov | 0:704c89673b57 | 74 | { |
nikapov | 0:704c89673b57 | 75 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 76 | } |
nikapov | 0:704c89673b57 | 77 | } |
nikapov | 0:704c89673b57 | 78 | |
nikapov | 0:704c89673b57 | 79 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 80 | * Function Name : LSM6DSL_ACC_GYRO_write_reg |
nikapov | 0:704c89673b57 | 81 | * Description : Generic Writing function. It must be fullfilled with either |
nikapov | 0:704c89673b57 | 82 | * : I2C or SPI writing function |
nikapov | 0:704c89673b57 | 83 | * Input : Register Address, Data to be written, length of buffer |
nikapov | 0:704c89673b57 | 84 | * Output : None |
nikapov | 0:704c89673b57 | 85 | * Return : None |
nikapov | 0:704c89673b57 | 86 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 87 | mems_status_t LSM6DSL_ACC_GYRO_write_reg(void *handle, u8_t Reg, u8_t *Data, u16_t len) |
nikapov | 0:704c89673b57 | 88 | { |
nikapov | 0:704c89673b57 | 89 | if (LSM6DSL_io_write(handle, Reg, Data, len)) |
nikapov | 0:704c89673b57 | 90 | { |
nikapov | 0:704c89673b57 | 91 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 92 | } |
nikapov | 0:704c89673b57 | 93 | else |
nikapov | 0:704c89673b57 | 94 | { |
nikapov | 0:704c89673b57 | 95 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 96 | } |
nikapov | 0:704c89673b57 | 97 | } |
nikapov | 0:704c89673b57 | 98 | |
nikapov | 0:704c89673b57 | 99 | /**************** Base Function *******************/ |
nikapov | 0:704c89673b57 | 100 | |
nikapov | 0:704c89673b57 | 101 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 102 | * Function Name : LSM6DSL_ACC_GYRO_R_WHO_AM_I |
nikapov | 0:704c89673b57 | 103 | * Description : Read WHO_AM_I_BIT |
nikapov | 0:704c89673b57 | 104 | * Input : Pointer to u8_t |
nikapov | 0:704c89673b57 | 105 | * Output : Status of WHO_AM_I_BIT |
nikapov | 0:704c89673b57 | 106 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 107 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 108 | mems_status_t LSM6DSL_ACC_GYRO_R_WHO_AM_I(void *handle, u8_t *value) |
nikapov | 0:704c89673b57 | 109 | { |
nikapov | 0:704c89673b57 | 110 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_WHO_AM_I_REG, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 111 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 112 | |
nikapov | 0:704c89673b57 | 113 | *value &= LSM6DSL_ACC_GYRO_WHO_AM_I_BIT_MASK; //coerce |
nikapov | 0:704c89673b57 | 114 | *value = *value >> LSM6DSL_ACC_GYRO_WHO_AM_I_BIT_POSITION; //mask |
nikapov | 0:704c89673b57 | 115 | |
nikapov | 0:704c89673b57 | 116 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 117 | } |
nikapov | 0:704c89673b57 | 118 | |
nikapov | 0:704c89673b57 | 119 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 120 | * Function Name : LSM6DSL_ACC_GYRO_W_BDU |
nikapov | 0:704c89673b57 | 121 | * Description : Write BDU |
nikapov | 0:704c89673b57 | 122 | * Input : LSM6DSL_ACC_GYRO_BDU_t |
nikapov | 0:704c89673b57 | 123 | * Output : None |
nikapov | 0:704c89673b57 | 124 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 125 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 126 | mems_status_t LSM6DSL_ACC_GYRO_W_BDU(void *handle, LSM6DSL_ACC_GYRO_BDU_t newValue) |
nikapov | 0:704c89673b57 | 127 | { |
nikapov | 0:704c89673b57 | 128 | u8_t value; |
nikapov | 0:704c89673b57 | 129 | |
nikapov | 0:704c89673b57 | 130 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL3_C, &value, 1)) |
nikapov | 0:704c89673b57 | 131 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 132 | |
nikapov | 0:704c89673b57 | 133 | value &= ~LSM6DSL_ACC_GYRO_BDU_MASK; |
nikapov | 0:704c89673b57 | 134 | value |= newValue; |
nikapov | 0:704c89673b57 | 135 | |
nikapov | 0:704c89673b57 | 136 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL3_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 137 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 138 | |
nikapov | 0:704c89673b57 | 139 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 140 | } |
nikapov | 0:704c89673b57 | 141 | |
nikapov | 0:704c89673b57 | 142 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 143 | * Function Name : LSM6DSL_ACC_GYRO_R_BDU |
nikapov | 0:704c89673b57 | 144 | * Description : Read BDU |
nikapov | 0:704c89673b57 | 145 | * Input : Pointer to LSM6DSL_ACC_GYRO_BDU_t |
nikapov | 0:704c89673b57 | 146 | * Output : Status of BDU see LSM6DSL_ACC_GYRO_BDU_t |
nikapov | 0:704c89673b57 | 147 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 148 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 149 | mems_status_t LSM6DSL_ACC_GYRO_R_BDU(void *handle, LSM6DSL_ACC_GYRO_BDU_t *value) |
nikapov | 0:704c89673b57 | 150 | { |
nikapov | 0:704c89673b57 | 151 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL3_C, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 152 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 153 | |
nikapov | 0:704c89673b57 | 154 | *value &= LSM6DSL_ACC_GYRO_BDU_MASK; //mask |
nikapov | 0:704c89673b57 | 155 | |
nikapov | 0:704c89673b57 | 156 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 157 | } |
nikapov | 0:704c89673b57 | 158 | |
nikapov | 0:704c89673b57 | 159 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 160 | * Function Name : LSM6DSL_ACC_GYRO_W_FS_XL |
nikapov | 0:704c89673b57 | 161 | * Description : Write FS_XL |
nikapov | 0:704c89673b57 | 162 | * Input : LSM6DSL_ACC_GYRO_FS_XL_t |
nikapov | 0:704c89673b57 | 163 | * Output : None |
nikapov | 0:704c89673b57 | 164 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 165 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 166 | mems_status_t LSM6DSL_ACC_GYRO_W_FS_XL(void *handle, LSM6DSL_ACC_GYRO_FS_XL_t newValue) |
nikapov | 0:704c89673b57 | 167 | { |
nikapov | 0:704c89673b57 | 168 | u8_t value; |
nikapov | 0:704c89673b57 | 169 | |
nikapov | 0:704c89673b57 | 170 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL1_XL, &value, 1)) |
nikapov | 0:704c89673b57 | 171 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 172 | |
nikapov | 0:704c89673b57 | 173 | value &= ~LSM6DSL_ACC_GYRO_FS_XL_MASK; |
nikapov | 0:704c89673b57 | 174 | value |= newValue; |
nikapov | 0:704c89673b57 | 175 | |
nikapov | 0:704c89673b57 | 176 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL1_XL, &value, 1) ) |
nikapov | 0:704c89673b57 | 177 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 178 | |
nikapov | 0:704c89673b57 | 179 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 180 | } |
nikapov | 0:704c89673b57 | 181 | |
nikapov | 0:704c89673b57 | 182 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 183 | * Function Name : LSM6DSL_ACC_GYRO_R_FS_XL |
nikapov | 0:704c89673b57 | 184 | * Description : Read FS_XL |
nikapov | 0:704c89673b57 | 185 | * Input : Pointer to LSM6DSL_ACC_GYRO_FS_XL_t |
nikapov | 0:704c89673b57 | 186 | * Output : Status of FS_XL see LSM6DSL_ACC_GYRO_FS_XL_t |
nikapov | 0:704c89673b57 | 187 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 188 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 189 | mems_status_t LSM6DSL_ACC_GYRO_R_FS_XL(void *handle, LSM6DSL_ACC_GYRO_FS_XL_t *value) |
nikapov | 0:704c89673b57 | 190 | { |
nikapov | 0:704c89673b57 | 191 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL1_XL, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 192 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 193 | |
nikapov | 0:704c89673b57 | 194 | *value &= LSM6DSL_ACC_GYRO_FS_XL_MASK; //mask |
nikapov | 0:704c89673b57 | 195 | |
nikapov | 0:704c89673b57 | 196 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 197 | } |
nikapov | 0:704c89673b57 | 198 | |
nikapov | 0:704c89673b57 | 199 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 200 | * Function Name : mems_status_t LSM6DSL_ACC_GYRO_GetRawAccData(u8_t *buff) |
nikapov | 0:704c89673b57 | 201 | * Description : Read GetAccData output register |
nikapov | 0:704c89673b57 | 202 | * Input : pointer to [u8_t] |
nikapov | 0:704c89673b57 | 203 | * Output : GetAccData buffer u8_t |
nikapov | 0:704c89673b57 | 204 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 205 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 206 | mems_status_t LSM6DSL_ACC_GYRO_GetRawAccData(void *handle, u8_t *buff) |
nikapov | 0:704c89673b57 | 207 | { |
nikapov | 0:704c89673b57 | 208 | u8_t i, j, k; |
nikapov | 0:704c89673b57 | 209 | u8_t numberOfByteForDimension; |
nikapov | 0:704c89673b57 | 210 | |
nikapov | 0:704c89673b57 | 211 | numberOfByteForDimension=6/3; |
nikapov | 0:704c89673b57 | 212 | |
nikapov | 0:704c89673b57 | 213 | k=0; |
nikapov | 0:704c89673b57 | 214 | for (i=0; i<3;i++ ) |
nikapov | 0:704c89673b57 | 215 | { |
nikapov | 0:704c89673b57 | 216 | for (j=0; j<numberOfByteForDimension;j++ ) |
nikapov | 0:704c89673b57 | 217 | { |
nikapov | 0:704c89673b57 | 218 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_OUTX_L_XL+k, &buff[k], 1)) |
nikapov | 0:704c89673b57 | 219 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 220 | k++; |
nikapov | 0:704c89673b57 | 221 | } |
nikapov | 0:704c89673b57 | 222 | } |
nikapov | 0:704c89673b57 | 223 | |
nikapov | 0:704c89673b57 | 224 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 225 | } |
nikapov | 0:704c89673b57 | 226 | |
nikapov | 0:704c89673b57 | 227 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 228 | * Function Name : mems_status_t LSM6DSL_ACC_Get_Acceleration(void *handle, int *buff, u8_t from_fifo) |
nikapov | 0:704c89673b57 | 229 | * Description : Read GetAccData output register |
nikapov | 0:704c89673b57 | 230 | * Input : pointer to [u8_t] |
nikapov | 0:704c89673b57 | 231 | * Output : values are expressed in mg |
nikapov | 0:704c89673b57 | 232 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 233 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 234 | /* |
nikapov | 0:704c89673b57 | 235 | * Following is the table of sensitivity values for each case. |
nikapov | 0:704c89673b57 | 236 | * Values are expressed in ug/digit. |
nikapov | 0:704c89673b57 | 237 | */ |
nikapov | 0:704c89673b57 | 238 | static const long long LSM6DSL_ACC_Sensitivity_List[4] = { |
nikapov | 0:704c89673b57 | 239 | 61, /* FS @2g */ |
nikapov | 0:704c89673b57 | 240 | 122, /* FS @4g */ |
nikapov | 0:704c89673b57 | 241 | 244, /* FS @8g */ |
nikapov | 0:704c89673b57 | 242 | 488, /* FS @16g */ |
nikapov | 0:704c89673b57 | 243 | }; |
nikapov | 0:704c89673b57 | 244 | mems_status_t LSM6DSL_ACC_Get_Acceleration(void *handle, int *buff, u8_t from_fifo) |
nikapov | 0:704c89673b57 | 245 | { |
nikapov | 0:704c89673b57 | 246 | LSM6DSL_ACC_GYRO_FS_XL_t fs; |
nikapov | 0:704c89673b57 | 247 | long long sensitivity = 0; |
nikapov | 0:704c89673b57 | 248 | Type3Axis16bit_U raw_data_tmp; |
nikapov | 0:704c89673b57 | 249 | |
nikapov | 0:704c89673b57 | 250 | /* Read out current odr, fs, hf setting */ |
nikapov | 0:704c89673b57 | 251 | LSM6DSL_ACC_GYRO_R_FS_XL(handle, &fs); |
nikapov | 0:704c89673b57 | 252 | |
nikapov | 0:704c89673b57 | 253 | /* Determine the sensitivity according to fs */ |
nikapov | 0:704c89673b57 | 254 | switch(fs) { |
nikapov | 0:704c89673b57 | 255 | case LSM6DSL_ACC_GYRO_FS_XL_2g: |
nikapov | 0:704c89673b57 | 256 | sensitivity = LSM6DSL_ACC_Sensitivity_List[0]; |
nikapov | 0:704c89673b57 | 257 | break; |
nikapov | 0:704c89673b57 | 258 | |
nikapov | 0:704c89673b57 | 259 | case LSM6DSL_ACC_GYRO_FS_XL_4g: |
nikapov | 0:704c89673b57 | 260 | sensitivity = LSM6DSL_ACC_Sensitivity_List[1]; |
nikapov | 0:704c89673b57 | 261 | break; |
nikapov | 0:704c89673b57 | 262 | |
nikapov | 0:704c89673b57 | 263 | case LSM6DSL_ACC_GYRO_FS_XL_8g: |
nikapov | 0:704c89673b57 | 264 | sensitivity = LSM6DSL_ACC_Sensitivity_List[2]; |
nikapov | 0:704c89673b57 | 265 | break; |
nikapov | 0:704c89673b57 | 266 | |
nikapov | 0:704c89673b57 | 267 | case LSM6DSL_ACC_GYRO_FS_XL_16g: |
nikapov | 0:704c89673b57 | 268 | sensitivity = LSM6DSL_ACC_Sensitivity_List[3]; |
nikapov | 0:704c89673b57 | 269 | break; |
nikapov | 0:704c89673b57 | 270 | } |
nikapov | 0:704c89673b57 | 271 | |
nikapov | 0:704c89673b57 | 272 | /* Read out raw accelerometer samples */ |
nikapov | 0:704c89673b57 | 273 | if (from_fifo) { |
nikapov | 0:704c89673b57 | 274 | u8_t i; |
nikapov | 0:704c89673b57 | 275 | |
nikapov | 0:704c89673b57 | 276 | /* read all 3 axis from FIFO */ |
nikapov | 0:704c89673b57 | 277 | for(i = 0; i < 3; i++) |
nikapov | 0:704c89673b57 | 278 | LSM6DSL_ACC_GYRO_Get_GetFIFOData(handle, raw_data_tmp.u8bit + 2*i); |
nikapov | 0:704c89673b57 | 279 | } else |
nikapov | 0:704c89673b57 | 280 | LSM6DSL_ACC_GYRO_GetRawAccData(handle, raw_data_tmp.u8bit); |
nikapov | 0:704c89673b57 | 281 | |
nikapov | 0:704c89673b57 | 282 | /* Apply proper shift and sensitivity */ |
nikapov | 0:704c89673b57 | 283 | buff[0] = (raw_data_tmp.i16bit[0] * sensitivity + 500)/1000; |
nikapov | 0:704c89673b57 | 284 | buff[1] = (raw_data_tmp.i16bit[1] * sensitivity + 500)/1000; |
nikapov | 0:704c89673b57 | 285 | buff[2] = (raw_data_tmp.i16bit[2] * sensitivity + 500)/1000; |
nikapov | 0:704c89673b57 | 286 | |
nikapov | 0:704c89673b57 | 287 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 288 | } |
nikapov | 0:704c89673b57 | 289 | |
nikapov | 0:704c89673b57 | 290 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 291 | * Function Name : LSM6DSL_ACC_GYRO_W_ODR_XL |
nikapov | 0:704c89673b57 | 292 | * Description : Write ODR_XL |
nikapov | 0:704c89673b57 | 293 | * Input : LSM6DSL_ACC_GYRO_ODR_XL_t |
nikapov | 0:704c89673b57 | 294 | * Output : None |
nikapov | 0:704c89673b57 | 295 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 296 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 297 | mems_status_t LSM6DSL_ACC_GYRO_W_ODR_XL(void *handle, LSM6DSL_ACC_GYRO_ODR_XL_t newValue) |
nikapov | 0:704c89673b57 | 298 | { |
nikapov | 0:704c89673b57 | 299 | u8_t value; |
nikapov | 0:704c89673b57 | 300 | |
nikapov | 0:704c89673b57 | 301 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL1_XL, &value, 1)) |
nikapov | 0:704c89673b57 | 302 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 303 | |
nikapov | 0:704c89673b57 | 304 | value &= ~LSM6DSL_ACC_GYRO_ODR_XL_MASK; |
nikapov | 0:704c89673b57 | 305 | value |= newValue; |
nikapov | 0:704c89673b57 | 306 | |
nikapov | 0:704c89673b57 | 307 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL1_XL, &value, 1) ) |
nikapov | 0:704c89673b57 | 308 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 309 | |
nikapov | 0:704c89673b57 | 310 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 311 | } |
nikapov | 0:704c89673b57 | 312 | |
nikapov | 0:704c89673b57 | 313 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 314 | * Function Name : LSM6DSL_ACC_GYRO_R_ODR_XL |
nikapov | 0:704c89673b57 | 315 | * Description : Read ODR_XL |
nikapov | 0:704c89673b57 | 316 | * Input : Pointer to LSM6DSL_ACC_GYRO_ODR_XL_t |
nikapov | 0:704c89673b57 | 317 | * Output : Status of ODR_XL see LSM6DSL_ACC_GYRO_ODR_XL_t |
nikapov | 0:704c89673b57 | 318 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 319 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 320 | mems_status_t LSM6DSL_ACC_GYRO_R_ODR_XL(void *handle, LSM6DSL_ACC_GYRO_ODR_XL_t *value) |
nikapov | 0:704c89673b57 | 321 | { |
nikapov | 0:704c89673b57 | 322 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL1_XL, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 323 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 324 | |
nikapov | 0:704c89673b57 | 325 | *value &= LSM6DSL_ACC_GYRO_ODR_XL_MASK; //mask |
nikapov | 0:704c89673b57 | 326 | |
nikapov | 0:704c89673b57 | 327 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 328 | } |
nikapov | 0:704c89673b57 | 329 | |
nikapov | 0:704c89673b57 | 330 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 331 | * Function Name : LSM6DSL_ACC_GYRO_translate_ODR_XL |
nikapov | 0:704c89673b57 | 332 | * Description : Read ODR_XL |
nikapov | 0:704c89673b57 | 333 | * Input : LSM6DSL_ACC_GYRO_ODR_XL_t |
nikapov | 0:704c89673b57 | 334 | * Output : The ODR value in Hz |
nikapov | 0:704c89673b57 | 335 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 336 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 337 | mems_status_t LSM6DSL_ACC_GYRO_translate_ODR_XL(LSM6DSL_ACC_GYRO_ODR_XL_t value, u16_t *odr_hz_val) |
nikapov | 0:704c89673b57 | 338 | { |
nikapov | 0:704c89673b57 | 339 | switch(value) { |
nikapov | 0:704c89673b57 | 340 | case LSM6DSL_ACC_GYRO_ODR_XL_POWER_DOWN: |
nikapov | 0:704c89673b57 | 341 | *odr_hz_val = 0; |
nikapov | 0:704c89673b57 | 342 | break; |
nikapov | 0:704c89673b57 | 343 | |
nikapov | 0:704c89673b57 | 344 | case LSM6DSL_ACC_GYRO_ODR_XL_13Hz: |
nikapov | 0:704c89673b57 | 345 | *odr_hz_val = 13; |
nikapov | 0:704c89673b57 | 346 | break; |
nikapov | 0:704c89673b57 | 347 | |
nikapov | 0:704c89673b57 | 348 | case LSM6DSL_ACC_GYRO_ODR_XL_26Hz: |
nikapov | 0:704c89673b57 | 349 | *odr_hz_val = 26; |
nikapov | 0:704c89673b57 | 350 | break; |
nikapov | 0:704c89673b57 | 351 | |
nikapov | 0:704c89673b57 | 352 | case LSM6DSL_ACC_GYRO_ODR_XL_52Hz: |
nikapov | 0:704c89673b57 | 353 | *odr_hz_val = 52; |
nikapov | 0:704c89673b57 | 354 | break; |
nikapov | 0:704c89673b57 | 355 | |
nikapov | 0:704c89673b57 | 356 | case LSM6DSL_ACC_GYRO_ODR_XL_104Hz: |
nikapov | 0:704c89673b57 | 357 | *odr_hz_val = 104; |
nikapov | 0:704c89673b57 | 358 | break; |
nikapov | 0:704c89673b57 | 359 | |
nikapov | 0:704c89673b57 | 360 | case LSM6DSL_ACC_GYRO_ODR_XL_208Hz: |
nikapov | 0:704c89673b57 | 361 | *odr_hz_val = 208; |
nikapov | 0:704c89673b57 | 362 | break; |
nikapov | 0:704c89673b57 | 363 | |
nikapov | 0:704c89673b57 | 364 | case LSM6DSL_ACC_GYRO_ODR_XL_416Hz: |
nikapov | 0:704c89673b57 | 365 | *odr_hz_val = 416; |
nikapov | 0:704c89673b57 | 366 | break; |
nikapov | 0:704c89673b57 | 367 | |
nikapov | 0:704c89673b57 | 368 | case LSM6DSL_ACC_GYRO_ODR_XL_833Hz: |
nikapov | 0:704c89673b57 | 369 | *odr_hz_val = 833; |
nikapov | 0:704c89673b57 | 370 | break; |
nikapov | 0:704c89673b57 | 371 | |
nikapov | 0:704c89673b57 | 372 | case LSM6DSL_ACC_GYRO_ODR_XL_1660Hz: |
nikapov | 0:704c89673b57 | 373 | *odr_hz_val = 1660; |
nikapov | 0:704c89673b57 | 374 | break; |
nikapov | 0:704c89673b57 | 375 | |
nikapov | 0:704c89673b57 | 376 | default: |
nikapov | 0:704c89673b57 | 377 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 378 | } |
nikapov | 0:704c89673b57 | 379 | |
nikapov | 0:704c89673b57 | 380 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 381 | } |
nikapov | 0:704c89673b57 | 382 | |
nikapov | 0:704c89673b57 | 383 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 384 | * Function Name : LSM6DSL_ACC_GYRO_W_FS_G |
nikapov | 0:704c89673b57 | 385 | * Description : Write FS_G |
nikapov | 0:704c89673b57 | 386 | * Input : LSM6DSL_ACC_GYRO_FS_G_t |
nikapov | 0:704c89673b57 | 387 | * Output : None |
nikapov | 0:704c89673b57 | 388 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 389 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 390 | mems_status_t LSM6DSL_ACC_GYRO_W_FS_G(void *handle, LSM6DSL_ACC_GYRO_FS_G_t newValue) |
nikapov | 0:704c89673b57 | 391 | { |
nikapov | 0:704c89673b57 | 392 | u8_t value; |
nikapov | 0:704c89673b57 | 393 | |
nikapov | 0:704c89673b57 | 394 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL2_G, &value, 1)) |
nikapov | 0:704c89673b57 | 395 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 396 | |
nikapov | 0:704c89673b57 | 397 | value &= ~LSM6DSL_ACC_GYRO_FS_G_MASK; |
nikapov | 0:704c89673b57 | 398 | value |= newValue; |
nikapov | 0:704c89673b57 | 399 | |
nikapov | 0:704c89673b57 | 400 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL2_G, &value, 1) ) |
nikapov | 0:704c89673b57 | 401 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 402 | |
nikapov | 0:704c89673b57 | 403 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 404 | } |
nikapov | 0:704c89673b57 | 405 | |
nikapov | 0:704c89673b57 | 406 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 407 | * Function Name : LSM6DSL_ACC_GYRO_R_FS_G |
nikapov | 0:704c89673b57 | 408 | * Description : Read FS_G |
nikapov | 0:704c89673b57 | 409 | * Input : Pointer to LSM6DSL_ACC_GYRO_FS_G_t |
nikapov | 0:704c89673b57 | 410 | * Output : Status of FS_G see LSM6DSL_ACC_GYRO_FS_G_t |
nikapov | 0:704c89673b57 | 411 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 412 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 413 | mems_status_t LSM6DSL_ACC_GYRO_R_FS_G(void *handle, LSM6DSL_ACC_GYRO_FS_G_t *value) |
nikapov | 0:704c89673b57 | 414 | { |
nikapov | 0:704c89673b57 | 415 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL2_G, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 416 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 417 | |
nikapov | 0:704c89673b57 | 418 | *value &= LSM6DSL_ACC_GYRO_FS_G_MASK; //mask |
nikapov | 0:704c89673b57 | 419 | |
nikapov | 0:704c89673b57 | 420 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 421 | } |
nikapov | 0:704c89673b57 | 422 | |
nikapov | 0:704c89673b57 | 423 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 424 | * Function Name : mems_status_t LSM6DSL_ACC_GYRO_GetRawGyroData(u8_t *buff) |
nikapov | 0:704c89673b57 | 425 | * Description : Read GetGyroData output register |
nikapov | 0:704c89673b57 | 426 | * Input : pointer to [u8_t] |
nikapov | 0:704c89673b57 | 427 | * Output : GetGyroData buffer u8_t |
nikapov | 0:704c89673b57 | 428 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 429 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 430 | mems_status_t LSM6DSL_ACC_GYRO_GetRawGyroData(void *handle, u8_t *buff) |
nikapov | 0:704c89673b57 | 431 | { |
nikapov | 0:704c89673b57 | 432 | u8_t i, j, k; |
nikapov | 0:704c89673b57 | 433 | u8_t numberOfByteForDimension; |
nikapov | 0:704c89673b57 | 434 | |
nikapov | 0:704c89673b57 | 435 | numberOfByteForDimension=6/3; |
nikapov | 0:704c89673b57 | 436 | |
nikapov | 0:704c89673b57 | 437 | k=0; |
nikapov | 0:704c89673b57 | 438 | for (i=0; i<3;i++ ) |
nikapov | 0:704c89673b57 | 439 | { |
nikapov | 0:704c89673b57 | 440 | for (j=0; j<numberOfByteForDimension;j++ ) |
nikapov | 0:704c89673b57 | 441 | { |
nikapov | 0:704c89673b57 | 442 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_OUTX_L_G+k, &buff[k], 1)) |
nikapov | 0:704c89673b57 | 443 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 444 | k++; |
nikapov | 0:704c89673b57 | 445 | } |
nikapov | 0:704c89673b57 | 446 | } |
nikapov | 0:704c89673b57 | 447 | |
nikapov | 0:704c89673b57 | 448 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 449 | } |
nikapov | 0:704c89673b57 | 450 | |
nikapov | 0:704c89673b57 | 451 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 452 | * Function Name : mems_status_t LSM6DSL_ACC_Get_AngularRate(u8_t *buff) |
nikapov | 0:704c89673b57 | 453 | * Description : Read GetGyroData output register |
nikapov | 0:704c89673b57 | 454 | * Input : pointer to [u8_t] |
nikapov | 0:704c89673b57 | 455 | * Output : Returned values are espressed in mdps |
nikapov | 0:704c89673b57 | 456 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 457 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 458 | /* |
nikapov | 0:704c89673b57 | 459 | * Following is the table of sensitivity values for each case. |
nikapov | 0:704c89673b57 | 460 | * Values are espressed in udps/digit. |
nikapov | 0:704c89673b57 | 461 | */ |
nikapov | 0:704c89673b57 | 462 | static const long long LSM6DSL_GYRO_Sensitivity_List[5] = { |
nikapov | 0:704c89673b57 | 463 | 4375, /* FS @125 */ |
nikapov | 0:704c89673b57 | 464 | 8750, /* FS @245 */ |
nikapov | 0:704c89673b57 | 465 | 17500, /* FS @500 */ |
nikapov | 0:704c89673b57 | 466 | 35000, /* FS @1000 */ |
nikapov | 0:704c89673b57 | 467 | 70000, /* FS @2000 */ |
nikapov | 0:704c89673b57 | 468 | }; |
nikapov | 0:704c89673b57 | 469 | mems_status_t LSM6DSL_ACC_Get_AngularRate(void *handle, int *buff, u8_t from_fifo) |
nikapov | 0:704c89673b57 | 470 | { |
nikapov | 0:704c89673b57 | 471 | LSM6DSL_ACC_GYRO_FS_125_t fs_125; |
nikapov | 0:704c89673b57 | 472 | LSM6DSL_ACC_GYRO_FS_G_t fs; |
nikapov | 0:704c89673b57 | 473 | long long sensitivity = 0; |
nikapov | 0:704c89673b57 | 474 | Type3Axis16bit_U raw_data_tmp; |
nikapov | 0:704c89673b57 | 475 | |
nikapov | 0:704c89673b57 | 476 | /* Read out current odr, fs, hf setting */ |
nikapov | 0:704c89673b57 | 477 | LSM6DSL_ACC_GYRO_R_FS_125(handle, &fs_125); |
nikapov | 0:704c89673b57 | 478 | if (fs_125 == LSM6DSL_ACC_GYRO_FS_125_ENABLED) { |
nikapov | 0:704c89673b57 | 479 | sensitivity = LSM6DSL_GYRO_Sensitivity_List[0]; |
nikapov | 0:704c89673b57 | 480 | } else { |
nikapov | 0:704c89673b57 | 481 | LSM6DSL_ACC_GYRO_R_FS_G(handle, &fs); |
nikapov | 0:704c89673b57 | 482 | |
nikapov | 0:704c89673b57 | 483 | /* Determine the sensitivity according to fs */ |
nikapov | 0:704c89673b57 | 484 | switch(fs) { |
nikapov | 0:704c89673b57 | 485 | case LSM6DSL_ACC_GYRO_FS_G_245dps: |
nikapov | 0:704c89673b57 | 486 | sensitivity = LSM6DSL_GYRO_Sensitivity_List[1]; |
nikapov | 0:704c89673b57 | 487 | break; |
nikapov | 0:704c89673b57 | 488 | |
nikapov | 0:704c89673b57 | 489 | case LSM6DSL_ACC_GYRO_FS_G_500dps: |
nikapov | 0:704c89673b57 | 490 | sensitivity = LSM6DSL_GYRO_Sensitivity_List[2]; |
nikapov | 0:704c89673b57 | 491 | break; |
nikapov | 0:704c89673b57 | 492 | |
nikapov | 0:704c89673b57 | 493 | case LSM6DSL_ACC_GYRO_FS_G_1000dps: |
nikapov | 0:704c89673b57 | 494 | sensitivity = LSM6DSL_GYRO_Sensitivity_List[3]; |
nikapov | 0:704c89673b57 | 495 | break; |
nikapov | 0:704c89673b57 | 496 | |
nikapov | 0:704c89673b57 | 497 | case LSM6DSL_ACC_GYRO_FS_G_2000dps: |
nikapov | 0:704c89673b57 | 498 | sensitivity = LSM6DSL_GYRO_Sensitivity_List[4]; |
nikapov | 0:704c89673b57 | 499 | break; |
nikapov | 0:704c89673b57 | 500 | } |
nikapov | 0:704c89673b57 | 501 | } |
nikapov | 0:704c89673b57 | 502 | |
nikapov | 0:704c89673b57 | 503 | /* Read out raw accelerometer samples */ |
nikapov | 0:704c89673b57 | 504 | if (from_fifo) { |
nikapov | 0:704c89673b57 | 505 | u8_t i; |
nikapov | 0:704c89673b57 | 506 | |
nikapov | 0:704c89673b57 | 507 | /* read all 3 axis from FIFO */ |
nikapov | 0:704c89673b57 | 508 | for(i = 0; i < 3; i++) |
nikapov | 0:704c89673b57 | 509 | LSM6DSL_ACC_GYRO_Get_GetFIFOData(handle, raw_data_tmp.u8bit + 2*i); |
nikapov | 0:704c89673b57 | 510 | } else |
nikapov | 0:704c89673b57 | 511 | LSM6DSL_ACC_GYRO_GetRawGyroData(handle, raw_data_tmp.u8bit); |
nikapov | 0:704c89673b57 | 512 | |
nikapov | 0:704c89673b57 | 513 | /* Apply proper shift and sensitivity */ |
nikapov | 0:704c89673b57 | 514 | buff[0] = (raw_data_tmp.i16bit[0] * sensitivity + 500)/1000; |
nikapov | 0:704c89673b57 | 515 | buff[1] = (raw_data_tmp.i16bit[1] * sensitivity + 500)/1000; |
nikapov | 0:704c89673b57 | 516 | buff[2] = (raw_data_tmp.i16bit[2] * sensitivity + 500)/1000; |
nikapov | 0:704c89673b57 | 517 | |
nikapov | 0:704c89673b57 | 518 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 519 | } |
nikapov | 0:704c89673b57 | 520 | |
nikapov | 0:704c89673b57 | 521 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 522 | * Function Name : LSM6DSL_ACC_GYRO_W_ODR_G |
nikapov | 0:704c89673b57 | 523 | * Description : Write ODR_G |
nikapov | 0:704c89673b57 | 524 | * Input : LSM6DSL_ACC_GYRO_ODR_G_t |
nikapov | 0:704c89673b57 | 525 | * Output : None |
nikapov | 0:704c89673b57 | 526 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 527 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 528 | mems_status_t LSM6DSL_ACC_GYRO_W_ODR_G(void *handle, LSM6DSL_ACC_GYRO_ODR_G_t newValue) |
nikapov | 0:704c89673b57 | 529 | { |
nikapov | 0:704c89673b57 | 530 | u8_t value; |
nikapov | 0:704c89673b57 | 531 | |
nikapov | 0:704c89673b57 | 532 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL2_G, &value, 1)) |
nikapov | 0:704c89673b57 | 533 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 534 | |
nikapov | 0:704c89673b57 | 535 | value &= ~LSM6DSL_ACC_GYRO_ODR_G_MASK; |
nikapov | 0:704c89673b57 | 536 | value |= newValue; |
nikapov | 0:704c89673b57 | 537 | |
nikapov | 0:704c89673b57 | 538 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL2_G, &value, 1) ) |
nikapov | 0:704c89673b57 | 539 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 540 | |
nikapov | 0:704c89673b57 | 541 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 542 | } |
nikapov | 0:704c89673b57 | 543 | |
nikapov | 0:704c89673b57 | 544 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 545 | * Function Name : LSM6DSL_ACC_GYRO_R_ODR_G |
nikapov | 0:704c89673b57 | 546 | * Description : Read ODR_G |
nikapov | 0:704c89673b57 | 547 | * Input : Pointer to LSM6DSL_ACC_GYRO_ODR_G_t |
nikapov | 0:704c89673b57 | 548 | * Output : Status of ODR_G see LSM6DSL_ACC_GYRO_ODR_G_t |
nikapov | 0:704c89673b57 | 549 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 550 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 551 | mems_status_t LSM6DSL_ACC_GYRO_R_ODR_G(void *handle, LSM6DSL_ACC_GYRO_ODR_G_t *value) |
nikapov | 0:704c89673b57 | 552 | { |
nikapov | 0:704c89673b57 | 553 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL2_G, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 554 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 555 | |
nikapov | 0:704c89673b57 | 556 | *value &= LSM6DSL_ACC_GYRO_ODR_G_MASK; //mask |
nikapov | 0:704c89673b57 | 557 | |
nikapov | 0:704c89673b57 | 558 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 559 | } |
nikapov | 0:704c89673b57 | 560 | |
nikapov | 0:704c89673b57 | 561 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 562 | * Function Name : LSM6DSL_ACC_GYRO_translate_ODR_G |
nikapov | 0:704c89673b57 | 563 | * Description : Read ODR_G |
nikapov | 0:704c89673b57 | 564 | * Input : LSM6DSL_ACC_GYRO_ODR_G_t |
nikapov | 0:704c89673b57 | 565 | * Output : The ODR value in Hz |
nikapov | 0:704c89673b57 | 566 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 567 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 568 | mems_status_t LSM6DSL_ACC_GYRO_translate_ODR_G(LSM6DSL_ACC_GYRO_ODR_G_t value, u16_t *odr_hz_val) |
nikapov | 0:704c89673b57 | 569 | { |
nikapov | 0:704c89673b57 | 570 | switch(value) { |
nikapov | 0:704c89673b57 | 571 | case LSM6DSL_ACC_GYRO_ODR_G_POWER_DOWN: |
nikapov | 0:704c89673b57 | 572 | *odr_hz_val = 0; |
nikapov | 0:704c89673b57 | 573 | break; |
nikapov | 0:704c89673b57 | 574 | |
nikapov | 0:704c89673b57 | 575 | case LSM6DSL_ACC_GYRO_ODR_G_13Hz: |
nikapov | 0:704c89673b57 | 576 | *odr_hz_val = 13; |
nikapov | 0:704c89673b57 | 577 | break; |
nikapov | 0:704c89673b57 | 578 | |
nikapov | 0:704c89673b57 | 579 | case LSM6DSL_ACC_GYRO_ODR_G_26Hz: |
nikapov | 0:704c89673b57 | 580 | *odr_hz_val = 26; |
nikapov | 0:704c89673b57 | 581 | break; |
nikapov | 0:704c89673b57 | 582 | |
nikapov | 0:704c89673b57 | 583 | case LSM6DSL_ACC_GYRO_ODR_G_52Hz: |
nikapov | 0:704c89673b57 | 584 | *odr_hz_val = 52; |
nikapov | 0:704c89673b57 | 585 | break; |
nikapov | 0:704c89673b57 | 586 | |
nikapov | 0:704c89673b57 | 587 | case LSM6DSL_ACC_GYRO_ODR_G_104Hz: |
nikapov | 0:704c89673b57 | 588 | *odr_hz_val = 104; |
nikapov | 0:704c89673b57 | 589 | break; |
nikapov | 0:704c89673b57 | 590 | |
nikapov | 0:704c89673b57 | 591 | case LSM6DSL_ACC_GYRO_ODR_G_208Hz: |
nikapov | 0:704c89673b57 | 592 | *odr_hz_val = 208; |
nikapov | 0:704c89673b57 | 593 | break; |
nikapov | 0:704c89673b57 | 594 | |
nikapov | 0:704c89673b57 | 595 | case LSM6DSL_ACC_GYRO_ODR_G_416Hz: |
nikapov | 0:704c89673b57 | 596 | *odr_hz_val = 416; |
nikapov | 0:704c89673b57 | 597 | break; |
nikapov | 0:704c89673b57 | 598 | |
nikapov | 0:704c89673b57 | 599 | case LSM6DSL_ACC_GYRO_ODR_G_833Hz: |
nikapov | 0:704c89673b57 | 600 | *odr_hz_val = 833; |
nikapov | 0:704c89673b57 | 601 | break; |
nikapov | 0:704c89673b57 | 602 | |
nikapov | 0:704c89673b57 | 603 | case LSM6DSL_ACC_GYRO_ODR_G_1660Hz: |
nikapov | 0:704c89673b57 | 604 | *odr_hz_val = 1660; |
nikapov | 0:704c89673b57 | 605 | break; |
nikapov | 0:704c89673b57 | 606 | |
nikapov | 0:704c89673b57 | 607 | default: |
nikapov | 0:704c89673b57 | 608 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 609 | } |
nikapov | 0:704c89673b57 | 610 | |
nikapov | 0:704c89673b57 | 611 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 612 | } |
nikapov | 0:704c89673b57 | 613 | |
nikapov | 0:704c89673b57 | 614 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 615 | * Function Name : LSM6DSL_ACC_GYRO_W_FS_125 |
nikapov | 0:704c89673b57 | 616 | * Description : Write FS_125 |
nikapov | 0:704c89673b57 | 617 | * Input : LSM6DSL_ACC_GYRO_FS_125_t |
nikapov | 0:704c89673b57 | 618 | * Output : None |
nikapov | 0:704c89673b57 | 619 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 620 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 621 | mems_status_t LSM6DSL_ACC_GYRO_W_FS_125(void *handle, LSM6DSL_ACC_GYRO_FS_125_t newValue) |
nikapov | 0:704c89673b57 | 622 | { |
nikapov | 0:704c89673b57 | 623 | u8_t value; |
nikapov | 0:704c89673b57 | 624 | |
nikapov | 0:704c89673b57 | 625 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL2_G, &value, 1)) |
nikapov | 0:704c89673b57 | 626 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 627 | |
nikapov | 0:704c89673b57 | 628 | value &= ~LSM6DSL_ACC_GYRO_FS_125_MASK; |
nikapov | 0:704c89673b57 | 629 | value |= newValue; |
nikapov | 0:704c89673b57 | 630 | |
nikapov | 0:704c89673b57 | 631 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL2_G, &value, 1) ) |
nikapov | 0:704c89673b57 | 632 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 633 | |
nikapov | 0:704c89673b57 | 634 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 635 | } |
nikapov | 0:704c89673b57 | 636 | |
nikapov | 0:704c89673b57 | 637 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 638 | * Function Name : LSM6DSL_ACC_GYRO_R_FS_125 |
nikapov | 0:704c89673b57 | 639 | * Description : Read FS_125 |
nikapov | 0:704c89673b57 | 640 | * Input : Pointer to LSM6DSL_ACC_GYRO_FS_125_t |
nikapov | 0:704c89673b57 | 641 | * Output : Status of FS_125 see LSM6DSL_ACC_GYRO_FS_125_t |
nikapov | 0:704c89673b57 | 642 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 643 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 644 | mems_status_t LSM6DSL_ACC_GYRO_R_FS_125(void *handle, LSM6DSL_ACC_GYRO_FS_125_t *value) |
nikapov | 0:704c89673b57 | 645 | { |
nikapov | 0:704c89673b57 | 646 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL2_G, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 647 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 648 | |
nikapov | 0:704c89673b57 | 649 | *value &= LSM6DSL_ACC_GYRO_FS_125_MASK; //mask |
nikapov | 0:704c89673b57 | 650 | |
nikapov | 0:704c89673b57 | 651 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 652 | } |
nikapov | 0:704c89673b57 | 653 | |
nikapov | 0:704c89673b57 | 654 | /**************** Advanced Function *******************/ |
nikapov | 0:704c89673b57 | 655 | |
nikapov | 0:704c89673b57 | 656 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 657 | * Function Name : LSM6DSL_ACC_GYRO_W_BW_SEL |
nikapov | 0:704c89673b57 | 658 | * Description : Write BW_SEL |
nikapov | 0:704c89673b57 | 659 | * Input : LSM6DSL_ACC_GYRO_BW_SEL_t |
nikapov | 0:704c89673b57 | 660 | * Output : None |
nikapov | 0:704c89673b57 | 661 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 662 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 663 | mems_status_t LSM6DSL_ACC_GYRO_W_BW_SEL(void *handle, LSM6DSL_ACC_GYRO_BW_SEL_t newValue) |
nikapov | 0:704c89673b57 | 664 | { |
nikapov | 0:704c89673b57 | 665 | u8_t value; |
nikapov | 0:704c89673b57 | 666 | |
nikapov | 0:704c89673b57 | 667 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL1_XL, &value, 1)) |
nikapov | 0:704c89673b57 | 668 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 669 | |
nikapov | 0:704c89673b57 | 670 | value &= ~LSM6DSL_ACC_GYRO_BW_SEL_MASK; |
nikapov | 0:704c89673b57 | 671 | value |= newValue; |
nikapov | 0:704c89673b57 | 672 | |
nikapov | 0:704c89673b57 | 673 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL1_XL, &value, 1) ) |
nikapov | 0:704c89673b57 | 674 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 675 | |
nikapov | 0:704c89673b57 | 676 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 677 | } |
nikapov | 0:704c89673b57 | 678 | |
nikapov | 0:704c89673b57 | 679 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 680 | * Function Name : LSM6DSL_ACC_GYRO_R_BW_SEL |
nikapov | 0:704c89673b57 | 681 | * Description : Read BW_SEL |
nikapov | 0:704c89673b57 | 682 | * Input : Pointer to LSM6DSL_ACC_GYRO_BW_SEL_t |
nikapov | 0:704c89673b57 | 683 | * Output : Status of BW_SEL see LSM6DSL_ACC_GYRO_BW_SEL_t |
nikapov | 0:704c89673b57 | 684 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 685 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 686 | mems_status_t LSM6DSL_ACC_GYRO_R_BW_SEL(void *handle, LSM6DSL_ACC_GYRO_BW_SEL_t *value) |
nikapov | 0:704c89673b57 | 687 | { |
nikapov | 0:704c89673b57 | 688 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL1_XL, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 689 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 690 | |
nikapov | 0:704c89673b57 | 691 | *value &= LSM6DSL_ACC_GYRO_BW_SEL_MASK; //mask |
nikapov | 0:704c89673b57 | 692 | |
nikapov | 0:704c89673b57 | 693 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 694 | } |
nikapov | 0:704c89673b57 | 695 | |
nikapov | 0:704c89673b57 | 696 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 697 | * Function Name : LSM6DSL_ACC_GYRO_W_BLE |
nikapov | 0:704c89673b57 | 698 | * Description : Write BLE |
nikapov | 0:704c89673b57 | 699 | * Input : LSM6DSL_ACC_GYRO_BLE_t |
nikapov | 0:704c89673b57 | 700 | * Output : None |
nikapov | 0:704c89673b57 | 701 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 702 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 703 | mems_status_t LSM6DSL_ACC_GYRO_W_BLE(void *handle, LSM6DSL_ACC_GYRO_BLE_t newValue) |
nikapov | 0:704c89673b57 | 704 | { |
nikapov | 0:704c89673b57 | 705 | u8_t value; |
nikapov | 0:704c89673b57 | 706 | |
nikapov | 0:704c89673b57 | 707 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL3_C, &value, 1)) |
nikapov | 0:704c89673b57 | 708 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 709 | |
nikapov | 0:704c89673b57 | 710 | value &= ~LSM6DSL_ACC_GYRO_BLE_MASK; |
nikapov | 0:704c89673b57 | 711 | value |= newValue; |
nikapov | 0:704c89673b57 | 712 | |
nikapov | 0:704c89673b57 | 713 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL3_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 714 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 715 | |
nikapov | 0:704c89673b57 | 716 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 717 | } |
nikapov | 0:704c89673b57 | 718 | |
nikapov | 0:704c89673b57 | 719 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 720 | * Function Name : LSM6DSL_ACC_GYRO_R_BLE |
nikapov | 0:704c89673b57 | 721 | * Description : Read BLE |
nikapov | 0:704c89673b57 | 722 | * Input : Pointer to LSM6DSL_ACC_GYRO_BLE_t |
nikapov | 0:704c89673b57 | 723 | * Output : Status of BLE see LSM6DSL_ACC_GYRO_BLE_t |
nikapov | 0:704c89673b57 | 724 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 725 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 726 | mems_status_t LSM6DSL_ACC_GYRO_R_BLE(void *handle, LSM6DSL_ACC_GYRO_BLE_t *value) |
nikapov | 0:704c89673b57 | 727 | { |
nikapov | 0:704c89673b57 | 728 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL3_C, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 729 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 730 | |
nikapov | 0:704c89673b57 | 731 | *value &= LSM6DSL_ACC_GYRO_BLE_MASK; //mask |
nikapov | 0:704c89673b57 | 732 | |
nikapov | 0:704c89673b57 | 733 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 734 | } |
nikapov | 0:704c89673b57 | 735 | |
nikapov | 0:704c89673b57 | 736 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 737 | * Function Name : LSM6DSL_ACC_GYRO_W_EmbeddedAccess |
nikapov | 0:704c89673b57 | 738 | * Description : Write EMB_ACC |
nikapov | 0:704c89673b57 | 739 | * Input : LSM6DSL_ACC_GYRO_EMB_ACC_t |
nikapov | 0:704c89673b57 | 740 | * Output : None |
nikapov | 0:704c89673b57 | 741 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 742 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 743 | mems_status_t LSM6DSL_ACC_GYRO_W_EmbeddedAccess(void *handle, LSM6DSL_ACC_GYRO_EMB_ACC_t newValue) |
nikapov | 0:704c89673b57 | 744 | { |
nikapov | 0:704c89673b57 | 745 | u8_t value; |
nikapov | 0:704c89673b57 | 746 | |
nikapov | 0:704c89673b57 | 747 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FUNC_CFG_ACCESS, &value, 1) ) |
nikapov | 0:704c89673b57 | 748 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 749 | |
nikapov | 0:704c89673b57 | 750 | value &= ~LSM6DSL_ACC_GYRO_EMB_ACC_MASK; |
nikapov | 0:704c89673b57 | 751 | value |= newValue; |
nikapov | 0:704c89673b57 | 752 | |
nikapov | 0:704c89673b57 | 753 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_FUNC_CFG_ACCESS, &value, 1) ) |
nikapov | 0:704c89673b57 | 754 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 755 | |
nikapov | 0:704c89673b57 | 756 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 757 | } |
nikapov | 0:704c89673b57 | 758 | |
nikapov | 0:704c89673b57 | 759 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 760 | * Function Name : LSM6DSL_ACC_GYRO_R_EmbeddedAccess |
nikapov | 0:704c89673b57 | 761 | * Description : Read EMB_ACC |
nikapov | 0:704c89673b57 | 762 | * Input : Pointer to LSM6DSL_ACC_GYRO_EMB_ACC_t |
nikapov | 0:704c89673b57 | 763 | * Output : Status of EMB_ACC see LSM6DSL_ACC_GYRO_EMB_ACC_t |
nikapov | 0:704c89673b57 | 764 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 765 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 766 | mems_status_t LSM6DSL_ACC_GYRO_R_EmbeddedAccess(void *handle, LSM6DSL_ACC_GYRO_EMB_ACC_t *value) |
nikapov | 0:704c89673b57 | 767 | { |
nikapov | 0:704c89673b57 | 768 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FUNC_CFG_ACCESS, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 769 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 770 | |
nikapov | 0:704c89673b57 | 771 | *value &= LSM6DSL_ACC_GYRO_EMB_ACC_MASK; //mask |
nikapov | 0:704c89673b57 | 772 | |
nikapov | 0:704c89673b57 | 773 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 774 | } |
nikapov | 0:704c89673b57 | 775 | |
nikapov | 0:704c89673b57 | 776 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 777 | * Function Name : LSM6DSL_ACC_GYRO_W_SYNC_RES_RATIO |
nikapov | 0:704c89673b57 | 778 | * Description : Write RR |
nikapov | 0:704c89673b57 | 779 | * Input : LSM6DSL_ACC_GYRO_SYNC_RES_RATIO_t |
nikapov | 0:704c89673b57 | 780 | * Output : None |
nikapov | 0:704c89673b57 | 781 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 782 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 783 | mems_status_t LSM6DSL_ACC_GYRO_W_SYNC_RES_RATIO(void *handle, LSM6DSL_ACC_GYRO_SYNC_RES_RATIO_t newValue) |
nikapov | 0:704c89673b57 | 784 | { |
nikapov | 0:704c89673b57 | 785 | u8_t value; |
nikapov | 0:704c89673b57 | 786 | |
nikapov | 0:704c89673b57 | 787 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_SENSOR_RES_RATIO, &value, 1) ) |
nikapov | 0:704c89673b57 | 788 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 789 | |
nikapov | 0:704c89673b57 | 790 | value &= ~LSM6DSL_ACC_GYRO_SYNC_RES_RATIO_MASK; |
nikapov | 0:704c89673b57 | 791 | value |= newValue; |
nikapov | 0:704c89673b57 | 792 | |
nikapov | 0:704c89673b57 | 793 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_SENSOR_RES_RATIO, &value, 1) ) |
nikapov | 0:704c89673b57 | 794 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 795 | |
nikapov | 0:704c89673b57 | 796 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 797 | } |
nikapov | 0:704c89673b57 | 798 | |
nikapov | 0:704c89673b57 | 799 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 800 | * Function Name : LSM6DSL_ACC_GYRO_R_SYNC_RES_RATIO |
nikapov | 0:704c89673b57 | 801 | * Description : Read RR |
nikapov | 0:704c89673b57 | 802 | * Input : Pointer to LSM6DSL_ACC_GYRO_SYNC_RES_RATIO_t |
nikapov | 0:704c89673b57 | 803 | * Output : Status of RR see LSM6DSL_ACC_GYRO_SYNC_RES_RATIO_t |
nikapov | 0:704c89673b57 | 804 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 805 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 806 | mems_status_t LSM6DSL_ACC_GYRO_R_SYNC_RES_RATIO(void *handle, LSM6DSL_ACC_GYRO_SYNC_RES_RATIO_t *value) |
nikapov | 0:704c89673b57 | 807 | { |
nikapov | 0:704c89673b57 | 808 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_SENSOR_RES_RATIO, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 809 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 810 | |
nikapov | 0:704c89673b57 | 811 | *value &= LSM6DSL_ACC_GYRO_SYNC_RES_RATIO_MASK; //mask |
nikapov | 0:704c89673b57 | 812 | |
nikapov | 0:704c89673b57 | 813 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 814 | } |
nikapov | 0:704c89673b57 | 815 | |
nikapov | 0:704c89673b57 | 816 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 817 | * Function Name : LSM6DSL_ACC_GYRO_W_Stamping_Time_Frame |
nikapov | 0:704c89673b57 | 818 | * Description : Write TPH |
nikapov | 0:704c89673b57 | 819 | * Input : u8_t |
nikapov | 0:704c89673b57 | 820 | * Output : None |
nikapov | 0:704c89673b57 | 821 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 822 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 823 | mems_status_t LSM6DSL_ACC_GYRO_W_Stamping_Time_Frame(void *handle, u8_t newValue) |
nikapov | 0:704c89673b57 | 824 | { |
nikapov | 0:704c89673b57 | 825 | u8_t value; |
nikapov | 0:704c89673b57 | 826 | |
nikapov | 0:704c89673b57 | 827 | newValue = newValue << LSM6DSL_ACC_GYRO_TPH_POSITION; //mask |
nikapov | 0:704c89673b57 | 828 | newValue &= LSM6DSL_ACC_GYRO_TPH_MASK; //coerce |
nikapov | 0:704c89673b57 | 829 | |
nikapov | 0:704c89673b57 | 830 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_SENSOR_SYNC_TIME, &value, 1) ) |
nikapov | 0:704c89673b57 | 831 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 832 | |
nikapov | 0:704c89673b57 | 833 | value &= (u8_t)~LSM6DSL_ACC_GYRO_TPH_MASK; |
nikapov | 0:704c89673b57 | 834 | value |= newValue; |
nikapov | 0:704c89673b57 | 835 | |
nikapov | 0:704c89673b57 | 836 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_SENSOR_SYNC_TIME, &value, 1) ) |
nikapov | 0:704c89673b57 | 837 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 838 | |
nikapov | 0:704c89673b57 | 839 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 840 | } |
nikapov | 0:704c89673b57 | 841 | |
nikapov | 0:704c89673b57 | 842 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 843 | * Function Name : LSM6DSL_ACC_GYRO_R_Stamping_Time_Frame |
nikapov | 0:704c89673b57 | 844 | * Description : Read TPH |
nikapov | 0:704c89673b57 | 845 | * Input : Pointer to u8_t |
nikapov | 0:704c89673b57 | 846 | * Output : Status of TPH |
nikapov | 0:704c89673b57 | 847 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 848 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 849 | mems_status_t LSM6DSL_ACC_GYRO_R_Stamping_Time_Frame(void *handle, u8_t *value) |
nikapov | 0:704c89673b57 | 850 | { |
nikapov | 0:704c89673b57 | 851 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_SENSOR_SYNC_TIME, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 852 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 853 | |
nikapov | 0:704c89673b57 | 854 | *value &= LSM6DSL_ACC_GYRO_TPH_MASK; //coerce |
nikapov | 0:704c89673b57 | 855 | *value = *value >> LSM6DSL_ACC_GYRO_TPH_POSITION; //mask |
nikapov | 0:704c89673b57 | 856 | |
nikapov | 0:704c89673b57 | 857 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 858 | } |
nikapov | 0:704c89673b57 | 859 | |
nikapov | 0:704c89673b57 | 860 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 861 | * Function Name : LSM6DSL_ACC_GYRO_W_FIFO_Watermark |
nikapov | 0:704c89673b57 | 862 | * Description : Write WTM_FIFO |
nikapov | 0:704c89673b57 | 863 | * Input : u16_t |
nikapov | 0:704c89673b57 | 864 | * Output : None |
nikapov | 0:704c89673b57 | 865 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 866 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 867 | mems_status_t LSM6DSL_ACC_GYRO_W_FIFO_Watermark(void *handle, u16_t newValue) |
nikapov | 0:704c89673b57 | 868 | { |
nikapov | 0:704c89673b57 | 869 | u8_t valueH, valueL; |
nikapov | 0:704c89673b57 | 870 | u8_t value; |
nikapov | 0:704c89673b57 | 871 | |
nikapov | 0:704c89673b57 | 872 | valueL = newValue & 0xFF; |
nikapov | 0:704c89673b57 | 873 | valueH = (newValue >> 8) & 0xFF; |
nikapov | 0:704c89673b57 | 874 | |
nikapov | 0:704c89673b57 | 875 | /* Low part goes in FIFO_CTRL1 */ |
nikapov | 0:704c89673b57 | 876 | valueL = valueL << LSM6DSL_ACC_GYRO_WTM_FIFO_CTRL1_POSITION; //mask |
nikapov | 0:704c89673b57 | 877 | valueL &= LSM6DSL_ACC_GYRO_WTM_FIFO_CTRL1_MASK; //coerce |
nikapov | 0:704c89673b57 | 878 | |
nikapov | 0:704c89673b57 | 879 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL1, &value, 1) ) |
nikapov | 0:704c89673b57 | 880 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 881 | |
nikapov | 0:704c89673b57 | 882 | value &= (u8_t)~LSM6DSL_ACC_GYRO_WTM_FIFO_CTRL1_MASK; |
nikapov | 0:704c89673b57 | 883 | value |= valueL; |
nikapov | 0:704c89673b57 | 884 | |
nikapov | 0:704c89673b57 | 885 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL1, &value, 1) ) |
nikapov | 0:704c89673b57 | 886 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 887 | |
nikapov | 0:704c89673b57 | 888 | /* High part goes in FIFO_CTRL2 */ |
nikapov | 0:704c89673b57 | 889 | valueH = valueH << LSM6DSL_ACC_GYRO_WTM_FIFO_CTRL2_POSITION; //mask |
nikapov | 0:704c89673b57 | 890 | valueH &= LSM6DSL_ACC_GYRO_WTM_FIFO_CTRL2_MASK; //coerce |
nikapov | 0:704c89673b57 | 891 | |
nikapov | 0:704c89673b57 | 892 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL2, &value, 1) ) |
nikapov | 0:704c89673b57 | 893 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 894 | |
nikapov | 0:704c89673b57 | 895 | value &= ~LSM6DSL_ACC_GYRO_WTM_FIFO_CTRL2_MASK; |
nikapov | 0:704c89673b57 | 896 | value |= valueH; |
nikapov | 0:704c89673b57 | 897 | |
nikapov | 0:704c89673b57 | 898 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL2, &value, 1) ) |
nikapov | 0:704c89673b57 | 899 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 900 | |
nikapov | 0:704c89673b57 | 901 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 902 | } |
nikapov | 0:704c89673b57 | 903 | |
nikapov | 0:704c89673b57 | 904 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 905 | * Function Name : LSM6DSL_ACC_GYRO_R_FIFO_Watermark |
nikapov | 0:704c89673b57 | 906 | * Description : Read WTM_FIFO |
nikapov | 0:704c89673b57 | 907 | * Input : Pointer to u16_t |
nikapov | 0:704c89673b57 | 908 | * Output : Status of WTM_FIFO |
nikapov | 0:704c89673b57 | 909 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 910 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 911 | mems_status_t LSM6DSL_ACC_GYRO_R_FIFO_Watermark(void *handle, u16_t *value) |
nikapov | 0:704c89673b57 | 912 | { |
nikapov | 0:704c89673b57 | 913 | u8_t valueH, valueL; |
nikapov | 0:704c89673b57 | 914 | |
nikapov | 0:704c89673b57 | 915 | /* Low part from FIFO_CTRL1 */ |
nikapov | 0:704c89673b57 | 916 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL1, (u8_t *)&valueL, 1) ) |
nikapov | 0:704c89673b57 | 917 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 918 | |
nikapov | 0:704c89673b57 | 919 | valueL &= LSM6DSL_ACC_GYRO_WTM_FIFO_CTRL1_MASK; //coerce |
nikapov | 0:704c89673b57 | 920 | valueL = valueL >> LSM6DSL_ACC_GYRO_WTM_FIFO_CTRL1_POSITION; //mask |
nikapov | 0:704c89673b57 | 921 | |
nikapov | 0:704c89673b57 | 922 | /* High part from FIFO_CTRL2 */ |
nikapov | 0:704c89673b57 | 923 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL2, (u8_t *)&valueH, 1) ) |
nikapov | 0:704c89673b57 | 924 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 925 | |
nikapov | 0:704c89673b57 | 926 | valueH &= LSM6DSL_ACC_GYRO_WTM_FIFO_CTRL2_MASK; //coerce |
nikapov | 0:704c89673b57 | 927 | valueH = valueH >> LSM6DSL_ACC_GYRO_WTM_FIFO_CTRL2_POSITION; //mask |
nikapov | 0:704c89673b57 | 928 | |
nikapov | 0:704c89673b57 | 929 | *value = ((valueH << 8) & 0xFF00) | valueL; |
nikapov | 0:704c89673b57 | 930 | |
nikapov | 0:704c89673b57 | 931 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 932 | } |
nikapov | 0:704c89673b57 | 933 | |
nikapov | 0:704c89673b57 | 934 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 935 | * Function Name : LSM6DSL_ACC_GYRO_W_FIFO_TEMP |
nikapov | 0:704c89673b57 | 936 | * Description : Write FIFO_TEMP_EN |
nikapov | 0:704c89673b57 | 937 | * Input : LSM6DSL_ACC_GYRO_FIFO_TEMP_t |
nikapov | 0:704c89673b57 | 938 | * Output : None |
nikapov | 0:704c89673b57 | 939 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 940 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 941 | mems_status_t LSM6DSL_ACC_GYRO_W_FIFO_TEMP(void *handle, LSM6DSL_ACC_GYRO_FIFO_TEMP_t newValue) |
nikapov | 0:704c89673b57 | 942 | { |
nikapov | 0:704c89673b57 | 943 | u8_t value; |
nikapov | 0:704c89673b57 | 944 | |
nikapov | 0:704c89673b57 | 945 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL2, &value, 1) ) |
nikapov | 0:704c89673b57 | 946 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 947 | |
nikapov | 0:704c89673b57 | 948 | value &= ~LSM6DSL_ACC_GYRO_FIFO_TEMP_MASK; |
nikapov | 0:704c89673b57 | 949 | value |= newValue; |
nikapov | 0:704c89673b57 | 950 | |
nikapov | 0:704c89673b57 | 951 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL2, &value, 1) ) |
nikapov | 0:704c89673b57 | 952 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 953 | |
nikapov | 0:704c89673b57 | 954 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 955 | } |
nikapov | 0:704c89673b57 | 956 | |
nikapov | 0:704c89673b57 | 957 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 958 | * Function Name : LSM6DSL_ACC_GYRO_R_FIFO_TEMP |
nikapov | 0:704c89673b57 | 959 | * Description : Read FIFO_TEMP_EN |
nikapov | 0:704c89673b57 | 960 | * Input : Pointer to LSM6DSL_ACC_GYRO_FIFO_TEMP_t |
nikapov | 0:704c89673b57 | 961 | * Output : Status of FIFO_TEMP_EN see LSM6DSL_ACC_GYRO_FIFO_TEMP_t |
nikapov | 0:704c89673b57 | 962 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 963 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 964 | mems_status_t LSM6DSL_ACC_GYRO_R_FIFO_TEMP(void *handle, LSM6DSL_ACC_GYRO_FIFO_TEMP_t *value) |
nikapov | 0:704c89673b57 | 965 | { |
nikapov | 0:704c89673b57 | 966 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL2, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 967 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 968 | |
nikapov | 0:704c89673b57 | 969 | *value &= LSM6DSL_ACC_GYRO_FIFO_TEMP_MASK; //mask |
nikapov | 0:704c89673b57 | 970 | |
nikapov | 0:704c89673b57 | 971 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 972 | } |
nikapov | 0:704c89673b57 | 973 | |
nikapov | 0:704c89673b57 | 974 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 975 | * Function Name : LSM6DSL_ACC_GYRO_W_TIM_PEDO_FIFO_Write_En |
nikapov | 0:704c89673b57 | 976 | * Description : Write TIM_PEDO_FIFO_DRDY |
nikapov | 0:704c89673b57 | 977 | * Input : LSM6DSL_ACC_GYRO_TIM_PEDO_FIFO_DRDY_t |
nikapov | 0:704c89673b57 | 978 | * Output : None |
nikapov | 0:704c89673b57 | 979 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 980 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 981 | mems_status_t LSM6DSL_ACC_GYRO_W_TIM_PEDO_FIFO_Write_En(void *handle, LSM6DSL_ACC_GYRO_TIM_PEDO_FIFO_DRDY_t newValue) |
nikapov | 0:704c89673b57 | 982 | { |
nikapov | 0:704c89673b57 | 983 | u8_t value; |
nikapov | 0:704c89673b57 | 984 | |
nikapov | 0:704c89673b57 | 985 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL2, &value, 1) ) |
nikapov | 0:704c89673b57 | 986 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 987 | |
nikapov | 0:704c89673b57 | 988 | value &= ~LSM6DSL_ACC_GYRO_TIM_PEDO_FIFO_DRDY_MASK; |
nikapov | 0:704c89673b57 | 989 | value |= newValue; |
nikapov | 0:704c89673b57 | 990 | |
nikapov | 0:704c89673b57 | 991 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL2, &value, 1) ) |
nikapov | 0:704c89673b57 | 992 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 993 | |
nikapov | 0:704c89673b57 | 994 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 995 | } |
nikapov | 0:704c89673b57 | 996 | |
nikapov | 0:704c89673b57 | 997 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 998 | * Function Name : LSM6DSL_ACC_GYRO_R_TIM_PEDO_FIFO_Write_En |
nikapov | 0:704c89673b57 | 999 | * Description : Read TIM_PEDO_FIFO_DRDY |
nikapov | 0:704c89673b57 | 1000 | * Input : Pointer to LSM6DSL_ACC_GYRO_TIM_PEDO_FIFO_DRDY_t |
nikapov | 0:704c89673b57 | 1001 | * Output : Status of TIM_PEDO_FIFO_DRDY see LSM6DSL_ACC_GYRO_TIM_PEDO_FIFO_DRDY_t |
nikapov | 0:704c89673b57 | 1002 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1003 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1004 | mems_status_t LSM6DSL_ACC_GYRO_R_TIM_PEDO_FIFO_Write_En(void *handle, LSM6DSL_ACC_GYRO_TIM_PEDO_FIFO_DRDY_t *value) |
nikapov | 0:704c89673b57 | 1005 | { |
nikapov | 0:704c89673b57 | 1006 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL2, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 1007 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1008 | |
nikapov | 0:704c89673b57 | 1009 | *value &= LSM6DSL_ACC_GYRO_TIM_PEDO_FIFO_DRDY_MASK; //mask |
nikapov | 0:704c89673b57 | 1010 | |
nikapov | 0:704c89673b57 | 1011 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1012 | } |
nikapov | 0:704c89673b57 | 1013 | |
nikapov | 0:704c89673b57 | 1014 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1015 | * Function Name : LSM6DSL_ACC_GYRO_W_TIM_PEDO_FIFO_En |
nikapov | 0:704c89673b57 | 1016 | * Description : Write TIM_PEDO_FIFO_EN |
nikapov | 0:704c89673b57 | 1017 | * Input : LSM6DSL_ACC_GYRO_TIM_PEDO_FIFO_EN_t |
nikapov | 0:704c89673b57 | 1018 | * Output : None |
nikapov | 0:704c89673b57 | 1019 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1020 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1021 | mems_status_t LSM6DSL_ACC_GYRO_W_TIM_PEDO_FIFO_En(void *handle, LSM6DSL_ACC_GYRO_TIM_PEDO_FIFO_EN_t newValue) |
nikapov | 0:704c89673b57 | 1022 | { |
nikapov | 0:704c89673b57 | 1023 | u8_t value; |
nikapov | 0:704c89673b57 | 1024 | |
nikapov | 0:704c89673b57 | 1025 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL2, &value, 1) ) |
nikapov | 0:704c89673b57 | 1026 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1027 | |
nikapov | 0:704c89673b57 | 1028 | value &= ~LSM6DSL_ACC_GYRO_TIM_PEDO_FIFO_EN_MASK; |
nikapov | 0:704c89673b57 | 1029 | value |= newValue; |
nikapov | 0:704c89673b57 | 1030 | |
nikapov | 0:704c89673b57 | 1031 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL2, &value, 1) ) |
nikapov | 0:704c89673b57 | 1032 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1033 | |
nikapov | 0:704c89673b57 | 1034 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1035 | } |
nikapov | 0:704c89673b57 | 1036 | |
nikapov | 0:704c89673b57 | 1037 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1038 | * Function Name : LSM6DSL_ACC_GYRO_R_TIM_PEDO_FIFO_En |
nikapov | 0:704c89673b57 | 1039 | * Description : Read TIM_PEDO_FIFO_EN |
nikapov | 0:704c89673b57 | 1040 | * Input : Pointer to LSM6DSL_ACC_GYRO_TIM_PEDO_FIFO_EN_t |
nikapov | 0:704c89673b57 | 1041 | * Output : Status of TIM_PEDO_FIFO_EN see LSM6DSL_ACC_GYRO_TIM_PEDO_FIFO_EN_t |
nikapov | 0:704c89673b57 | 1042 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1043 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1044 | mems_status_t LSM6DSL_ACC_GYRO_R_TIM_PEDO_FIFO_En(void *handle, LSM6DSL_ACC_GYRO_TIM_PEDO_FIFO_EN_t *value) |
nikapov | 0:704c89673b57 | 1045 | { |
nikapov | 0:704c89673b57 | 1046 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL2, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 1047 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1048 | |
nikapov | 0:704c89673b57 | 1049 | *value &= LSM6DSL_ACC_GYRO_TIM_PEDO_FIFO_EN_MASK; //mask |
nikapov | 0:704c89673b57 | 1050 | |
nikapov | 0:704c89673b57 | 1051 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1052 | } |
nikapov | 0:704c89673b57 | 1053 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1054 | * Function Name : LSM6DSL_ACC_GYRO_W_DEC_FIFO_XL |
nikapov | 0:704c89673b57 | 1055 | * Description : Write DEC_FIFO_XL |
nikapov | 0:704c89673b57 | 1056 | * Input : LSM6DSL_ACC_GYRO_DEC_FIFO_XL_t |
nikapov | 0:704c89673b57 | 1057 | * Output : None |
nikapov | 0:704c89673b57 | 1058 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1059 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1060 | mems_status_t LSM6DSL_ACC_GYRO_W_DEC_FIFO_XL(void *handle, LSM6DSL_ACC_GYRO_DEC_FIFO_XL_t newValue) |
nikapov | 0:704c89673b57 | 1061 | { |
nikapov | 0:704c89673b57 | 1062 | u8_t value; |
nikapov | 0:704c89673b57 | 1063 | |
nikapov | 0:704c89673b57 | 1064 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL3, &value, 1) ) |
nikapov | 0:704c89673b57 | 1065 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1066 | |
nikapov | 0:704c89673b57 | 1067 | value &= ~LSM6DSL_ACC_GYRO_DEC_FIFO_XL_MASK; |
nikapov | 0:704c89673b57 | 1068 | value |= newValue; |
nikapov | 0:704c89673b57 | 1069 | |
nikapov | 0:704c89673b57 | 1070 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL3, &value, 1) ) |
nikapov | 0:704c89673b57 | 1071 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1072 | |
nikapov | 0:704c89673b57 | 1073 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1074 | } |
nikapov | 0:704c89673b57 | 1075 | |
nikapov | 0:704c89673b57 | 1076 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1077 | * Function Name : LSM6DSL_ACC_GYRO_W_DEC_FIFO_XL_val |
nikapov | 0:704c89673b57 | 1078 | * Description : Write DEC_FIFO_XL |
nikapov | 0:704c89673b57 | 1079 | * Input : u16_t |
nikapov | 0:704c89673b57 | 1080 | * Output : Program XL decimation value from unsigned short |
nikapov | 0:704c89673b57 | 1081 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1082 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1083 | mems_status_t LSM6DSL_ACC_GYRO_W_DEC_FIFO_XL_val(void *handle, u16_t newValue) |
nikapov | 0:704c89673b57 | 1084 | { |
nikapov | 0:704c89673b57 | 1085 | switch(newValue) { |
nikapov | 0:704c89673b57 | 1086 | case 0: |
nikapov | 0:704c89673b57 | 1087 | LSM6DSL_ACC_GYRO_W_DEC_FIFO_XL(handle, LSM6DSL_ACC_GYRO_DEC_FIFO_XL_DATA_NOT_IN_FIFO); |
nikapov | 0:704c89673b57 | 1088 | break; |
nikapov | 0:704c89673b57 | 1089 | |
nikapov | 0:704c89673b57 | 1090 | case 1: |
nikapov | 0:704c89673b57 | 1091 | LSM6DSL_ACC_GYRO_W_DEC_FIFO_XL(handle, LSM6DSL_ACC_GYRO_DEC_FIFO_XL_NO_DECIMATION); |
nikapov | 0:704c89673b57 | 1092 | break; |
nikapov | 0:704c89673b57 | 1093 | |
nikapov | 0:704c89673b57 | 1094 | case 2: |
nikapov | 0:704c89673b57 | 1095 | LSM6DSL_ACC_GYRO_W_DEC_FIFO_XL(handle, LSM6DSL_ACC_GYRO_DEC_FIFO_XL_DECIMATION_BY_2); |
nikapov | 0:704c89673b57 | 1096 | break; |
nikapov | 0:704c89673b57 | 1097 | |
nikapov | 0:704c89673b57 | 1098 | case 3: |
nikapov | 0:704c89673b57 | 1099 | LSM6DSL_ACC_GYRO_W_DEC_FIFO_XL(handle, LSM6DSL_ACC_GYRO_DEC_FIFO_XL_DECIMATION_BY_3); |
nikapov | 0:704c89673b57 | 1100 | break; |
nikapov | 0:704c89673b57 | 1101 | |
nikapov | 0:704c89673b57 | 1102 | case 4: |
nikapov | 0:704c89673b57 | 1103 | LSM6DSL_ACC_GYRO_W_DEC_FIFO_XL(handle, LSM6DSL_ACC_GYRO_DEC_FIFO_XL_DECIMATION_BY_4); |
nikapov | 0:704c89673b57 | 1104 | break; |
nikapov | 0:704c89673b57 | 1105 | |
nikapov | 0:704c89673b57 | 1106 | case 8: |
nikapov | 0:704c89673b57 | 1107 | LSM6DSL_ACC_GYRO_W_DEC_FIFO_XL(handle, LSM6DSL_ACC_GYRO_DEC_FIFO_XL_DECIMATION_BY_8); |
nikapov | 0:704c89673b57 | 1108 | break; |
nikapov | 0:704c89673b57 | 1109 | |
nikapov | 0:704c89673b57 | 1110 | case 16: |
nikapov | 0:704c89673b57 | 1111 | LSM6DSL_ACC_GYRO_W_DEC_FIFO_XL(handle, LSM6DSL_ACC_GYRO_DEC_FIFO_XL_DECIMATION_BY_16); |
nikapov | 0:704c89673b57 | 1112 | break; |
nikapov | 0:704c89673b57 | 1113 | |
nikapov | 0:704c89673b57 | 1114 | case 32: |
nikapov | 0:704c89673b57 | 1115 | LSM6DSL_ACC_GYRO_W_DEC_FIFO_XL(handle, LSM6DSL_ACC_GYRO_DEC_FIFO_XL_DECIMATION_BY_32); |
nikapov | 0:704c89673b57 | 1116 | break; |
nikapov | 0:704c89673b57 | 1117 | |
nikapov | 0:704c89673b57 | 1118 | default: |
nikapov | 0:704c89673b57 | 1119 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1120 | } |
nikapov | 0:704c89673b57 | 1121 | |
nikapov | 0:704c89673b57 | 1122 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1123 | } |
nikapov | 0:704c89673b57 | 1124 | |
nikapov | 0:704c89673b57 | 1125 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1126 | * Function Name : LSM6DSL_ACC_GYRO_R_DEC_FIFO_XL |
nikapov | 0:704c89673b57 | 1127 | * Description : Read DEC_FIFO_XL |
nikapov | 0:704c89673b57 | 1128 | * Input : Pointer to LSM6DSL_ACC_GYRO_DEC_FIFO_XL_t |
nikapov | 0:704c89673b57 | 1129 | * Output : Status of DEC_FIFO_XL see LSM6DSL_ACC_GYRO_DEC_FIFO_XL_t |
nikapov | 0:704c89673b57 | 1130 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1131 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1132 | mems_status_t LSM6DSL_ACC_GYRO_R_DEC_FIFO_XL(void *handle, LSM6DSL_ACC_GYRO_DEC_FIFO_XL_t *value) |
nikapov | 0:704c89673b57 | 1133 | { |
nikapov | 0:704c89673b57 | 1134 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL3, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 1135 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1136 | |
nikapov | 0:704c89673b57 | 1137 | *value &= LSM6DSL_ACC_GYRO_DEC_FIFO_XL_MASK; //mask |
nikapov | 0:704c89673b57 | 1138 | |
nikapov | 0:704c89673b57 | 1139 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1140 | } |
nikapov | 0:704c89673b57 | 1141 | |
nikapov | 0:704c89673b57 | 1142 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1143 | * Function Name : LSM6DSL_ACC_GYRO_W_DEC_FIFO_G |
nikapov | 0:704c89673b57 | 1144 | * Description : Write DEC_FIFO_G |
nikapov | 0:704c89673b57 | 1145 | * Input : LSM6DSL_ACC_GYRO_DEC_FIFO_G_t |
nikapov | 0:704c89673b57 | 1146 | * Output : None |
nikapov | 0:704c89673b57 | 1147 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1148 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1149 | mems_status_t LSM6DSL_ACC_GYRO_W_DEC_FIFO_G(void *handle, LSM6DSL_ACC_GYRO_DEC_FIFO_G_t newValue) |
nikapov | 0:704c89673b57 | 1150 | { |
nikapov | 0:704c89673b57 | 1151 | u8_t value; |
nikapov | 0:704c89673b57 | 1152 | |
nikapov | 0:704c89673b57 | 1153 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL3, &value, 1)) |
nikapov | 0:704c89673b57 | 1154 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1155 | |
nikapov | 0:704c89673b57 | 1156 | value &= ~LSM6DSL_ACC_GYRO_DEC_FIFO_G_MASK; |
nikapov | 0:704c89673b57 | 1157 | value |= newValue; |
nikapov | 0:704c89673b57 | 1158 | |
nikapov | 0:704c89673b57 | 1159 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL3, &value, 1) ) |
nikapov | 0:704c89673b57 | 1160 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1161 | |
nikapov | 0:704c89673b57 | 1162 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1163 | } |
nikapov | 0:704c89673b57 | 1164 | |
nikapov | 0:704c89673b57 | 1165 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1166 | * Function Name : LSM6DSL_ACC_GYRO_W_DEC_FIFO_G_val |
nikapov | 0:704c89673b57 | 1167 | * Description : Write DEC_FIFO_G |
nikapov | 0:704c89673b57 | 1168 | * Input : u16_t |
nikapov | 0:704c89673b57 | 1169 | * Output : Program G decimation value from unsigned short |
nikapov | 0:704c89673b57 | 1170 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1171 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1172 | mems_status_t LSM6DSL_ACC_GYRO_W_DEC_FIFO_G_val(void *handle, u16_t newValue) |
nikapov | 0:704c89673b57 | 1173 | { |
nikapov | 0:704c89673b57 | 1174 | switch(newValue) { |
nikapov | 0:704c89673b57 | 1175 | case 0: |
nikapov | 0:704c89673b57 | 1176 | LSM6DSL_ACC_GYRO_W_DEC_FIFO_G(handle, LSM6DSL_ACC_GYRO_DEC_FIFO_G_DATA_NOT_IN_FIFO); |
nikapov | 0:704c89673b57 | 1177 | break; |
nikapov | 0:704c89673b57 | 1178 | |
nikapov | 0:704c89673b57 | 1179 | case 1: |
nikapov | 0:704c89673b57 | 1180 | LSM6DSL_ACC_GYRO_W_DEC_FIFO_G(handle, LSM6DSL_ACC_GYRO_DEC_FIFO_G_NO_DECIMATION); |
nikapov | 0:704c89673b57 | 1181 | break; |
nikapov | 0:704c89673b57 | 1182 | |
nikapov | 0:704c89673b57 | 1183 | case 2: |
nikapov | 0:704c89673b57 | 1184 | LSM6DSL_ACC_GYRO_W_DEC_FIFO_G(handle, LSM6DSL_ACC_GYRO_DEC_FIFO_G_DECIMATION_BY_2); |
nikapov | 0:704c89673b57 | 1185 | break; |
nikapov | 0:704c89673b57 | 1186 | |
nikapov | 0:704c89673b57 | 1187 | case 3: |
nikapov | 0:704c89673b57 | 1188 | LSM6DSL_ACC_GYRO_W_DEC_FIFO_G(handle, LSM6DSL_ACC_GYRO_DEC_FIFO_G_DECIMATION_BY_3); |
nikapov | 0:704c89673b57 | 1189 | break; |
nikapov | 0:704c89673b57 | 1190 | |
nikapov | 0:704c89673b57 | 1191 | case 4: |
nikapov | 0:704c89673b57 | 1192 | LSM6DSL_ACC_GYRO_W_DEC_FIFO_G(handle, LSM6DSL_ACC_GYRO_DEC_FIFO_G_DECIMATION_BY_4); |
nikapov | 0:704c89673b57 | 1193 | break; |
nikapov | 0:704c89673b57 | 1194 | |
nikapov | 0:704c89673b57 | 1195 | case 8: |
nikapov | 0:704c89673b57 | 1196 | LSM6DSL_ACC_GYRO_W_DEC_FIFO_G(handle, LSM6DSL_ACC_GYRO_DEC_FIFO_G_DECIMATION_BY_8); |
nikapov | 0:704c89673b57 | 1197 | break; |
nikapov | 0:704c89673b57 | 1198 | |
nikapov | 0:704c89673b57 | 1199 | case 16: |
nikapov | 0:704c89673b57 | 1200 | LSM6DSL_ACC_GYRO_W_DEC_FIFO_G(handle, LSM6DSL_ACC_GYRO_DEC_FIFO_G_DECIMATION_BY_16); |
nikapov | 0:704c89673b57 | 1201 | break; |
nikapov | 0:704c89673b57 | 1202 | |
nikapov | 0:704c89673b57 | 1203 | case 32: |
nikapov | 0:704c89673b57 | 1204 | LSM6DSL_ACC_GYRO_W_DEC_FIFO_G(handle, LSM6DSL_ACC_GYRO_DEC_FIFO_G_DECIMATION_BY_32); |
nikapov | 0:704c89673b57 | 1205 | break; |
nikapov | 0:704c89673b57 | 1206 | |
nikapov | 0:704c89673b57 | 1207 | default: |
nikapov | 0:704c89673b57 | 1208 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1209 | } |
nikapov | 0:704c89673b57 | 1210 | |
nikapov | 0:704c89673b57 | 1211 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1212 | } |
nikapov | 0:704c89673b57 | 1213 | |
nikapov | 0:704c89673b57 | 1214 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1215 | * Function Name : LSM6DSL_ACC_GYRO_R_DEC_FIFO_G |
nikapov | 0:704c89673b57 | 1216 | * Description : Read DEC_FIFO_G |
nikapov | 0:704c89673b57 | 1217 | * Input : Pointer to LSM6DSL_ACC_GYRO_DEC_FIFO_G_t |
nikapov | 0:704c89673b57 | 1218 | * Output : Status of DEC_FIFO_G see LSM6DSL_ACC_GYRO_DEC_FIFO_G_t |
nikapov | 0:704c89673b57 | 1219 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1220 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1221 | mems_status_t LSM6DSL_ACC_GYRO_R_DEC_FIFO_G(void *handle, LSM6DSL_ACC_GYRO_DEC_FIFO_G_t *value) |
nikapov | 0:704c89673b57 | 1222 | { |
nikapov | 0:704c89673b57 | 1223 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL3, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 1224 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1225 | |
nikapov | 0:704c89673b57 | 1226 | *value &= LSM6DSL_ACC_GYRO_DEC_FIFO_G_MASK; //mask |
nikapov | 0:704c89673b57 | 1227 | |
nikapov | 0:704c89673b57 | 1228 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1229 | } |
nikapov | 0:704c89673b57 | 1230 | |
nikapov | 0:704c89673b57 | 1231 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1232 | * Function Name : LSM6DSL_ACC_GYRO_W_DEC_FIFO_DS3 |
nikapov | 0:704c89673b57 | 1233 | * Description : Write DEC_DS3_FIFO |
nikapov | 0:704c89673b57 | 1234 | * Input : LSM6DSL_ACC_GYRO_DEC_FIFO_DS3_t |
nikapov | 0:704c89673b57 | 1235 | * Output : None |
nikapov | 0:704c89673b57 | 1236 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1237 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1238 | mems_status_t LSM6DSL_ACC_GYRO_W_DEC_FIFO_DS3(void *handle, LSM6DSL_ACC_GYRO_DEC_FIFO_DS3_t newValue) |
nikapov | 0:704c89673b57 | 1239 | { |
nikapov | 0:704c89673b57 | 1240 | u8_t value; |
nikapov | 0:704c89673b57 | 1241 | |
nikapov | 0:704c89673b57 | 1242 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL4, &value, 1)) |
nikapov | 0:704c89673b57 | 1243 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1244 | |
nikapov | 0:704c89673b57 | 1245 | value &= ~LSM6DSL_ACC_GYRO_DEC_FIFO_DS3_MASK; |
nikapov | 0:704c89673b57 | 1246 | value |= newValue; |
nikapov | 0:704c89673b57 | 1247 | |
nikapov | 0:704c89673b57 | 1248 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL4, &value, 1) ) |
nikapov | 0:704c89673b57 | 1249 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1250 | |
nikapov | 0:704c89673b57 | 1251 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1252 | } |
nikapov | 0:704c89673b57 | 1253 | |
nikapov | 0:704c89673b57 | 1254 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1255 | * Function Name : LSM6DSL_ACC_GYRO_R_DEC_FIFO_DS3 |
nikapov | 0:704c89673b57 | 1256 | * Description : Read DEC_DS3_FIFO |
nikapov | 0:704c89673b57 | 1257 | * Input : Pointer to LSM6DSL_ACC_GYRO_DEC_FIFO_DS3_t |
nikapov | 0:704c89673b57 | 1258 | * Output : Status of DEC_DS3_FIFO see LSM6DSL_ACC_GYRO_DEC_FIFO_DS3_t |
nikapov | 0:704c89673b57 | 1259 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1260 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1261 | mems_status_t LSM6DSL_ACC_GYRO_R_DEC_FIFO_DS3(void *handle, LSM6DSL_ACC_GYRO_DEC_FIFO_DS3_t *value) |
nikapov | 0:704c89673b57 | 1262 | { |
nikapov | 0:704c89673b57 | 1263 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL4, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 1264 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1265 | |
nikapov | 0:704c89673b57 | 1266 | *value &= LSM6DSL_ACC_GYRO_DEC_FIFO_DS3_MASK; //mask |
nikapov | 0:704c89673b57 | 1267 | |
nikapov | 0:704c89673b57 | 1268 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1269 | } |
nikapov | 0:704c89673b57 | 1270 | |
nikapov | 0:704c89673b57 | 1271 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1272 | * Function Name : LSM6DSL_ACC_GYRO_W_DEC_FIFO_DS4 |
nikapov | 0:704c89673b57 | 1273 | * Description : Write DEC_DS4_FIFO |
nikapov | 0:704c89673b57 | 1274 | * Input : LSM6DSL_ACC_GYRO_DEC_FIFO_DS4_t |
nikapov | 0:704c89673b57 | 1275 | * Output : None |
nikapov | 0:704c89673b57 | 1276 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1277 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1278 | mems_status_t LSM6DSL_ACC_GYRO_W_DEC_FIFO_DS4(void *handle, LSM6DSL_ACC_GYRO_DEC_FIFO_DS4_t newValue) |
nikapov | 0:704c89673b57 | 1279 | { |
nikapov | 0:704c89673b57 | 1280 | u8_t value; |
nikapov | 0:704c89673b57 | 1281 | |
nikapov | 0:704c89673b57 | 1282 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL4, &value, 1)) |
nikapov | 0:704c89673b57 | 1283 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1284 | |
nikapov | 0:704c89673b57 | 1285 | value &= ~LSM6DSL_ACC_GYRO_DEC_FIFO_DS4_MASK; |
nikapov | 0:704c89673b57 | 1286 | value |= newValue; |
nikapov | 0:704c89673b57 | 1287 | |
nikapov | 0:704c89673b57 | 1288 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL4, &value, 1) ) |
nikapov | 0:704c89673b57 | 1289 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1290 | |
nikapov | 0:704c89673b57 | 1291 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1292 | } |
nikapov | 0:704c89673b57 | 1293 | |
nikapov | 0:704c89673b57 | 1294 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1295 | * Function Name : LSM6DSL_ACC_GYRO_R_DEC_FIFO_DS4 |
nikapov | 0:704c89673b57 | 1296 | * Description : Read DEC_DS4_FIFO |
nikapov | 0:704c89673b57 | 1297 | * Input : Pointer to LSM6DSL_ACC_GYRO_DEC_FIFO_DS4_t |
nikapov | 0:704c89673b57 | 1298 | * Output : Status of DEC_DS4_FIFO see LSM6DSL_ACC_GYRO_DEC_FIFO_DS4_t |
nikapov | 0:704c89673b57 | 1299 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1300 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1301 | mems_status_t LSM6DSL_ACC_GYRO_R_DEC_FIFO_DS4(void *handle, LSM6DSL_ACC_GYRO_DEC_FIFO_DS4_t *value) |
nikapov | 0:704c89673b57 | 1302 | { |
nikapov | 0:704c89673b57 | 1303 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL4, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 1304 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1305 | |
nikapov | 0:704c89673b57 | 1306 | *value &= LSM6DSL_ACC_GYRO_DEC_FIFO_DS4_MASK; //mask |
nikapov | 0:704c89673b57 | 1307 | |
nikapov | 0:704c89673b57 | 1308 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1309 | } |
nikapov | 0:704c89673b57 | 1310 | |
nikapov | 0:704c89673b57 | 1311 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1312 | * Function Name : LSM6DSL_ACC_GYRO_W_HI_DATA_ONLY |
nikapov | 0:704c89673b57 | 1313 | * Description : Write HI_DATA_ONLY |
nikapov | 0:704c89673b57 | 1314 | * Input : LSM6DSL_ACC_GYRO_HI_DATA_ONLY_t |
nikapov | 0:704c89673b57 | 1315 | * Output : None |
nikapov | 0:704c89673b57 | 1316 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1317 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1318 | mems_status_t LSM6DSL_ACC_GYRO_W_HI_DATA_ONLY(void *handle, LSM6DSL_ACC_GYRO_HI_DATA_ONLY_t newValue) |
nikapov | 0:704c89673b57 | 1319 | { |
nikapov | 0:704c89673b57 | 1320 | u8_t value; |
nikapov | 0:704c89673b57 | 1321 | |
nikapov | 0:704c89673b57 | 1322 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL4, &value, 1)) |
nikapov | 0:704c89673b57 | 1323 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1324 | |
nikapov | 0:704c89673b57 | 1325 | value &= ~LSM6DSL_ACC_GYRO_HI_DATA_ONLY_MASK; |
nikapov | 0:704c89673b57 | 1326 | value |= newValue; |
nikapov | 0:704c89673b57 | 1327 | |
nikapov | 0:704c89673b57 | 1328 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL4, &value, 1) ) |
nikapov | 0:704c89673b57 | 1329 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1330 | |
nikapov | 0:704c89673b57 | 1331 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1332 | } |
nikapov | 0:704c89673b57 | 1333 | |
nikapov | 0:704c89673b57 | 1334 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1335 | * Function Name : LSM6DSL_ACC_GYRO_R_HI_DATA_ONLY |
nikapov | 0:704c89673b57 | 1336 | * Description : Read HI_DATA_ONLY |
nikapov | 0:704c89673b57 | 1337 | * Input : Pointer to LSM6DSL_ACC_GYRO_HI_DATA_ONLY_t |
nikapov | 0:704c89673b57 | 1338 | * Output : Status of HI_DATA_ONLY see LSM6DSL_ACC_GYRO_HI_DATA_ONLY_t |
nikapov | 0:704c89673b57 | 1339 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1340 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1341 | mems_status_t LSM6DSL_ACC_GYRO_R_HI_DATA_ONLY(void *handle, LSM6DSL_ACC_GYRO_HI_DATA_ONLY_t *value) |
nikapov | 0:704c89673b57 | 1342 | { |
nikapov | 0:704c89673b57 | 1343 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL4, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 1344 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1345 | |
nikapov | 0:704c89673b57 | 1346 | *value &= LSM6DSL_ACC_GYRO_HI_DATA_ONLY_MASK; //mask |
nikapov | 0:704c89673b57 | 1347 | |
nikapov | 0:704c89673b57 | 1348 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1349 | } |
nikapov | 0:704c89673b57 | 1350 | |
nikapov | 0:704c89673b57 | 1351 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1352 | * Function Name : LSM6DSL_ACC_GYRO_W_STOP_ON_FTH |
nikapov | 0:704c89673b57 | 1353 | * Description : Write STOP_ON_FTH |
nikapov | 0:704c89673b57 | 1354 | * Input : LSM6DSL_ACC_GYRO_STOP_ON_FTH_t |
nikapov | 0:704c89673b57 | 1355 | * Output : None |
nikapov | 0:704c89673b57 | 1356 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1357 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1358 | mems_status_t LSM6DSL_ACC_GYRO_W_STOP_ON_FTH(void *handle, LSM6DSL_ACC_GYRO_STOP_ON_FTH_t newValue) |
nikapov | 0:704c89673b57 | 1359 | { |
nikapov | 0:704c89673b57 | 1360 | u8_t value; |
nikapov | 0:704c89673b57 | 1361 | |
nikapov | 0:704c89673b57 | 1362 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL4, &value, 1)) |
nikapov | 0:704c89673b57 | 1363 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1364 | |
nikapov | 0:704c89673b57 | 1365 | value &= ~LSM6DSL_ACC_GYRO_STOP_ON_FTH_MASK; |
nikapov | 0:704c89673b57 | 1366 | value |= newValue; |
nikapov | 0:704c89673b57 | 1367 | |
nikapov | 0:704c89673b57 | 1368 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL4, &value, 1) ) |
nikapov | 0:704c89673b57 | 1369 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1370 | |
nikapov | 0:704c89673b57 | 1371 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1372 | } |
nikapov | 0:704c89673b57 | 1373 | |
nikapov | 0:704c89673b57 | 1374 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1375 | * Function Name : LSM6DSL_ACC_GYRO_R_STOP_ON_FTH |
nikapov | 0:704c89673b57 | 1376 | * Description : Read STOP_ON_FTH |
nikapov | 0:704c89673b57 | 1377 | * Input : Pointer to LSM6DSL_ACC_GYRO_STOP_ON_FTH_t |
nikapov | 0:704c89673b57 | 1378 | * Output : Status of STOP_ON_FTH see LSM6DSL_ACC_GYRO_STOP_ON_FTH_t |
nikapov | 0:704c89673b57 | 1379 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1380 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1381 | mems_status_t LSM6DSL_ACC_GYRO_R_STOP_ON_FTH(void *handle, LSM6DSL_ACC_GYRO_STOP_ON_FTH_t *value) |
nikapov | 0:704c89673b57 | 1382 | { |
nikapov | 0:704c89673b57 | 1383 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL4, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 1384 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1385 | |
nikapov | 0:704c89673b57 | 1386 | *value &= LSM6DSL_ACC_GYRO_STOP_ON_FTH_MASK; //mask |
nikapov | 0:704c89673b57 | 1387 | |
nikapov | 0:704c89673b57 | 1388 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1389 | } |
nikapov | 0:704c89673b57 | 1390 | |
nikapov | 0:704c89673b57 | 1391 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1392 | * Function Name : LSM6DSL_ACC_GYRO_W_FIFO_MODE |
nikapov | 0:704c89673b57 | 1393 | * Description : Write FIFO_MODE |
nikapov | 0:704c89673b57 | 1394 | * Input : LSM6DSL_ACC_GYRO_FIFO_MODE_t |
nikapov | 0:704c89673b57 | 1395 | * Output : None |
nikapov | 0:704c89673b57 | 1396 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1397 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1398 | mems_status_t LSM6DSL_ACC_GYRO_W_FIFO_MODE(void *handle, LSM6DSL_ACC_GYRO_FIFO_MODE_t newValue) |
nikapov | 0:704c89673b57 | 1399 | { |
nikapov | 0:704c89673b57 | 1400 | u8_t value; |
nikapov | 0:704c89673b57 | 1401 | |
nikapov | 0:704c89673b57 | 1402 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL5, &value, 1)) |
nikapov | 0:704c89673b57 | 1403 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1404 | |
nikapov | 0:704c89673b57 | 1405 | value &= ~LSM6DSL_ACC_GYRO_FIFO_MODE_MASK; |
nikapov | 0:704c89673b57 | 1406 | value |= newValue; |
nikapov | 0:704c89673b57 | 1407 | |
nikapov | 0:704c89673b57 | 1408 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL5, &value, 1) ) |
nikapov | 0:704c89673b57 | 1409 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1410 | |
nikapov | 0:704c89673b57 | 1411 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1412 | } |
nikapov | 0:704c89673b57 | 1413 | |
nikapov | 0:704c89673b57 | 1414 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1415 | * Function Name : LSM6DSL_ACC_GYRO_R_FIFO_MODE |
nikapov | 0:704c89673b57 | 1416 | * Description : Read FIFO_MODE |
nikapov | 0:704c89673b57 | 1417 | * Input : Pointer to LSM6DSL_ACC_GYRO_FIFO_MODE_t |
nikapov | 0:704c89673b57 | 1418 | * Output : Status of FIFO_MODE see LSM6DSL_ACC_GYRO_FIFO_MODE_t |
nikapov | 0:704c89673b57 | 1419 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1420 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1421 | mems_status_t LSM6DSL_ACC_GYRO_R_FIFO_MODE(void *handle, LSM6DSL_ACC_GYRO_FIFO_MODE_t *value) |
nikapov | 0:704c89673b57 | 1422 | { |
nikapov | 0:704c89673b57 | 1423 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL5, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 1424 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1425 | |
nikapov | 0:704c89673b57 | 1426 | *value &= LSM6DSL_ACC_GYRO_FIFO_MODE_MASK; //mask |
nikapov | 0:704c89673b57 | 1427 | |
nikapov | 0:704c89673b57 | 1428 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1429 | } |
nikapov | 0:704c89673b57 | 1430 | |
nikapov | 0:704c89673b57 | 1431 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1432 | * Function Name : LSM6DSL_ACC_GYRO_W_ODR_FIFO |
nikapov | 0:704c89673b57 | 1433 | * Description : Write ODR_FIFO |
nikapov | 0:704c89673b57 | 1434 | * Input : LSM6DSL_ACC_GYRO_ODR_FIFO_t |
nikapov | 0:704c89673b57 | 1435 | * Output : None |
nikapov | 0:704c89673b57 | 1436 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1437 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1438 | mems_status_t LSM6DSL_ACC_GYRO_W_ODR_FIFO(void *handle, LSM6DSL_ACC_GYRO_ODR_FIFO_t newValue) |
nikapov | 0:704c89673b57 | 1439 | { |
nikapov | 0:704c89673b57 | 1440 | u8_t value; |
nikapov | 0:704c89673b57 | 1441 | |
nikapov | 0:704c89673b57 | 1442 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL5, &value, 1)) |
nikapov | 0:704c89673b57 | 1443 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1444 | |
nikapov | 0:704c89673b57 | 1445 | value &= ~LSM6DSL_ACC_GYRO_ODR_FIFO_MASK; |
nikapov | 0:704c89673b57 | 1446 | value |= newValue; |
nikapov | 0:704c89673b57 | 1447 | |
nikapov | 0:704c89673b57 | 1448 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL5, &value, 1) ) |
nikapov | 0:704c89673b57 | 1449 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1450 | |
nikapov | 0:704c89673b57 | 1451 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1452 | } |
nikapov | 0:704c89673b57 | 1453 | |
nikapov | 0:704c89673b57 | 1454 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1455 | * Function Name : LSM6DSL_ACC_GYRO_R_ODR_FIFO |
nikapov | 0:704c89673b57 | 1456 | * Description : Read ODR_FIFO |
nikapov | 0:704c89673b57 | 1457 | * Input : Pointer to LSM6DSL_ACC_GYRO_ODR_FIFO_t |
nikapov | 0:704c89673b57 | 1458 | * Output : Status of ODR_FIFO see LSM6DSL_ACC_GYRO_ODR_FIFO_t |
nikapov | 0:704c89673b57 | 1459 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1460 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1461 | mems_status_t LSM6DSL_ACC_GYRO_R_ODR_FIFO(void *handle, LSM6DSL_ACC_GYRO_ODR_FIFO_t *value) |
nikapov | 0:704c89673b57 | 1462 | { |
nikapov | 0:704c89673b57 | 1463 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_CTRL5, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 1464 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1465 | |
nikapov | 0:704c89673b57 | 1466 | *value &= LSM6DSL_ACC_GYRO_ODR_FIFO_MASK; //mask |
nikapov | 0:704c89673b57 | 1467 | |
nikapov | 0:704c89673b57 | 1468 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1469 | } |
nikapov | 0:704c89673b57 | 1470 | |
nikapov | 0:704c89673b57 | 1471 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1472 | * Function Name : LSM6DSL_ACC_GYRO_W_DRDY_PULSE |
nikapov | 0:704c89673b57 | 1473 | * Description : Write DRDY_PULSE |
nikapov | 0:704c89673b57 | 1474 | * Input : LSM6DSL_ACC_GYRO_DRDY_PULSE_t |
nikapov | 0:704c89673b57 | 1475 | * Output : None |
nikapov | 0:704c89673b57 | 1476 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1477 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1478 | mems_status_t LSM6DSL_ACC_GYRO_W_DRDY_PULSE(void *handle, LSM6DSL_ACC_GYRO_DRDY_PULSE_t newValue) |
nikapov | 0:704c89673b57 | 1479 | { |
nikapov | 0:704c89673b57 | 1480 | u8_t value; |
nikapov | 0:704c89673b57 | 1481 | |
nikapov | 0:704c89673b57 | 1482 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_DRDY_PULSE_CFG_G, &value, 1)) |
nikapov | 0:704c89673b57 | 1483 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1484 | |
nikapov | 0:704c89673b57 | 1485 | value &= ~LSM6DSL_ACC_GYRO_DRDY_PULSE_MASK; |
nikapov | 0:704c89673b57 | 1486 | value |= newValue; |
nikapov | 0:704c89673b57 | 1487 | |
nikapov | 0:704c89673b57 | 1488 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_DRDY_PULSE_CFG_G, &value, 1) ) |
nikapov | 0:704c89673b57 | 1489 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1490 | |
nikapov | 0:704c89673b57 | 1491 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1492 | } |
nikapov | 0:704c89673b57 | 1493 | |
nikapov | 0:704c89673b57 | 1494 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1495 | * Function Name : LSM6DSL_ACC_GYRO_R_DRDY_PULSE |
nikapov | 0:704c89673b57 | 1496 | * Description : Read DRDY_PULSE |
nikapov | 0:704c89673b57 | 1497 | * Input : Pointer to LSM6DSL_ACC_GYRO_DRDY_PULSE_t |
nikapov | 0:704c89673b57 | 1498 | * Output : Status of DRDY_PULSE see LSM6DSL_ACC_GYRO_DRDY_PULSE_t |
nikapov | 0:704c89673b57 | 1499 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1500 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1501 | mems_status_t LSM6DSL_ACC_GYRO_R_DRDY_PULSE(void *handle, LSM6DSL_ACC_GYRO_DRDY_PULSE_t *value) |
nikapov | 0:704c89673b57 | 1502 | { |
nikapov | 0:704c89673b57 | 1503 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_DRDY_PULSE_CFG_G, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 1504 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1505 | |
nikapov | 0:704c89673b57 | 1506 | *value &= LSM6DSL_ACC_GYRO_DRDY_PULSE_MASK; //mask |
nikapov | 0:704c89673b57 | 1507 | |
nikapov | 0:704c89673b57 | 1508 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1509 | } |
nikapov | 0:704c89673b57 | 1510 | |
nikapov | 0:704c89673b57 | 1511 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1512 | * Function Name : LSM6DSL_ACC_GYRO_W_DRDY_XL_on_INT1 |
nikapov | 0:704c89673b57 | 1513 | * Description : Write INT1_DRDY_XL |
nikapov | 0:704c89673b57 | 1514 | * Input : LSM6DSL_ACC_GYRO_INT1_DRDY_XL_t |
nikapov | 0:704c89673b57 | 1515 | * Output : None |
nikapov | 0:704c89673b57 | 1516 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1517 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1518 | mems_status_t LSM6DSL_ACC_GYRO_W_DRDY_XL_on_INT1(void *handle, LSM6DSL_ACC_GYRO_INT1_DRDY_XL_t newValue) |
nikapov | 0:704c89673b57 | 1519 | { |
nikapov | 0:704c89673b57 | 1520 | u8_t value; |
nikapov | 0:704c89673b57 | 1521 | |
nikapov | 0:704c89673b57 | 1522 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT1_CTRL, &value, 1)) |
nikapov | 0:704c89673b57 | 1523 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1524 | |
nikapov | 0:704c89673b57 | 1525 | value &= ~LSM6DSL_ACC_GYRO_INT1_DRDY_XL_MASK; |
nikapov | 0:704c89673b57 | 1526 | value |= newValue; |
nikapov | 0:704c89673b57 | 1527 | |
nikapov | 0:704c89673b57 | 1528 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_INT1_CTRL, &value, 1) ) |
nikapov | 0:704c89673b57 | 1529 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1530 | |
nikapov | 0:704c89673b57 | 1531 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1532 | } |
nikapov | 0:704c89673b57 | 1533 | |
nikapov | 0:704c89673b57 | 1534 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1535 | * Function Name : LSM6DSL_ACC_GYRO_R_DRDY_XL_on_INT1 |
nikapov | 0:704c89673b57 | 1536 | * Description : Read INT1_DRDY_XL |
nikapov | 0:704c89673b57 | 1537 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT1_DRDY_XL_t |
nikapov | 0:704c89673b57 | 1538 | * Output : Status of INT1_DRDY_XL see LSM6DSL_ACC_GYRO_INT1_DRDY_XL_t |
nikapov | 0:704c89673b57 | 1539 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1540 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1541 | mems_status_t LSM6DSL_ACC_GYRO_R_DRDY_XL_on_INT1(void *handle, LSM6DSL_ACC_GYRO_INT1_DRDY_XL_t *value) |
nikapov | 0:704c89673b57 | 1542 | { |
nikapov | 0:704c89673b57 | 1543 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT1_CTRL, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 1544 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1545 | |
nikapov | 0:704c89673b57 | 1546 | *value &= LSM6DSL_ACC_GYRO_INT1_DRDY_XL_MASK; //mask |
nikapov | 0:704c89673b57 | 1547 | |
nikapov | 0:704c89673b57 | 1548 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1549 | } |
nikapov | 0:704c89673b57 | 1550 | |
nikapov | 0:704c89673b57 | 1551 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1552 | * Function Name : LSM6DSL_ACC_GYRO_W_DRDY_G_on_INT1 |
nikapov | 0:704c89673b57 | 1553 | * Description : Write INT1_DRDY_G |
nikapov | 0:704c89673b57 | 1554 | * Input : LSM6DSL_ACC_GYRO_INT1_DRDY_G_t |
nikapov | 0:704c89673b57 | 1555 | * Output : None |
nikapov | 0:704c89673b57 | 1556 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1557 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1558 | mems_status_t LSM6DSL_ACC_GYRO_W_DRDY_G_on_INT1(void *handle, LSM6DSL_ACC_GYRO_INT1_DRDY_G_t newValue) |
nikapov | 0:704c89673b57 | 1559 | { |
nikapov | 0:704c89673b57 | 1560 | u8_t value; |
nikapov | 0:704c89673b57 | 1561 | |
nikapov | 0:704c89673b57 | 1562 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT1_CTRL, &value, 1)) |
nikapov | 0:704c89673b57 | 1563 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1564 | |
nikapov | 0:704c89673b57 | 1565 | value &= ~LSM6DSL_ACC_GYRO_INT1_DRDY_G_MASK; |
nikapov | 0:704c89673b57 | 1566 | value |= newValue; |
nikapov | 0:704c89673b57 | 1567 | |
nikapov | 0:704c89673b57 | 1568 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_INT1_CTRL, &value, 1) ) |
nikapov | 0:704c89673b57 | 1569 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1570 | |
nikapov | 0:704c89673b57 | 1571 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1572 | } |
nikapov | 0:704c89673b57 | 1573 | |
nikapov | 0:704c89673b57 | 1574 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1575 | * Function Name : LSM6DSL_ACC_GYRO_R_DRDY_G_on_INT1 |
nikapov | 0:704c89673b57 | 1576 | * Description : Read INT1_DRDY_G |
nikapov | 0:704c89673b57 | 1577 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT1_DRDY_G_t |
nikapov | 0:704c89673b57 | 1578 | * Output : Status of INT1_DRDY_G see LSM6DSL_ACC_GYRO_INT1_DRDY_G_t |
nikapov | 0:704c89673b57 | 1579 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1580 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1581 | mems_status_t LSM6DSL_ACC_GYRO_R_DRDY_G_on_INT1(void *handle, LSM6DSL_ACC_GYRO_INT1_DRDY_G_t *value) |
nikapov | 0:704c89673b57 | 1582 | { |
nikapov | 0:704c89673b57 | 1583 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT1_CTRL, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 1584 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1585 | |
nikapov | 0:704c89673b57 | 1586 | *value &= LSM6DSL_ACC_GYRO_INT1_DRDY_G_MASK; //mask |
nikapov | 0:704c89673b57 | 1587 | |
nikapov | 0:704c89673b57 | 1588 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1589 | } |
nikapov | 0:704c89673b57 | 1590 | |
nikapov | 0:704c89673b57 | 1591 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1592 | * Function Name : LSM6DSL_ACC_GYRO_W_BOOT_on_INT1 |
nikapov | 0:704c89673b57 | 1593 | * Description : Write INT1_BOOT |
nikapov | 0:704c89673b57 | 1594 | * Input : LSM6DSL_ACC_GYRO_INT1_BOOT_t |
nikapov | 0:704c89673b57 | 1595 | * Output : None |
nikapov | 0:704c89673b57 | 1596 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1597 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1598 | mems_status_t LSM6DSL_ACC_GYRO_W_BOOT_on_INT1(void *handle, LSM6DSL_ACC_GYRO_INT1_BOOT_t newValue) |
nikapov | 0:704c89673b57 | 1599 | { |
nikapov | 0:704c89673b57 | 1600 | u8_t value; |
nikapov | 0:704c89673b57 | 1601 | |
nikapov | 0:704c89673b57 | 1602 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT1_CTRL, &value, 1)) |
nikapov | 0:704c89673b57 | 1603 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1604 | |
nikapov | 0:704c89673b57 | 1605 | value &= ~LSM6DSL_ACC_GYRO_INT1_BOOT_MASK; |
nikapov | 0:704c89673b57 | 1606 | value |= newValue; |
nikapov | 0:704c89673b57 | 1607 | |
nikapov | 0:704c89673b57 | 1608 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_INT1_CTRL, &value, 1) ) |
nikapov | 0:704c89673b57 | 1609 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1610 | |
nikapov | 0:704c89673b57 | 1611 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1612 | } |
nikapov | 0:704c89673b57 | 1613 | |
nikapov | 0:704c89673b57 | 1614 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1615 | * Function Name : LSM6DSL_ACC_GYRO_R_BOOT_on_INT1 |
nikapov | 0:704c89673b57 | 1616 | * Description : Read INT1_BOOT |
nikapov | 0:704c89673b57 | 1617 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT1_BOOT_t |
nikapov | 0:704c89673b57 | 1618 | * Output : Status of INT1_BOOT see LSM6DSL_ACC_GYRO_INT1_BOOT_t |
nikapov | 0:704c89673b57 | 1619 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1620 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1621 | mems_status_t LSM6DSL_ACC_GYRO_R_BOOT_on_INT1(void *handle, LSM6DSL_ACC_GYRO_INT1_BOOT_t *value) |
nikapov | 0:704c89673b57 | 1622 | { |
nikapov | 0:704c89673b57 | 1623 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT1_CTRL, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 1624 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1625 | |
nikapov | 0:704c89673b57 | 1626 | *value &= LSM6DSL_ACC_GYRO_INT1_BOOT_MASK; //mask |
nikapov | 0:704c89673b57 | 1627 | |
nikapov | 0:704c89673b57 | 1628 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1629 | } |
nikapov | 0:704c89673b57 | 1630 | |
nikapov | 0:704c89673b57 | 1631 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1632 | * Function Name : LSM6DSL_ACC_GYRO_W_FIFO_TSHLD_on_INT1 |
nikapov | 0:704c89673b57 | 1633 | * Description : Write INT1_FTH |
nikapov | 0:704c89673b57 | 1634 | * Input : LSM6DSL_ACC_GYRO_INT1_FTH_t |
nikapov | 0:704c89673b57 | 1635 | * Output : None |
nikapov | 0:704c89673b57 | 1636 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1637 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1638 | mems_status_t LSM6DSL_ACC_GYRO_W_FIFO_TSHLD_on_INT1(void *handle, LSM6DSL_ACC_GYRO_INT1_FTH_t newValue) |
nikapov | 0:704c89673b57 | 1639 | { |
nikapov | 0:704c89673b57 | 1640 | u8_t value; |
nikapov | 0:704c89673b57 | 1641 | |
nikapov | 0:704c89673b57 | 1642 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT1_CTRL, &value, 1) ) |
nikapov | 0:704c89673b57 | 1643 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1644 | |
nikapov | 0:704c89673b57 | 1645 | value &= ~LSM6DSL_ACC_GYRO_INT1_FTH_MASK; |
nikapov | 0:704c89673b57 | 1646 | value |= newValue; |
nikapov | 0:704c89673b57 | 1647 | |
nikapov | 0:704c89673b57 | 1648 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_INT1_CTRL, &value, 1) ) |
nikapov | 0:704c89673b57 | 1649 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1650 | |
nikapov | 0:704c89673b57 | 1651 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1652 | } |
nikapov | 0:704c89673b57 | 1653 | |
nikapov | 0:704c89673b57 | 1654 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1655 | * Function Name : LSM6DSL_ACC_GYRO_R_FIFO_TSHLD_on_INT1 |
nikapov | 0:704c89673b57 | 1656 | * Description : Read INT1_FTH |
nikapov | 0:704c89673b57 | 1657 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT1_FTH_t |
nikapov | 0:704c89673b57 | 1658 | * Output : Status of INT1_FTH see LSM6DSL_ACC_GYRO_INT1_FTH_t |
nikapov | 0:704c89673b57 | 1659 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1660 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1661 | mems_status_t LSM6DSL_ACC_GYRO_R_FIFO_TSHLD_on_INT1(void *handle, LSM6DSL_ACC_GYRO_INT1_FTH_t *value) |
nikapov | 0:704c89673b57 | 1662 | { |
nikapov | 0:704c89673b57 | 1663 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT1_CTRL, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 1664 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1665 | |
nikapov | 0:704c89673b57 | 1666 | *value &= LSM6DSL_ACC_GYRO_INT1_FTH_MASK; //mask |
nikapov | 0:704c89673b57 | 1667 | |
nikapov | 0:704c89673b57 | 1668 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1669 | } |
nikapov | 0:704c89673b57 | 1670 | |
nikapov | 0:704c89673b57 | 1671 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1672 | * Function Name : LSM6DSL_ACC_GYRO_W_OVERRUN_on_INT1 |
nikapov | 0:704c89673b57 | 1673 | * Description : Write INT1_OVR |
nikapov | 0:704c89673b57 | 1674 | * Input : LSM6DSL_ACC_GYRO_INT1_OVR_t |
nikapov | 0:704c89673b57 | 1675 | * Output : None |
nikapov | 0:704c89673b57 | 1676 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1677 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1678 | mems_status_t LSM6DSL_ACC_GYRO_W_OVERRUN_on_INT1(void *handle, LSM6DSL_ACC_GYRO_INT1_OVR_t newValue) |
nikapov | 0:704c89673b57 | 1679 | { |
nikapov | 0:704c89673b57 | 1680 | u8_t value; |
nikapov | 0:704c89673b57 | 1681 | |
nikapov | 0:704c89673b57 | 1682 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT1_CTRL, &value, 1)) |
nikapov | 0:704c89673b57 | 1683 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1684 | |
nikapov | 0:704c89673b57 | 1685 | value &= ~LSM6DSL_ACC_GYRO_INT1_OVR_MASK; |
nikapov | 0:704c89673b57 | 1686 | value |= newValue; |
nikapov | 0:704c89673b57 | 1687 | |
nikapov | 0:704c89673b57 | 1688 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_INT1_CTRL, &value, 1)) |
nikapov | 0:704c89673b57 | 1689 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1690 | |
nikapov | 0:704c89673b57 | 1691 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1692 | } |
nikapov | 0:704c89673b57 | 1693 | |
nikapov | 0:704c89673b57 | 1694 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1695 | * Function Name : LSM6DSL_ACC_GYRO_R_OVERRUN_on_INT1 |
nikapov | 0:704c89673b57 | 1696 | * Description : Read INT1_OVR |
nikapov | 0:704c89673b57 | 1697 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT1_OVR_t |
nikapov | 0:704c89673b57 | 1698 | * Output : Status of INT1_OVR see LSM6DSL_ACC_GYRO_INT1_OVR_t |
nikapov | 0:704c89673b57 | 1699 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1700 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1701 | mems_status_t LSM6DSL_ACC_GYRO_R_OVERRUN_on_INT1(void *handle, LSM6DSL_ACC_GYRO_INT1_OVR_t *value) |
nikapov | 0:704c89673b57 | 1702 | { |
nikapov | 0:704c89673b57 | 1703 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT1_CTRL, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 1704 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1705 | |
nikapov | 0:704c89673b57 | 1706 | *value &= LSM6DSL_ACC_GYRO_INT1_OVR_MASK; //mask |
nikapov | 0:704c89673b57 | 1707 | |
nikapov | 0:704c89673b57 | 1708 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1709 | } |
nikapov | 0:704c89673b57 | 1710 | |
nikapov | 0:704c89673b57 | 1711 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1712 | * Function Name : LSM6DSL_ACC_GYRO_W_FULL_FLAG_on_INT1 |
nikapov | 0:704c89673b57 | 1713 | * Description : Write INT1_FULL_FLAG |
nikapov | 0:704c89673b57 | 1714 | * Input : LSM6DSL_ACC_GYRO_INT1_FULL_FLAG_t |
nikapov | 0:704c89673b57 | 1715 | * Output : None |
nikapov | 0:704c89673b57 | 1716 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1717 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1718 | mems_status_t LSM6DSL_ACC_GYRO_W_FULL_FLAG_on_INT1(void *handle, LSM6DSL_ACC_GYRO_INT1_FULL_FLAG_t newValue) |
nikapov | 0:704c89673b57 | 1719 | { |
nikapov | 0:704c89673b57 | 1720 | u8_t value; |
nikapov | 0:704c89673b57 | 1721 | |
nikapov | 0:704c89673b57 | 1722 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT1_CTRL, &value, 1)) |
nikapov | 0:704c89673b57 | 1723 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1724 | |
nikapov | 0:704c89673b57 | 1725 | value &= ~LSM6DSL_ACC_GYRO_INT1_FULL_FLAG_MASK; |
nikapov | 0:704c89673b57 | 1726 | value |= newValue; |
nikapov | 0:704c89673b57 | 1727 | |
nikapov | 0:704c89673b57 | 1728 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_INT1_CTRL, &value, 1) ) |
nikapov | 0:704c89673b57 | 1729 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1730 | |
nikapov | 0:704c89673b57 | 1731 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1732 | } |
nikapov | 0:704c89673b57 | 1733 | |
nikapov | 0:704c89673b57 | 1734 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1735 | * Function Name : LSM6DSL_ACC_GYRO_R_FULL_FLAG_on_INT1 |
nikapov | 0:704c89673b57 | 1736 | * Description : Read INT1_FULL_FLAG |
nikapov | 0:704c89673b57 | 1737 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT1_FULL_FLAG_t |
nikapov | 0:704c89673b57 | 1738 | * Output : Status of INT1_FULL_FLAG see LSM6DSL_ACC_GYRO_INT1_FULL_FLAG_t |
nikapov | 0:704c89673b57 | 1739 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1740 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1741 | mems_status_t LSM6DSL_ACC_GYRO_R_FULL_FLAG_on_INT1(void *handle, LSM6DSL_ACC_GYRO_INT1_FULL_FLAG_t *value) |
nikapov | 0:704c89673b57 | 1742 | { |
nikapov | 0:704c89673b57 | 1743 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT1_CTRL, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 1744 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1745 | |
nikapov | 0:704c89673b57 | 1746 | *value &= LSM6DSL_ACC_GYRO_INT1_FULL_FLAG_MASK; //mask |
nikapov | 0:704c89673b57 | 1747 | |
nikapov | 0:704c89673b57 | 1748 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1749 | } |
nikapov | 0:704c89673b57 | 1750 | |
nikapov | 0:704c89673b57 | 1751 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1752 | * Function Name : LSM6DSL_ACC_GYRO_W_SIGN_MOT_on_INT1 |
nikapov | 0:704c89673b57 | 1753 | * Description : Write INT1_SIGN_MOT |
nikapov | 0:704c89673b57 | 1754 | * Input : LSM6DSL_ACC_GYRO_INT1_SIGN_MOT_t |
nikapov | 0:704c89673b57 | 1755 | * Output : None |
nikapov | 0:704c89673b57 | 1756 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1757 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1758 | mems_status_t LSM6DSL_ACC_GYRO_W_SIGN_MOT_on_INT1(void *handle, LSM6DSL_ACC_GYRO_INT1_SIGN_MOT_t newValue) |
nikapov | 0:704c89673b57 | 1759 | { |
nikapov | 0:704c89673b57 | 1760 | u8_t value; |
nikapov | 0:704c89673b57 | 1761 | |
nikapov | 0:704c89673b57 | 1762 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT1_CTRL, &value, 1)) |
nikapov | 0:704c89673b57 | 1763 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1764 | |
nikapov | 0:704c89673b57 | 1765 | value &= ~LSM6DSL_ACC_GYRO_INT1_SIGN_MOT_MASK; |
nikapov | 0:704c89673b57 | 1766 | value |= newValue; |
nikapov | 0:704c89673b57 | 1767 | |
nikapov | 0:704c89673b57 | 1768 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_INT1_CTRL, &value, 1) ) |
nikapov | 0:704c89673b57 | 1769 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1770 | |
nikapov | 0:704c89673b57 | 1771 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1772 | } |
nikapov | 0:704c89673b57 | 1773 | |
nikapov | 0:704c89673b57 | 1774 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1775 | * Function Name : LSM6DSL_ACC_GYRO_R_SIGN_MOT_on_INT1 |
nikapov | 0:704c89673b57 | 1776 | * Description : Read INT1_SIGN_MOT |
nikapov | 0:704c89673b57 | 1777 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT1_SIGN_MOT_t |
nikapov | 0:704c89673b57 | 1778 | * Output : Status of INT1_SIGN_MOT see LSM6DSL_ACC_GYRO_INT1_SIGN_MOT_t |
nikapov | 0:704c89673b57 | 1779 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1780 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1781 | mems_status_t LSM6DSL_ACC_GYRO_R_SIGN_MOT_on_INT1(void *handle, LSM6DSL_ACC_GYRO_INT1_SIGN_MOT_t *value) |
nikapov | 0:704c89673b57 | 1782 | { |
nikapov | 0:704c89673b57 | 1783 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT1_CTRL, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 1784 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1785 | |
nikapov | 0:704c89673b57 | 1786 | *value &= LSM6DSL_ACC_GYRO_INT1_SIGN_MOT_MASK; //mask |
nikapov | 0:704c89673b57 | 1787 | |
nikapov | 0:704c89673b57 | 1788 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1789 | } |
nikapov | 0:704c89673b57 | 1790 | |
nikapov | 0:704c89673b57 | 1791 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1792 | * Function Name : LSM6DSL_ACC_GYRO_W_STEP_DET_on_INT1 |
nikapov | 0:704c89673b57 | 1793 | * Description : Write INT1_PEDO |
nikapov | 0:704c89673b57 | 1794 | * Input : LSM6DSL_ACC_GYRO_INT1_PEDO_t |
nikapov | 0:704c89673b57 | 1795 | * Output : None |
nikapov | 0:704c89673b57 | 1796 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1797 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1798 | mems_status_t LSM6DSL_ACC_GYRO_W_STEP_DET_on_INT1(void *handle, LSM6DSL_ACC_GYRO_INT1_PEDO_t newValue) |
nikapov | 0:704c89673b57 | 1799 | { |
nikapov | 0:704c89673b57 | 1800 | u8_t value; |
nikapov | 0:704c89673b57 | 1801 | |
nikapov | 0:704c89673b57 | 1802 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT1_CTRL, &value, 1)) |
nikapov | 0:704c89673b57 | 1803 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1804 | |
nikapov | 0:704c89673b57 | 1805 | value &= ~LSM6DSL_ACC_GYRO_INT1_PEDO_MASK; |
nikapov | 0:704c89673b57 | 1806 | value |= newValue; |
nikapov | 0:704c89673b57 | 1807 | |
nikapov | 0:704c89673b57 | 1808 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_INT1_CTRL, &value, 1) ) |
nikapov | 0:704c89673b57 | 1809 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1810 | |
nikapov | 0:704c89673b57 | 1811 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1812 | } |
nikapov | 0:704c89673b57 | 1813 | |
nikapov | 0:704c89673b57 | 1814 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1815 | * Function Name : LSM6DSL_ACC_GYRO_R_STEP_DET_on_INT1 |
nikapov | 0:704c89673b57 | 1816 | * Description : Read INT1_PEDO |
nikapov | 0:704c89673b57 | 1817 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT1_PEDO_t |
nikapov | 0:704c89673b57 | 1818 | * Output : Status of INT1_PEDO see LSM6DSL_ACC_GYRO_INT1_PEDO_t |
nikapov | 0:704c89673b57 | 1819 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1820 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1821 | mems_status_t LSM6DSL_ACC_GYRO_R_STEP_DET_on_INT1(void *handle, LSM6DSL_ACC_GYRO_INT1_PEDO_t *value) |
nikapov | 0:704c89673b57 | 1822 | { |
nikapov | 0:704c89673b57 | 1823 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT1_CTRL, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 1824 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1825 | |
nikapov | 0:704c89673b57 | 1826 | *value &= LSM6DSL_ACC_GYRO_INT1_PEDO_MASK; //mask |
nikapov | 0:704c89673b57 | 1827 | |
nikapov | 0:704c89673b57 | 1828 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1829 | } |
nikapov | 0:704c89673b57 | 1830 | |
nikapov | 0:704c89673b57 | 1831 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1832 | * Function Name : LSM6DSL_ACC_GYRO_W_DRDY_XL_on_INT2 |
nikapov | 0:704c89673b57 | 1833 | * Description : Write INT2_DRDY_XL |
nikapov | 0:704c89673b57 | 1834 | * Input : LSM6DSL_ACC_GYRO_INT2_DRDY_XL_t |
nikapov | 0:704c89673b57 | 1835 | * Output : None |
nikapov | 0:704c89673b57 | 1836 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1837 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1838 | mems_status_t LSM6DSL_ACC_GYRO_W_DRDY_XL_on_INT2(void *handle, LSM6DSL_ACC_GYRO_INT2_DRDY_XL_t newValue) |
nikapov | 0:704c89673b57 | 1839 | { |
nikapov | 0:704c89673b57 | 1840 | u8_t value; |
nikapov | 0:704c89673b57 | 1841 | |
nikapov | 0:704c89673b57 | 1842 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT2_CTRL, &value, 1)) |
nikapov | 0:704c89673b57 | 1843 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1844 | |
nikapov | 0:704c89673b57 | 1845 | value &= ~LSM6DSL_ACC_GYRO_INT2_DRDY_XL_MASK; |
nikapov | 0:704c89673b57 | 1846 | value |= newValue; |
nikapov | 0:704c89673b57 | 1847 | |
nikapov | 0:704c89673b57 | 1848 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_INT2_CTRL, &value, 1) ) |
nikapov | 0:704c89673b57 | 1849 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1850 | |
nikapov | 0:704c89673b57 | 1851 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1852 | } |
nikapov | 0:704c89673b57 | 1853 | |
nikapov | 0:704c89673b57 | 1854 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1855 | * Function Name : LSM6DSL_ACC_GYRO_R_DRDY_XL_on_INT2 |
nikapov | 0:704c89673b57 | 1856 | * Description : Read INT2_DRDY_XL |
nikapov | 0:704c89673b57 | 1857 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT2_DRDY_XL_t |
nikapov | 0:704c89673b57 | 1858 | * Output : Status of INT2_DRDY_XL see LSM6DSL_ACC_GYRO_INT2_DRDY_XL_t |
nikapov | 0:704c89673b57 | 1859 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1860 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1861 | mems_status_t LSM6DSL_ACC_GYRO_R_DRDY_XL_on_INT2(void *handle, LSM6DSL_ACC_GYRO_INT2_DRDY_XL_t *value) |
nikapov | 0:704c89673b57 | 1862 | { |
nikapov | 0:704c89673b57 | 1863 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT2_CTRL, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 1864 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1865 | |
nikapov | 0:704c89673b57 | 1866 | *value &= LSM6DSL_ACC_GYRO_INT2_DRDY_XL_MASK; //mask |
nikapov | 0:704c89673b57 | 1867 | |
nikapov | 0:704c89673b57 | 1868 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1869 | } |
nikapov | 0:704c89673b57 | 1870 | |
nikapov | 0:704c89673b57 | 1871 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1872 | * Function Name : LSM6DSL_ACC_GYRO_W_DRDY_G_on_INT2 |
nikapov | 0:704c89673b57 | 1873 | * Description : Write INT2_DRDY_G |
nikapov | 0:704c89673b57 | 1874 | * Input : LSM6DSL_ACC_GYRO_INT2_DRDY_G_t |
nikapov | 0:704c89673b57 | 1875 | * Output : None |
nikapov | 0:704c89673b57 | 1876 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1877 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1878 | mems_status_t LSM6DSL_ACC_GYRO_W_DRDY_G_on_INT2(void *handle, LSM6DSL_ACC_GYRO_INT2_DRDY_G_t newValue) |
nikapov | 0:704c89673b57 | 1879 | { |
nikapov | 0:704c89673b57 | 1880 | u8_t value; |
nikapov | 0:704c89673b57 | 1881 | |
nikapov | 0:704c89673b57 | 1882 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT2_CTRL, &value, 1)) |
nikapov | 0:704c89673b57 | 1883 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1884 | |
nikapov | 0:704c89673b57 | 1885 | value &= ~LSM6DSL_ACC_GYRO_INT2_DRDY_G_MASK; |
nikapov | 0:704c89673b57 | 1886 | value |= newValue; |
nikapov | 0:704c89673b57 | 1887 | |
nikapov | 0:704c89673b57 | 1888 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_INT2_CTRL, &value, 1) ) |
nikapov | 0:704c89673b57 | 1889 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1890 | |
nikapov | 0:704c89673b57 | 1891 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1892 | } |
nikapov | 0:704c89673b57 | 1893 | |
nikapov | 0:704c89673b57 | 1894 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1895 | * Function Name : LSM6DSL_ACC_GYRO_R_DRDY_G_on_INT2 |
nikapov | 0:704c89673b57 | 1896 | * Description : Read INT2_DRDY_G |
nikapov | 0:704c89673b57 | 1897 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT2_DRDY_G_t |
nikapov | 0:704c89673b57 | 1898 | * Output : Status of INT2_DRDY_G see LSM6DSL_ACC_GYRO_INT2_DRDY_G_t |
nikapov | 0:704c89673b57 | 1899 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1900 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1901 | mems_status_t LSM6DSL_ACC_GYRO_R_DRDY_G_on_INT2(void *handle, LSM6DSL_ACC_GYRO_INT2_DRDY_G_t *value) |
nikapov | 0:704c89673b57 | 1902 | { |
nikapov | 0:704c89673b57 | 1903 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT2_CTRL, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 1904 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1905 | |
nikapov | 0:704c89673b57 | 1906 | *value &= LSM6DSL_ACC_GYRO_INT2_DRDY_G_MASK; //mask |
nikapov | 0:704c89673b57 | 1907 | |
nikapov | 0:704c89673b57 | 1908 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1909 | } |
nikapov | 0:704c89673b57 | 1910 | |
nikapov | 0:704c89673b57 | 1911 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1912 | * Function Name : LSM6DSL_ACC_GYRO_W_DRDY_TEMP_on_INT2 |
nikapov | 0:704c89673b57 | 1913 | * Description : Write INT2_DRDY_TEMP |
nikapov | 0:704c89673b57 | 1914 | * Input : LSM6DSL_ACC_GYRO_INT2_DRDY_TEMP_t |
nikapov | 0:704c89673b57 | 1915 | * Output : None |
nikapov | 0:704c89673b57 | 1916 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1917 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1918 | mems_status_t LSM6DSL_ACC_GYRO_W_DRDY_TEMP_on_INT2(void *handle, LSM6DSL_ACC_GYRO_INT2_DRDY_TEMP_t newValue) |
nikapov | 0:704c89673b57 | 1919 | { |
nikapov | 0:704c89673b57 | 1920 | u8_t value; |
nikapov | 0:704c89673b57 | 1921 | |
nikapov | 0:704c89673b57 | 1922 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT2_CTRL, &value, 1)) |
nikapov | 0:704c89673b57 | 1923 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1924 | |
nikapov | 0:704c89673b57 | 1925 | value &= ~LSM6DSL_ACC_GYRO_INT2_DRDY_TEMP_MASK; |
nikapov | 0:704c89673b57 | 1926 | value |= newValue; |
nikapov | 0:704c89673b57 | 1927 | |
nikapov | 0:704c89673b57 | 1928 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_INT2_CTRL, &value, 1) ) |
nikapov | 0:704c89673b57 | 1929 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1930 | |
nikapov | 0:704c89673b57 | 1931 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1932 | } |
nikapov | 0:704c89673b57 | 1933 | |
nikapov | 0:704c89673b57 | 1934 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1935 | * Function Name : LSM6DSL_ACC_GYRO_R_DRDY_TEMP_on_INT2 |
nikapov | 0:704c89673b57 | 1936 | * Description : Read INT2_DRDY_TEMP |
nikapov | 0:704c89673b57 | 1937 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT2_DRDY_TEMP_t |
nikapov | 0:704c89673b57 | 1938 | * Output : Status of INT2_DRDY_TEMP see LSM6DSL_ACC_GYRO_INT2_DRDY_TEMP_t |
nikapov | 0:704c89673b57 | 1939 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1940 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1941 | mems_status_t LSM6DSL_ACC_GYRO_R_DRDY_TEMP_on_INT2(void *handle, LSM6DSL_ACC_GYRO_INT2_DRDY_TEMP_t *value) |
nikapov | 0:704c89673b57 | 1942 | { |
nikapov | 0:704c89673b57 | 1943 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT2_CTRL, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 1944 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1945 | |
nikapov | 0:704c89673b57 | 1946 | *value &= LSM6DSL_ACC_GYRO_INT2_DRDY_TEMP_MASK; //mask |
nikapov | 0:704c89673b57 | 1947 | |
nikapov | 0:704c89673b57 | 1948 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1949 | } |
nikapov | 0:704c89673b57 | 1950 | |
nikapov | 0:704c89673b57 | 1951 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1952 | * Function Name : LSM6DSL_ACC_GYRO_W_FIFO_TSHLD_on_INT2 |
nikapov | 0:704c89673b57 | 1953 | * Description : Write INT2_FTH |
nikapov | 0:704c89673b57 | 1954 | * Input : LSM6DSL_ACC_GYRO_INT2_FTH_t |
nikapov | 0:704c89673b57 | 1955 | * Output : None |
nikapov | 0:704c89673b57 | 1956 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1957 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1958 | mems_status_t LSM6DSL_ACC_GYRO_W_FIFO_TSHLD_on_INT2(void *handle, LSM6DSL_ACC_GYRO_INT2_FTH_t newValue) |
nikapov | 0:704c89673b57 | 1959 | { |
nikapov | 0:704c89673b57 | 1960 | u8_t value; |
nikapov | 0:704c89673b57 | 1961 | |
nikapov | 0:704c89673b57 | 1962 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT2_CTRL, &value, 1)) |
nikapov | 0:704c89673b57 | 1963 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1964 | |
nikapov | 0:704c89673b57 | 1965 | value &= ~LSM6DSL_ACC_GYRO_INT2_FTH_MASK; |
nikapov | 0:704c89673b57 | 1966 | value |= newValue; |
nikapov | 0:704c89673b57 | 1967 | |
nikapov | 0:704c89673b57 | 1968 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_INT2_CTRL, &value, 1) ) |
nikapov | 0:704c89673b57 | 1969 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1970 | |
nikapov | 0:704c89673b57 | 1971 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1972 | } |
nikapov | 0:704c89673b57 | 1973 | |
nikapov | 0:704c89673b57 | 1974 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1975 | * Function Name : LSM6DSL_ACC_GYRO_R_FIFO_TSHLD_on_INT2 |
nikapov | 0:704c89673b57 | 1976 | * Description : Read INT2_FTH |
nikapov | 0:704c89673b57 | 1977 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT2_FTH_t |
nikapov | 0:704c89673b57 | 1978 | * Output : Status of INT2_FTH see LSM6DSL_ACC_GYRO_INT2_FTH_t |
nikapov | 0:704c89673b57 | 1979 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1980 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1981 | mems_status_t LSM6DSL_ACC_GYRO_R_FIFO_TSHLD_on_INT2(void *handle, LSM6DSL_ACC_GYRO_INT2_FTH_t *value) |
nikapov | 0:704c89673b57 | 1982 | { |
nikapov | 0:704c89673b57 | 1983 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT2_CTRL, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 1984 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 1985 | |
nikapov | 0:704c89673b57 | 1986 | *value &= LSM6DSL_ACC_GYRO_INT2_FTH_MASK; //mask |
nikapov | 0:704c89673b57 | 1987 | |
nikapov | 0:704c89673b57 | 1988 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 1989 | } |
nikapov | 0:704c89673b57 | 1990 | |
nikapov | 0:704c89673b57 | 1991 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 1992 | * Function Name : LSM6DSL_ACC_GYRO_W_OVERRUN_on_INT2 |
nikapov | 0:704c89673b57 | 1993 | * Description : Write INT2_OVR |
nikapov | 0:704c89673b57 | 1994 | * Input : LSM6DSL_ACC_GYRO_INT2_OVR_t |
nikapov | 0:704c89673b57 | 1995 | * Output : None |
nikapov | 0:704c89673b57 | 1996 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 1997 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 1998 | mems_status_t LSM6DSL_ACC_GYRO_W_OVERRUN_on_INT2(void *handle, LSM6DSL_ACC_GYRO_INT2_OVR_t newValue) |
nikapov | 0:704c89673b57 | 1999 | { |
nikapov | 0:704c89673b57 | 2000 | u8_t value; |
nikapov | 0:704c89673b57 | 2001 | |
nikapov | 0:704c89673b57 | 2002 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT2_CTRL, &value, 1)) |
nikapov | 0:704c89673b57 | 2003 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2004 | |
nikapov | 0:704c89673b57 | 2005 | value &= ~LSM6DSL_ACC_GYRO_INT2_OVR_MASK; |
nikapov | 0:704c89673b57 | 2006 | value |= newValue; |
nikapov | 0:704c89673b57 | 2007 | |
nikapov | 0:704c89673b57 | 2008 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_INT2_CTRL, &value, 1) ) |
nikapov | 0:704c89673b57 | 2009 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2010 | |
nikapov | 0:704c89673b57 | 2011 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2012 | } |
nikapov | 0:704c89673b57 | 2013 | |
nikapov | 0:704c89673b57 | 2014 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2015 | * Function Name : LSM6DSL_ACC_GYRO_R_OVERRUN_on_INT2 |
nikapov | 0:704c89673b57 | 2016 | * Description : Read INT2_OVR |
nikapov | 0:704c89673b57 | 2017 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT2_OVR_t |
nikapov | 0:704c89673b57 | 2018 | * Output : Status of INT2_OVR see LSM6DSL_ACC_GYRO_INT2_OVR_t |
nikapov | 0:704c89673b57 | 2019 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2020 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2021 | mems_status_t LSM6DSL_ACC_GYRO_R_OVERRUN_on_INT2(void *handle, LSM6DSL_ACC_GYRO_INT2_OVR_t *value) |
nikapov | 0:704c89673b57 | 2022 | { |
nikapov | 0:704c89673b57 | 2023 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT2_CTRL, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 2024 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2025 | |
nikapov | 0:704c89673b57 | 2026 | *value &= LSM6DSL_ACC_GYRO_INT2_OVR_MASK; //mask |
nikapov | 0:704c89673b57 | 2027 | |
nikapov | 0:704c89673b57 | 2028 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2029 | } |
nikapov | 0:704c89673b57 | 2030 | |
nikapov | 0:704c89673b57 | 2031 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2032 | * Function Name : LSM6DSL_ACC_GYRO_W_FULL_FLAG_on_INT2 |
nikapov | 0:704c89673b57 | 2033 | * Description : Write INT2_FULL_FLAG |
nikapov | 0:704c89673b57 | 2034 | * Input : LSM6DSL_ACC_GYRO_INT2_FULL_FLAG_t |
nikapov | 0:704c89673b57 | 2035 | * Output : None |
nikapov | 0:704c89673b57 | 2036 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2037 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2038 | mems_status_t LSM6DSL_ACC_GYRO_W_FULL_FLAG_on_INT2(void *handle, LSM6DSL_ACC_GYRO_INT2_FULL_FLAG_t newValue) |
nikapov | 0:704c89673b57 | 2039 | { |
nikapov | 0:704c89673b57 | 2040 | u8_t value; |
nikapov | 0:704c89673b57 | 2041 | |
nikapov | 0:704c89673b57 | 2042 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT2_CTRL, &value, 1)) |
nikapov | 0:704c89673b57 | 2043 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2044 | |
nikapov | 0:704c89673b57 | 2045 | value &= ~LSM6DSL_ACC_GYRO_INT2_FULL_FLAG_MASK; |
nikapov | 0:704c89673b57 | 2046 | value |= newValue; |
nikapov | 0:704c89673b57 | 2047 | |
nikapov | 0:704c89673b57 | 2048 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_INT2_CTRL, &value, 1) ) |
nikapov | 0:704c89673b57 | 2049 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2050 | |
nikapov | 0:704c89673b57 | 2051 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2052 | } |
nikapov | 0:704c89673b57 | 2053 | |
nikapov | 0:704c89673b57 | 2054 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2055 | * Function Name : LSM6DSL_ACC_GYRO_R_FULL_FLAG_on_INT2 |
nikapov | 0:704c89673b57 | 2056 | * Description : Read INT2_FULL_FLAG |
nikapov | 0:704c89673b57 | 2057 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT2_FULL_FLAG_t |
nikapov | 0:704c89673b57 | 2058 | * Output : Status of INT2_FULL_FLAG see LSM6DSL_ACC_GYRO_INT2_FULL_FLAG_t |
nikapov | 0:704c89673b57 | 2059 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2060 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2061 | mems_status_t LSM6DSL_ACC_GYRO_R_FULL_FLAG_on_INT2(void *handle, LSM6DSL_ACC_GYRO_INT2_FULL_FLAG_t *value) |
nikapov | 0:704c89673b57 | 2062 | { |
nikapov | 0:704c89673b57 | 2063 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT2_CTRL, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 2064 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2065 | |
nikapov | 0:704c89673b57 | 2066 | *value &= LSM6DSL_ACC_GYRO_INT2_FULL_FLAG_MASK; //mask |
nikapov | 0:704c89673b57 | 2067 | |
nikapov | 0:704c89673b57 | 2068 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2069 | } |
nikapov | 0:704c89673b57 | 2070 | |
nikapov | 0:704c89673b57 | 2071 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2072 | * Function Name : LSM6DSL_ACC_GYRO_W_STEP_COUNT_OV_on_INT2 |
nikapov | 0:704c89673b57 | 2073 | * Description : Write INT2_STEP_COUNT_OV |
nikapov | 0:704c89673b57 | 2074 | * Input : LSM6DSL_ACC_GYRO_INT2_STEP_COUNT_OV_t |
nikapov | 0:704c89673b57 | 2075 | * Output : None |
nikapov | 0:704c89673b57 | 2076 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2077 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2078 | mems_status_t LSM6DSL_ACC_GYRO_W_STEP_COUNT_OV_on_INT2(void *handle, LSM6DSL_ACC_GYRO_INT2_STEP_COUNT_OV_t newValue) |
nikapov | 0:704c89673b57 | 2079 | { |
nikapov | 0:704c89673b57 | 2080 | u8_t value; |
nikapov | 0:704c89673b57 | 2081 | |
nikapov | 0:704c89673b57 | 2082 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT2_CTRL, &value, 1)) |
nikapov | 0:704c89673b57 | 2083 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2084 | |
nikapov | 0:704c89673b57 | 2085 | value &= ~LSM6DSL_ACC_GYRO_INT2_STEP_COUNT_OV_MASK; |
nikapov | 0:704c89673b57 | 2086 | value |= newValue; |
nikapov | 0:704c89673b57 | 2087 | |
nikapov | 0:704c89673b57 | 2088 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_INT2_CTRL, &value, 1) ) |
nikapov | 0:704c89673b57 | 2089 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2090 | |
nikapov | 0:704c89673b57 | 2091 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2092 | } |
nikapov | 0:704c89673b57 | 2093 | |
nikapov | 0:704c89673b57 | 2094 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2095 | * Function Name : LSM6DSL_ACC_GYRO_R_STEP_COUNT_OV_on_INT2 |
nikapov | 0:704c89673b57 | 2096 | * Description : Read INT2_STEP_COUNT_OV |
nikapov | 0:704c89673b57 | 2097 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT2_STEP_COUNT_OV_t |
nikapov | 0:704c89673b57 | 2098 | * Output : Status of INT2_STEP_COUNT_OV see LSM6DSL_ACC_GYRO_INT2_STEP_COUNT_OV_t |
nikapov | 0:704c89673b57 | 2099 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2100 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2101 | mems_status_t LSM6DSL_ACC_GYRO_R_STEP_COUNT_OV_on_INT2(void *handle, LSM6DSL_ACC_GYRO_INT2_STEP_COUNT_OV_t *value) |
nikapov | 0:704c89673b57 | 2102 | { |
nikapov | 0:704c89673b57 | 2103 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT2_CTRL, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 2104 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2105 | |
nikapov | 0:704c89673b57 | 2106 | *value &= LSM6DSL_ACC_GYRO_INT2_STEP_COUNT_OV_MASK; //mask |
nikapov | 0:704c89673b57 | 2107 | |
nikapov | 0:704c89673b57 | 2108 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2109 | } |
nikapov | 0:704c89673b57 | 2110 | |
nikapov | 0:704c89673b57 | 2111 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2112 | * Function Name : LSM6DSL_ACC_GYRO_W_STEP_DELTA_on_INT2 |
nikapov | 0:704c89673b57 | 2113 | * Description : Write INT2_STEP_DELTA |
nikapov | 0:704c89673b57 | 2114 | * Input : LSM6DSL_ACC_GYRO_INT2_STEP_DELTA_t |
nikapov | 0:704c89673b57 | 2115 | * Output : None |
nikapov | 0:704c89673b57 | 2116 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2117 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2118 | mems_status_t LSM6DSL_ACC_GYRO_W_STEP_DELTA_on_INT2(void *handle, LSM6DSL_ACC_GYRO_INT2_STEP_DELTA_t newValue) |
nikapov | 0:704c89673b57 | 2119 | { |
nikapov | 0:704c89673b57 | 2120 | u8_t value; |
nikapov | 0:704c89673b57 | 2121 | |
nikapov | 0:704c89673b57 | 2122 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT2_CTRL, &value, 1)) |
nikapov | 0:704c89673b57 | 2123 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2124 | |
nikapov | 0:704c89673b57 | 2125 | value &= ~LSM6DSL_ACC_GYRO_INT2_STEP_DELTA_MASK; |
nikapov | 0:704c89673b57 | 2126 | value |= newValue; |
nikapov | 0:704c89673b57 | 2127 | |
nikapov | 0:704c89673b57 | 2128 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_INT2_CTRL, &value, 1) ) |
nikapov | 0:704c89673b57 | 2129 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2130 | |
nikapov | 0:704c89673b57 | 2131 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2132 | } |
nikapov | 0:704c89673b57 | 2133 | |
nikapov | 0:704c89673b57 | 2134 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2135 | * Function Name : LSM6DSL_ACC_GYRO_R_STEP_DELTA_on_INT2 |
nikapov | 0:704c89673b57 | 2136 | * Description : Read INT2_STEP_DELTA |
nikapov | 0:704c89673b57 | 2137 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT2_STEP_DELTA_t |
nikapov | 0:704c89673b57 | 2138 | * Output : Status of INT2_STEP_DELTA see LSM6DSL_ACC_GYRO_INT2_STEP_DELTA_t |
nikapov | 0:704c89673b57 | 2139 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2140 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2141 | mems_status_t LSM6DSL_ACC_GYRO_R_STEP_DELTA_on_INT2(void *handle, LSM6DSL_ACC_GYRO_INT2_STEP_DELTA_t *value) |
nikapov | 0:704c89673b57 | 2142 | { |
nikapov | 0:704c89673b57 | 2143 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT2_CTRL, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 2144 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2145 | |
nikapov | 0:704c89673b57 | 2146 | *value &= LSM6DSL_ACC_GYRO_INT2_STEP_DELTA_MASK; //mask |
nikapov | 0:704c89673b57 | 2147 | |
nikapov | 0:704c89673b57 | 2148 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2149 | } |
nikapov | 0:704c89673b57 | 2150 | |
nikapov | 0:704c89673b57 | 2151 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2152 | * Function Name : LSM6DSL_ACC_GYRO_W_SW_RESET |
nikapov | 0:704c89673b57 | 2153 | * Description : Write SW_RESET |
nikapov | 0:704c89673b57 | 2154 | * Input : LSM6DSL_ACC_GYRO_SW_RESET_t |
nikapov | 0:704c89673b57 | 2155 | * Output : None |
nikapov | 0:704c89673b57 | 2156 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2157 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2158 | mems_status_t LSM6DSL_ACC_GYRO_W_SW_RESET(void *handle, LSM6DSL_ACC_GYRO_SW_RESET_t newValue) |
nikapov | 0:704c89673b57 | 2159 | { |
nikapov | 0:704c89673b57 | 2160 | u8_t value; |
nikapov | 0:704c89673b57 | 2161 | |
nikapov | 0:704c89673b57 | 2162 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL3_C, &value, 1)) |
nikapov | 0:704c89673b57 | 2163 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2164 | |
nikapov | 0:704c89673b57 | 2165 | value &= ~LSM6DSL_ACC_GYRO_SW_RESET_MASK; |
nikapov | 0:704c89673b57 | 2166 | value |= newValue; |
nikapov | 0:704c89673b57 | 2167 | |
nikapov | 0:704c89673b57 | 2168 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL3_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 2169 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2170 | |
nikapov | 0:704c89673b57 | 2171 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2172 | } |
nikapov | 0:704c89673b57 | 2173 | |
nikapov | 0:704c89673b57 | 2174 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2175 | * Function Name : LSM6DSL_ACC_GYRO_R_SW_RESET |
nikapov | 0:704c89673b57 | 2176 | * Description : Read SW_RESET |
nikapov | 0:704c89673b57 | 2177 | * Input : Pointer to LSM6DSL_ACC_GYRO_SW_RESET_t |
nikapov | 0:704c89673b57 | 2178 | * Output : Status of SW_RESET see LSM6DSL_ACC_GYRO_SW_RESET_t |
nikapov | 0:704c89673b57 | 2179 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2180 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2181 | mems_status_t LSM6DSL_ACC_GYRO_R_SW_RESET(void *handle, LSM6DSL_ACC_GYRO_SW_RESET_t *value) |
nikapov | 0:704c89673b57 | 2182 | { |
nikapov | 0:704c89673b57 | 2183 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL3_C, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 2184 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2185 | |
nikapov | 0:704c89673b57 | 2186 | *value &= LSM6DSL_ACC_GYRO_SW_RESET_MASK; //mask |
nikapov | 0:704c89673b57 | 2187 | |
nikapov | 0:704c89673b57 | 2188 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2189 | } |
nikapov | 0:704c89673b57 | 2190 | |
nikapov | 0:704c89673b57 | 2191 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2192 | * Function Name : LSM6DSL_ACC_GYRO_W_IF_Addr_Incr |
nikapov | 0:704c89673b57 | 2193 | * Description : Write IF_INC |
nikapov | 0:704c89673b57 | 2194 | * Input : LSM6DSL_ACC_GYRO_IF_INC_t |
nikapov | 0:704c89673b57 | 2195 | * Output : None |
nikapov | 0:704c89673b57 | 2196 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2197 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2198 | mems_status_t LSM6DSL_ACC_GYRO_W_IF_Addr_Incr(void *handle, LSM6DSL_ACC_GYRO_IF_INC_t newValue) |
nikapov | 0:704c89673b57 | 2199 | { |
nikapov | 0:704c89673b57 | 2200 | u8_t value; |
nikapov | 0:704c89673b57 | 2201 | |
nikapov | 0:704c89673b57 | 2202 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL3_C, &value, 1)) |
nikapov | 0:704c89673b57 | 2203 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2204 | |
nikapov | 0:704c89673b57 | 2205 | value &= ~LSM6DSL_ACC_GYRO_IF_INC_MASK; |
nikapov | 0:704c89673b57 | 2206 | value |= newValue; |
nikapov | 0:704c89673b57 | 2207 | |
nikapov | 0:704c89673b57 | 2208 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL3_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 2209 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2210 | |
nikapov | 0:704c89673b57 | 2211 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2212 | } |
nikapov | 0:704c89673b57 | 2213 | |
nikapov | 0:704c89673b57 | 2214 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2215 | * Function Name : LSM6DSL_ACC_GYRO_R_IF_Addr_Incr |
nikapov | 0:704c89673b57 | 2216 | * Description : Read IF_INC |
nikapov | 0:704c89673b57 | 2217 | * Input : Pointer to LSM6DSL_ACC_GYRO_IF_INC_t |
nikapov | 0:704c89673b57 | 2218 | * Output : Status of IF_INC see LSM6DSL_ACC_GYRO_IF_INC_t |
nikapov | 0:704c89673b57 | 2219 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2220 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2221 | mems_status_t LSM6DSL_ACC_GYRO_R_IF_Addr_Incr(void *handle, LSM6DSL_ACC_GYRO_IF_INC_t *value) |
nikapov | 0:704c89673b57 | 2222 | { |
nikapov | 0:704c89673b57 | 2223 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL3_C, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 2224 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2225 | |
nikapov | 0:704c89673b57 | 2226 | *value &= LSM6DSL_ACC_GYRO_IF_INC_MASK; //mask |
nikapov | 0:704c89673b57 | 2227 | |
nikapov | 0:704c89673b57 | 2228 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2229 | } |
nikapov | 0:704c89673b57 | 2230 | |
nikapov | 0:704c89673b57 | 2231 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2232 | * Function Name : LSM6DSL_ACC_GYRO_W_SPI_Mode |
nikapov | 0:704c89673b57 | 2233 | * Description : Write SIM |
nikapov | 0:704c89673b57 | 2234 | * Input : LSM6DSL_ACC_GYRO_SIM_t |
nikapov | 0:704c89673b57 | 2235 | * Output : None |
nikapov | 0:704c89673b57 | 2236 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2237 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2238 | mems_status_t LSM6DSL_ACC_GYRO_W_SPI_Mode(void *handle, LSM6DSL_ACC_GYRO_SIM_t newValue) |
nikapov | 0:704c89673b57 | 2239 | { |
mapellil | 3:20ccff7dd652 | 2240 | u8_t value=0x04; |
mapellil | 3:20ccff7dd652 | 2241 | |
mapellil | 3:20ccff7dd652 | 2242 | // if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL3_C, &value, 1)) |
mapellil | 3:20ccff7dd652 | 2243 | // return MEMS_ERROR; /** FIXED not possible to read in 3w as deft spi is 4w |
nikapov | 0:704c89673b57 | 2244 | |
nikapov | 0:704c89673b57 | 2245 | value &= ~LSM6DSL_ACC_GYRO_SIM_MASK; |
nikapov | 0:704c89673b57 | 2246 | value |= newValue; |
nikapov | 0:704c89673b57 | 2247 | |
nikapov | 0:704c89673b57 | 2248 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL3_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 2249 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2250 | |
nikapov | 0:704c89673b57 | 2251 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2252 | } |
nikapov | 0:704c89673b57 | 2253 | |
nikapov | 0:704c89673b57 | 2254 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2255 | * Function Name : LSM6DSL_ACC_GYRO_R_SPI_Mode |
nikapov | 0:704c89673b57 | 2256 | * Description : Read SIM |
nikapov | 0:704c89673b57 | 2257 | * Input : Pointer to LSM6DSL_ACC_GYRO_SIM_t |
nikapov | 0:704c89673b57 | 2258 | * Output : Status of SIM see LSM6DSL_ACC_GYRO_SIM_t |
nikapov | 0:704c89673b57 | 2259 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2260 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2261 | mems_status_t LSM6DSL_ACC_GYRO_R_SPI_Mode(void *handle, LSM6DSL_ACC_GYRO_SIM_t *value) |
nikapov | 0:704c89673b57 | 2262 | { |
nikapov | 0:704c89673b57 | 2263 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL3_C, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 2264 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2265 | |
nikapov | 0:704c89673b57 | 2266 | *value &= LSM6DSL_ACC_GYRO_SIM_MASK; //mask |
nikapov | 0:704c89673b57 | 2267 | |
nikapov | 0:704c89673b57 | 2268 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2269 | } |
nikapov | 0:704c89673b57 | 2270 | |
nikapov | 0:704c89673b57 | 2271 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2272 | * Function Name : LSM6DSL_ACC_GYRO_W_PadSel |
nikapov | 0:704c89673b57 | 2273 | * Description : Write PP_OD |
nikapov | 0:704c89673b57 | 2274 | * Input : LSM6DSL_ACC_GYRO_PP_OD_t |
nikapov | 0:704c89673b57 | 2275 | * Output : None |
nikapov | 0:704c89673b57 | 2276 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2277 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2278 | mems_status_t LSM6DSL_ACC_GYRO_W_PadSel(void *handle, LSM6DSL_ACC_GYRO_PP_OD_t newValue) |
nikapov | 0:704c89673b57 | 2279 | { |
nikapov | 0:704c89673b57 | 2280 | u8_t value; |
nikapov | 0:704c89673b57 | 2281 | |
nikapov | 0:704c89673b57 | 2282 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL3_C, &value, 1)) |
nikapov | 0:704c89673b57 | 2283 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2284 | |
nikapov | 0:704c89673b57 | 2285 | value &= ~LSM6DSL_ACC_GYRO_PP_OD_MASK; |
nikapov | 0:704c89673b57 | 2286 | value |= newValue; |
nikapov | 0:704c89673b57 | 2287 | |
nikapov | 0:704c89673b57 | 2288 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL3_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 2289 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2290 | |
nikapov | 0:704c89673b57 | 2291 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2292 | } |
nikapov | 0:704c89673b57 | 2293 | |
nikapov | 0:704c89673b57 | 2294 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2295 | * Function Name : LSM6DSL_ACC_GYRO_R_PadSel |
nikapov | 0:704c89673b57 | 2296 | * Description : Read PP_OD |
nikapov | 0:704c89673b57 | 2297 | * Input : Pointer to LSM6DSL_ACC_GYRO_PP_OD_t |
nikapov | 0:704c89673b57 | 2298 | * Output : Status of PP_OD see LSM6DSL_ACC_GYRO_PP_OD_t |
nikapov | 0:704c89673b57 | 2299 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2300 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2301 | mems_status_t LSM6DSL_ACC_GYRO_R_PadSel(void *handle, LSM6DSL_ACC_GYRO_PP_OD_t *value) |
nikapov | 0:704c89673b57 | 2302 | { |
nikapov | 0:704c89673b57 | 2303 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL3_C, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 2304 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2305 | |
nikapov | 0:704c89673b57 | 2306 | *value &= LSM6DSL_ACC_GYRO_PP_OD_MASK; //mask |
nikapov | 0:704c89673b57 | 2307 | |
nikapov | 0:704c89673b57 | 2308 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2309 | } |
nikapov | 0:704c89673b57 | 2310 | |
nikapov | 0:704c89673b57 | 2311 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2312 | * Function Name : LSM6DSL_ACC_GYRO_W_INT_ACT_LEVEL |
nikapov | 0:704c89673b57 | 2313 | * Description : Write INT_ACT_LEVEL |
nikapov | 0:704c89673b57 | 2314 | * Input : LSM6DSL_ACC_GYRO_INT_ACT_LEVEL_t |
nikapov | 0:704c89673b57 | 2315 | * Output : None |
nikapov | 0:704c89673b57 | 2316 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2317 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2318 | mems_status_t LSM6DSL_ACC_GYRO_W_INT_ACT_LEVEL(void *handle, LSM6DSL_ACC_GYRO_INT_ACT_LEVEL_t newValue) |
nikapov | 0:704c89673b57 | 2319 | { |
nikapov | 0:704c89673b57 | 2320 | u8_t value; |
nikapov | 0:704c89673b57 | 2321 | |
nikapov | 0:704c89673b57 | 2322 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL3_C, &value, 1)) |
nikapov | 0:704c89673b57 | 2323 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2324 | |
nikapov | 0:704c89673b57 | 2325 | value &= ~LSM6DSL_ACC_GYRO_INT_ACT_LEVEL_MASK; |
nikapov | 0:704c89673b57 | 2326 | value |= newValue; |
nikapov | 0:704c89673b57 | 2327 | |
nikapov | 0:704c89673b57 | 2328 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL3_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 2329 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2330 | |
nikapov | 0:704c89673b57 | 2331 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2332 | } |
nikapov | 0:704c89673b57 | 2333 | |
nikapov | 0:704c89673b57 | 2334 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2335 | * Function Name : LSM6DSL_ACC_GYRO_R_INT_ACT_LEVEL |
nikapov | 0:704c89673b57 | 2336 | * Description : Read INT_ACT_LEVEL |
nikapov | 0:704c89673b57 | 2337 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT_ACT_LEVEL_t |
nikapov | 0:704c89673b57 | 2338 | * Output : Status of INT_ACT_LEVEL see LSM6DSL_ACC_GYRO_INT_ACT_LEVEL_t |
nikapov | 0:704c89673b57 | 2339 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2340 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2341 | mems_status_t LSM6DSL_ACC_GYRO_R_INT_ACT_LEVEL(void *handle, LSM6DSL_ACC_GYRO_INT_ACT_LEVEL_t *value) |
nikapov | 0:704c89673b57 | 2342 | { |
nikapov | 0:704c89673b57 | 2343 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL3_C, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 2344 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2345 | |
nikapov | 0:704c89673b57 | 2346 | *value &= LSM6DSL_ACC_GYRO_INT_ACT_LEVEL_MASK; //mask |
nikapov | 0:704c89673b57 | 2347 | |
nikapov | 0:704c89673b57 | 2348 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2349 | } |
nikapov | 0:704c89673b57 | 2350 | |
nikapov | 0:704c89673b57 | 2351 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2352 | * Function Name : LSM6DSL_ACC_GYRO_W_BOOT |
nikapov | 0:704c89673b57 | 2353 | * Description : Write BOOT |
nikapov | 0:704c89673b57 | 2354 | * Input : LSM6DSL_ACC_GYRO_BOOT_t |
nikapov | 0:704c89673b57 | 2355 | * Output : None |
nikapov | 0:704c89673b57 | 2356 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2357 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2358 | mems_status_t LSM6DSL_ACC_GYRO_W_BOOT(void *handle, LSM6DSL_ACC_GYRO_BOOT_t newValue) |
nikapov | 0:704c89673b57 | 2359 | { |
nikapov | 0:704c89673b57 | 2360 | u8_t value; |
nikapov | 0:704c89673b57 | 2361 | |
nikapov | 0:704c89673b57 | 2362 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL3_C, &value, 1)) |
nikapov | 0:704c89673b57 | 2363 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2364 | |
nikapov | 0:704c89673b57 | 2365 | value &= ~LSM6DSL_ACC_GYRO_BOOT_MASK; |
nikapov | 0:704c89673b57 | 2366 | value |= newValue; |
nikapov | 0:704c89673b57 | 2367 | |
nikapov | 0:704c89673b57 | 2368 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL3_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 2369 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2370 | |
nikapov | 0:704c89673b57 | 2371 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2372 | } |
nikapov | 0:704c89673b57 | 2373 | |
nikapov | 0:704c89673b57 | 2374 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2375 | * Function Name : LSM6DSL_ACC_GYRO_R_BOOT |
nikapov | 0:704c89673b57 | 2376 | * Description : Read BOOT |
nikapov | 0:704c89673b57 | 2377 | * Input : Pointer to LSM6DSL_ACC_GYRO_BOOT_t |
nikapov | 0:704c89673b57 | 2378 | * Output : Status of BOOT see LSM6DSL_ACC_GYRO_BOOT_t |
nikapov | 0:704c89673b57 | 2379 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2380 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2381 | mems_status_t LSM6DSL_ACC_GYRO_R_BOOT(void *handle, LSM6DSL_ACC_GYRO_BOOT_t *value) |
nikapov | 0:704c89673b57 | 2382 | { |
nikapov | 0:704c89673b57 | 2383 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL3_C, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 2384 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2385 | |
nikapov | 0:704c89673b57 | 2386 | *value &= LSM6DSL_ACC_GYRO_BOOT_MASK; //mask |
nikapov | 0:704c89673b57 | 2387 | |
nikapov | 0:704c89673b57 | 2388 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2389 | } |
nikapov | 0:704c89673b57 | 2390 | |
nikapov | 0:704c89673b57 | 2391 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2392 | * Function Name : LSM6DSL_ACC_GYRO_LPF1_SEL_G |
nikapov | 0:704c89673b57 | 2393 | * Description : Write LPF1_SEL_G |
nikapov | 0:704c89673b57 | 2394 | * Input : LSM6DSL_ACC_GYRO_LPF1_SEL_G_t |
nikapov | 0:704c89673b57 | 2395 | * Output : None |
nikapov | 0:704c89673b57 | 2396 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2397 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2398 | mems_status_t LSM6DSL_ACC_GYRO_W_LPF1_SEL_G(void *handle, LSM6DSL_ACC_GYRO_LPF1_SEL_G_t newValue) |
nikapov | 0:704c89673b57 | 2399 | { |
nikapov | 0:704c89673b57 | 2400 | u8_t value; |
nikapov | 0:704c89673b57 | 2401 | |
nikapov | 0:704c89673b57 | 2402 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL4_C, &value, 1)) |
nikapov | 0:704c89673b57 | 2403 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2404 | |
nikapov | 0:704c89673b57 | 2405 | value &= ~LSM6DSL_ACC_GYRO_LPF1_SEL_G_MASK; |
nikapov | 0:704c89673b57 | 2406 | value |= newValue; |
nikapov | 0:704c89673b57 | 2407 | |
nikapov | 0:704c89673b57 | 2408 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL4_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 2409 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2410 | |
nikapov | 0:704c89673b57 | 2411 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2412 | } |
nikapov | 0:704c89673b57 | 2413 | |
nikapov | 0:704c89673b57 | 2414 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2415 | * Function Name : LSM6DSL_ACC_GYRO_LPF1_SEL_G |
nikapov | 0:704c89673b57 | 2416 | * Description : Read LPF1_SEL_G |
nikapov | 0:704c89673b57 | 2417 | * Input : Pointer to LSM6DSL_ACC_GYRO_LPF1_SEL_G_t |
nikapov | 0:704c89673b57 | 2418 | * Output : Status of LPF1_SEL_G see LSM6DSL_ACC_GYRO_LPF1_SEL_G_t |
nikapov | 0:704c89673b57 | 2419 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2420 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2421 | mems_status_t LSM6DSL_ACC_GYRO_R_LPF1_SEL_G(void *handle, LSM6DSL_ACC_GYRO_LPF1_SEL_G_t *value) |
nikapov | 0:704c89673b57 | 2422 | { |
nikapov | 0:704c89673b57 | 2423 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL4_C, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 2424 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2425 | |
nikapov | 0:704c89673b57 | 2426 | *value &= LSM6DSL_ACC_GYRO_LPF1_SEL_G_MASK; //mask |
nikapov | 0:704c89673b57 | 2427 | |
nikapov | 0:704c89673b57 | 2428 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2429 | } |
nikapov | 0:704c89673b57 | 2430 | |
nikapov | 0:704c89673b57 | 2431 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2432 | * Function Name : LSM6DSL_ACC_GYRO_W_I2C_DISABLE |
nikapov | 0:704c89673b57 | 2433 | * Description : Write I2C_DISABLE |
nikapov | 0:704c89673b57 | 2434 | * Input : LSM6DSL_ACC_GYRO_I2C_DISABLE_t |
nikapov | 0:704c89673b57 | 2435 | * Output : None |
nikapov | 0:704c89673b57 | 2436 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2437 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2438 | mems_status_t LSM6DSL_ACC_GYRO_W_I2C_DISABLE(void *handle, LSM6DSL_ACC_GYRO_I2C_DISABLE_t newValue) |
nikapov | 0:704c89673b57 | 2439 | { |
nikapov | 0:704c89673b57 | 2440 | u8_t value; |
nikapov | 0:704c89673b57 | 2441 | |
nikapov | 0:704c89673b57 | 2442 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL4_C, &value, 1)) |
nikapov | 0:704c89673b57 | 2443 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2444 | |
nikapov | 0:704c89673b57 | 2445 | value &= ~LSM6DSL_ACC_GYRO_I2C_DISABLE_MASK; |
nikapov | 0:704c89673b57 | 2446 | value |= newValue; |
nikapov | 0:704c89673b57 | 2447 | |
nikapov | 0:704c89673b57 | 2448 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL4_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 2449 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2450 | |
nikapov | 0:704c89673b57 | 2451 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2452 | } |
nikapov | 0:704c89673b57 | 2453 | |
nikapov | 0:704c89673b57 | 2454 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2455 | * Function Name : LSM6DSL_ACC_GYRO_R_I2C_DISABLE |
nikapov | 0:704c89673b57 | 2456 | * Description : Read I2C_DISABLE |
nikapov | 0:704c89673b57 | 2457 | * Input : Pointer to LSM6DSL_ACC_GYRO_I2C_DISABLE_t |
nikapov | 0:704c89673b57 | 2458 | * Output : Status of I2C_DISABLE see LSM6DSL_ACC_GYRO_I2C_DISABLE_t |
nikapov | 0:704c89673b57 | 2459 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2460 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2461 | mems_status_t LSM6DSL_ACC_GYRO_R_I2C_DISABLE(void *handle, LSM6DSL_ACC_GYRO_I2C_DISABLE_t *value) |
nikapov | 0:704c89673b57 | 2462 | { |
nikapov | 0:704c89673b57 | 2463 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL4_C, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 2464 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2465 | |
nikapov | 0:704c89673b57 | 2466 | *value &= LSM6DSL_ACC_GYRO_I2C_DISABLE_MASK; //mask |
nikapov | 0:704c89673b57 | 2467 | |
nikapov | 0:704c89673b57 | 2468 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2469 | } |
nikapov | 0:704c89673b57 | 2470 | |
nikapov | 0:704c89673b57 | 2471 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2472 | * Function Name : LSM6DSL_ACC_GYRO_W_DRDY_MSK |
nikapov | 0:704c89673b57 | 2473 | * Description : Write DRDY_MSK |
nikapov | 0:704c89673b57 | 2474 | * Input : LSM6DSL_ACC_GYRO_DRDY_MSK_t |
nikapov | 0:704c89673b57 | 2475 | * Output : None |
nikapov | 0:704c89673b57 | 2476 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2477 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2478 | mems_status_t LSM6DSL_ACC_GYRO_W_DRDY_MSK(void *handle, LSM6DSL_ACC_GYRO_DRDY_MSK_t newValue) |
nikapov | 0:704c89673b57 | 2479 | { |
nikapov | 0:704c89673b57 | 2480 | u8_t value; |
nikapov | 0:704c89673b57 | 2481 | |
nikapov | 0:704c89673b57 | 2482 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL4_C, &value, 1)) |
nikapov | 0:704c89673b57 | 2483 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2484 | |
nikapov | 0:704c89673b57 | 2485 | value &= ~LSM6DSL_ACC_GYRO_DRDY_MSK_MASK; |
nikapov | 0:704c89673b57 | 2486 | value |= newValue; |
nikapov | 0:704c89673b57 | 2487 | |
nikapov | 0:704c89673b57 | 2488 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL4_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 2489 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2490 | |
nikapov | 0:704c89673b57 | 2491 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2492 | } |
nikapov | 0:704c89673b57 | 2493 | |
nikapov | 0:704c89673b57 | 2494 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2495 | * Function Name : LSM6DSL_ACC_GYRO_R_DRDY_MSK |
nikapov | 0:704c89673b57 | 2496 | * Description : Read DRDY_MSK |
nikapov | 0:704c89673b57 | 2497 | * Input : Pointer to LSM6DSL_ACC_GYRO_DRDY_MSK_t |
nikapov | 0:704c89673b57 | 2498 | * Output : Status of DRDY_MSK see LSM6DSL_ACC_GYRO_DRDY_MSK_t |
nikapov | 0:704c89673b57 | 2499 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2500 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2501 | mems_status_t LSM6DSL_ACC_GYRO_R_DRDY_MSK(void *handle, LSM6DSL_ACC_GYRO_DRDY_MSK_t *value) |
nikapov | 0:704c89673b57 | 2502 | { |
nikapov | 0:704c89673b57 | 2503 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL4_C, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 2504 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2505 | |
nikapov | 0:704c89673b57 | 2506 | *value &= LSM6DSL_ACC_GYRO_DRDY_MSK_MASK; //mask |
nikapov | 0:704c89673b57 | 2507 | |
nikapov | 0:704c89673b57 | 2508 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2509 | } |
nikapov | 0:704c89673b57 | 2510 | |
nikapov | 0:704c89673b57 | 2511 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2512 | * Function Name : LSM6DSL_ACC_GYRO_W_INT2_ON_INT1 |
nikapov | 0:704c89673b57 | 2513 | * Description : Write INT2_ON_INT1 |
nikapov | 0:704c89673b57 | 2514 | * Input : LSM6DSL_ACC_GYRO_INT2_ON_INT1_t |
nikapov | 0:704c89673b57 | 2515 | * Output : None |
nikapov | 0:704c89673b57 | 2516 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2517 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2518 | mems_status_t LSM6DSL_ACC_GYRO_W_INT2_ON_INT1(void *handle, LSM6DSL_ACC_GYRO_INT2_ON_INT1_t newValue) |
nikapov | 0:704c89673b57 | 2519 | { |
nikapov | 0:704c89673b57 | 2520 | u8_t value; |
nikapov | 0:704c89673b57 | 2521 | |
nikapov | 0:704c89673b57 | 2522 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL4_C, &value, 1)) |
nikapov | 0:704c89673b57 | 2523 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2524 | |
nikapov | 0:704c89673b57 | 2525 | value &= ~LSM6DSL_ACC_GYRO_INT2_ON_INT1_MASK; |
nikapov | 0:704c89673b57 | 2526 | value |= newValue; |
nikapov | 0:704c89673b57 | 2527 | |
nikapov | 0:704c89673b57 | 2528 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL4_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 2529 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2530 | |
nikapov | 0:704c89673b57 | 2531 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2532 | } |
nikapov | 0:704c89673b57 | 2533 | |
nikapov | 0:704c89673b57 | 2534 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2535 | * Function Name : LSM6DSL_ACC_GYRO_R_INT2_ON_INT1 |
nikapov | 0:704c89673b57 | 2536 | * Description : Read INT2_ON_INT1 |
nikapov | 0:704c89673b57 | 2537 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT2_ON_INT1_t |
nikapov | 0:704c89673b57 | 2538 | * Output : Status of INT2_ON_INT1 see LSM6DSL_ACC_GYRO_INT2_ON_INT1_t |
nikapov | 0:704c89673b57 | 2539 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2540 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2541 | mems_status_t LSM6DSL_ACC_GYRO_R_INT2_ON_INT1(void *handle, LSM6DSL_ACC_GYRO_INT2_ON_INT1_t *value) |
nikapov | 0:704c89673b57 | 2542 | { |
nikapov | 0:704c89673b57 | 2543 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL4_C, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 2544 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2545 | |
nikapov | 0:704c89673b57 | 2546 | *value &= LSM6DSL_ACC_GYRO_INT2_ON_INT1_MASK; //mask |
nikapov | 0:704c89673b57 | 2547 | |
nikapov | 0:704c89673b57 | 2548 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2549 | } |
nikapov | 0:704c89673b57 | 2550 | |
nikapov | 0:704c89673b57 | 2551 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2552 | * Function Name : LSM6DSL_ACC_GYRO_W_SleepMode_G |
nikapov | 0:704c89673b57 | 2553 | * Description : Write SLEEP_G |
nikapov | 0:704c89673b57 | 2554 | * Input : LSM6DSL_ACC_GYRO_SLEEP_G_t |
nikapov | 0:704c89673b57 | 2555 | * Output : None |
nikapov | 0:704c89673b57 | 2556 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2557 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2558 | mems_status_t LSM6DSL_ACC_GYRO_W_SleepMode_G(void *handle, LSM6DSL_ACC_GYRO_SLEEP_G_t newValue) |
nikapov | 0:704c89673b57 | 2559 | { |
nikapov | 0:704c89673b57 | 2560 | u8_t value; |
nikapov | 0:704c89673b57 | 2561 | |
nikapov | 0:704c89673b57 | 2562 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL4_C, &value, 1)) |
nikapov | 0:704c89673b57 | 2563 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2564 | |
nikapov | 0:704c89673b57 | 2565 | value &= ~LSM6DSL_ACC_GYRO_SLEEP_G_MASK; |
nikapov | 0:704c89673b57 | 2566 | value |= newValue; |
nikapov | 0:704c89673b57 | 2567 | |
nikapov | 0:704c89673b57 | 2568 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL4_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 2569 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2570 | |
nikapov | 0:704c89673b57 | 2571 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2572 | } |
nikapov | 0:704c89673b57 | 2573 | |
nikapov | 0:704c89673b57 | 2574 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2575 | * Function Name : LSM6DSL_ACC_GYRO_R_SleepMode_G |
nikapov | 0:704c89673b57 | 2576 | * Description : Read SLEEP_G |
nikapov | 0:704c89673b57 | 2577 | * Input : Pointer to LSM6DSL_ACC_GYRO_SLEEP_G_t |
nikapov | 0:704c89673b57 | 2578 | * Output : Status of SLEEP_G see LSM6DSL_ACC_GYRO_SLEEP_G_t |
nikapov | 0:704c89673b57 | 2579 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2580 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2581 | mems_status_t LSM6DSL_ACC_GYRO_R_SleepMode_G(void *handle, LSM6DSL_ACC_GYRO_SLEEP_G_t *value) |
nikapov | 0:704c89673b57 | 2582 | { |
nikapov | 0:704c89673b57 | 2583 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL4_C, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 2584 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2585 | |
nikapov | 0:704c89673b57 | 2586 | *value &= LSM6DSL_ACC_GYRO_SLEEP_G_MASK; //mask |
nikapov | 0:704c89673b57 | 2587 | |
nikapov | 0:704c89673b57 | 2588 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2589 | } |
nikapov | 0:704c89673b57 | 2590 | |
nikapov | 0:704c89673b57 | 2591 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2592 | * Function Name : LSM6DSL_ACC_GYRO_W_SelfTest_XL |
nikapov | 0:704c89673b57 | 2593 | * Description : Write ST_XL |
nikapov | 0:704c89673b57 | 2594 | * Input : LSM6DSL_ACC_GYRO_ST_XL_t |
nikapov | 0:704c89673b57 | 2595 | * Output : None |
nikapov | 0:704c89673b57 | 2596 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2597 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2598 | mems_status_t LSM6DSL_ACC_GYRO_W_SelfTest_XL(void *handle, LSM6DSL_ACC_GYRO_ST_XL_t newValue) |
nikapov | 0:704c89673b57 | 2599 | { |
nikapov | 0:704c89673b57 | 2600 | u8_t value; |
nikapov | 0:704c89673b57 | 2601 | |
nikapov | 0:704c89673b57 | 2602 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL5_C, &value, 1)) |
nikapov | 0:704c89673b57 | 2603 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2604 | |
nikapov | 0:704c89673b57 | 2605 | value &= ~LSM6DSL_ACC_GYRO_ST_XL_MASK; |
nikapov | 0:704c89673b57 | 2606 | value |= newValue; |
nikapov | 0:704c89673b57 | 2607 | |
nikapov | 0:704c89673b57 | 2608 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL5_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 2609 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2610 | |
nikapov | 0:704c89673b57 | 2611 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2612 | } |
nikapov | 0:704c89673b57 | 2613 | |
nikapov | 0:704c89673b57 | 2614 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2615 | * Function Name : LSM6DSL_ACC_GYRO_R_SelfTest_XL |
nikapov | 0:704c89673b57 | 2616 | * Description : Read ST_XL |
nikapov | 0:704c89673b57 | 2617 | * Input : Pointer to LSM6DSL_ACC_GYRO_ST_XL_t |
nikapov | 0:704c89673b57 | 2618 | * Output : Status of ST_XL see LSM6DSL_ACC_GYRO_ST_XL_t |
nikapov | 0:704c89673b57 | 2619 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2620 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2621 | mems_status_t LSM6DSL_ACC_GYRO_R_SelfTest_XL(void *handle, LSM6DSL_ACC_GYRO_ST_XL_t *value) |
nikapov | 0:704c89673b57 | 2622 | { |
nikapov | 0:704c89673b57 | 2623 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL5_C, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 2624 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2625 | |
nikapov | 0:704c89673b57 | 2626 | *value &= LSM6DSL_ACC_GYRO_ST_XL_MASK; //mask |
nikapov | 0:704c89673b57 | 2627 | |
nikapov | 0:704c89673b57 | 2628 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2629 | } |
nikapov | 0:704c89673b57 | 2630 | |
nikapov | 0:704c89673b57 | 2631 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2632 | * Function Name : LSM6DSL_ACC_GYRO_W_SelfTest_G |
nikapov | 0:704c89673b57 | 2633 | * Description : Write ST_G |
nikapov | 0:704c89673b57 | 2634 | * Input : LSM6DSL_ACC_GYRO_ST_G_t |
nikapov | 0:704c89673b57 | 2635 | * Output : None |
nikapov | 0:704c89673b57 | 2636 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2637 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2638 | mems_status_t LSM6DSL_ACC_GYRO_W_SelfTest_G(void *handle, LSM6DSL_ACC_GYRO_ST_G_t newValue) |
nikapov | 0:704c89673b57 | 2639 | { |
nikapov | 0:704c89673b57 | 2640 | u8_t value; |
nikapov | 0:704c89673b57 | 2641 | |
nikapov | 0:704c89673b57 | 2642 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL5_C, &value, 1)) |
nikapov | 0:704c89673b57 | 2643 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2644 | |
nikapov | 0:704c89673b57 | 2645 | value &= ~LSM6DSL_ACC_GYRO_ST_G_MASK; |
nikapov | 0:704c89673b57 | 2646 | value |= newValue; |
nikapov | 0:704c89673b57 | 2647 | |
nikapov | 0:704c89673b57 | 2648 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL5_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 2649 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2650 | |
nikapov | 0:704c89673b57 | 2651 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2652 | } |
nikapov | 0:704c89673b57 | 2653 | |
nikapov | 0:704c89673b57 | 2654 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2655 | * Function Name : LSM6DSL_ACC_GYRO_R_SelfTest_G |
nikapov | 0:704c89673b57 | 2656 | * Description : Read ST_G |
nikapov | 0:704c89673b57 | 2657 | * Input : Pointer to LSM6DSL_ACC_GYRO_ST_G_t |
nikapov | 0:704c89673b57 | 2658 | * Output : Status of ST_G see LSM6DSL_ACC_GYRO_ST_G_t |
nikapov | 0:704c89673b57 | 2659 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2660 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2661 | mems_status_t LSM6DSL_ACC_GYRO_R_SelfTest_G(void *handle, LSM6DSL_ACC_GYRO_ST_G_t *value) |
nikapov | 0:704c89673b57 | 2662 | { |
nikapov | 0:704c89673b57 | 2663 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL5_C, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 2664 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2665 | |
nikapov | 0:704c89673b57 | 2666 | *value &= LSM6DSL_ACC_GYRO_ST_G_MASK; //mask |
nikapov | 0:704c89673b57 | 2667 | |
nikapov | 0:704c89673b57 | 2668 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2669 | } |
nikapov | 0:704c89673b57 | 2670 | |
nikapov | 0:704c89673b57 | 2671 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2672 | * Function Name : LSM6DSL_ACC_GYRO_W_DEN_Polarity |
nikapov | 0:704c89673b57 | 2673 | * Description : Write DEN_LH |
nikapov | 0:704c89673b57 | 2674 | * Input : LSM6DSL_ACC_GYRO_DEN_LH_t |
nikapov | 0:704c89673b57 | 2675 | * Output : None |
nikapov | 0:704c89673b57 | 2676 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2677 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2678 | mems_status_t LSM6DSL_ACC_GYRO_W_DEN_Polarity(void *handle, LSM6DSL_ACC_GYRO_DEN_LH_t newValue) |
nikapov | 0:704c89673b57 | 2679 | { |
nikapov | 0:704c89673b57 | 2680 | u8_t value; |
nikapov | 0:704c89673b57 | 2681 | |
nikapov | 0:704c89673b57 | 2682 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL5_C, &value, 1)) |
nikapov | 0:704c89673b57 | 2683 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2684 | |
nikapov | 0:704c89673b57 | 2685 | value &= ~LSM6DSL_ACC_GYRO_DEN_LH_MASK; |
nikapov | 0:704c89673b57 | 2686 | value |= newValue; |
nikapov | 0:704c89673b57 | 2687 | |
nikapov | 0:704c89673b57 | 2688 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL5_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 2689 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2690 | |
nikapov | 0:704c89673b57 | 2691 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2692 | } |
nikapov | 0:704c89673b57 | 2693 | |
nikapov | 0:704c89673b57 | 2694 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2695 | * Function Name : LSM6DSL_ACC_GYRO_R_DEN_Polarity |
nikapov | 0:704c89673b57 | 2696 | * Description : Read DEN_LH |
nikapov | 0:704c89673b57 | 2697 | * Input : Pointer to LSM6DSL_ACC_GYRO_DEN_LH_t |
nikapov | 0:704c89673b57 | 2698 | * Output : Status of DEN_LH see LSM6DSL_ACC_GYRO_DEN_LH_t |
nikapov | 0:704c89673b57 | 2699 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2700 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2701 | mems_status_t LSM6DSL_ACC_GYRO_R_DEN_Polarity(void *handle, LSM6DSL_ACC_GYRO_DEN_LH_t *value) |
nikapov | 0:704c89673b57 | 2702 | { |
nikapov | 0:704c89673b57 | 2703 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL5_C, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 2704 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2705 | |
nikapov | 0:704c89673b57 | 2706 | *value &= LSM6DSL_ACC_GYRO_DEN_LH_MASK; //mask |
nikapov | 0:704c89673b57 | 2707 | |
nikapov | 0:704c89673b57 | 2708 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2709 | } |
nikapov | 0:704c89673b57 | 2710 | |
nikapov | 0:704c89673b57 | 2711 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2712 | * Function Name : LSM6DSL_ACC_GYRO_W_CircularBurstMode |
nikapov | 0:704c89673b57 | 2713 | * Description : Write ST_ROUNDING |
nikapov | 0:704c89673b57 | 2714 | * Input : LSM6DSL_ACC_GYRO_ROUNDING_t |
nikapov | 0:704c89673b57 | 2715 | * Output : None |
nikapov | 0:704c89673b57 | 2716 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2717 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2718 | mems_status_t LSM6DSL_ACC_GYRO_W_CircularBurstMode(void *handle, LSM6DSL_ACC_GYRO_ROUNDING_t newValue) |
nikapov | 0:704c89673b57 | 2719 | { |
nikapov | 0:704c89673b57 | 2720 | u8_t value; |
nikapov | 0:704c89673b57 | 2721 | |
nikapov | 0:704c89673b57 | 2722 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL5_C, &value, 1)) |
nikapov | 0:704c89673b57 | 2723 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2724 | |
nikapov | 0:704c89673b57 | 2725 | value &= ~LSM6DSL_ACC_GYRO_LSM6DSL_ACC_GYRO_ROUNDING_t_MASK; |
nikapov | 0:704c89673b57 | 2726 | value |= newValue; |
nikapov | 0:704c89673b57 | 2727 | |
nikapov | 0:704c89673b57 | 2728 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL5_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 2729 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2730 | |
nikapov | 0:704c89673b57 | 2731 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2732 | } |
nikapov | 0:704c89673b57 | 2733 | |
nikapov | 0:704c89673b57 | 2734 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2735 | * Function Name : LSM6DSL_ACC_GYRO_R_CircularBurstMode |
nikapov | 0:704c89673b57 | 2736 | * Description : Read ST_ROUNDING |
nikapov | 0:704c89673b57 | 2737 | * Input : Pointer to LSM6DSL_ACC_GYRO_ROUNDING_t |
nikapov | 0:704c89673b57 | 2738 | * Output : Status of ST_ROUNDING see LSM6DSL_ACC_GYRO_ROUNDING_t |
nikapov | 0:704c89673b57 | 2739 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2740 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2741 | mems_status_t LSM6DSL_ACC_GYRO_R_CircularBurstMode(void *handle, LSM6DSL_ACC_GYRO_ROUNDING_t *value) |
nikapov | 0:704c89673b57 | 2742 | { |
nikapov | 0:704c89673b57 | 2743 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL5_C, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 2744 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2745 | |
nikapov | 0:704c89673b57 | 2746 | *value &= LSM6DSL_ACC_GYRO_LSM6DSL_ACC_GYRO_ROUNDING_t_MASK; //mask |
nikapov | 0:704c89673b57 | 2747 | |
nikapov | 0:704c89673b57 | 2748 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2749 | } |
nikapov | 0:704c89673b57 | 2750 | |
nikapov | 0:704c89673b57 | 2751 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2752 | * Function Name : LSM6DSL_ACC_GYRO_W_LP_BW_G |
nikapov | 0:704c89673b57 | 2753 | * Description : Write FTYPE |
nikapov | 0:704c89673b57 | 2754 | * Input : LSM6DSL_ACC_GYRO_FTYPE_t |
nikapov | 0:704c89673b57 | 2755 | * Output : None |
nikapov | 0:704c89673b57 | 2756 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2757 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2758 | mems_status_t LSM6DSL_ACC_GYRO_W_LP_BW_G(void *handle, LSM6DSL_ACC_GYRO_FTYPE_t newValue) |
nikapov | 0:704c89673b57 | 2759 | { |
nikapov | 0:704c89673b57 | 2760 | u8_t value; |
nikapov | 0:704c89673b57 | 2761 | |
nikapov | 0:704c89673b57 | 2762 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL6_G, &value, 1)) |
nikapov | 0:704c89673b57 | 2763 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2764 | |
nikapov | 0:704c89673b57 | 2765 | value &= ~LSM6DSL_ACC_GYRO_FTYPE_MASK; |
nikapov | 0:704c89673b57 | 2766 | value |= newValue; |
nikapov | 0:704c89673b57 | 2767 | |
nikapov | 0:704c89673b57 | 2768 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL6_G, &value, 1) ) |
nikapov | 0:704c89673b57 | 2769 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2770 | |
nikapov | 0:704c89673b57 | 2771 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2772 | } |
nikapov | 0:704c89673b57 | 2773 | |
nikapov | 0:704c89673b57 | 2774 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2775 | * Function Name : LSM6DSL_ACC_GYRO_R_LP_BW_G |
nikapov | 0:704c89673b57 | 2776 | * Description : Read FTYPE |
nikapov | 0:704c89673b57 | 2777 | * Input : Pointer to LSM6DSL_ACC_GYRO_FTYPE_t |
nikapov | 0:704c89673b57 | 2778 | * Output : Status of FTYPE see LSM6DSL_ACC_GYRO_FTYPE_t |
nikapov | 0:704c89673b57 | 2779 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2780 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2781 | mems_status_t LSM6DSL_ACC_GYRO_R_LP_BW_G(void *handle, LSM6DSL_ACC_GYRO_FTYPE_t *value) |
nikapov | 0:704c89673b57 | 2782 | { |
nikapov | 0:704c89673b57 | 2783 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL6_G, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 2784 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2785 | |
nikapov | 0:704c89673b57 | 2786 | *value &= LSM6DSL_ACC_GYRO_FTYPE_MASK; //mask |
nikapov | 0:704c89673b57 | 2787 | |
nikapov | 0:704c89673b57 | 2788 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2789 | } |
nikapov | 0:704c89673b57 | 2790 | |
nikapov | 0:704c89673b57 | 2791 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2792 | * Function Name : LSM6DSL_ACC_GYRO_W_UserOffsetWeight |
nikapov | 0:704c89673b57 | 2793 | * Description : Write USR_OFF_W |
nikapov | 0:704c89673b57 | 2794 | * Input : LSM6DSL_ACC_GYRO_USR_OFF_W_t |
nikapov | 0:704c89673b57 | 2795 | * Output : None |
nikapov | 0:704c89673b57 | 2796 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2797 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2798 | mems_status_t LSM6DSL_ACC_GYRO_W_UserOffsetWeight(void *handle, LSM6DSL_ACC_GYRO_USR_OFF_W_t newValue) |
nikapov | 0:704c89673b57 | 2799 | { |
nikapov | 0:704c89673b57 | 2800 | u8_t value; |
nikapov | 0:704c89673b57 | 2801 | |
nikapov | 0:704c89673b57 | 2802 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL6_G, &value, 1)) |
nikapov | 0:704c89673b57 | 2803 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2804 | |
nikapov | 0:704c89673b57 | 2805 | value &= ~LSM6DSL_ACC_GYRO_USR_OFF_W_MASK; |
nikapov | 0:704c89673b57 | 2806 | value |= newValue; |
nikapov | 0:704c89673b57 | 2807 | |
nikapov | 0:704c89673b57 | 2808 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL6_G, &value, 1) ) |
nikapov | 0:704c89673b57 | 2809 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2810 | |
nikapov | 0:704c89673b57 | 2811 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2812 | } |
nikapov | 0:704c89673b57 | 2813 | |
nikapov | 0:704c89673b57 | 2814 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2815 | * Function Name : LSM6DSL_ACC_GYRO_R_UserOffsetWeight |
nikapov | 0:704c89673b57 | 2816 | * Description : Read USR_OFF_W |
nikapov | 0:704c89673b57 | 2817 | * Input : Pointer to LSM6DSL_ACC_GYRO_USR_OFF_W_t |
nikapov | 0:704c89673b57 | 2818 | * Output : Status of USR_OFF_W see LSM6DSL_ACC_GYRO_USR_OFF_W_t |
nikapov | 0:704c89673b57 | 2819 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2820 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2821 | mems_status_t LSM6DSL_ACC_GYRO_R_UserOffsetWeight(void *handle, LSM6DSL_ACC_GYRO_USR_OFF_W_t *value) |
nikapov | 0:704c89673b57 | 2822 | { |
nikapov | 0:704c89673b57 | 2823 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL6_G, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 2824 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2825 | |
nikapov | 0:704c89673b57 | 2826 | *value &= LSM6DSL_ACC_GYRO_USR_OFF_W_MASK; //mask |
nikapov | 0:704c89673b57 | 2827 | |
nikapov | 0:704c89673b57 | 2828 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2829 | } |
nikapov | 0:704c89673b57 | 2830 | |
nikapov | 0:704c89673b57 | 2831 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2832 | * Function Name : LSM6DSL_ACC_GYRO_W_LowPower_XL |
nikapov | 0:704c89673b57 | 2833 | * Description : Write LP_XL |
nikapov | 0:704c89673b57 | 2834 | * Input : LSM6DSL_ACC_GYRO_LP_XL_t |
nikapov | 0:704c89673b57 | 2835 | * Output : None |
nikapov | 0:704c89673b57 | 2836 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2837 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2838 | mems_status_t LSM6DSL_ACC_GYRO_W_LowPower_XL(void *handle, LSM6DSL_ACC_GYRO_LP_XL_t newValue) |
nikapov | 0:704c89673b57 | 2839 | { |
nikapov | 0:704c89673b57 | 2840 | u8_t value; |
nikapov | 0:704c89673b57 | 2841 | |
nikapov | 0:704c89673b57 | 2842 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL6_G, &value, 1)) |
nikapov | 0:704c89673b57 | 2843 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2844 | |
nikapov | 0:704c89673b57 | 2845 | value &= ~LSM6DSL_ACC_GYRO_LP_XL_MASK; |
nikapov | 0:704c89673b57 | 2846 | value |= newValue; |
nikapov | 0:704c89673b57 | 2847 | |
nikapov | 0:704c89673b57 | 2848 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL6_G, &value, 1) ) |
nikapov | 0:704c89673b57 | 2849 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2850 | |
nikapov | 0:704c89673b57 | 2851 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2852 | } |
nikapov | 0:704c89673b57 | 2853 | |
nikapov | 0:704c89673b57 | 2854 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2855 | * Function Name : LSM6DSL_ACC_GYRO_R_LowPower_XL |
nikapov | 0:704c89673b57 | 2856 | * Description : Read LP_XL |
nikapov | 0:704c89673b57 | 2857 | * Input : Pointer to LSM6DSL_ACC_GYRO_LP_XL_t |
nikapov | 0:704c89673b57 | 2858 | * Output : Status of LP_XL see LSM6DSL_ACC_GYRO_LP_XL_t |
nikapov | 0:704c89673b57 | 2859 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2860 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2861 | mems_status_t LSM6DSL_ACC_GYRO_R_LowPower_XL(void *handle, LSM6DSL_ACC_GYRO_LP_XL_t *value) |
nikapov | 0:704c89673b57 | 2862 | { |
nikapov | 0:704c89673b57 | 2863 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL6_G, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 2864 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2865 | |
nikapov | 0:704c89673b57 | 2866 | *value &= LSM6DSL_ACC_GYRO_LP_XL_MASK; //mask |
nikapov | 0:704c89673b57 | 2867 | |
nikapov | 0:704c89673b57 | 2868 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2869 | } |
nikapov | 0:704c89673b57 | 2870 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2871 | * Function Name : LSM6DSL_ACC_GYRO_W_DEN_LVL2_EN |
nikapov | 0:704c89673b57 | 2872 | * Description : Write DEN_LVL2_EN |
nikapov | 0:704c89673b57 | 2873 | * Input : LSM6DSL_ACC_GYRO_DEN_LVL2_EN_t |
nikapov | 0:704c89673b57 | 2874 | * Output : None |
nikapov | 0:704c89673b57 | 2875 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2876 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2877 | mems_status_t LSM6DSL_ACC_GYRO_W_DEN_LVL2_EN(void *handle, LSM6DSL_ACC_GYRO_DEN_LVL2_EN_t newValue) |
nikapov | 0:704c89673b57 | 2878 | { |
nikapov | 0:704c89673b57 | 2879 | u8_t value; |
nikapov | 0:704c89673b57 | 2880 | |
nikapov | 0:704c89673b57 | 2881 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL6_G, &value, 1)) |
nikapov | 0:704c89673b57 | 2882 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2883 | |
nikapov | 0:704c89673b57 | 2884 | value &= ~LSM6DSL_ACC_GYRO_DEN_LVL2_EN_MASK; |
nikapov | 0:704c89673b57 | 2885 | value |= newValue; |
nikapov | 0:704c89673b57 | 2886 | |
nikapov | 0:704c89673b57 | 2887 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL6_G, &value, 1) ) |
nikapov | 0:704c89673b57 | 2888 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2889 | |
nikapov | 0:704c89673b57 | 2890 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2891 | } |
nikapov | 0:704c89673b57 | 2892 | |
nikapov | 0:704c89673b57 | 2893 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2894 | * Function Name : LSM6DSL_ACC_GYRO_R_DEN_LVL2_EN |
nikapov | 0:704c89673b57 | 2895 | * Description : Read DEN_LVL2_EN |
nikapov | 0:704c89673b57 | 2896 | * Input : Pointer to LSM6DSL_ACC_GYRO_DEN_LVL2_EN_t |
nikapov | 0:704c89673b57 | 2897 | * Output : Status of DEN_LVL2_EN see LSM6DSL_ACC_GYRO_DEN_LVL2_EN_t |
nikapov | 0:704c89673b57 | 2898 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2899 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2900 | mems_status_t LSM6DSL_ACC_GYRO_R_DEN_LVL2_EN(void *handle, LSM6DSL_ACC_GYRO_DEN_LVL2_EN_t *value) |
nikapov | 0:704c89673b57 | 2901 | { |
nikapov | 0:704c89673b57 | 2902 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL6_G, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 2903 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2904 | |
nikapov | 0:704c89673b57 | 2905 | *value &= LSM6DSL_ACC_GYRO_DEN_LVL2_EN_MASK; //mask |
nikapov | 0:704c89673b57 | 2906 | |
nikapov | 0:704c89673b57 | 2907 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2908 | } |
nikapov | 0:704c89673b57 | 2909 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2910 | * Function Name : LSM6DSL_ACC_GYRO_W_DEN_LVL_EN |
nikapov | 0:704c89673b57 | 2911 | * Description : Write DEN_LVL_EN |
nikapov | 0:704c89673b57 | 2912 | * Input : LSM6DSL_ACC_GYRO_DEN_LVL_EN_t |
nikapov | 0:704c89673b57 | 2913 | * Output : None |
nikapov | 0:704c89673b57 | 2914 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2915 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2916 | mems_status_t LSM6DSL_ACC_GYRO_W_DEN_LVL_EN(void *handle, LSM6DSL_ACC_GYRO_DEN_LVL_EN_t newValue) |
nikapov | 0:704c89673b57 | 2917 | { |
nikapov | 0:704c89673b57 | 2918 | u8_t value; |
nikapov | 0:704c89673b57 | 2919 | |
nikapov | 0:704c89673b57 | 2920 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL6_G, &value, 1)) |
nikapov | 0:704c89673b57 | 2921 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2922 | |
nikapov | 0:704c89673b57 | 2923 | value &= ~LSM6DSL_ACC_GYRO_DEN_LVL_EN_MASK; |
nikapov | 0:704c89673b57 | 2924 | value |= newValue; |
nikapov | 0:704c89673b57 | 2925 | |
nikapov | 0:704c89673b57 | 2926 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL6_G, &value, 1) ) |
nikapov | 0:704c89673b57 | 2927 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2928 | |
nikapov | 0:704c89673b57 | 2929 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2930 | } |
nikapov | 0:704c89673b57 | 2931 | |
nikapov | 0:704c89673b57 | 2932 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2933 | * Function Name : LSM6DSL_ACC_GYRO_R_DEN_LVL_EN |
nikapov | 0:704c89673b57 | 2934 | * Description : Read DEN_LVL_EN |
nikapov | 0:704c89673b57 | 2935 | * Input : Pointer to LSM6DSL_ACC_GYRO_DEN_LVL_EN_t |
nikapov | 0:704c89673b57 | 2936 | * Output : Status of DEN_LVL_EN see LSM6DSL_ACC_GYRO_DEN_LVL_EN_t |
nikapov | 0:704c89673b57 | 2937 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2938 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2939 | mems_status_t LSM6DSL_ACC_GYRO_R_DEN_LVL_EN(void *handle, LSM6DSL_ACC_GYRO_DEN_LVL_EN_t *value) |
nikapov | 0:704c89673b57 | 2940 | { |
nikapov | 0:704c89673b57 | 2941 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL6_G, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 2942 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2943 | |
nikapov | 0:704c89673b57 | 2944 | *value &= LSM6DSL_ACC_GYRO_DEN_LVL_EN_MASK; //mask |
nikapov | 0:704c89673b57 | 2945 | |
nikapov | 0:704c89673b57 | 2946 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2947 | } |
nikapov | 0:704c89673b57 | 2948 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2949 | * Function Name : LSM6DSL_ACC_GYRO_W_ExternalTrigger |
nikapov | 0:704c89673b57 | 2950 | * Description : Write DEN_EDGE_EN |
nikapov | 0:704c89673b57 | 2951 | * Input : LSM6DSL_ACC_GYRO_DEN_EDGE_EN_t |
nikapov | 0:704c89673b57 | 2952 | * Output : None |
nikapov | 0:704c89673b57 | 2953 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2954 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2955 | mems_status_t LSM6DSL_ACC_GYRO_W_ExternalTrigger(void *handle, LSM6DSL_ACC_GYRO_DEN_EDGE_EN_t newValue) |
nikapov | 0:704c89673b57 | 2956 | { |
nikapov | 0:704c89673b57 | 2957 | u8_t value; |
nikapov | 0:704c89673b57 | 2958 | |
nikapov | 0:704c89673b57 | 2959 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL6_G, &value, 1) ) |
nikapov | 0:704c89673b57 | 2960 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2961 | |
nikapov | 0:704c89673b57 | 2962 | value &= ~LSM6DSL_ACC_GYRO_DEN_EDGE_EN_MASK; |
nikapov | 0:704c89673b57 | 2963 | value |= newValue; |
nikapov | 0:704c89673b57 | 2964 | |
nikapov | 0:704c89673b57 | 2965 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL6_G, &value, 1) ) |
nikapov | 0:704c89673b57 | 2966 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2967 | |
nikapov | 0:704c89673b57 | 2968 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2969 | } |
nikapov | 0:704c89673b57 | 2970 | |
nikapov | 0:704c89673b57 | 2971 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2972 | * Function Name : LSM6DSL_ACC_GYRO_R_ExternalTrigger |
nikapov | 0:704c89673b57 | 2973 | * Description : Read DEN_EDGE_EN |
nikapov | 0:704c89673b57 | 2974 | * Input : Pointer to LSM6DSL_ACC_GYRO_DEN_EDGE_EN_t |
nikapov | 0:704c89673b57 | 2975 | * Output : Status of DEN_EDGE_EN see LSM6DSL_ACC_GYRO_DEN_EDGE_EN_t |
nikapov | 0:704c89673b57 | 2976 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2977 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2978 | mems_status_t LSM6DSL_ACC_GYRO_R_ExternalTrigger(void *handle, LSM6DSL_ACC_GYRO_DEN_EDGE_EN_t *value) |
nikapov | 0:704c89673b57 | 2979 | { |
nikapov | 0:704c89673b57 | 2980 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL6_G, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 2981 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 2982 | |
nikapov | 0:704c89673b57 | 2983 | *value &= LSM6DSL_ACC_GYRO_DEN_EDGE_EN_MASK; //mask |
nikapov | 0:704c89673b57 | 2984 | |
nikapov | 0:704c89673b57 | 2985 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 2986 | } |
nikapov | 0:704c89673b57 | 2987 | |
nikapov | 0:704c89673b57 | 2988 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 2989 | * Function Name : LSM6DSL_ACC_GYRO_W_HPM_G |
nikapov | 0:704c89673b57 | 2990 | * Description : Write HPM_G |
nikapov | 0:704c89673b57 | 2991 | * Input : LSM6DSL_ACC_GYRO_HPM_G_t |
nikapov | 0:704c89673b57 | 2992 | * Output : None |
nikapov | 0:704c89673b57 | 2993 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 2994 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 2995 | mems_status_t LSM6DSL_ACC_GYRO_W_HPM_G(void *handle, LSM6DSL_ACC_GYRO_HPM_G_t newValue) |
nikapov | 0:704c89673b57 | 2996 | { |
nikapov | 0:704c89673b57 | 2997 | u8_t value; |
nikapov | 0:704c89673b57 | 2998 | |
nikapov | 0:704c89673b57 | 2999 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL7_G, &value, 1) ) |
nikapov | 0:704c89673b57 | 3000 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3001 | |
nikapov | 0:704c89673b57 | 3002 | value &= ~LSM6DSL_ACC_GYRO_HPM_G_MASK; |
nikapov | 0:704c89673b57 | 3003 | value |= newValue; |
nikapov | 0:704c89673b57 | 3004 | |
nikapov | 0:704c89673b57 | 3005 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL7_G, &value, 1) ) |
nikapov | 0:704c89673b57 | 3006 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3007 | |
nikapov | 0:704c89673b57 | 3008 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3009 | } |
nikapov | 0:704c89673b57 | 3010 | |
nikapov | 0:704c89673b57 | 3011 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3012 | * Function Name : LSM6DSL_ACC_GYRO_R_HPM_G |
nikapov | 0:704c89673b57 | 3013 | * Description : Read HPM_G |
nikapov | 0:704c89673b57 | 3014 | * Input : Pointer to LSM6DSL_ACC_GYRO_HPM_G_t |
nikapov | 0:704c89673b57 | 3015 | * Output : Status of HPM_G see LSM6DSL_ACC_GYRO_HPM_G_t |
nikapov | 0:704c89673b57 | 3016 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3017 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3018 | mems_status_t LSM6DSL_ACC_GYRO_R_HPM_G(void *handle, LSM6DSL_ACC_GYRO_HPM_G_t *value) |
nikapov | 0:704c89673b57 | 3019 | { |
nikapov | 0:704c89673b57 | 3020 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL7_G, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 3021 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3022 | |
nikapov | 0:704c89673b57 | 3023 | *value &= LSM6DSL_ACC_GYRO_HPM_G_MASK; //mask |
nikapov | 0:704c89673b57 | 3024 | |
nikapov | 0:704c89673b57 | 3025 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3026 | } |
nikapov | 0:704c89673b57 | 3027 | |
nikapov | 0:704c89673b57 | 3028 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3029 | * Function Name : LSM6DSL_ACC_GYRO_W_RoundingOnStatusRegisters |
nikapov | 0:704c89673b57 | 3030 | * Description : Write HPM_G |
nikapov | 0:704c89673b57 | 3031 | * Input : LSM6DSL_ACC_GYRO_RND_STATUS_t |
nikapov | 0:704c89673b57 | 3032 | * Output : None |
nikapov | 0:704c89673b57 | 3033 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3034 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3035 | mems_status_t LSM6DSL_ACC_GYRO_W_RoundingOnStatusRegisters(void *handle, LSM6DSL_ACC_GYRO_RND_STATUS_t newValue) |
nikapov | 0:704c89673b57 | 3036 | { |
nikapov | 0:704c89673b57 | 3037 | u8_t value; |
nikapov | 0:704c89673b57 | 3038 | |
nikapov | 0:704c89673b57 | 3039 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL7_G, &value, 1) ) |
nikapov | 0:704c89673b57 | 3040 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3041 | |
nikapov | 0:704c89673b57 | 3042 | value &= ~LSM6DSL_ACC_GYRO_RND_STATUS_MASK; |
nikapov | 0:704c89673b57 | 3043 | value |= newValue; |
nikapov | 0:704c89673b57 | 3044 | |
nikapov | 0:704c89673b57 | 3045 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL7_G, &value, 1) ) |
nikapov | 0:704c89673b57 | 3046 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3047 | |
nikapov | 0:704c89673b57 | 3048 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3049 | } |
nikapov | 0:704c89673b57 | 3050 | |
nikapov | 0:704c89673b57 | 3051 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3052 | * Function Name : LSM6DSL_ACC_GYRO_R_RoundingOnStatusRegisters |
nikapov | 0:704c89673b57 | 3053 | * Description : Read HPM_G |
nikapov | 0:704c89673b57 | 3054 | * Input : Pointer to LSM6DSL_ACC_GYRO_RND_STATUS_t |
nikapov | 0:704c89673b57 | 3055 | * Output : Status of HPM_G see LSM6DSL_ACC_GYRO_RND_STATUS_t |
nikapov | 0:704c89673b57 | 3056 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3057 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3058 | mems_status_t LSM6DSL_ACC_GYRO_R_RoundingOnStatusRegisters(void *handle, LSM6DSL_ACC_GYRO_RND_STATUS_t *value) |
nikapov | 0:704c89673b57 | 3059 | { |
nikapov | 0:704c89673b57 | 3060 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL7_G, (u8_t *)value, 1)) |
nikapov | 0:704c89673b57 | 3061 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3062 | |
nikapov | 0:704c89673b57 | 3063 | *value &= LSM6DSL_ACC_GYRO_RND_STATUS_MASK; //mask |
nikapov | 0:704c89673b57 | 3064 | |
nikapov | 0:704c89673b57 | 3065 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3066 | } |
nikapov | 0:704c89673b57 | 3067 | |
nikapov | 0:704c89673b57 | 3068 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3069 | * Function Name : LSM6DSL_ACC_GYRO_W_HPFilter_En |
nikapov | 0:704c89673b57 | 3070 | * Description : Write HP_EN |
nikapov | 0:704c89673b57 | 3071 | * Input : LSM6DSL_ACC_GYRO_HP_EN_t |
nikapov | 0:704c89673b57 | 3072 | * Output : None |
nikapov | 0:704c89673b57 | 3073 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3074 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3075 | mems_status_t LSM6DSL_ACC_GYRO_W_HPFilter_En(void *handle, LSM6DSL_ACC_GYRO_HP_EN_t newValue) |
nikapov | 0:704c89673b57 | 3076 | { |
nikapov | 0:704c89673b57 | 3077 | u8_t value; |
nikapov | 0:704c89673b57 | 3078 | |
nikapov | 0:704c89673b57 | 3079 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL7_G, &value, 1) ) |
nikapov | 0:704c89673b57 | 3080 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3081 | |
nikapov | 0:704c89673b57 | 3082 | value &= ~LSM6DSL_ACC_GYRO_HP_EN_MASK; |
nikapov | 0:704c89673b57 | 3083 | value |= newValue; |
nikapov | 0:704c89673b57 | 3084 | |
nikapov | 0:704c89673b57 | 3085 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL7_G, &value, 1) ) |
nikapov | 0:704c89673b57 | 3086 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3087 | |
nikapov | 0:704c89673b57 | 3088 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3089 | } |
nikapov | 0:704c89673b57 | 3090 | |
nikapov | 0:704c89673b57 | 3091 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3092 | * Function Name : LSM6DSL_ACC_GYRO_R_HPFilter_En |
nikapov | 0:704c89673b57 | 3093 | * Description : Read HP_EN |
nikapov | 0:704c89673b57 | 3094 | * Input : Pointer to LSM6DSL_ACC_GYRO_HP_EN_t |
nikapov | 0:704c89673b57 | 3095 | * Output : Status of HP_EN see LSM6DSL_ACC_GYRO_HP_EN_t |
nikapov | 0:704c89673b57 | 3096 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3097 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3098 | mems_status_t LSM6DSL_ACC_GYRO_R_HPFilter_En(void *handle, LSM6DSL_ACC_GYRO_HP_EN_t *value) |
nikapov | 0:704c89673b57 | 3099 | { |
nikapov | 0:704c89673b57 | 3100 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL7_G, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 3101 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3102 | |
nikapov | 0:704c89673b57 | 3103 | *value &= LSM6DSL_ACC_GYRO_HP_EN_MASK; //mask |
nikapov | 0:704c89673b57 | 3104 | |
nikapov | 0:704c89673b57 | 3105 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3106 | } |
nikapov | 0:704c89673b57 | 3107 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3108 | * Function Name : LSM6DSL_ACC_GYRO_W_LP_Mode |
nikapov | 0:704c89673b57 | 3109 | * Description : Write LP_EN |
nikapov | 0:704c89673b57 | 3110 | * Input : LSM6DSL_ACC_GYRO_LP_EN_t |
nikapov | 0:704c89673b57 | 3111 | * Output : None |
nikapov | 0:704c89673b57 | 3112 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3113 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3114 | mems_status_t LSM6DSL_ACC_GYRO_W_LP_Mode(void *handle, LSM6DSL_ACC_GYRO_LP_EN_t newValue) |
nikapov | 0:704c89673b57 | 3115 | { |
nikapov | 0:704c89673b57 | 3116 | u8_t value; |
nikapov | 0:704c89673b57 | 3117 | |
nikapov | 0:704c89673b57 | 3118 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL7_G, &value, 1) ) |
nikapov | 0:704c89673b57 | 3119 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3120 | |
nikapov | 0:704c89673b57 | 3121 | value &= ~LSM6DSL_ACC_GYRO_LP_EN_MASK; |
nikapov | 0:704c89673b57 | 3122 | value |= newValue; |
nikapov | 0:704c89673b57 | 3123 | |
nikapov | 0:704c89673b57 | 3124 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL7_G, &value, 1) ) |
nikapov | 0:704c89673b57 | 3125 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3126 | |
nikapov | 0:704c89673b57 | 3127 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3128 | } |
nikapov | 0:704c89673b57 | 3129 | |
nikapov | 0:704c89673b57 | 3130 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3131 | * Function Name : LSM6DSL_ACC_GYRO_R_LP_Mode |
nikapov | 0:704c89673b57 | 3132 | * Description : Read LP_EN |
nikapov | 0:704c89673b57 | 3133 | * Input : Pointer to LSM6DSL_ACC_GYRO_LP_EN_t |
nikapov | 0:704c89673b57 | 3134 | * Output : Status of LP_EN see LSM6DSL_ACC_GYRO_LP_EN_t |
nikapov | 0:704c89673b57 | 3135 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3136 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3137 | mems_status_t LSM6DSL_ACC_GYRO_R_LP_Mode(void *handle, LSM6DSL_ACC_GYRO_LP_EN_t *value) |
nikapov | 0:704c89673b57 | 3138 | { |
nikapov | 0:704c89673b57 | 3139 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL7_G, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 3140 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3141 | |
nikapov | 0:704c89673b57 | 3142 | *value &= LSM6DSL_ACC_GYRO_LP_EN_MASK; //mask |
nikapov | 0:704c89673b57 | 3143 | |
nikapov | 0:704c89673b57 | 3144 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3145 | } |
nikapov | 0:704c89673b57 | 3146 | |
nikapov | 0:704c89673b57 | 3147 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3148 | * Function Name : LSM6DSL_ACC_GYRO_W_ROUNDING_STATUS |
nikapov | 0:704c89673b57 | 3149 | * Description : Write ROUNDING_STATUS |
nikapov | 0:704c89673b57 | 3150 | * Input : LSM6DSL_ACC_GYRO_ROUNDING_STATUS_t |
nikapov | 0:704c89673b57 | 3151 | * Output : None |
nikapov | 0:704c89673b57 | 3152 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3153 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3154 | mems_status_t LSM6DSL_ACC_GYRO_W_ROUNDING_STATUS(void *handle, LSM6DSL_ACC_GYRO_ROUNDING_STATUS_t newValue) |
nikapov | 0:704c89673b57 | 3155 | { |
nikapov | 0:704c89673b57 | 3156 | u8_t value; |
nikapov | 0:704c89673b57 | 3157 | |
nikapov | 0:704c89673b57 | 3158 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL7_G, &value, 1) ) |
nikapov | 0:704c89673b57 | 3159 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3160 | |
nikapov | 0:704c89673b57 | 3161 | value &= ~LSM6DSL_ACC_GYRO_ROUNDING_STATUS_MASK; |
nikapov | 0:704c89673b57 | 3162 | value |= newValue; |
nikapov | 0:704c89673b57 | 3163 | |
nikapov | 0:704c89673b57 | 3164 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL7_G, &value, 1) ) |
nikapov | 0:704c89673b57 | 3165 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3166 | |
nikapov | 0:704c89673b57 | 3167 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3168 | } |
nikapov | 0:704c89673b57 | 3169 | |
nikapov | 0:704c89673b57 | 3170 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3171 | * Function Name : LSM6DSL_ACC_GYRO_R_ROUNDING_STATUS |
nikapov | 0:704c89673b57 | 3172 | * Description : Read ROUNDING_STATUS |
nikapov | 0:704c89673b57 | 3173 | * Input : Pointer to LSM6DSL_ACC_GYRO_ROUNDING_STATUS_t |
nikapov | 0:704c89673b57 | 3174 | * Output : Status of ROUNDING_STATUS see LSM6DSL_ACC_GYRO_ROUNDING_STATUS_t |
nikapov | 0:704c89673b57 | 3175 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3176 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3177 | mems_status_t LSM6DSL_ACC_GYRO_R_ROUNDING_STATUS(void *handle, LSM6DSL_ACC_GYRO_ROUNDING_STATUS_t *value) |
nikapov | 0:704c89673b57 | 3178 | { |
nikapov | 0:704c89673b57 | 3179 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL7_G, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 3180 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3181 | |
nikapov | 0:704c89673b57 | 3182 | *value &= LSM6DSL_ACC_GYRO_ROUNDING_STATUS_MASK; //mask |
nikapov | 0:704c89673b57 | 3183 | |
nikapov | 0:704c89673b57 | 3184 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3185 | } |
nikapov | 0:704c89673b57 | 3186 | |
nikapov | 0:704c89673b57 | 3187 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3188 | * Function Name : LSM6DSL_ACC_GYRO_W_HP_G_RST |
nikapov | 0:704c89673b57 | 3189 | * Description : Write HP_G_RST |
nikapov | 0:704c89673b57 | 3190 | * Input : LSM6DSL_ACC_GYRO_HP_G_RST_t |
nikapov | 0:704c89673b57 | 3191 | * Output : None |
nikapov | 0:704c89673b57 | 3192 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3193 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3194 | mems_status_t LSM6DSL_ACC_GYRO_W_HP_G_RST(void *handle, LSM6DSL_ACC_GYRO_HP_G_RST_t newValue) |
nikapov | 0:704c89673b57 | 3195 | { |
nikapov | 0:704c89673b57 | 3196 | u8_t value; |
nikapov | 0:704c89673b57 | 3197 | |
nikapov | 0:704c89673b57 | 3198 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL7_G, &value, 1) ) |
nikapov | 0:704c89673b57 | 3199 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3200 | |
nikapov | 0:704c89673b57 | 3201 | value &= ~LSM6DSL_ACC_GYRO_HP_G_RST_MASK; |
nikapov | 0:704c89673b57 | 3202 | value |= newValue; |
nikapov | 0:704c89673b57 | 3203 | |
nikapov | 0:704c89673b57 | 3204 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL7_G, &value, 1) ) |
nikapov | 0:704c89673b57 | 3205 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3206 | |
nikapov | 0:704c89673b57 | 3207 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3208 | } |
nikapov | 0:704c89673b57 | 3209 | |
nikapov | 0:704c89673b57 | 3210 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3211 | * Function Name : LSM6DSL_ACC_GYRO_R_HP_G_RST |
nikapov | 0:704c89673b57 | 3212 | * Description : Read HP_G_RST |
nikapov | 0:704c89673b57 | 3213 | * Input : Pointer to LSM6DSL_ACC_GYRO_HP_G_RST_t |
nikapov | 0:704c89673b57 | 3214 | * Output : Status of HP_G_RST see LSM6DSL_ACC_GYRO_HP_G_RST_t |
nikapov | 0:704c89673b57 | 3215 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3216 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3217 | mems_status_t LSM6DSL_ACC_GYRO_R_HP_G_RST(void *handle, LSM6DSL_ACC_GYRO_HP_G_RST_t *value) |
nikapov | 0:704c89673b57 | 3218 | { |
nikapov | 0:704c89673b57 | 3219 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL7_G, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 3220 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3221 | |
nikapov | 0:704c89673b57 | 3222 | *value &= LSM6DSL_ACC_GYRO_HP_G_RST_MASK; //mask |
nikapov | 0:704c89673b57 | 3223 | |
nikapov | 0:704c89673b57 | 3224 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3225 | } |
nikapov | 0:704c89673b57 | 3226 | |
nikapov | 0:704c89673b57 | 3227 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3228 | * Function Name : LSM6DSL_ACC_GYRO_W_InComposit |
nikapov | 0:704c89673b57 | 3229 | * Description : Write INPUT_COMPOSITE |
nikapov | 0:704c89673b57 | 3230 | * Input : LSM6DSL_ACC_GYRO_IN_COMP_t |
nikapov | 0:704c89673b57 | 3231 | * Output : None |
nikapov | 0:704c89673b57 | 3232 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3233 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3234 | mems_status_t LSM6DSL_ACC_GYRO_W_InComposit(void *handle, LSM6DSL_ACC_GYRO_IN_COMP_t newValue) |
nikapov | 0:704c89673b57 | 3235 | { |
nikapov | 0:704c89673b57 | 3236 | u8_t value; |
nikapov | 0:704c89673b57 | 3237 | |
nikapov | 0:704c89673b57 | 3238 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL8_XL, &value, 1) ) |
nikapov | 0:704c89673b57 | 3239 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3240 | |
nikapov | 0:704c89673b57 | 3241 | value &= ~LSM6DSL_ACC_GYRO_IN_COMP_MASK; |
nikapov | 0:704c89673b57 | 3242 | value |= newValue; |
nikapov | 0:704c89673b57 | 3243 | |
nikapov | 0:704c89673b57 | 3244 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL8_XL, &value, 1) ) |
nikapov | 0:704c89673b57 | 3245 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3246 | |
nikapov | 0:704c89673b57 | 3247 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3248 | } |
nikapov | 0:704c89673b57 | 3249 | |
nikapov | 0:704c89673b57 | 3250 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3251 | * Function Name : LSM6DSL_ACC_GYRO_R_InComposit |
nikapov | 0:704c89673b57 | 3252 | * Description : Read INPUT_COMPOSITE |
nikapov | 0:704c89673b57 | 3253 | * Input : Pointer to LSM6DSL_ACC_GYRO_IN_COMP_t |
nikapov | 0:704c89673b57 | 3254 | * Output : Status of INPUT_COMPOSITE see LSM6DSL_ACC_GYRO_IN_COMP_t |
nikapov | 0:704c89673b57 | 3255 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3256 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3257 | mems_status_t LSM6DSL_ACC_GYRO_R_InComposit(void *handle, LSM6DSL_ACC_GYRO_IN_COMP_t *value) |
nikapov | 0:704c89673b57 | 3258 | { |
nikapov | 0:704c89673b57 | 3259 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL8_XL, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 3260 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3261 | |
nikapov | 0:704c89673b57 | 3262 | *value &= LSM6DSL_ACC_GYRO_IN_COMP_MASK; //mask |
nikapov | 0:704c89673b57 | 3263 | |
nikapov | 0:704c89673b57 | 3264 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3265 | } |
nikapov | 0:704c89673b57 | 3266 | |
nikapov | 0:704c89673b57 | 3267 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3268 | * Function Name : LSM6DSL_ACC_GYRO_W_HPfilterReference |
nikapov | 0:704c89673b57 | 3269 | * Description : Write HP_REF_MODE |
nikapov | 0:704c89673b57 | 3270 | * Input : LSM6DSL_ACC_GYRO_HP_REF_MODE_t |
nikapov | 0:704c89673b57 | 3271 | * Output : None |
nikapov | 0:704c89673b57 | 3272 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3273 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3274 | mems_status_t LSM6DSL_ACC_GYRO_W_HPfilterReference(void *handle, LSM6DSL_ACC_GYRO_HP_REF_MODE_t newValue) |
nikapov | 0:704c89673b57 | 3275 | { |
nikapov | 0:704c89673b57 | 3276 | u8_t value; |
nikapov | 0:704c89673b57 | 3277 | |
nikapov | 0:704c89673b57 | 3278 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL8_XL, &value, 1) ) |
nikapov | 0:704c89673b57 | 3279 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3280 | |
nikapov | 0:704c89673b57 | 3281 | value &= ~LSM6DSL_ACC_GYRO_HP_REF_MODE_MASK; |
nikapov | 0:704c89673b57 | 3282 | value |= newValue; |
nikapov | 0:704c89673b57 | 3283 | |
nikapov | 0:704c89673b57 | 3284 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL8_XL, &value, 1) ) |
nikapov | 0:704c89673b57 | 3285 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3286 | |
nikapov | 0:704c89673b57 | 3287 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3288 | } |
nikapov | 0:704c89673b57 | 3289 | |
nikapov | 0:704c89673b57 | 3290 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3291 | * Function Name : LSM6DSL_ACC_GYRO_R_HPfilterReference |
nikapov | 0:704c89673b57 | 3292 | * Description : Read HP_REF_MODE |
nikapov | 0:704c89673b57 | 3293 | * Input : Pointer to LSM6DSL_ACC_GYRO_HP_REF_MODE_t |
nikapov | 0:704c89673b57 | 3294 | * Output : Status of HP_REF_MODE see LSM6DSL_ACC_GYRO_HP_REF_MODE_t |
nikapov | 0:704c89673b57 | 3295 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3296 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3297 | mems_status_t LSM6DSL_ACC_GYRO_R_HPfilterReference(void *handle, LSM6DSL_ACC_GYRO_HP_REF_MODE_t *value) |
nikapov | 0:704c89673b57 | 3298 | { |
nikapov | 0:704c89673b57 | 3299 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL8_XL, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 3300 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3301 | |
nikapov | 0:704c89673b57 | 3302 | *value &= LSM6DSL_ACC_GYRO_HP_REF_MODE_MASK; //mask |
nikapov | 0:704c89673b57 | 3303 | |
nikapov | 0:704c89673b57 | 3304 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3305 | } |
nikapov | 0:704c89673b57 | 3306 | |
nikapov | 0:704c89673b57 | 3307 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3308 | * Function Name : LSM6DSL_ACC_GYRO_W_HPCF_XL |
nikapov | 0:704c89673b57 | 3309 | * Description : Write HPCF_XL |
nikapov | 0:704c89673b57 | 3310 | * Input : LSM6DSL_ACC_GYRO_HPCF_XL_t |
nikapov | 0:704c89673b57 | 3311 | * Output : None |
nikapov | 0:704c89673b57 | 3312 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3313 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3314 | mems_status_t LSM6DSL_ACC_GYRO_W_HPCF_XL(void *handle, LSM6DSL_ACC_GYRO_HPCF_XL_t newValue) |
nikapov | 0:704c89673b57 | 3315 | { |
nikapov | 0:704c89673b57 | 3316 | u8_t value; |
nikapov | 0:704c89673b57 | 3317 | |
nikapov | 0:704c89673b57 | 3318 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL8_XL, &value, 1) ) |
nikapov | 0:704c89673b57 | 3319 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3320 | |
nikapov | 0:704c89673b57 | 3321 | value &= ~LSM6DSL_ACC_GYRO_HPCF_XL_MASK; |
nikapov | 0:704c89673b57 | 3322 | value |= newValue; |
nikapov | 0:704c89673b57 | 3323 | |
nikapov | 0:704c89673b57 | 3324 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL8_XL, &value, 1) ) |
nikapov | 0:704c89673b57 | 3325 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3326 | |
nikapov | 0:704c89673b57 | 3327 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3328 | } |
nikapov | 0:704c89673b57 | 3329 | |
nikapov | 0:704c89673b57 | 3330 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3331 | * Function Name : LSM6DSL_ACC_GYRO_R_HPCF_XL |
nikapov | 0:704c89673b57 | 3332 | * Description : Read HPCF_XL |
nikapov | 0:704c89673b57 | 3333 | * Input : Pointer to LSM6DSL_ACC_GYRO_HPCF_XL_t |
nikapov | 0:704c89673b57 | 3334 | * Output : Status of HPCF_XL see LSM6DSL_ACC_GYRO_HPCF_XL_t |
nikapov | 0:704c89673b57 | 3335 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3336 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3337 | mems_status_t LSM6DSL_ACC_GYRO_R_HPCF_XL(void *handle, LSM6DSL_ACC_GYRO_HPCF_XL_t *value) |
nikapov | 0:704c89673b57 | 3338 | { |
nikapov | 0:704c89673b57 | 3339 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL8_XL, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 3340 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3341 | |
nikapov | 0:704c89673b57 | 3342 | *value &= LSM6DSL_ACC_GYRO_HPCF_XL_MASK; //mask |
nikapov | 0:704c89673b57 | 3343 | |
nikapov | 0:704c89673b57 | 3344 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3345 | } |
nikapov | 0:704c89673b57 | 3346 | |
nikapov | 0:704c89673b57 | 3347 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3348 | * Function Name : LSM6DSL_ACC_GYRO_W_LowPassFiltSel_XL |
nikapov | 0:704c89673b57 | 3349 | * Description : Write LPF2_XL_EN |
nikapov | 0:704c89673b57 | 3350 | * Input : LSM6DSL_ACC_GYRO_LPF2_XL_t |
nikapov | 0:704c89673b57 | 3351 | * Output : None |
nikapov | 0:704c89673b57 | 3352 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3353 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3354 | mems_status_t LSM6DSL_ACC_GYRO_W_LowPassFiltSel_XL(void *handle, LSM6DSL_ACC_GYRO_LPF2_XL_t newValue) |
nikapov | 0:704c89673b57 | 3355 | { |
nikapov | 0:704c89673b57 | 3356 | u8_t value; |
nikapov | 0:704c89673b57 | 3357 | |
nikapov | 0:704c89673b57 | 3358 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL8_XL, &value, 1) ) |
nikapov | 0:704c89673b57 | 3359 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3360 | |
nikapov | 0:704c89673b57 | 3361 | value &= ~LSM6DSL_ACC_GYRO_LPF2_XL_MASK; |
nikapov | 0:704c89673b57 | 3362 | value |= newValue; |
nikapov | 0:704c89673b57 | 3363 | |
nikapov | 0:704c89673b57 | 3364 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL8_XL, &value, 1) ) |
nikapov | 0:704c89673b57 | 3365 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3366 | |
nikapov | 0:704c89673b57 | 3367 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3368 | } |
nikapov | 0:704c89673b57 | 3369 | |
nikapov | 0:704c89673b57 | 3370 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3371 | * Function Name : LSM6DSL_ACC_GYRO_R_LowPassFiltSel_XL |
nikapov | 0:704c89673b57 | 3372 | * Description : Read LPF2_XL_EN |
nikapov | 0:704c89673b57 | 3373 | * Input : Pointer to LSM6DSL_ACC_GYRO_LPF2_XL_t |
nikapov | 0:704c89673b57 | 3374 | * Output : Status of LPF2_XL_EN see LSM6DSL_ACC_GYRO_LPF2_XL_t |
nikapov | 0:704c89673b57 | 3375 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3376 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3377 | mems_status_t LSM6DSL_ACC_GYRO_R_LowPassFiltSel_XL(void *handle, LSM6DSL_ACC_GYRO_LPF2_XL_t *value) |
nikapov | 0:704c89673b57 | 3378 | { |
nikapov | 0:704c89673b57 | 3379 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL8_XL, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 3380 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3381 | |
nikapov | 0:704c89673b57 | 3382 | *value &= LSM6DSL_ACC_GYRO_LPF2_XL_MASK; //mask |
nikapov | 0:704c89673b57 | 3383 | |
nikapov | 0:704c89673b57 | 3384 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3385 | } |
nikapov | 0:704c89673b57 | 3386 | |
nikapov | 0:704c89673b57 | 3387 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3388 | * Function Name : LSM6DSL_ACC_GYRO_W_LOW_PASS_ON_6D |
nikapov | 0:704c89673b57 | 3389 | * Description : Write LOW_PASS_ON_6D |
nikapov | 0:704c89673b57 | 3390 | * Input : LSM6DSL_ACC_GYRO_LOW_PASS_ON_6D_t |
nikapov | 0:704c89673b57 | 3391 | * Output : None |
nikapov | 0:704c89673b57 | 3392 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3393 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3394 | mems_status_t LSM6DSL_ACC_GYRO_W_LOW_PASS_ON_6D(void *handle, LSM6DSL_ACC_GYRO_LOW_PASS_ON_6D_t newValue) |
nikapov | 0:704c89673b57 | 3395 | { |
nikapov | 0:704c89673b57 | 3396 | u8_t value; |
nikapov | 0:704c89673b57 | 3397 | |
nikapov | 0:704c89673b57 | 3398 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL8_XL, &value, 1) ) |
nikapov | 0:704c89673b57 | 3399 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3400 | |
nikapov | 0:704c89673b57 | 3401 | value &= ~LSM6DSL_ACC_GYRO_LOW_PASS_ON_6D_MASK; |
nikapov | 0:704c89673b57 | 3402 | value |= newValue; |
nikapov | 0:704c89673b57 | 3403 | |
nikapov | 0:704c89673b57 | 3404 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL8_XL, &value, 1) ) |
nikapov | 0:704c89673b57 | 3405 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3406 | |
nikapov | 0:704c89673b57 | 3407 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3408 | } |
nikapov | 0:704c89673b57 | 3409 | |
nikapov | 0:704c89673b57 | 3410 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3411 | * Function Name : LSM6DSL_ACC_GYRO_R_LOW_PASS_ON_6D |
nikapov | 0:704c89673b57 | 3412 | * Description : Read LOW_PASS_ON_6D |
nikapov | 0:704c89673b57 | 3413 | * Input : Pointer to LSM6DSL_ACC_GYRO_LOW_PASS_ON_6D_t |
nikapov | 0:704c89673b57 | 3414 | * Output : Status of LOW_PASS_ON_6D see LSM6DSL_ACC_GYRO_LOW_PASS_ON_6D_t |
nikapov | 0:704c89673b57 | 3415 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3416 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3417 | mems_status_t LSM6DSL_ACC_GYRO_R_LOW_PASS_ON_6D(void *handle, LSM6DSL_ACC_GYRO_LOW_PASS_ON_6D_t *value) |
nikapov | 0:704c89673b57 | 3418 | { |
nikapov | 0:704c89673b57 | 3419 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL8_XL, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 3420 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3421 | |
nikapov | 0:704c89673b57 | 3422 | *value &= LSM6DSL_ACC_GYRO_LOW_PASS_ON_6D_MASK; //mask |
nikapov | 0:704c89673b57 | 3423 | |
nikapov | 0:704c89673b57 | 3424 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3425 | } |
nikapov | 0:704c89673b57 | 3426 | |
nikapov | 0:704c89673b57 | 3427 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3428 | * Function Name : LSM6DSL_ACC_GYRO_W_HP_SLOPE_XL |
nikapov | 0:704c89673b57 | 3429 | * Description : Write HP_SLOPE_XL_EN |
nikapov | 0:704c89673b57 | 3430 | * Input : LSM6DSL_ACC_GYRO_HP_SLOPE_XL_t |
nikapov | 0:704c89673b57 | 3431 | * Output : None |
nikapov | 0:704c89673b57 | 3432 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3433 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3434 | mems_status_t LSM6DSL_ACC_GYRO_W_HP_SLOPE_XL(void *handle, LSM6DSL_ACC_GYRO_HP_SLOPE_XL_t newValue) |
nikapov | 0:704c89673b57 | 3435 | { |
nikapov | 0:704c89673b57 | 3436 | u8_t value; |
nikapov | 0:704c89673b57 | 3437 | |
nikapov | 0:704c89673b57 | 3438 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL8_XL, &value, 1) ) |
nikapov | 0:704c89673b57 | 3439 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3440 | |
nikapov | 0:704c89673b57 | 3441 | value &= ~LSM6DSL_ACC_GYRO_HP_SLOPE_XL_MASK; |
nikapov | 0:704c89673b57 | 3442 | value |= newValue; |
nikapov | 0:704c89673b57 | 3443 | |
nikapov | 0:704c89673b57 | 3444 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL8_XL, &value, 1) ) |
nikapov | 0:704c89673b57 | 3445 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3446 | |
nikapov | 0:704c89673b57 | 3447 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3448 | } |
nikapov | 0:704c89673b57 | 3449 | |
nikapov | 0:704c89673b57 | 3450 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3451 | * Function Name : LSM6DSL_ACC_GYRO_R_HP_SLOPE_XL |
nikapov | 0:704c89673b57 | 3452 | * Description : Read HP_SLOPE_XL_EN |
nikapov | 0:704c89673b57 | 3453 | * Input : Pointer to LSM6DSL_ACC_GYRO_HP_SLOPE_XL_t |
nikapov | 0:704c89673b57 | 3454 | * Output : Status of HP_SLOPE_XL_EN see LSM6DSL_ACC_GYRO_HP_SLOPE_XL_t |
nikapov | 0:704c89673b57 | 3455 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3456 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3457 | mems_status_t LSM6DSL_ACC_GYRO_R_HP_SLOPE_XL(void *handle, LSM6DSL_ACC_GYRO_HP_SLOPE_XL_t *value) |
nikapov | 0:704c89673b57 | 3458 | { |
nikapov | 0:704c89673b57 | 3459 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL8_XL, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 3460 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3461 | |
nikapov | 0:704c89673b57 | 3462 | *value &= LSM6DSL_ACC_GYRO_HP_SLOPE_XL_MASK; //mask |
nikapov | 0:704c89673b57 | 3463 | |
nikapov | 0:704c89673b57 | 3464 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3465 | } |
nikapov | 0:704c89673b57 | 3466 | |
nikapov | 0:704c89673b57 | 3467 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3468 | * Function Name : LSM6DSL_ACC_GYRO_W_SOFT |
nikapov | 0:704c89673b57 | 3469 | * Description : Write SOFT_EN |
nikapov | 0:704c89673b57 | 3470 | * Input : LSM6DSL_ACC_GYRO_SOFT_t |
nikapov | 0:704c89673b57 | 3471 | * Output : None |
nikapov | 0:704c89673b57 | 3472 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3473 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3474 | mems_status_t LSM6DSL_ACC_GYRO_W_SOFT(void *handle, LSM6DSL_ACC_GYRO_SOFT_t newValue) |
nikapov | 0:704c89673b57 | 3475 | { |
nikapov | 0:704c89673b57 | 3476 | u8_t value; |
nikapov | 0:704c89673b57 | 3477 | |
nikapov | 0:704c89673b57 | 3478 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL9_XL, &value, 1) ) |
nikapov | 0:704c89673b57 | 3479 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3480 | |
nikapov | 0:704c89673b57 | 3481 | value &= ~LSM6DSL_ACC_GYRO_SOFT_MASK; |
nikapov | 0:704c89673b57 | 3482 | value |= newValue; |
nikapov | 0:704c89673b57 | 3483 | |
nikapov | 0:704c89673b57 | 3484 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL9_XL, &value, 1) ) |
nikapov | 0:704c89673b57 | 3485 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3486 | |
nikapov | 0:704c89673b57 | 3487 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3488 | } |
nikapov | 0:704c89673b57 | 3489 | |
nikapov | 0:704c89673b57 | 3490 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3491 | * Function Name : LSM6DSL_ACC_GYRO_R_SOFT |
nikapov | 0:704c89673b57 | 3492 | * Description : Read SOFT_EN |
nikapov | 0:704c89673b57 | 3493 | * Input : Pointer to LSM6DSL_ACC_GYRO_SOFT_t |
nikapov | 0:704c89673b57 | 3494 | * Output : Status of SOFT_EN see LSM6DSL_ACC_GYRO_SOFT_t |
nikapov | 0:704c89673b57 | 3495 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3496 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3497 | mems_status_t LSM6DSL_ACC_GYRO_R_SOFT(void *handle, LSM6DSL_ACC_GYRO_SOFT_t *value) |
nikapov | 0:704c89673b57 | 3498 | { |
nikapov | 0:704c89673b57 | 3499 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL9_XL, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 3500 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3501 | |
nikapov | 0:704c89673b57 | 3502 | *value &= LSM6DSL_ACC_GYRO_SOFT_MASK; //mask |
nikapov | 0:704c89673b57 | 3503 | |
nikapov | 0:704c89673b57 | 3504 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3505 | } |
nikapov | 0:704c89673b57 | 3506 | |
nikapov | 0:704c89673b57 | 3507 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3508 | * Function Name : LSM6DSL_ACC_GYRO_W_SignifcantMotion |
nikapov | 0:704c89673b57 | 3509 | * Description : Write SIGN_MOTION_EN |
nikapov | 0:704c89673b57 | 3510 | * Input : LSM6DSL_ACC_GYRO_SIGN_MOTION_EN_t |
nikapov | 0:704c89673b57 | 3511 | * Output : None |
nikapov | 0:704c89673b57 | 3512 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3513 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3514 | mems_status_t LSM6DSL_ACC_GYRO_W_SignifcantMotion(void *handle, LSM6DSL_ACC_GYRO_SIGN_MOTION_EN_t newValue) |
nikapov | 0:704c89673b57 | 3515 | { |
nikapov | 0:704c89673b57 | 3516 | u8_t value; |
nikapov | 0:704c89673b57 | 3517 | |
nikapov | 0:704c89673b57 | 3518 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL10_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 3519 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3520 | |
nikapov | 0:704c89673b57 | 3521 | value &= ~LSM6DSL_ACC_GYRO_SIGN_MOTION_EN_MASK; |
nikapov | 0:704c89673b57 | 3522 | value |= newValue; |
nikapov | 0:704c89673b57 | 3523 | |
nikapov | 0:704c89673b57 | 3524 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL10_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 3525 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3526 | |
nikapov | 0:704c89673b57 | 3527 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3528 | } |
nikapov | 0:704c89673b57 | 3529 | |
nikapov | 0:704c89673b57 | 3530 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3531 | * Function Name : LSM6DSL_ACC_GYRO_R_SignifcantMotion |
nikapov | 0:704c89673b57 | 3532 | * Description : Read SIGN_MOTION_EN |
nikapov | 0:704c89673b57 | 3533 | * Input : Pointer to LSM6DSL_ACC_GYRO_SIGN_MOTION_EN_t |
nikapov | 0:704c89673b57 | 3534 | * Output : Status of SIGN_MOTION_EN see LSM6DSL_ACC_GYRO_SIGN_MOTION_EN_t |
nikapov | 0:704c89673b57 | 3535 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3536 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3537 | mems_status_t LSM6DSL_ACC_GYRO_R_SignifcantMotion(void *handle, LSM6DSL_ACC_GYRO_SIGN_MOTION_EN_t *value) |
nikapov | 0:704c89673b57 | 3538 | { |
nikapov | 0:704c89673b57 | 3539 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL10_C, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 3540 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3541 | |
nikapov | 0:704c89673b57 | 3542 | *value &= LSM6DSL_ACC_GYRO_SIGN_MOTION_EN_MASK; //mask |
nikapov | 0:704c89673b57 | 3543 | |
nikapov | 0:704c89673b57 | 3544 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3545 | } |
nikapov | 0:704c89673b57 | 3546 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3547 | * Function Name : LSM6DSL_ACC_GYRO_W_PedoStepReset |
nikapov | 0:704c89673b57 | 3548 | * Description : Write PEDO_RST_STEP |
nikapov | 0:704c89673b57 | 3549 | * Input : LSM6DSL_ACC_GYRO_PEDO_RST_STEP_t |
nikapov | 0:704c89673b57 | 3550 | * Output : None |
nikapov | 0:704c89673b57 | 3551 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3552 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3553 | mems_status_t LSM6DSL_ACC_GYRO_W_PedoStepReset(void *handle, LSM6DSL_ACC_GYRO_PEDO_RST_STEP_t newValue) |
nikapov | 0:704c89673b57 | 3554 | { |
nikapov | 0:704c89673b57 | 3555 | u8_t value; |
nikapov | 0:704c89673b57 | 3556 | |
nikapov | 0:704c89673b57 | 3557 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL10_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 3558 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3559 | |
nikapov | 0:704c89673b57 | 3560 | value &= ~LSM6DSL_ACC_GYRO_PEDO_RST_STEP_MASK; |
nikapov | 0:704c89673b57 | 3561 | value |= newValue; |
nikapov | 0:704c89673b57 | 3562 | |
nikapov | 0:704c89673b57 | 3563 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL10_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 3564 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3565 | |
nikapov | 0:704c89673b57 | 3566 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3567 | } |
nikapov | 0:704c89673b57 | 3568 | |
nikapov | 0:704c89673b57 | 3569 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3570 | * Function Name : LSM6DSL_ACC_GYRO_R_PedoStepReset |
nikapov | 0:704c89673b57 | 3571 | * Description : Read PEDO_RST_STEP |
nikapov | 0:704c89673b57 | 3572 | * Input : Pointer to LSM6DSL_ACC_GYRO_PEDO_RST_STEP_t |
nikapov | 0:704c89673b57 | 3573 | * Output : Status of PEDO_RST_STEP see LSM6DSL_ACC_GYRO_PEDO_RST_STEP_t |
nikapov | 0:704c89673b57 | 3574 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3575 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3576 | mems_status_t LSM6DSL_ACC_GYRO_R_PedoStepReset(void *handle, LSM6DSL_ACC_GYRO_PEDO_RST_STEP_t *value) |
nikapov | 0:704c89673b57 | 3577 | { |
nikapov | 0:704c89673b57 | 3578 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL10_C, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 3579 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3580 | |
nikapov | 0:704c89673b57 | 3581 | *value &= LSM6DSL_ACC_GYRO_PEDO_RST_STEP_MASK; //mask |
nikapov | 0:704c89673b57 | 3582 | |
nikapov | 0:704c89673b57 | 3583 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3584 | } |
nikapov | 0:704c89673b57 | 3585 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3586 | * Function Name : LSM6DSL_ACC_GYRO_W_TILT |
nikapov | 0:704c89673b57 | 3587 | * Description : Write XEN_G |
nikapov | 0:704c89673b57 | 3588 | * Input : LSM6DSL_ACC_GYRO_TILT_G_t |
nikapov | 0:704c89673b57 | 3589 | * Output : None |
nikapov | 0:704c89673b57 | 3590 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3591 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3592 | mems_status_t LSM6DSL_ACC_GYRO_W_TILT(void *handle, LSM6DSL_ACC_GYRO_TILT_G_t newValue) |
nikapov | 0:704c89673b57 | 3593 | { |
nikapov | 0:704c89673b57 | 3594 | u8_t value; |
nikapov | 0:704c89673b57 | 3595 | |
nikapov | 0:704c89673b57 | 3596 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL10_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 3597 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3598 | |
nikapov | 0:704c89673b57 | 3599 | value &= ~LSM6DSL_ACC_GYRO_TILT_MASK; |
nikapov | 0:704c89673b57 | 3600 | value |= newValue; |
nikapov | 0:704c89673b57 | 3601 | |
nikapov | 0:704c89673b57 | 3602 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL10_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 3603 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3604 | |
nikapov | 0:704c89673b57 | 3605 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3606 | } |
nikapov | 0:704c89673b57 | 3607 | |
nikapov | 0:704c89673b57 | 3608 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3609 | * Function Name : LSM6DSL_ACC_GYRO_R_TILT |
nikapov | 0:704c89673b57 | 3610 | * Description : Read XEN_G |
nikapov | 0:704c89673b57 | 3611 | * Input : Pointer to LSM6DSL_ACC_GYRO_TILT_G_t |
nikapov | 0:704c89673b57 | 3612 | * Output : Status of XEN_G see LSM6DSL_ACC_GYRO_TILT_G_t |
nikapov | 0:704c89673b57 | 3613 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3614 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3615 | mems_status_t LSM6DSL_ACC_GYRO_R_TILT(void *handle, LSM6DSL_ACC_GYRO_TILT_G_t *value) |
nikapov | 0:704c89673b57 | 3616 | { |
nikapov | 0:704c89673b57 | 3617 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL10_C, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 3618 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3619 | |
nikapov | 0:704c89673b57 | 3620 | *value &= LSM6DSL_ACC_GYRO_TILT_MASK; //mask |
nikapov | 0:704c89673b57 | 3621 | |
nikapov | 0:704c89673b57 | 3622 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3623 | } |
nikapov | 0:704c89673b57 | 3624 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3625 | * Function Name : LSM6DSL_ACC_GYRO_W_PEDO |
nikapov | 0:704c89673b57 | 3626 | * Description : Write PEDO_EN |
nikapov | 0:704c89673b57 | 3627 | * Input : LSM6DSL_ACC_GYRO_PEDO_t |
nikapov | 0:704c89673b57 | 3628 | * Output : None |
nikapov | 0:704c89673b57 | 3629 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3630 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3631 | mems_status_t LSM6DSL_ACC_GYRO_W_PEDO(void *handle, LSM6DSL_ACC_GYRO_PEDO_t newValue) |
nikapov | 0:704c89673b57 | 3632 | { |
nikapov | 0:704c89673b57 | 3633 | u8_t value; |
nikapov | 0:704c89673b57 | 3634 | |
nikapov | 0:704c89673b57 | 3635 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL10_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 3636 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3637 | |
nikapov | 0:704c89673b57 | 3638 | value &= ~LSM6DSL_ACC_GYRO_PEDO_MASK; |
nikapov | 0:704c89673b57 | 3639 | value |= newValue; |
nikapov | 0:704c89673b57 | 3640 | |
nikapov | 0:704c89673b57 | 3641 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL10_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 3642 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3643 | |
nikapov | 0:704c89673b57 | 3644 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3645 | } |
nikapov | 0:704c89673b57 | 3646 | |
nikapov | 0:704c89673b57 | 3647 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3648 | * Function Name : LSM6DSL_ACC_GYRO_R_PEDO |
nikapov | 0:704c89673b57 | 3649 | * Description : Read PEDO_EN |
nikapov | 0:704c89673b57 | 3650 | * Input : Pointer to LSM6DSL_ACC_GYRO_PEDO_t |
nikapov | 0:704c89673b57 | 3651 | * Output : Status of PEDO_EN see LSM6DSL_ACC_GYRO_PEDO_t |
nikapov | 0:704c89673b57 | 3652 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3653 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3654 | mems_status_t LSM6DSL_ACC_GYRO_R_PEDO(void *handle, LSM6DSL_ACC_GYRO_PEDO_t *value) |
nikapov | 0:704c89673b57 | 3655 | { |
nikapov | 0:704c89673b57 | 3656 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL10_C, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 3657 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3658 | |
nikapov | 0:704c89673b57 | 3659 | *value &= LSM6DSL_ACC_GYRO_PEDO_MASK; //mask |
nikapov | 0:704c89673b57 | 3660 | |
nikapov | 0:704c89673b57 | 3661 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3662 | } |
nikapov | 0:704c89673b57 | 3663 | |
nikapov | 0:704c89673b57 | 3664 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3665 | * Function Name : LSM6DSL_ACC_GYRO_W_TIMER |
nikapov | 0:704c89673b57 | 3666 | * Description : Write TIMER_EN |
nikapov | 0:704c89673b57 | 3667 | * Input : LSM6DSL_ACC_GYRO_TIMER_t |
nikapov | 0:704c89673b57 | 3668 | * Output : None |
nikapov | 0:704c89673b57 | 3669 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3670 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3671 | mems_status_t LSM6DSL_ACC_GYRO_W_TIMER(void *handle, LSM6DSL_ACC_GYRO_TIMER_t newValue) |
nikapov | 0:704c89673b57 | 3672 | { |
nikapov | 0:704c89673b57 | 3673 | u8_t value; |
nikapov | 0:704c89673b57 | 3674 | |
nikapov | 0:704c89673b57 | 3675 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL10_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 3676 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3677 | |
nikapov | 0:704c89673b57 | 3678 | value &= ~LSM6DSL_ACC_GYRO_TIMER_MASK; |
nikapov | 0:704c89673b57 | 3679 | value |= newValue; |
nikapov | 0:704c89673b57 | 3680 | |
nikapov | 0:704c89673b57 | 3681 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL10_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 3682 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3683 | |
nikapov | 0:704c89673b57 | 3684 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3685 | } |
nikapov | 0:704c89673b57 | 3686 | |
nikapov | 0:704c89673b57 | 3687 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3688 | * Function Name : LSM6DSL_ACC_GYRO_R_TIMER |
nikapov | 0:704c89673b57 | 3689 | * Description : Read TIMER_EN |
nikapov | 0:704c89673b57 | 3690 | * Input : Pointer to LSM6DSL_ACC_GYRO_TIMER_t |
nikapov | 0:704c89673b57 | 3691 | * Output : Status of TIMER_EN see LSM6DSL_ACC_GYRO_TIMER_t |
nikapov | 0:704c89673b57 | 3692 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3693 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3694 | mems_status_t LSM6DSL_ACC_GYRO_R_TIMER(void *handle, LSM6DSL_ACC_GYRO_TIMER_t *value) |
nikapov | 0:704c89673b57 | 3695 | { |
nikapov | 0:704c89673b57 | 3696 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL10_C, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 3697 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3698 | |
nikapov | 0:704c89673b57 | 3699 | *value &= LSM6DSL_ACC_GYRO_TIMER_MASK; //mask |
nikapov | 0:704c89673b57 | 3700 | |
nikapov | 0:704c89673b57 | 3701 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3702 | } |
nikapov | 0:704c89673b57 | 3703 | |
nikapov | 0:704c89673b57 | 3704 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3705 | * Function Name : LSM6DSL_ACC_GYRO_W_FUNC_EN |
nikapov | 0:704c89673b57 | 3706 | * Description : Write FUNC_EN |
nikapov | 0:704c89673b57 | 3707 | * Input : LSM6DSL_ACC_GYRO_FUNC_EN_t |
nikapov | 0:704c89673b57 | 3708 | * Output : None |
nikapov | 0:704c89673b57 | 3709 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3710 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3711 | mems_status_t LSM6DSL_ACC_GYRO_W_FUNC_EN(void *handle, LSM6DSL_ACC_GYRO_FUNC_EN_t newValue) |
nikapov | 0:704c89673b57 | 3712 | { |
nikapov | 0:704c89673b57 | 3713 | u8_t value; |
nikapov | 0:704c89673b57 | 3714 | |
nikapov | 0:704c89673b57 | 3715 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL10_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 3716 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3717 | |
nikapov | 0:704c89673b57 | 3718 | value &= ~LSM6DSL_ACC_GYRO_FUNC_EN_MASK; |
nikapov | 0:704c89673b57 | 3719 | value |= newValue; |
nikapov | 0:704c89673b57 | 3720 | |
nikapov | 0:704c89673b57 | 3721 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CTRL10_C, &value, 1) ) |
nikapov | 0:704c89673b57 | 3722 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3723 | |
nikapov | 0:704c89673b57 | 3724 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3725 | } |
nikapov | 0:704c89673b57 | 3726 | |
nikapov | 0:704c89673b57 | 3727 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3728 | * Function Name : LSM6DSL_ACC_GYRO_R_FUNC_EN |
nikapov | 0:704c89673b57 | 3729 | * Description : Read FUNC_EN |
nikapov | 0:704c89673b57 | 3730 | * Input : Pointer to LSM6DSL_ACC_GYRO_FUNC_EN_t |
nikapov | 0:704c89673b57 | 3731 | * Output : Status of FUNC_EN see LSM6DSL_ACC_GYRO_FUNC_EN_t |
nikapov | 0:704c89673b57 | 3732 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3733 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3734 | mems_status_t LSM6DSL_ACC_GYRO_R_FUNC_EN(void *handle, LSM6DSL_ACC_GYRO_FUNC_EN_t *value) |
nikapov | 0:704c89673b57 | 3735 | { |
nikapov | 0:704c89673b57 | 3736 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CTRL10_C, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 3737 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3738 | |
nikapov | 0:704c89673b57 | 3739 | *value &= LSM6DSL_ACC_GYRO_FUNC_EN_MASK; //mask |
nikapov | 0:704c89673b57 | 3740 | |
nikapov | 0:704c89673b57 | 3741 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3742 | } |
nikapov | 0:704c89673b57 | 3743 | |
nikapov | 0:704c89673b57 | 3744 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3745 | * Function Name : LSM6DSL_ACC_GYRO_W_I2C_MASTER_Enable |
nikapov | 0:704c89673b57 | 3746 | * Description : Write MASTER_ON |
nikapov | 0:704c89673b57 | 3747 | * Input : LSM6DSL_ACC_GYRO_MASTER_ON_t |
nikapov | 0:704c89673b57 | 3748 | * Output : None |
nikapov | 0:704c89673b57 | 3749 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3750 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3751 | mems_status_t LSM6DSL_ACC_GYRO_W_I2C_MASTER_Enable(void *handle, LSM6DSL_ACC_GYRO_MASTER_ON_t newValue) |
nikapov | 0:704c89673b57 | 3752 | { |
nikapov | 0:704c89673b57 | 3753 | u8_t value; |
nikapov | 0:704c89673b57 | 3754 | |
nikapov | 0:704c89673b57 | 3755 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MASTER_CONFIG, &value, 1) ) |
nikapov | 0:704c89673b57 | 3756 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3757 | |
nikapov | 0:704c89673b57 | 3758 | value &= ~LSM6DSL_ACC_GYRO_MASTER_ON_MASK; |
nikapov | 0:704c89673b57 | 3759 | value |= newValue; |
nikapov | 0:704c89673b57 | 3760 | |
nikapov | 0:704c89673b57 | 3761 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_MASTER_CONFIG, &value, 1) ) |
nikapov | 0:704c89673b57 | 3762 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3763 | |
nikapov | 0:704c89673b57 | 3764 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3765 | } |
nikapov | 0:704c89673b57 | 3766 | |
nikapov | 0:704c89673b57 | 3767 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3768 | * Function Name : LSM6DSL_ACC_GYRO_R_I2C_MASTER_Enable |
nikapov | 0:704c89673b57 | 3769 | * Description : Read MASTER_ON |
nikapov | 0:704c89673b57 | 3770 | * Input : Pointer to LSM6DSL_ACC_GYRO_MASTER_ON_t |
nikapov | 0:704c89673b57 | 3771 | * Output : Status of MASTER_ON see LSM6DSL_ACC_GYRO_MASTER_ON_t |
nikapov | 0:704c89673b57 | 3772 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3773 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3774 | mems_status_t LSM6DSL_ACC_GYRO_R_I2C_MASTER_Enable(void *handle, LSM6DSL_ACC_GYRO_MASTER_ON_t *value) |
nikapov | 0:704c89673b57 | 3775 | { |
nikapov | 0:704c89673b57 | 3776 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MASTER_CONFIG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 3777 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3778 | |
nikapov | 0:704c89673b57 | 3779 | *value &= LSM6DSL_ACC_GYRO_MASTER_ON_MASK; //mask |
nikapov | 0:704c89673b57 | 3780 | |
nikapov | 0:704c89673b57 | 3781 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3782 | } |
nikapov | 0:704c89673b57 | 3783 | |
nikapov | 0:704c89673b57 | 3784 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3785 | * Function Name : LSM6DSL_ACC_GYRO_W_IronCorrection_EN |
nikapov | 0:704c89673b57 | 3786 | * Description : Write IRON_EN |
nikapov | 0:704c89673b57 | 3787 | * Input : LSM6DSL_ACC_GYRO_IRON_EN_t |
nikapov | 0:704c89673b57 | 3788 | * Output : None |
nikapov | 0:704c89673b57 | 3789 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3790 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3791 | mems_status_t LSM6DSL_ACC_GYRO_W_IronCorrection_EN(void *handle, LSM6DSL_ACC_GYRO_IRON_EN_t newValue) |
nikapov | 0:704c89673b57 | 3792 | { |
nikapov | 0:704c89673b57 | 3793 | u8_t value; |
nikapov | 0:704c89673b57 | 3794 | |
nikapov | 0:704c89673b57 | 3795 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MASTER_CONFIG, &value, 1) ) |
nikapov | 0:704c89673b57 | 3796 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3797 | |
nikapov | 0:704c89673b57 | 3798 | value &= ~LSM6DSL_ACC_GYRO_IRON_EN_MASK; |
nikapov | 0:704c89673b57 | 3799 | value |= newValue; |
nikapov | 0:704c89673b57 | 3800 | |
nikapov | 0:704c89673b57 | 3801 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_MASTER_CONFIG, &value, 1) ) |
nikapov | 0:704c89673b57 | 3802 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3803 | |
nikapov | 0:704c89673b57 | 3804 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3805 | } |
nikapov | 0:704c89673b57 | 3806 | |
nikapov | 0:704c89673b57 | 3807 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3808 | * Function Name : LSM6DSL_ACC_GYRO_R_IronCorrection_EN |
nikapov | 0:704c89673b57 | 3809 | * Description : Read IRON_EN |
nikapov | 0:704c89673b57 | 3810 | * Input : Pointer to LSM6DSL_ACC_GYRO_IRON_EN_t |
nikapov | 0:704c89673b57 | 3811 | * Output : Status of IRON_EN see LSM6DSL_ACC_GYRO_IRON_EN_t |
nikapov | 0:704c89673b57 | 3812 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3813 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3814 | mems_status_t LSM6DSL_ACC_GYRO_R_IronCorrection_EN(void *handle, LSM6DSL_ACC_GYRO_IRON_EN_t *value) |
nikapov | 0:704c89673b57 | 3815 | { |
nikapov | 0:704c89673b57 | 3816 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MASTER_CONFIG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 3817 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3818 | |
nikapov | 0:704c89673b57 | 3819 | *value &= LSM6DSL_ACC_GYRO_IRON_EN_MASK; //mask |
nikapov | 0:704c89673b57 | 3820 | |
nikapov | 0:704c89673b57 | 3821 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3822 | } |
nikapov | 0:704c89673b57 | 3823 | |
nikapov | 0:704c89673b57 | 3824 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3825 | * Function Name : LSM6DSL_ACC_GYRO_W_PASS_THRU_MODE |
nikapov | 0:704c89673b57 | 3826 | * Description : Write PASS_THRU_MODE |
nikapov | 0:704c89673b57 | 3827 | * Input : LSM6DSL_ACC_GYRO_PASS_THRU_MODE_t |
nikapov | 0:704c89673b57 | 3828 | * Output : None |
nikapov | 0:704c89673b57 | 3829 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3830 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3831 | mems_status_t LSM6DSL_ACC_GYRO_W_PASS_THRU_MODE(void *handle, LSM6DSL_ACC_GYRO_PASS_THRU_MODE_t newValue) |
nikapov | 0:704c89673b57 | 3832 | { |
nikapov | 0:704c89673b57 | 3833 | u8_t value; |
nikapov | 0:704c89673b57 | 3834 | |
nikapov | 0:704c89673b57 | 3835 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MASTER_CONFIG, &value, 1) ) |
nikapov | 0:704c89673b57 | 3836 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3837 | |
nikapov | 0:704c89673b57 | 3838 | value &= ~LSM6DSL_ACC_GYRO_PASS_THRU_MODE_MASK; |
nikapov | 0:704c89673b57 | 3839 | value |= newValue; |
nikapov | 0:704c89673b57 | 3840 | |
nikapov | 0:704c89673b57 | 3841 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_MASTER_CONFIG, &value, 1) ) |
nikapov | 0:704c89673b57 | 3842 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3843 | |
nikapov | 0:704c89673b57 | 3844 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3845 | } |
nikapov | 0:704c89673b57 | 3846 | |
nikapov | 0:704c89673b57 | 3847 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3848 | * Function Name : LSM6DSL_ACC_GYRO_R_PASS_THRU_MODE |
nikapov | 0:704c89673b57 | 3849 | * Description : Read PASS_THRU_MODE |
nikapov | 0:704c89673b57 | 3850 | * Input : Pointer to LSM6DSL_ACC_GYRO_PASS_THRU_MODE_t |
nikapov | 0:704c89673b57 | 3851 | * Output : Status of PASS_THRU_MODE see LSM6DSL_ACC_GYRO_PASS_THRU_MODE_t |
nikapov | 0:704c89673b57 | 3852 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3853 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3854 | mems_status_t LSM6DSL_ACC_GYRO_R_PASS_THRU_MODE(void *handle, LSM6DSL_ACC_GYRO_PASS_THRU_MODE_t *value) |
nikapov | 0:704c89673b57 | 3855 | { |
nikapov | 0:704c89673b57 | 3856 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MASTER_CONFIG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 3857 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3858 | |
nikapov | 0:704c89673b57 | 3859 | *value &= LSM6DSL_ACC_GYRO_PASS_THRU_MODE_MASK; //mask |
nikapov | 0:704c89673b57 | 3860 | |
nikapov | 0:704c89673b57 | 3861 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3862 | } |
nikapov | 0:704c89673b57 | 3863 | |
nikapov | 0:704c89673b57 | 3864 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3865 | * Function Name : LSM6DSL_ACC_GYRO_W_PULL_UP_EN |
nikapov | 0:704c89673b57 | 3866 | * Description : Write PULL_UP_EN |
nikapov | 0:704c89673b57 | 3867 | * Input : LSM6DSL_ACC_GYRO_PULL_UP_EN_t |
nikapov | 0:704c89673b57 | 3868 | * Output : None |
nikapov | 0:704c89673b57 | 3869 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3870 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3871 | mems_status_t LSM6DSL_ACC_GYRO_W_PULL_UP_EN(void *handle, LSM6DSL_ACC_GYRO_PULL_UP_EN_t newValue) |
nikapov | 0:704c89673b57 | 3872 | { |
nikapov | 0:704c89673b57 | 3873 | u8_t value; |
nikapov | 0:704c89673b57 | 3874 | |
nikapov | 0:704c89673b57 | 3875 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MASTER_CONFIG, &value, 1) ) |
nikapov | 0:704c89673b57 | 3876 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3877 | |
nikapov | 0:704c89673b57 | 3878 | value &= ~LSM6DSL_ACC_GYRO_PULL_UP_EN_MASK; |
nikapov | 0:704c89673b57 | 3879 | value |= newValue; |
nikapov | 0:704c89673b57 | 3880 | |
nikapov | 0:704c89673b57 | 3881 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_MASTER_CONFIG, &value, 1) ) |
nikapov | 0:704c89673b57 | 3882 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3883 | |
nikapov | 0:704c89673b57 | 3884 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3885 | } |
nikapov | 0:704c89673b57 | 3886 | |
nikapov | 0:704c89673b57 | 3887 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3888 | * Function Name : LSM6DSL_ACC_GYRO_R_PULL_UP_EN |
nikapov | 0:704c89673b57 | 3889 | * Description : Read PULL_UP_EN |
nikapov | 0:704c89673b57 | 3890 | * Input : Pointer to LSM6DSL_ACC_GYRO_PULL_UP_EN_t |
nikapov | 0:704c89673b57 | 3891 | * Output : Status of PULL_UP_EN see LSM6DSL_ACC_GYRO_PULL_UP_EN_t |
nikapov | 0:704c89673b57 | 3892 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3893 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3894 | mems_status_t LSM6DSL_ACC_GYRO_R_PULL_UP_EN(void *handle, LSM6DSL_ACC_GYRO_PULL_UP_EN_t *value) |
nikapov | 0:704c89673b57 | 3895 | { |
nikapov | 0:704c89673b57 | 3896 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MASTER_CONFIG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 3897 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3898 | |
nikapov | 0:704c89673b57 | 3899 | *value &= LSM6DSL_ACC_GYRO_PULL_UP_EN_MASK; //mask |
nikapov | 0:704c89673b57 | 3900 | |
nikapov | 0:704c89673b57 | 3901 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3902 | } |
nikapov | 0:704c89673b57 | 3903 | |
nikapov | 0:704c89673b57 | 3904 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3905 | * Function Name : LSM6DSL_ACC_GYRO_W_SensorHUB_Trigger_Sel |
nikapov | 0:704c89673b57 | 3906 | * Description : Write START_CONFIG |
nikapov | 0:704c89673b57 | 3907 | * Input : LSM6DSL_ACC_GYRO_START_CONFIG_t |
nikapov | 0:704c89673b57 | 3908 | * Output : None |
nikapov | 0:704c89673b57 | 3909 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3910 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3911 | mems_status_t LSM6DSL_ACC_GYRO_W_SensorHUB_Trigger_Sel(void *handle, LSM6DSL_ACC_GYRO_START_CONFIG_t newValue) |
nikapov | 0:704c89673b57 | 3912 | { |
nikapov | 0:704c89673b57 | 3913 | u8_t value; |
nikapov | 0:704c89673b57 | 3914 | |
nikapov | 0:704c89673b57 | 3915 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MASTER_CONFIG, &value, 1) ) |
nikapov | 0:704c89673b57 | 3916 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3917 | |
nikapov | 0:704c89673b57 | 3918 | value &= ~LSM6DSL_ACC_GYRO_START_CONFIG_MASK; |
nikapov | 0:704c89673b57 | 3919 | value |= newValue; |
nikapov | 0:704c89673b57 | 3920 | |
nikapov | 0:704c89673b57 | 3921 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_MASTER_CONFIG, &value, 1) ) |
nikapov | 0:704c89673b57 | 3922 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3923 | |
nikapov | 0:704c89673b57 | 3924 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3925 | } |
nikapov | 0:704c89673b57 | 3926 | |
nikapov | 0:704c89673b57 | 3927 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3928 | * Function Name : LSM6DSL_ACC_GYRO_R_SensorHUB_Trigger_Sel |
nikapov | 0:704c89673b57 | 3929 | * Description : Read START_CONFIG |
nikapov | 0:704c89673b57 | 3930 | * Input : Pointer to LSM6DSL_ACC_GYRO_START_CONFIG_t |
nikapov | 0:704c89673b57 | 3931 | * Output : Status of START_CONFIG see LSM6DSL_ACC_GYRO_START_CONFIG_t |
nikapov | 0:704c89673b57 | 3932 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3933 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3934 | mems_status_t LSM6DSL_ACC_GYRO_R_SensorHUB_Trigger_Sel(void *handle, LSM6DSL_ACC_GYRO_START_CONFIG_t *value) |
nikapov | 0:704c89673b57 | 3935 | { |
nikapov | 0:704c89673b57 | 3936 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MASTER_CONFIG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 3937 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3938 | |
nikapov | 0:704c89673b57 | 3939 | *value &= LSM6DSL_ACC_GYRO_START_CONFIG_MASK; //mask |
nikapov | 0:704c89673b57 | 3940 | |
nikapov | 0:704c89673b57 | 3941 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3942 | } |
nikapov | 0:704c89673b57 | 3943 | |
nikapov | 0:704c89673b57 | 3944 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3945 | * Function Name : LSM6DSL_ACC_GYRO_W_DATA_VAL_SEL_FIFO |
nikapov | 0:704c89673b57 | 3946 | * Description : Write DATA_VAL_SEL_FIFO |
nikapov | 0:704c89673b57 | 3947 | * Input : LSM6DSL_ACC_GYRO_DATA_VAL_SEL_FIFO_t |
nikapov | 0:704c89673b57 | 3948 | * Output : None |
nikapov | 0:704c89673b57 | 3949 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3950 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3951 | mems_status_t LSM6DSL_ACC_GYRO_W_DATA_VAL_SEL_FIFO(void *handle, LSM6DSL_ACC_GYRO_DATA_VAL_SEL_FIFO_t newValue) |
nikapov | 0:704c89673b57 | 3952 | { |
nikapov | 0:704c89673b57 | 3953 | u8_t value; |
nikapov | 0:704c89673b57 | 3954 | |
nikapov | 0:704c89673b57 | 3955 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MASTER_CONFIG, &value, 1) ) |
nikapov | 0:704c89673b57 | 3956 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3957 | |
nikapov | 0:704c89673b57 | 3958 | value &= ~LSM6DSL_ACC_GYRO_DATA_VAL_SEL_FIFO_MASK; |
nikapov | 0:704c89673b57 | 3959 | value |= newValue; |
nikapov | 0:704c89673b57 | 3960 | |
nikapov | 0:704c89673b57 | 3961 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_MASTER_CONFIG, &value, 1) ) |
nikapov | 0:704c89673b57 | 3962 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3963 | |
nikapov | 0:704c89673b57 | 3964 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3965 | } |
nikapov | 0:704c89673b57 | 3966 | |
nikapov | 0:704c89673b57 | 3967 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3968 | * Function Name : LSM6DSL_ACC_GYRO_R_DATA_VAL_SEL_FIFO |
nikapov | 0:704c89673b57 | 3969 | * Description : Read DATA_VAL_SEL_FIFO |
nikapov | 0:704c89673b57 | 3970 | * Input : Pointer to LSM6DSL_ACC_GYRO_DATA_VAL_SEL_FIFO_t |
nikapov | 0:704c89673b57 | 3971 | * Output : Status of DATA_VAL_SEL_FIFO see LSM6DSL_ACC_GYRO_DATA_VAL_SEL_FIFO_t |
nikapov | 0:704c89673b57 | 3972 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3973 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3974 | mems_status_t LSM6DSL_ACC_GYRO_R_DATA_VAL_SEL_FIFO(void *handle, LSM6DSL_ACC_GYRO_DATA_VAL_SEL_FIFO_t *value) |
nikapov | 0:704c89673b57 | 3975 | { |
nikapov | 0:704c89673b57 | 3976 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MASTER_CONFIG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 3977 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3978 | |
nikapov | 0:704c89673b57 | 3979 | *value &= LSM6DSL_ACC_GYRO_DATA_VAL_SEL_FIFO_MASK; //mask |
nikapov | 0:704c89673b57 | 3980 | |
nikapov | 0:704c89673b57 | 3981 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 3982 | } |
nikapov | 0:704c89673b57 | 3983 | |
nikapov | 0:704c89673b57 | 3984 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 3985 | * Function Name : LSM6DSL_ACC_GYRO_W_DRDY_ON_INT1 |
nikapov | 0:704c89673b57 | 3986 | * Description : Write DRDY_ON_INT1 |
nikapov | 0:704c89673b57 | 3987 | * Input : LSM6DSL_ACC_GYRO_DRDY_ON_INT1_t |
nikapov | 0:704c89673b57 | 3988 | * Output : None |
nikapov | 0:704c89673b57 | 3989 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 3990 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 3991 | mems_status_t LSM6DSL_ACC_GYRO_W_DRDY_ON_INT1(void *handle, LSM6DSL_ACC_GYRO_DRDY_ON_INT1_t newValue) |
nikapov | 0:704c89673b57 | 3992 | { |
nikapov | 0:704c89673b57 | 3993 | u8_t value; |
nikapov | 0:704c89673b57 | 3994 | |
nikapov | 0:704c89673b57 | 3995 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MASTER_CONFIG, &value, 1) ) |
nikapov | 0:704c89673b57 | 3996 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 3997 | |
nikapov | 0:704c89673b57 | 3998 | value &= ~LSM6DSL_ACC_GYRO_DRDY_ON_INT1_MASK; |
nikapov | 0:704c89673b57 | 3999 | value |= newValue; |
nikapov | 0:704c89673b57 | 4000 | |
nikapov | 0:704c89673b57 | 4001 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_MASTER_CONFIG, &value, 1) ) |
nikapov | 0:704c89673b57 | 4002 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4003 | |
nikapov | 0:704c89673b57 | 4004 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4005 | } |
nikapov | 0:704c89673b57 | 4006 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4007 | * Function Name : LSM6DSL_ACC_GYRO_R_DRDY_ON_INT1 |
nikapov | 0:704c89673b57 | 4008 | * Description : Read DRDY_ON_INT1 |
nikapov | 0:704c89673b57 | 4009 | * Input : Pointer to LSM6DSL_ACC_GYRO_DRDY_ON_INT1_t |
nikapov | 0:704c89673b57 | 4010 | * Output : Status of DRDY_ON_INT1 see LSM6DSL_ACC_GYRO_DRDY_ON_INT1_t |
nikapov | 0:704c89673b57 | 4011 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4012 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4013 | mems_status_t LSM6DSL_ACC_GYRO_R_DRDY_ON_INT1(void *handle, LSM6DSL_ACC_GYRO_DRDY_ON_INT1_t *value) |
nikapov | 0:704c89673b57 | 4014 | { |
nikapov | 0:704c89673b57 | 4015 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MASTER_CONFIG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4016 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4017 | |
nikapov | 0:704c89673b57 | 4018 | *value &= LSM6DSL_ACC_GYRO_DRDY_ON_INT1_MASK; //mask |
nikapov | 0:704c89673b57 | 4019 | |
nikapov | 0:704c89673b57 | 4020 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4021 | } |
nikapov | 0:704c89673b57 | 4022 | |
nikapov | 0:704c89673b57 | 4023 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4024 | * Function Name : LSM6DSL_ACC_GYRO_R_Z_WU |
nikapov | 0:704c89673b57 | 4025 | * Description : Read Z_WU |
nikapov | 0:704c89673b57 | 4026 | * Input : Pointer to LSM6DSL_ACC_GYRO_Z_WU_t |
nikapov | 0:704c89673b57 | 4027 | * Output : Status of Z_WU see LSM6DSL_ACC_GYRO_Z_WU_t |
nikapov | 0:704c89673b57 | 4028 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4029 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4030 | mems_status_t LSM6DSL_ACC_GYRO_R_Z_WU(void *handle, LSM6DSL_ACC_GYRO_Z_WU_t *value) |
nikapov | 0:704c89673b57 | 4031 | { |
nikapov | 0:704c89673b57 | 4032 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_WAKE_UP_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4033 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4034 | |
nikapov | 0:704c89673b57 | 4035 | *value &= LSM6DSL_ACC_GYRO_Z_WU_MASK; //mask |
nikapov | 0:704c89673b57 | 4036 | |
nikapov | 0:704c89673b57 | 4037 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4038 | } |
nikapov | 0:704c89673b57 | 4039 | |
nikapov | 0:704c89673b57 | 4040 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4041 | * Function Name : LSM6DSL_ACC_GYRO_R_Y_WU |
nikapov | 0:704c89673b57 | 4042 | * Description : Read Y_WU |
nikapov | 0:704c89673b57 | 4043 | * Input : Pointer to LSM6DSL_ACC_GYRO_Y_WU_t |
nikapov | 0:704c89673b57 | 4044 | * Output : Status of Y_WU see LSM6DSL_ACC_GYRO_Y_WU_t |
nikapov | 0:704c89673b57 | 4045 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4046 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4047 | mems_status_t LSM6DSL_ACC_GYRO_R_Y_WU(void *handle, LSM6DSL_ACC_GYRO_Y_WU_t *value) |
nikapov | 0:704c89673b57 | 4048 | { |
nikapov | 0:704c89673b57 | 4049 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_WAKE_UP_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4050 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4051 | |
nikapov | 0:704c89673b57 | 4052 | *value &= LSM6DSL_ACC_GYRO_Y_WU_MASK; //mask |
nikapov | 0:704c89673b57 | 4053 | |
nikapov | 0:704c89673b57 | 4054 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4055 | } |
nikapov | 0:704c89673b57 | 4056 | |
nikapov | 0:704c89673b57 | 4057 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4058 | * Function Name : LSM6DSL_ACC_GYRO_R_X_WU |
nikapov | 0:704c89673b57 | 4059 | * Description : Read X_WU |
nikapov | 0:704c89673b57 | 4060 | * Input : Pointer to LSM6DSL_ACC_GYRO_X_WU_t |
nikapov | 0:704c89673b57 | 4061 | * Output : Status of X_WU see LSM6DSL_ACC_GYRO_X_WU_t |
nikapov | 0:704c89673b57 | 4062 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4063 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4064 | mems_status_t LSM6DSL_ACC_GYRO_R_X_WU(void *handle, LSM6DSL_ACC_GYRO_X_WU_t *value) |
nikapov | 0:704c89673b57 | 4065 | { |
nikapov | 0:704c89673b57 | 4066 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_WAKE_UP_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4067 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4068 | |
nikapov | 0:704c89673b57 | 4069 | *value &= LSM6DSL_ACC_GYRO_X_WU_MASK; //mask |
nikapov | 0:704c89673b57 | 4070 | |
nikapov | 0:704c89673b57 | 4071 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4072 | } |
nikapov | 0:704c89673b57 | 4073 | |
nikapov | 0:704c89673b57 | 4074 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4075 | * Function Name : LSM6DSL_ACC_GYRO_R_WU_EV_STATUS |
nikapov | 0:704c89673b57 | 4076 | * Description : Read WU_EV_STATUS |
nikapov | 0:704c89673b57 | 4077 | * Input : Pointer to LSM6DSL_ACC_GYRO_WU_EV_STATUS_t |
nikapov | 0:704c89673b57 | 4078 | * Output : Status of WU_EV_STATUS see LSM6DSL_ACC_GYRO_WU_EV_STATUS_t |
nikapov | 0:704c89673b57 | 4079 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4080 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4081 | mems_status_t LSM6DSL_ACC_GYRO_R_WU_EV_STATUS(void *handle, LSM6DSL_ACC_GYRO_WU_EV_STATUS_t *value) |
nikapov | 0:704c89673b57 | 4082 | { |
nikapov | 0:704c89673b57 | 4083 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_WAKE_UP_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4084 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4085 | |
nikapov | 0:704c89673b57 | 4086 | *value &= LSM6DSL_ACC_GYRO_WU_EV_STATUS_MASK; //mask |
nikapov | 0:704c89673b57 | 4087 | |
nikapov | 0:704c89673b57 | 4088 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4089 | } |
nikapov | 0:704c89673b57 | 4090 | |
nikapov | 0:704c89673b57 | 4091 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4092 | * Function Name : LSM6DSL_ACC_GYRO_R_SLEEP_EV_STATUS |
nikapov | 0:704c89673b57 | 4093 | * Description : Read SLEEP_EV_STATUS |
nikapov | 0:704c89673b57 | 4094 | * Input : Pointer to LSM6DSL_ACC_GYRO_SLEEP_EV_STATUS_t |
nikapov | 0:704c89673b57 | 4095 | * Output : Status of SLEEP_EV_STATUS see LSM6DSL_ACC_GYRO_SLEEP_EV_STATUS_t |
nikapov | 0:704c89673b57 | 4096 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4097 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4098 | mems_status_t LSM6DSL_ACC_GYRO_R_SLEEP_EV_STATUS(void *handle, LSM6DSL_ACC_GYRO_SLEEP_EV_STATUS_t *value) |
nikapov | 0:704c89673b57 | 4099 | { |
nikapov | 0:704c89673b57 | 4100 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_WAKE_UP_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4101 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4102 | |
nikapov | 0:704c89673b57 | 4103 | *value &= LSM6DSL_ACC_GYRO_SLEEP_EV_STATUS_MASK; //mask |
nikapov | 0:704c89673b57 | 4104 | |
nikapov | 0:704c89673b57 | 4105 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4106 | } |
nikapov | 0:704c89673b57 | 4107 | |
nikapov | 0:704c89673b57 | 4108 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4109 | * Function Name : LSM6DSL_ACC_GYRO_R_FF_EV_STATUS |
nikapov | 0:704c89673b57 | 4110 | * Description : Read FF_EV_STATUS |
nikapov | 0:704c89673b57 | 4111 | * Input : Pointer to LSM6DSL_ACC_GYRO_FF_EV_STATUS_t |
nikapov | 0:704c89673b57 | 4112 | * Output : Status of FF_EV_STATUS see LSM6DSL_ACC_GYRO_FF_EV_STATUS_t |
nikapov | 0:704c89673b57 | 4113 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4114 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4115 | mems_status_t LSM6DSL_ACC_GYRO_R_FF_EV_STATUS(void *handle, LSM6DSL_ACC_GYRO_FF_EV_STATUS_t *value) |
nikapov | 0:704c89673b57 | 4116 | { |
nikapov | 0:704c89673b57 | 4117 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_WAKE_UP_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4118 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4119 | |
nikapov | 0:704c89673b57 | 4120 | *value &= LSM6DSL_ACC_GYRO_FF_EV_STATUS_MASK; //mask |
nikapov | 0:704c89673b57 | 4121 | |
nikapov | 0:704c89673b57 | 4122 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4123 | } |
nikapov | 0:704c89673b57 | 4124 | |
nikapov | 0:704c89673b57 | 4125 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4126 | * Function Name : LSM6DSL_ACC_GYRO_R_Z_TAP |
nikapov | 0:704c89673b57 | 4127 | * Description : Read Z_TAP |
nikapov | 0:704c89673b57 | 4128 | * Input : Pointer to LSM6DSL_ACC_GYRO_Z_TAP_t |
nikapov | 0:704c89673b57 | 4129 | * Output : Status of Z_TAP see LSM6DSL_ACC_GYRO_Z_TAP_t |
nikapov | 0:704c89673b57 | 4130 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4131 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4132 | mems_status_t LSM6DSL_ACC_GYRO_R_Z_TAP(void *handle, LSM6DSL_ACC_GYRO_Z_TAP_t *value) |
nikapov | 0:704c89673b57 | 4133 | { |
nikapov | 0:704c89673b57 | 4134 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4135 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4136 | |
nikapov | 0:704c89673b57 | 4137 | *value &= LSM6DSL_ACC_GYRO_Z_TAP_MASK; //mask |
nikapov | 0:704c89673b57 | 4138 | |
nikapov | 0:704c89673b57 | 4139 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4140 | } |
nikapov | 0:704c89673b57 | 4141 | |
nikapov | 0:704c89673b57 | 4142 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4143 | * Function Name : LSM6DSL_ACC_GYRO_R_Y_TAP |
nikapov | 0:704c89673b57 | 4144 | * Description : Read Y_TAP |
nikapov | 0:704c89673b57 | 4145 | * Input : Pointer to LSM6DSL_ACC_GYRO_Y_TAP_t |
nikapov | 0:704c89673b57 | 4146 | * Output : Status of Y_TAP see LSM6DSL_ACC_GYRO_Y_TAP_t |
nikapov | 0:704c89673b57 | 4147 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4148 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4149 | mems_status_t LSM6DSL_ACC_GYRO_R_Y_TAP(void *handle, LSM6DSL_ACC_GYRO_Y_TAP_t *value) |
nikapov | 0:704c89673b57 | 4150 | { |
nikapov | 0:704c89673b57 | 4151 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4152 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4153 | |
nikapov | 0:704c89673b57 | 4154 | *value &= LSM6DSL_ACC_GYRO_Y_TAP_MASK; //mask |
nikapov | 0:704c89673b57 | 4155 | |
nikapov | 0:704c89673b57 | 4156 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4157 | } |
nikapov | 0:704c89673b57 | 4158 | |
nikapov | 0:704c89673b57 | 4159 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4160 | * Function Name : LSM6DSL_ACC_GYRO_R_X_TAP |
nikapov | 0:704c89673b57 | 4161 | * Description : Read X_TAP |
nikapov | 0:704c89673b57 | 4162 | * Input : Pointer to LSM6DSL_ACC_GYRO_X_TAP_t |
nikapov | 0:704c89673b57 | 4163 | * Output : Status of X_TAP see LSM6DSL_ACC_GYRO_X_TAP_t |
nikapov | 0:704c89673b57 | 4164 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4165 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4166 | mems_status_t LSM6DSL_ACC_GYRO_R_X_TAP(void *handle, LSM6DSL_ACC_GYRO_X_TAP_t *value) |
nikapov | 0:704c89673b57 | 4167 | { |
nikapov | 0:704c89673b57 | 4168 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4169 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4170 | |
nikapov | 0:704c89673b57 | 4171 | *value &= LSM6DSL_ACC_GYRO_X_TAP_MASK; //mask |
nikapov | 0:704c89673b57 | 4172 | |
nikapov | 0:704c89673b57 | 4173 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4174 | } |
nikapov | 0:704c89673b57 | 4175 | |
nikapov | 0:704c89673b57 | 4176 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4177 | * Function Name : LSM6DSL_ACC_GYRO_R_TAP_SIGN |
nikapov | 0:704c89673b57 | 4178 | * Description : Read TAP_SIGN |
nikapov | 0:704c89673b57 | 4179 | * Input : Pointer to LSM6DSL_ACC_GYRO_TAP_SIGN_t |
nikapov | 0:704c89673b57 | 4180 | * Output : Status of TAP_SIGN see LSM6DSL_ACC_GYRO_TAP_SIGN_t |
nikapov | 0:704c89673b57 | 4181 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4182 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4183 | mems_status_t LSM6DSL_ACC_GYRO_R_TAP_SIGN(void *handle, LSM6DSL_ACC_GYRO_TAP_SIGN_t *value) |
nikapov | 0:704c89673b57 | 4184 | { |
nikapov | 0:704c89673b57 | 4185 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4186 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4187 | |
nikapov | 0:704c89673b57 | 4188 | *value &= LSM6DSL_ACC_GYRO_TAP_SIGN_MASK; //mask |
nikapov | 0:704c89673b57 | 4189 | |
nikapov | 0:704c89673b57 | 4190 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4191 | } |
nikapov | 0:704c89673b57 | 4192 | |
nikapov | 0:704c89673b57 | 4193 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4194 | * Function Name : LSM6DSL_ACC_GYRO_R_DOUBLE_TAP_EV_STATUS |
nikapov | 0:704c89673b57 | 4195 | * Description : Read DOUBLE_TAP_EV_STATUS |
nikapov | 0:704c89673b57 | 4196 | * Input : Pointer to LSM6DSL_ACC_GYRO_DOUBLE_TAP_EV_STATUS_t |
nikapov | 0:704c89673b57 | 4197 | * Output : Status of DOUBLE_TAP_EV_STATUS see LSM6DSL_ACC_GYRO_DOUBLE_TAP_EV_STATUS_t |
nikapov | 0:704c89673b57 | 4198 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4199 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4200 | mems_status_t LSM6DSL_ACC_GYRO_R_DOUBLE_TAP_EV_STATUS(void *handle, LSM6DSL_ACC_GYRO_DOUBLE_TAP_EV_STATUS_t *value) |
nikapov | 0:704c89673b57 | 4201 | { |
nikapov | 0:704c89673b57 | 4202 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4203 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4204 | |
nikapov | 0:704c89673b57 | 4205 | *value &= LSM6DSL_ACC_GYRO_DOUBLE_TAP_EV_STATUS_MASK; //mask |
nikapov | 0:704c89673b57 | 4206 | |
nikapov | 0:704c89673b57 | 4207 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4208 | } |
nikapov | 0:704c89673b57 | 4209 | |
nikapov | 0:704c89673b57 | 4210 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4211 | * Function Name : LSM6DSL_ACC_GYRO_R_SINGLE_TAP_EV_STATUS |
nikapov | 0:704c89673b57 | 4212 | * Description : Read SINGLE_TAP_EV_STATUS |
nikapov | 0:704c89673b57 | 4213 | * Input : Pointer to LSM6DSL_ACC_GYRO_SINGLE_TAP_EV_STATUS_t |
nikapov | 0:704c89673b57 | 4214 | * Output : Status of SINGLE_TAP_EV_STATUS see LSM6DSL_ACC_GYRO_SINGLE_TAP_EV_STATUS_t |
nikapov | 0:704c89673b57 | 4215 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4216 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4217 | mems_status_t LSM6DSL_ACC_GYRO_R_SINGLE_TAP_EV_STATUS(void *handle, LSM6DSL_ACC_GYRO_SINGLE_TAP_EV_STATUS_t *value) |
nikapov | 0:704c89673b57 | 4218 | { |
nikapov | 0:704c89673b57 | 4219 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4220 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4221 | |
nikapov | 0:704c89673b57 | 4222 | *value &= LSM6DSL_ACC_GYRO_SINGLE_TAP_EV_STATUS_MASK; //mask |
nikapov | 0:704c89673b57 | 4223 | |
nikapov | 0:704c89673b57 | 4224 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4225 | } |
nikapov | 0:704c89673b57 | 4226 | |
nikapov | 0:704c89673b57 | 4227 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4228 | * Function Name : LSM6DSL_ACC_GYRO_R_TAP_EV_STATUS |
nikapov | 0:704c89673b57 | 4229 | * Description : Read TAP_EV_STATUS |
nikapov | 0:704c89673b57 | 4230 | * Input : Pointer to LSM6DSL_ACC_GYRO_TAP_EV_STATUS_t |
nikapov | 0:704c89673b57 | 4231 | * Output : Status of TAP_EV_STATUS see LSM6DSL_ACC_GYRO_TAP_EV_STATUS_t |
nikapov | 0:704c89673b57 | 4232 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4233 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4234 | mems_status_t LSM6DSL_ACC_GYRO_R_TAP_EV_STATUS(void *handle, LSM6DSL_ACC_GYRO_TAP_EV_STATUS_t *value) |
nikapov | 0:704c89673b57 | 4235 | { |
nikapov | 0:704c89673b57 | 4236 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4237 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4238 | |
nikapov | 0:704c89673b57 | 4239 | *value &= LSM6DSL_ACC_GYRO_TAP_EV_STATUS_MASK; //mask |
nikapov | 0:704c89673b57 | 4240 | |
nikapov | 0:704c89673b57 | 4241 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4242 | } |
nikapov | 0:704c89673b57 | 4243 | |
nikapov | 0:704c89673b57 | 4244 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4245 | * Function Name : LSM6DSL_ACC_GYRO_R_DSD_XL |
nikapov | 0:704c89673b57 | 4246 | * Description : Read DSD_XL |
nikapov | 0:704c89673b57 | 4247 | * Input : Pointer to LSM6DSL_ACC_GYRO_DSD_XL_t |
nikapov | 0:704c89673b57 | 4248 | * Output : Status of DSD_XL see LSM6DSL_ACC_GYRO_DSD_XL_t |
nikapov | 0:704c89673b57 | 4249 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4250 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4251 | mems_status_t LSM6DSL_ACC_GYRO_R_DSD_XL(void *handle, LSM6DSL_ACC_GYRO_DSD_XL_t *value) |
nikapov | 0:704c89673b57 | 4252 | { |
nikapov | 0:704c89673b57 | 4253 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_D6D_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4254 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4255 | |
nikapov | 0:704c89673b57 | 4256 | *value &= LSM6DSL_ACC_GYRO_DSD_XL_MASK; //mask |
nikapov | 0:704c89673b57 | 4257 | |
nikapov | 0:704c89673b57 | 4258 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4259 | } |
nikapov | 0:704c89673b57 | 4260 | |
nikapov | 0:704c89673b57 | 4261 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4262 | * Function Name : LSM6DSL_ACC_GYRO_R_DSD_XH |
nikapov | 0:704c89673b57 | 4263 | * Description : Read DSD_XH |
nikapov | 0:704c89673b57 | 4264 | * Input : Pointer to LSM6DSL_ACC_GYRO_DSD_XH_t |
nikapov | 0:704c89673b57 | 4265 | * Output : Status of DSD_XH see LSM6DSL_ACC_GYRO_DSD_XH_t |
nikapov | 0:704c89673b57 | 4266 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4267 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4268 | mems_status_t LSM6DSL_ACC_GYRO_R_DSD_XH(void *handle, LSM6DSL_ACC_GYRO_DSD_XH_t *value) |
nikapov | 0:704c89673b57 | 4269 | { |
nikapov | 0:704c89673b57 | 4270 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_D6D_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4271 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4272 | |
nikapov | 0:704c89673b57 | 4273 | *value &= LSM6DSL_ACC_GYRO_DSD_XH_MASK; //mask |
nikapov | 0:704c89673b57 | 4274 | |
nikapov | 0:704c89673b57 | 4275 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4276 | } |
nikapov | 0:704c89673b57 | 4277 | |
nikapov | 0:704c89673b57 | 4278 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4279 | * Function Name : LSM6DSL_ACC_GYRO_R_DSD_YL |
nikapov | 0:704c89673b57 | 4280 | * Description : Read DSD_YL |
nikapov | 0:704c89673b57 | 4281 | * Input : Pointer to LSM6DSL_ACC_GYRO_DSD_YL_t |
nikapov | 0:704c89673b57 | 4282 | * Output : Status of DSD_YL see LSM6DSL_ACC_GYRO_DSD_YL_t |
nikapov | 0:704c89673b57 | 4283 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4284 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4285 | mems_status_t LSM6DSL_ACC_GYRO_R_DSD_YL(void *handle, LSM6DSL_ACC_GYRO_DSD_YL_t *value) |
nikapov | 0:704c89673b57 | 4286 | { |
nikapov | 0:704c89673b57 | 4287 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_D6D_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4288 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4289 | |
nikapov | 0:704c89673b57 | 4290 | *value &= LSM6DSL_ACC_GYRO_DSD_YL_MASK; //mask |
nikapov | 0:704c89673b57 | 4291 | |
nikapov | 0:704c89673b57 | 4292 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4293 | } |
nikapov | 0:704c89673b57 | 4294 | |
nikapov | 0:704c89673b57 | 4295 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4296 | * Function Name : LSM6DSL_ACC_GYRO_R_DSD_YH |
nikapov | 0:704c89673b57 | 4297 | * Description : Read DSD_YH |
nikapov | 0:704c89673b57 | 4298 | * Input : Pointer to LSM6DSL_ACC_GYRO_DSD_YH_t |
nikapov | 0:704c89673b57 | 4299 | * Output : Status of DSD_YH see LSM6DSL_ACC_GYRO_DSD_YH_t |
nikapov | 0:704c89673b57 | 4300 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4301 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4302 | mems_status_t LSM6DSL_ACC_GYRO_R_DSD_YH(void *handle, LSM6DSL_ACC_GYRO_DSD_YH_t *value) |
nikapov | 0:704c89673b57 | 4303 | { |
nikapov | 0:704c89673b57 | 4304 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_D6D_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4305 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4306 | |
nikapov | 0:704c89673b57 | 4307 | *value &= LSM6DSL_ACC_GYRO_DSD_YH_MASK; //mask |
nikapov | 0:704c89673b57 | 4308 | |
nikapov | 0:704c89673b57 | 4309 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4310 | } |
nikapov | 0:704c89673b57 | 4311 | |
nikapov | 0:704c89673b57 | 4312 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4313 | * Function Name : LSM6DSL_ACC_GYRO_R_DSD_ZL |
nikapov | 0:704c89673b57 | 4314 | * Description : Read DSD_ZL |
nikapov | 0:704c89673b57 | 4315 | * Input : Pointer to LSM6DSL_ACC_GYRO_DSD_ZL_t |
nikapov | 0:704c89673b57 | 4316 | * Output : Status of DSD_ZL see LSM6DSL_ACC_GYRO_DSD_ZL_t |
nikapov | 0:704c89673b57 | 4317 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4318 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4319 | mems_status_t LSM6DSL_ACC_GYRO_R_DSD_ZL(void *handle, LSM6DSL_ACC_GYRO_DSD_ZL_t *value) |
nikapov | 0:704c89673b57 | 4320 | { |
nikapov | 0:704c89673b57 | 4321 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_D6D_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4322 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4323 | |
nikapov | 0:704c89673b57 | 4324 | *value &= LSM6DSL_ACC_GYRO_DSD_ZL_MASK; //mask |
nikapov | 0:704c89673b57 | 4325 | |
nikapov | 0:704c89673b57 | 4326 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4327 | } |
nikapov | 0:704c89673b57 | 4328 | |
nikapov | 0:704c89673b57 | 4329 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4330 | * Function Name : LSM6DSL_ACC_GYRO_R_DSD_ZH |
nikapov | 0:704c89673b57 | 4331 | * Description : Read DSD_ZH |
nikapov | 0:704c89673b57 | 4332 | * Input : Pointer to LSM6DSL_ACC_GYRO_DSD_ZH_t |
nikapov | 0:704c89673b57 | 4333 | * Output : Status of DSD_ZH see LSM6DSL_ACC_GYRO_DSD_ZH_t |
nikapov | 0:704c89673b57 | 4334 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4335 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4336 | mems_status_t LSM6DSL_ACC_GYRO_R_DSD_ZH(void *handle, LSM6DSL_ACC_GYRO_DSD_ZH_t *value) |
nikapov | 0:704c89673b57 | 4337 | { |
nikapov | 0:704c89673b57 | 4338 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_D6D_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4339 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4340 | |
nikapov | 0:704c89673b57 | 4341 | *value &= LSM6DSL_ACC_GYRO_DSD_ZH_MASK; //mask |
nikapov | 0:704c89673b57 | 4342 | |
nikapov | 0:704c89673b57 | 4343 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4344 | } |
nikapov | 0:704c89673b57 | 4345 | |
nikapov | 0:704c89673b57 | 4346 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4347 | * Function Name : LSM6DSL_ACC_GYRO_R_D6D_EV_STATUS |
nikapov | 0:704c89673b57 | 4348 | * Description : Read D6D_EV_STATUS |
nikapov | 0:704c89673b57 | 4349 | * Input : Pointer to LSM6DSL_ACC_GYRO_D6D_EV_STATUS_t |
nikapov | 0:704c89673b57 | 4350 | * Output : Status of D6D_EV_STATUS see LSM6DSL_ACC_GYRO_D6D_EV_STATUS_t |
nikapov | 0:704c89673b57 | 4351 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4352 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4353 | mems_status_t LSM6DSL_ACC_GYRO_R_D6D_EV_STATUS(void *handle, LSM6DSL_ACC_GYRO_D6D_EV_STATUS_t *value) |
nikapov | 0:704c89673b57 | 4354 | { |
nikapov | 0:704c89673b57 | 4355 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_D6D_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4356 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4357 | |
nikapov | 0:704c89673b57 | 4358 | *value &= LSM6DSL_ACC_GYRO_D6D_EV_STATUS_MASK; //mask |
nikapov | 0:704c89673b57 | 4359 | |
nikapov | 0:704c89673b57 | 4360 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4361 | } |
nikapov | 0:704c89673b57 | 4362 | |
nikapov | 0:704c89673b57 | 4363 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4364 | * Function Name : LSM6DSL_ACC_GYRO_R_XLDA |
nikapov | 0:704c89673b57 | 4365 | * Description : Read XLDA |
nikapov | 0:704c89673b57 | 4366 | * Input : Pointer to LSM6DSL_ACC_GYRO_XLDA_t |
nikapov | 0:704c89673b57 | 4367 | * Output : Status of XLDA see LSM6DSL_ACC_GYRO_XLDA_t |
nikapov | 0:704c89673b57 | 4368 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4369 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4370 | mems_status_t LSM6DSL_ACC_GYRO_R_XLDA(void *handle, LSM6DSL_ACC_GYRO_XLDA_t *value) |
nikapov | 0:704c89673b57 | 4371 | { |
nikapov | 0:704c89673b57 | 4372 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_STATUS_REG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4373 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4374 | |
nikapov | 0:704c89673b57 | 4375 | *value &= LSM6DSL_ACC_GYRO_XLDA_MASK; //mask |
nikapov | 0:704c89673b57 | 4376 | |
nikapov | 0:704c89673b57 | 4377 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4378 | } |
nikapov | 0:704c89673b57 | 4379 | |
nikapov | 0:704c89673b57 | 4380 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4381 | * Function Name : LSM6DSL_ACC_GYRO_R_GDA |
nikapov | 0:704c89673b57 | 4382 | * Description : Read GDA |
nikapov | 0:704c89673b57 | 4383 | * Input : Pointer to LSM6DSL_ACC_GYRO_GDA_t |
nikapov | 0:704c89673b57 | 4384 | * Output : Status of GDA see LSM6DSL_ACC_GYRO_GDA_t |
nikapov | 0:704c89673b57 | 4385 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4386 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4387 | mems_status_t LSM6DSL_ACC_GYRO_R_GDA(void *handle, LSM6DSL_ACC_GYRO_GDA_t *value) |
nikapov | 0:704c89673b57 | 4388 | { |
nikapov | 0:704c89673b57 | 4389 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_STATUS_REG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4390 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4391 | |
nikapov | 0:704c89673b57 | 4392 | *value &= LSM6DSL_ACC_GYRO_GDA_MASK; //mask |
nikapov | 0:704c89673b57 | 4393 | |
nikapov | 0:704c89673b57 | 4394 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4395 | } |
nikapov | 0:704c89673b57 | 4396 | |
nikapov | 0:704c89673b57 | 4397 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4398 | * Function Name : LSM6DSL_ACC_GYRO_R_TDA |
nikapov | 0:704c89673b57 | 4399 | * Description : Read GDA |
nikapov | 0:704c89673b57 | 4400 | * Input : Pointer to LSM6DSL_ACC_GYRO_TDA_t |
nikapov | 0:704c89673b57 | 4401 | * Output : Status of GDA see LSM6DSL_ACC_GYRO_TDA_t |
nikapov | 0:704c89673b57 | 4402 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4403 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4404 | mems_status_t LSM6DSL_ACC_GYRO_R_TDA(void *handle, LSM6DSL_ACC_GYRO_TDA_t *value) |
nikapov | 0:704c89673b57 | 4405 | { |
nikapov | 0:704c89673b57 | 4406 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_STATUS_REG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4407 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4408 | |
nikapov | 0:704c89673b57 | 4409 | *value &= LSM6DSL_ACC_GYRO_TDA_MASK; //mask |
nikapov | 0:704c89673b57 | 4410 | |
nikapov | 0:704c89673b57 | 4411 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4412 | } |
nikapov | 0:704c89673b57 | 4413 | |
nikapov | 0:704c89673b57 | 4414 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4415 | * Function Name : LSM6DSL_ACC_GYRO_R_FIFONumOfEntries |
nikapov | 0:704c89673b57 | 4416 | * Description : Read DIFF_FIFO |
nikapov | 0:704c89673b57 | 4417 | * Input : Pointer to u16_t |
nikapov | 0:704c89673b57 | 4418 | * Output : Status of DIFF_FIFO |
nikapov | 0:704c89673b57 | 4419 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4420 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4421 | mems_status_t LSM6DSL_ACC_GYRO_R_FIFONumOfEntries(void *handle, u16_t *value) |
nikapov | 0:704c89673b57 | 4422 | { |
nikapov | 0:704c89673b57 | 4423 | u8_t valueH, valueL; |
nikapov | 0:704c89673b57 | 4424 | |
nikapov | 0:704c89673b57 | 4425 | /* Low part from FIFO_STATUS1 */ |
nikapov | 0:704c89673b57 | 4426 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_STATUS1, (u8_t *)&valueL, 1) ) |
nikapov | 0:704c89673b57 | 4427 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4428 | |
nikapov | 0:704c89673b57 | 4429 | valueL &= LSM6DSL_ACC_GYRO_DIFF_FIFO_STATUS1_MASK; //coerce |
nikapov | 0:704c89673b57 | 4430 | valueL = valueL >> LSM6DSL_ACC_GYRO_DIFF_FIFO_STATUS1_POSITION; //mask |
nikapov | 0:704c89673b57 | 4431 | |
nikapov | 0:704c89673b57 | 4432 | /* High part from FIFO_STATUS2 */ |
nikapov | 0:704c89673b57 | 4433 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_STATUS2, (u8_t *)&valueH, 1) ) |
nikapov | 0:704c89673b57 | 4434 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4435 | |
nikapov | 0:704c89673b57 | 4436 | valueH &= LSM6DSL_ACC_GYRO_DIFF_FIFO_STATUS2_MASK; //coerce |
nikapov | 0:704c89673b57 | 4437 | valueH = valueH >> LSM6DSL_ACC_GYRO_DIFF_FIFO_STATUS2_POSITION; //mask |
nikapov | 0:704c89673b57 | 4438 | |
nikapov | 0:704c89673b57 | 4439 | *value = ((valueH << 8) & 0xFF00) | valueL; |
nikapov | 0:704c89673b57 | 4440 | |
nikapov | 0:704c89673b57 | 4441 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4442 | } |
nikapov | 0:704c89673b57 | 4443 | |
nikapov | 0:704c89673b57 | 4444 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4445 | * Function Name : LSM6DSL_ACC_GYRO_R_FIFOEmpty |
nikapov | 0:704c89673b57 | 4446 | * Description : Read FIFO_EMPTY |
nikapov | 0:704c89673b57 | 4447 | * Input : Pointer to LSM6DSL_ACC_GYRO_FIFO_EMPTY_t |
nikapov | 0:704c89673b57 | 4448 | * Output : Status of FIFO_EMPTY see LSM6DSL_ACC_GYRO_FIFO_EMPTY_t |
nikapov | 0:704c89673b57 | 4449 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4450 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4451 | mems_status_t LSM6DSL_ACC_GYRO_R_FIFOEmpty(void *handle, LSM6DSL_ACC_GYRO_FIFO_EMPTY_t *value) |
nikapov | 0:704c89673b57 | 4452 | { |
nikapov | 0:704c89673b57 | 4453 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_STATUS2, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4454 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4455 | |
nikapov | 0:704c89673b57 | 4456 | *value &= LSM6DSL_ACC_GYRO_FIFO_EMPTY_MASK; //mask |
nikapov | 0:704c89673b57 | 4457 | |
nikapov | 0:704c89673b57 | 4458 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4459 | } |
nikapov | 0:704c89673b57 | 4460 | |
nikapov | 0:704c89673b57 | 4461 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4462 | * Function Name : LSM6DSL_ACC_GYRO_R_FIFOFull |
nikapov | 0:704c89673b57 | 4463 | * Description : Read FIFO_FULL |
nikapov | 0:704c89673b57 | 4464 | * Input : Pointer to LSM6DSL_ACC_GYRO_FIFO_FULL_t |
nikapov | 0:704c89673b57 | 4465 | * Output : Status of FIFO_FULL see LSM6DSL_ACC_GYRO_FIFO_FULL_t |
nikapov | 0:704c89673b57 | 4466 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4467 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4468 | mems_status_t LSM6DSL_ACC_GYRO_R_FIFOFull(void *handle, LSM6DSL_ACC_GYRO_FIFO_FULL_t *value) |
nikapov | 0:704c89673b57 | 4469 | { |
nikapov | 0:704c89673b57 | 4470 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_STATUS2, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4471 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4472 | |
nikapov | 0:704c89673b57 | 4473 | *value &= LSM6DSL_ACC_GYRO_FIFO_FULL_MASK; //mask |
nikapov | 0:704c89673b57 | 4474 | |
nikapov | 0:704c89673b57 | 4475 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4476 | } |
nikapov | 0:704c89673b57 | 4477 | |
nikapov | 0:704c89673b57 | 4478 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4479 | * Function Name : LSM6DSL_ACC_GYRO_R_OVERRUN |
nikapov | 0:704c89673b57 | 4480 | * Description : Read OVERRUN |
nikapov | 0:704c89673b57 | 4481 | * Input : Pointer to LSM6DSL_ACC_GYRO_OVERRUN_t |
nikapov | 0:704c89673b57 | 4482 | * Output : Status of OVERRUN see LSM6DSL_ACC_GYRO_OVERRUN_t |
nikapov | 0:704c89673b57 | 4483 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4484 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4485 | mems_status_t LSM6DSL_ACC_GYRO_R_OVERRUN(void *handle, LSM6DSL_ACC_GYRO_OVERRUN_t *value) |
nikapov | 0:704c89673b57 | 4486 | { |
nikapov | 0:704c89673b57 | 4487 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_STATUS2, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4488 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4489 | |
nikapov | 0:704c89673b57 | 4490 | *value &= LSM6DSL_ACC_GYRO_OVERRUN_MASK; //mask |
nikapov | 0:704c89673b57 | 4491 | |
nikapov | 0:704c89673b57 | 4492 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4493 | } |
nikapov | 0:704c89673b57 | 4494 | |
nikapov | 0:704c89673b57 | 4495 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4496 | * Function Name : LSM6DSL_ACC_GYRO_R_WaterMark |
nikapov | 0:704c89673b57 | 4497 | * Description : Read WTM |
nikapov | 0:704c89673b57 | 4498 | * Input : Pointer to LSM6DSL_ACC_GYRO_WTM_t |
nikapov | 0:704c89673b57 | 4499 | * Output : Status of WTM see LSM6DSL_ACC_GYRO_WTM_t |
nikapov | 0:704c89673b57 | 4500 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4501 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4502 | mems_status_t LSM6DSL_ACC_GYRO_R_WaterMark(void *handle, LSM6DSL_ACC_GYRO_WTM_t *value) |
nikapov | 0:704c89673b57 | 4503 | { |
nikapov | 0:704c89673b57 | 4504 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_STATUS2, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4505 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4506 | |
nikapov | 0:704c89673b57 | 4507 | *value &= LSM6DSL_ACC_GYRO_WTM_MASK; //mask |
nikapov | 0:704c89673b57 | 4508 | |
nikapov | 0:704c89673b57 | 4509 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4510 | } |
nikapov | 0:704c89673b57 | 4511 | |
nikapov | 0:704c89673b57 | 4512 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4513 | * Function Name : LSM6DSL_ACC_GYRO_R_FIFOPattern |
nikapov | 0:704c89673b57 | 4514 | * Description : Read FIFO_PATTERN |
nikapov | 0:704c89673b57 | 4515 | * Input : Pointer to u16_t |
nikapov | 0:704c89673b57 | 4516 | * Output : Status of FIFO_PATTERN |
nikapov | 0:704c89673b57 | 4517 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4518 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4519 | mems_status_t LSM6DSL_ACC_GYRO_R_FIFOPattern(void *handle, u16_t *value) |
nikapov | 0:704c89673b57 | 4520 | { |
nikapov | 0:704c89673b57 | 4521 | u8_t valueH, valueL; |
nikapov | 0:704c89673b57 | 4522 | |
nikapov | 0:704c89673b57 | 4523 | /* Low part from FIFO_STATUS3 */ |
nikapov | 0:704c89673b57 | 4524 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_STATUS3, (u8_t *)&valueL, 1) ) |
nikapov | 0:704c89673b57 | 4525 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4526 | |
nikapov | 0:704c89673b57 | 4527 | valueL &= LSM6DSL_ACC_GYRO_FIFO_STATUS3_PATTERN_MASK; //coerce |
nikapov | 0:704c89673b57 | 4528 | valueL = valueL >> LSM6DSL_ACC_GYRO_FIFO_STATUS3_PATTERN_POSITION; //mask |
nikapov | 0:704c89673b57 | 4529 | |
nikapov | 0:704c89673b57 | 4530 | /* High part from FIFO_STATUS4 */ |
nikapov | 0:704c89673b57 | 4531 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_STATUS4, (u8_t *)&valueH, 1) ) |
nikapov | 0:704c89673b57 | 4532 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4533 | |
nikapov | 0:704c89673b57 | 4534 | valueH &= LSM6DSL_ACC_GYRO_FIFO_STATUS4_PATTERN_MASK; //coerce |
nikapov | 0:704c89673b57 | 4535 | valueH = valueH >> LSM6DSL_ACC_GYRO_FIFO_STATUS4_PATTERN_POSITION; //mask |
nikapov | 0:704c89673b57 | 4536 | |
nikapov | 0:704c89673b57 | 4537 | *value = ((valueH << 8) & 0xFF00) | valueL; |
nikapov | 0:704c89673b57 | 4538 | |
nikapov | 0:704c89673b57 | 4539 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4540 | } |
nikapov | 0:704c89673b57 | 4541 | |
nikapov | 0:704c89673b57 | 4542 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4543 | * Function Name : LSM6DSL_ACC_GYRO_R_SENS_HUB_END |
nikapov | 0:704c89673b57 | 4544 | * Description : Read SENS_HUB_END |
nikapov | 0:704c89673b57 | 4545 | * Input : Pointer to LSM6DSL_ACC_GYRO_SENS_HUB_END_t |
nikapov | 0:704c89673b57 | 4546 | * Output : Status of SENS_HUB_END see LSM6DSL_ACC_GYRO_SENS_HUB_END_t |
nikapov | 0:704c89673b57 | 4547 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4548 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4549 | mems_status_t LSM6DSL_ACC_GYRO_R_SENS_HUB_END(void *handle, LSM6DSL_ACC_GYRO_SENS_HUB_END_t *value) |
nikapov | 0:704c89673b57 | 4550 | { |
nikapov | 0:704c89673b57 | 4551 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FUNC_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4552 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4553 | |
nikapov | 0:704c89673b57 | 4554 | *value &= LSM6DSL_ACC_GYRO_SENS_HUB_END_MASK; //mask |
nikapov | 0:704c89673b57 | 4555 | |
nikapov | 0:704c89673b57 | 4556 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4557 | } |
nikapov | 0:704c89673b57 | 4558 | |
nikapov | 0:704c89673b57 | 4559 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4560 | * Function Name : LSM6DSL_ACC_GYRO_R_SOFT_IRON_END |
nikapov | 0:704c89673b57 | 4561 | * Description : Read SOFT_IRON_END |
nikapov | 0:704c89673b57 | 4562 | * Input : Pointer to LSM6DSL_ACC_GYRO_SOFT_IRON_END_t |
nikapov | 0:704c89673b57 | 4563 | * Output : Status of SOFT_IRON_END see LSM6DSL_ACC_GYRO_SOFT_IRON_END_t |
nikapov | 0:704c89673b57 | 4564 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4565 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4566 | mems_status_t LSM6DSL_ACC_GYRO_R_SOFT_IRON_END(void *handle, LSM6DSL_ACC_GYRO_SOFT_IRON_END_t *value) |
nikapov | 0:704c89673b57 | 4567 | { |
nikapov | 0:704c89673b57 | 4568 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FUNC_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4569 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4570 | |
nikapov | 0:704c89673b57 | 4571 | *value &= LSM6DSL_ACC_GYRO_SOFT_IRON_END_MASK; //mask |
nikapov | 0:704c89673b57 | 4572 | |
nikapov | 0:704c89673b57 | 4573 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4574 | } |
nikapov | 0:704c89673b57 | 4575 | |
nikapov | 0:704c89673b57 | 4576 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4577 | * Function Name : LSM6DSL_ACC_GYRO_R_HardIron |
nikapov | 0:704c89673b57 | 4578 | * Description : Read HI_FAIL |
nikapov | 0:704c89673b57 | 4579 | * Input : Pointer to LSM6DSL_ACC_GYRO_SOFT_HARD_IRON_STAT_t |
nikapov | 0:704c89673b57 | 4580 | * Output : Status of HI_FAIL see LSM6DSL_ACC_GYRO_SOFT_HARD_IRON_STAT_t |
nikapov | 0:704c89673b57 | 4581 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4582 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4583 | mems_status_t LSM6DSL_ACC_GYRO_R_HardIron(void *handle, LSM6DSL_ACC_GYRO_SOFT_HARD_IRON_STAT_t *value) |
nikapov | 0:704c89673b57 | 4584 | { |
nikapov | 0:704c89673b57 | 4585 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FUNC_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4586 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4587 | |
nikapov | 0:704c89673b57 | 4588 | *value &= LSM6DSL_ACC_GYRO_HARD_IRON_STAT_MASK; //mask |
nikapov | 0:704c89673b57 | 4589 | |
nikapov | 0:704c89673b57 | 4590 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4591 | } |
nikapov | 0:704c89673b57 | 4592 | |
nikapov | 0:704c89673b57 | 4593 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4594 | * Function Name : LSM6DSL_ACC_GYRO_R_STEP_OVERFLOW |
nikapov | 0:704c89673b57 | 4595 | * Description : Read STEP_OVERFLOW |
nikapov | 0:704c89673b57 | 4596 | * Input : Pointer to LSM6DSL_ACC_GYRO_STEP_OVERFLOW_t |
nikapov | 0:704c89673b57 | 4597 | * Output : Status of STEP_OVERFLOW see LSM6DSL_ACC_GYRO_STEP_OVERFLOW_t |
nikapov | 0:704c89673b57 | 4598 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4599 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4600 | mems_status_t LSM6DSL_ACC_GYRO_R_STEP_OVERFLOW(void *handle, LSM6DSL_ACC_GYRO_STEP_OVERFLOW_t *value) |
nikapov | 0:704c89673b57 | 4601 | { |
nikapov | 0:704c89673b57 | 4602 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FUNC_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4603 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4604 | |
nikapov | 0:704c89673b57 | 4605 | *value &= LSM6DSL_ACC_GYRO_STEP_OVERFLOW_MASK; //mask |
nikapov | 0:704c89673b57 | 4606 | |
nikapov | 0:704c89673b57 | 4607 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4608 | } |
nikapov | 0:704c89673b57 | 4609 | |
nikapov | 0:704c89673b57 | 4610 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4611 | * Function Name : LSM6DSL_ACC_GYRO_R_STEP_COUNT_DELTA |
nikapov | 0:704c89673b57 | 4612 | * Description : Read STEP_COUNT_DELTA_IA |
nikapov | 0:704c89673b57 | 4613 | * Input : Pointer to LSM6DSL_ACC_GYRO_STEP_COUNT_DELTA_t |
nikapov | 0:704c89673b57 | 4614 | * Output : Status of STEP_COUNT_DELTA_IA see LSM6DSL_ACC_GYRO_STEP_COUNT_DELTA_t |
nikapov | 0:704c89673b57 | 4615 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4616 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4617 | mems_status_t LSM6DSL_ACC_GYRO_R_STEP_COUNT_DELTA(void *handle, LSM6DSL_ACC_GYRO_STEP_COUNT_DELTA_t *value) |
nikapov | 0:704c89673b57 | 4618 | { |
nikapov | 0:704c89673b57 | 4619 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FUNC_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4620 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4621 | |
nikapov | 0:704c89673b57 | 4622 | *value &= LSM6DSL_ACC_GYRO_STEP_COUNT_DELTA_MASK; //mask |
nikapov | 0:704c89673b57 | 4623 | |
nikapov | 0:704c89673b57 | 4624 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4625 | } |
nikapov | 0:704c89673b57 | 4626 | |
nikapov | 0:704c89673b57 | 4627 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4628 | * Function Name : LSM6DSL_ACC_GYRO_R_PEDO_EV_STATUS |
nikapov | 0:704c89673b57 | 4629 | * Description : Read PEDO_EV_STATUS |
nikapov | 0:704c89673b57 | 4630 | * Input : Pointer to LSM6DSL_ACC_GYRO_PEDO_EV_STATUS_t |
nikapov | 0:704c89673b57 | 4631 | * Output : Status of PEDO_EV_STATUS see LSM6DSL_ACC_GYRO_PEDO_EV_STATUS_t |
nikapov | 0:704c89673b57 | 4632 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4633 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4634 | mems_status_t LSM6DSL_ACC_GYRO_R_PEDO_EV_STATUS(void *handle, LSM6DSL_ACC_GYRO_PEDO_EV_STATUS_t *value) |
nikapov | 0:704c89673b57 | 4635 | { |
nikapov | 0:704c89673b57 | 4636 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FUNC_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4637 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4638 | |
nikapov | 0:704c89673b57 | 4639 | *value &= LSM6DSL_ACC_GYRO_PEDO_EV_STATUS_MASK; //mask |
nikapov | 0:704c89673b57 | 4640 | |
nikapov | 0:704c89673b57 | 4641 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4642 | } |
nikapov | 0:704c89673b57 | 4643 | |
nikapov | 0:704c89673b57 | 4644 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4645 | * Function Name : LSM6DSL_ACC_GYRO_R_TILT_EV_STATUS |
nikapov | 0:704c89673b57 | 4646 | * Description : Read TILT_EV_STATUS |
nikapov | 0:704c89673b57 | 4647 | * Input : Pointer to LSM6DSL_ACC_GYRO_TILT_EV_STATUS_t |
nikapov | 0:704c89673b57 | 4648 | * Output : Status of TILT_EV_STATUS see LSM6DSL_ACC_GYRO_TILT_EV_STATUS_t |
nikapov | 0:704c89673b57 | 4649 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4650 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4651 | mems_status_t LSM6DSL_ACC_GYRO_R_TILT_EV_STATUS(void *handle, LSM6DSL_ACC_GYRO_TILT_EV_STATUS_t *value) |
nikapov | 0:704c89673b57 | 4652 | { |
nikapov | 0:704c89673b57 | 4653 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FUNC_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4654 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4655 | |
nikapov | 0:704c89673b57 | 4656 | *value &= LSM6DSL_ACC_GYRO_TILT_EV_STATUS_MASK; //mask |
nikapov | 0:704c89673b57 | 4657 | |
nikapov | 0:704c89673b57 | 4658 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4659 | } |
nikapov | 0:704c89673b57 | 4660 | |
nikapov | 0:704c89673b57 | 4661 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4662 | * Function Name : LSM6DSL_ACC_GYRO_R_SIGN_MOT_EV_STATUS |
nikapov | 0:704c89673b57 | 4663 | * Description : Read SIGN_MOT_EV_STATUS |
nikapov | 0:704c89673b57 | 4664 | * Input : Pointer to LSM6DSL_ACC_GYRO_SIGN_MOT_EV_STATUS_t |
nikapov | 0:704c89673b57 | 4665 | * Output : Status of SIGN_MOT_EV_STATUS see LSM6DSL_ACC_GYRO_SIGN_MOT_EV_STATUS_t |
nikapov | 0:704c89673b57 | 4666 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4667 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4668 | mems_status_t LSM6DSL_ACC_GYRO_R_SIGN_MOT_EV_STATUS(void *handle, LSM6DSL_ACC_GYRO_SIGN_MOT_EV_STATUS_t *value) |
nikapov | 0:704c89673b57 | 4669 | { |
nikapov | 0:704c89673b57 | 4670 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FUNC_SRC, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4671 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4672 | |
nikapov | 0:704c89673b57 | 4673 | *value &= LSM6DSL_ACC_GYRO_SIGN_MOT_EV_STATUS_MASK; //mask |
nikapov | 0:704c89673b57 | 4674 | |
nikapov | 0:704c89673b57 | 4675 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4676 | } |
nikapov | 0:704c89673b57 | 4677 | |
nikapov | 0:704c89673b57 | 4678 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4679 | * Function Name : LSM6DSL_ACC_GYRO_W_LIR |
nikapov | 0:704c89673b57 | 4680 | * Description : Write LIR |
nikapov | 0:704c89673b57 | 4681 | * Input : LSM6DSL_ACC_GYRO_LIR_t |
nikapov | 0:704c89673b57 | 4682 | * Output : None |
nikapov | 0:704c89673b57 | 4683 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4684 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4685 | mems_status_t LSM6DSL_ACC_GYRO_W_LIR(void *handle, LSM6DSL_ACC_GYRO_LIR_t newValue) |
nikapov | 0:704c89673b57 | 4686 | { |
nikapov | 0:704c89673b57 | 4687 | u8_t value; |
nikapov | 0:704c89673b57 | 4688 | |
nikapov | 0:704c89673b57 | 4689 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_CFG1, &value, 1) ) |
nikapov | 0:704c89673b57 | 4690 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4691 | |
nikapov | 0:704c89673b57 | 4692 | value &= ~LSM6DSL_ACC_GYRO_LIR_MASK; |
nikapov | 0:704c89673b57 | 4693 | value |= newValue; |
nikapov | 0:704c89673b57 | 4694 | |
nikapov | 0:704c89673b57 | 4695 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_TAP_CFG1, &value, 1) ) |
nikapov | 0:704c89673b57 | 4696 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4697 | |
nikapov | 0:704c89673b57 | 4698 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4699 | } |
nikapov | 0:704c89673b57 | 4700 | |
nikapov | 0:704c89673b57 | 4701 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4702 | * Function Name : LSM6DSL_ACC_GYRO_R_LIR |
nikapov | 0:704c89673b57 | 4703 | * Description : Read LIR |
nikapov | 0:704c89673b57 | 4704 | * Input : Pointer to LSM6DSL_ACC_GYRO_LIR_t |
nikapov | 0:704c89673b57 | 4705 | * Output : Status of LIR see LSM6DSL_ACC_GYRO_LIR_t |
nikapov | 0:704c89673b57 | 4706 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4707 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4708 | mems_status_t LSM6DSL_ACC_GYRO_R_LIR(void *handle, LSM6DSL_ACC_GYRO_LIR_t *value) |
nikapov | 0:704c89673b57 | 4709 | { |
nikapov | 0:704c89673b57 | 4710 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_CFG1, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4711 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4712 | |
nikapov | 0:704c89673b57 | 4713 | *value &= LSM6DSL_ACC_GYRO_LIR_MASK; //mask |
nikapov | 0:704c89673b57 | 4714 | |
nikapov | 0:704c89673b57 | 4715 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4716 | } |
nikapov | 0:704c89673b57 | 4717 | |
nikapov | 0:704c89673b57 | 4718 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4719 | * Function Name : LSM6DSL_ACC_GYRO_W_TAP_Z_EN |
nikapov | 0:704c89673b57 | 4720 | * Description : Write TAP_Z_EN |
nikapov | 0:704c89673b57 | 4721 | * Input : LSM6DSL_ACC_GYRO_TAP_Z_EN_t |
nikapov | 0:704c89673b57 | 4722 | * Output : None |
nikapov | 0:704c89673b57 | 4723 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4724 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4725 | mems_status_t LSM6DSL_ACC_GYRO_W_TAP_Z_EN(void *handle, LSM6DSL_ACC_GYRO_TAP_Z_EN_t newValue) |
nikapov | 0:704c89673b57 | 4726 | { |
nikapov | 0:704c89673b57 | 4727 | u8_t value; |
nikapov | 0:704c89673b57 | 4728 | |
nikapov | 0:704c89673b57 | 4729 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_CFG1, &value, 1) ) |
nikapov | 0:704c89673b57 | 4730 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4731 | |
nikapov | 0:704c89673b57 | 4732 | value &= ~LSM6DSL_ACC_GYRO_TAP_Z_EN_MASK; |
nikapov | 0:704c89673b57 | 4733 | value |= newValue; |
nikapov | 0:704c89673b57 | 4734 | |
nikapov | 0:704c89673b57 | 4735 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_TAP_CFG1, &value, 1) ) |
nikapov | 0:704c89673b57 | 4736 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4737 | |
nikapov | 0:704c89673b57 | 4738 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4739 | } |
nikapov | 0:704c89673b57 | 4740 | |
nikapov | 0:704c89673b57 | 4741 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4742 | * Function Name : LSM6DSL_ACC_GYRO_R_TAP_Z_EN |
nikapov | 0:704c89673b57 | 4743 | * Description : Read TAP_Z_EN |
nikapov | 0:704c89673b57 | 4744 | * Input : Pointer to LSM6DSL_ACC_GYRO_TAP_Z_EN_t |
nikapov | 0:704c89673b57 | 4745 | * Output : Status of TAP_Z_EN see LSM6DSL_ACC_GYRO_TAP_Z_EN_t |
nikapov | 0:704c89673b57 | 4746 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4747 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4748 | mems_status_t LSM6DSL_ACC_GYRO_R_TAP_Z_EN(void *handle, LSM6DSL_ACC_GYRO_TAP_Z_EN_t *value) |
nikapov | 0:704c89673b57 | 4749 | { |
nikapov | 0:704c89673b57 | 4750 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_CFG1, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4751 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4752 | |
nikapov | 0:704c89673b57 | 4753 | *value &= LSM6DSL_ACC_GYRO_TAP_Z_EN_MASK; //mask |
nikapov | 0:704c89673b57 | 4754 | |
nikapov | 0:704c89673b57 | 4755 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4756 | } |
nikapov | 0:704c89673b57 | 4757 | |
nikapov | 0:704c89673b57 | 4758 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4759 | * Function Name : LSM6DSL_ACC_GYRO_W_TAP_Y_EN |
nikapov | 0:704c89673b57 | 4760 | * Description : Write TAP_Y_EN |
nikapov | 0:704c89673b57 | 4761 | * Input : LSM6DSL_ACC_GYRO_TAP_Y_EN_t |
nikapov | 0:704c89673b57 | 4762 | * Output : None |
nikapov | 0:704c89673b57 | 4763 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4764 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4765 | mems_status_t LSM6DSL_ACC_GYRO_W_TAP_Y_EN(void *handle, LSM6DSL_ACC_GYRO_TAP_Y_EN_t newValue) |
nikapov | 0:704c89673b57 | 4766 | { |
nikapov | 0:704c89673b57 | 4767 | u8_t value; |
nikapov | 0:704c89673b57 | 4768 | |
nikapov | 0:704c89673b57 | 4769 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_CFG1, &value, 1) ) |
nikapov | 0:704c89673b57 | 4770 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4771 | |
nikapov | 0:704c89673b57 | 4772 | value &= ~LSM6DSL_ACC_GYRO_TAP_Y_EN_MASK; |
nikapov | 0:704c89673b57 | 4773 | value |= newValue; |
nikapov | 0:704c89673b57 | 4774 | |
nikapov | 0:704c89673b57 | 4775 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_TAP_CFG1, &value, 1) ) |
nikapov | 0:704c89673b57 | 4776 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4777 | |
nikapov | 0:704c89673b57 | 4778 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4779 | } |
nikapov | 0:704c89673b57 | 4780 | |
nikapov | 0:704c89673b57 | 4781 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4782 | * Function Name : LSM6DSL_ACC_GYRO_R_TAP_Y_EN |
nikapov | 0:704c89673b57 | 4783 | * Description : Read TAP_Y_EN |
nikapov | 0:704c89673b57 | 4784 | * Input : Pointer to LSM6DSL_ACC_GYRO_TAP_Y_EN_t |
nikapov | 0:704c89673b57 | 4785 | * Output : Status of TAP_Y_EN see LSM6DSL_ACC_GYRO_TAP_Y_EN_t |
nikapov | 0:704c89673b57 | 4786 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4787 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4788 | mems_status_t LSM6DSL_ACC_GYRO_R_TAP_Y_EN(void *handle, LSM6DSL_ACC_GYRO_TAP_Y_EN_t *value) |
nikapov | 0:704c89673b57 | 4789 | { |
nikapov | 0:704c89673b57 | 4790 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_CFG1, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4791 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4792 | |
nikapov | 0:704c89673b57 | 4793 | *value &= LSM6DSL_ACC_GYRO_TAP_Y_EN_MASK; //mask |
nikapov | 0:704c89673b57 | 4794 | |
nikapov | 0:704c89673b57 | 4795 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4796 | } |
nikapov | 0:704c89673b57 | 4797 | |
nikapov | 0:704c89673b57 | 4798 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4799 | * Function Name : LSM6DSL_ACC_GYRO_W_TAP_X_EN |
nikapov | 0:704c89673b57 | 4800 | * Description : Write TAP_X_EN |
nikapov | 0:704c89673b57 | 4801 | * Input : LSM6DSL_ACC_GYRO_TAP_X_EN_t |
nikapov | 0:704c89673b57 | 4802 | * Output : None |
nikapov | 0:704c89673b57 | 4803 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4804 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4805 | mems_status_t LSM6DSL_ACC_GYRO_W_TAP_X_EN(void *handle, LSM6DSL_ACC_GYRO_TAP_X_EN_t newValue) |
nikapov | 0:704c89673b57 | 4806 | { |
nikapov | 0:704c89673b57 | 4807 | u8_t value; |
nikapov | 0:704c89673b57 | 4808 | |
nikapov | 0:704c89673b57 | 4809 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_CFG1, &value, 1) ) |
nikapov | 0:704c89673b57 | 4810 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4811 | |
nikapov | 0:704c89673b57 | 4812 | value &= ~LSM6DSL_ACC_GYRO_TAP_X_EN_MASK; |
nikapov | 0:704c89673b57 | 4813 | value |= newValue; |
nikapov | 0:704c89673b57 | 4814 | |
nikapov | 0:704c89673b57 | 4815 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_TAP_CFG1, &value, 1) ) |
nikapov | 0:704c89673b57 | 4816 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4817 | |
nikapov | 0:704c89673b57 | 4818 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4819 | } |
nikapov | 0:704c89673b57 | 4820 | |
nikapov | 0:704c89673b57 | 4821 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4822 | * Function Name : LSM6DSL_ACC_GYRO_R_TAP_X_EN |
nikapov | 0:704c89673b57 | 4823 | * Description : Read TAP_X_EN |
nikapov | 0:704c89673b57 | 4824 | * Input : Pointer to LSM6DSL_ACC_GYRO_TAP_X_EN_t |
nikapov | 0:704c89673b57 | 4825 | * Output : Status of TAP_X_EN see LSM6DSL_ACC_GYRO_TAP_X_EN_t |
nikapov | 0:704c89673b57 | 4826 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4827 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4828 | mems_status_t LSM6DSL_ACC_GYRO_R_TAP_X_EN(void *handle, LSM6DSL_ACC_GYRO_TAP_X_EN_t *value) |
nikapov | 0:704c89673b57 | 4829 | { |
nikapov | 0:704c89673b57 | 4830 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_CFG1, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4831 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4832 | |
nikapov | 0:704c89673b57 | 4833 | *value &= LSM6DSL_ACC_GYRO_TAP_X_EN_MASK; //mask |
nikapov | 0:704c89673b57 | 4834 | |
nikapov | 0:704c89673b57 | 4835 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4836 | } |
nikapov | 0:704c89673b57 | 4837 | |
nikapov | 0:704c89673b57 | 4838 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4839 | * Function Name : LSM6DSL_ACC_GYRO_W_SLOPE_FDS |
nikapov | 0:704c89673b57 | 4840 | * Description : Write SLOPE_FDS |
nikapov | 0:704c89673b57 | 4841 | * Input : LSM6DSL_ACC_GYRO_SLOPE_FDS_t |
nikapov | 0:704c89673b57 | 4842 | * Output : None |
nikapov | 0:704c89673b57 | 4843 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4844 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4845 | mems_status_t LSM6DSL_ACC_GYRO_W_SLOPE_FDS(void *handle, LSM6DSL_ACC_GYRO_SLOPE_FDS_t newValue) |
nikapov | 0:704c89673b57 | 4846 | { |
nikapov | 0:704c89673b57 | 4847 | u8_t value; |
nikapov | 0:704c89673b57 | 4848 | |
nikapov | 0:704c89673b57 | 4849 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_CFG1, &value, 1) ) |
nikapov | 0:704c89673b57 | 4850 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4851 | |
nikapov | 0:704c89673b57 | 4852 | value &= ~LSM6DSL_ACC_GYRO_SLOPE_FDS_MASK; |
nikapov | 0:704c89673b57 | 4853 | value |= newValue; |
nikapov | 0:704c89673b57 | 4854 | |
nikapov | 0:704c89673b57 | 4855 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_TAP_CFG1, &value, 1) ) |
nikapov | 0:704c89673b57 | 4856 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4857 | |
nikapov | 0:704c89673b57 | 4858 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4859 | } |
nikapov | 0:704c89673b57 | 4860 | |
nikapov | 0:704c89673b57 | 4861 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4862 | * Function Name : LSM6DSL_ACC_GYRO_R_SLOPE_FDS |
nikapov | 0:704c89673b57 | 4863 | * Description : Read SLOPE_FDS |
nikapov | 0:704c89673b57 | 4864 | * Input : Pointer to LSM6DSL_ACC_GYRO_SLOPE_FDS_t |
nikapov | 0:704c89673b57 | 4865 | * Output : Status of SLOPE_FDS see LSM6DSL_ACC_GYRO_SLOPE_FDS_t |
nikapov | 0:704c89673b57 | 4866 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4867 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4868 | mems_status_t LSM6DSL_ACC_GYRO_R_SLOPE_FDS(void *handle, LSM6DSL_ACC_GYRO_SLOPE_FDS_t *value) |
nikapov | 0:704c89673b57 | 4869 | { |
nikapov | 0:704c89673b57 | 4870 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_CFG1, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4871 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4872 | |
nikapov | 0:704c89673b57 | 4873 | *value &= LSM6DSL_ACC_GYRO_SLOPE_FDS_MASK; //mask |
nikapov | 0:704c89673b57 | 4874 | |
nikapov | 0:704c89673b57 | 4875 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4876 | } |
nikapov | 0:704c89673b57 | 4877 | |
nikapov | 0:704c89673b57 | 4878 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4879 | * Function Name : LSM6DSL_ACC_GYRO_W_BASIC_INT |
nikapov | 0:704c89673b57 | 4880 | * Description : Write INTERRUPTS_ENABLE |
nikapov | 0:704c89673b57 | 4881 | * Input : LSM6DSL_ACC_GYRO_INT_EN_t |
nikapov | 0:704c89673b57 | 4882 | * Output : None |
nikapov | 0:704c89673b57 | 4883 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4884 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4885 | mems_status_t LSM6DSL_ACC_GYRO_W_BASIC_INT(void *handle, LSM6DSL_ACC_GYRO_INT_EN_t newValue) |
nikapov | 0:704c89673b57 | 4886 | { |
nikapov | 0:704c89673b57 | 4887 | u8_t value; |
nikapov | 0:704c89673b57 | 4888 | |
nikapov | 0:704c89673b57 | 4889 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_CFG1, &value, 1) ) |
nikapov | 0:704c89673b57 | 4890 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4891 | |
nikapov | 0:704c89673b57 | 4892 | value &= ~LSM6DSL_ACC_GYRO_INT_EN_MASK; |
nikapov | 0:704c89673b57 | 4893 | value |= newValue; |
nikapov | 0:704c89673b57 | 4894 | |
nikapov | 0:704c89673b57 | 4895 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_TAP_CFG1, &value, 1) ) |
nikapov | 0:704c89673b57 | 4896 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4897 | |
nikapov | 0:704c89673b57 | 4898 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4899 | } |
nikapov | 0:704c89673b57 | 4900 | |
nikapov | 0:704c89673b57 | 4901 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4902 | * Function Name : LSM6DSL_ACC_GYRO_R_BASIC_INT |
nikapov | 0:704c89673b57 | 4903 | * Description : Read INTERRUPTS_ENABLE |
nikapov | 0:704c89673b57 | 4904 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT_EN_t |
nikapov | 0:704c89673b57 | 4905 | * Output : Status of INTERRUPTS_ENABLE see LSM6DSL_ACC_GYRO_INT_EN_t |
nikapov | 0:704c89673b57 | 4906 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4907 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4908 | mems_status_t LSM6DSL_ACC_GYRO_R_BASIC_INT(void *handle, LSM6DSL_ACC_GYRO_INT_EN_t *value) |
nikapov | 0:704c89673b57 | 4909 | { |
nikapov | 0:704c89673b57 | 4910 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_CFG1, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4911 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4912 | |
nikapov | 0:704c89673b57 | 4913 | *value &= LSM6DSL_ACC_GYRO_INT_EN_MASK; //mask |
nikapov | 0:704c89673b57 | 4914 | |
nikapov | 0:704c89673b57 | 4915 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4916 | } |
nikapov | 0:704c89673b57 | 4917 | |
nikapov | 0:704c89673b57 | 4918 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4919 | * Function Name : LSM6DSL_ACC_GYRO_W_TAP_THS |
nikapov | 0:704c89673b57 | 4920 | * Description : Write TAP_THS |
nikapov | 0:704c89673b57 | 4921 | * Input : u8_t |
nikapov | 0:704c89673b57 | 4922 | * Output : None |
nikapov | 0:704c89673b57 | 4923 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4924 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4925 | mems_status_t LSM6DSL_ACC_GYRO_W_TAP_THS(void *handle, u8_t newValue) |
nikapov | 0:704c89673b57 | 4926 | { |
nikapov | 0:704c89673b57 | 4927 | u8_t value; |
nikapov | 0:704c89673b57 | 4928 | |
nikapov | 0:704c89673b57 | 4929 | newValue = newValue << LSM6DSL_ACC_GYRO_TAP_THS_POSITION; //mask |
nikapov | 0:704c89673b57 | 4930 | newValue &= LSM6DSL_ACC_GYRO_TAP_THS_MASK; //coerce |
nikapov | 0:704c89673b57 | 4931 | |
nikapov | 0:704c89673b57 | 4932 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_THS_6D, &value, 1) ) |
nikapov | 0:704c89673b57 | 4933 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4934 | |
nikapov | 0:704c89673b57 | 4935 | value &= ~LSM6DSL_ACC_GYRO_TAP_THS_MASK; |
nikapov | 0:704c89673b57 | 4936 | value |= newValue; |
nikapov | 0:704c89673b57 | 4937 | |
nikapov | 0:704c89673b57 | 4938 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_TAP_THS_6D, &value, 1) ) |
nikapov | 0:704c89673b57 | 4939 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4940 | |
nikapov | 0:704c89673b57 | 4941 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4942 | } |
nikapov | 0:704c89673b57 | 4943 | |
nikapov | 0:704c89673b57 | 4944 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4945 | * Function Name : LSM6DSL_ACC_GYRO_R_TAP_THS |
nikapov | 0:704c89673b57 | 4946 | * Description : Read TAP_THS |
nikapov | 0:704c89673b57 | 4947 | * Input : Pointer to u8_t |
nikapov | 0:704c89673b57 | 4948 | * Output : Status of TAP_THS |
nikapov | 0:704c89673b57 | 4949 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4950 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4951 | mems_status_t LSM6DSL_ACC_GYRO_R_TAP_THS(void *handle, u8_t *value) |
nikapov | 0:704c89673b57 | 4952 | { |
nikapov | 0:704c89673b57 | 4953 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_THS_6D, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4954 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4955 | |
nikapov | 0:704c89673b57 | 4956 | *value &= LSM6DSL_ACC_GYRO_TAP_THS_MASK; //coerce |
nikapov | 0:704c89673b57 | 4957 | *value = *value >> LSM6DSL_ACC_GYRO_TAP_THS_POSITION; //mask |
nikapov | 0:704c89673b57 | 4958 | |
nikapov | 0:704c89673b57 | 4959 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4960 | } |
nikapov | 0:704c89673b57 | 4961 | |
nikapov | 0:704c89673b57 | 4962 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4963 | * Function Name : LSM6DSL_ACC_GYRO_W_SIXD_THS |
nikapov | 0:704c89673b57 | 4964 | * Description : Write SIXD_THS |
nikapov | 0:704c89673b57 | 4965 | * Input : LSM6DSL_ACC_GYRO_SIXD_THS_t |
nikapov | 0:704c89673b57 | 4966 | * Output : None |
nikapov | 0:704c89673b57 | 4967 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4968 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4969 | mems_status_t LSM6DSL_ACC_GYRO_W_SIXD_THS(void *handle, LSM6DSL_ACC_GYRO_SIXD_THS_t newValue) |
nikapov | 0:704c89673b57 | 4970 | { |
nikapov | 0:704c89673b57 | 4971 | u8_t value; |
nikapov | 0:704c89673b57 | 4972 | |
nikapov | 0:704c89673b57 | 4973 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_THS_6D, &value, 1) ) |
nikapov | 0:704c89673b57 | 4974 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4975 | |
nikapov | 0:704c89673b57 | 4976 | value &= ~LSM6DSL_ACC_GYRO_SIXD_THS_MASK; |
nikapov | 0:704c89673b57 | 4977 | value |= newValue; |
nikapov | 0:704c89673b57 | 4978 | |
nikapov | 0:704c89673b57 | 4979 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_TAP_THS_6D, &value, 1) ) |
nikapov | 0:704c89673b57 | 4980 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4981 | |
nikapov | 0:704c89673b57 | 4982 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 4983 | } |
nikapov | 0:704c89673b57 | 4984 | |
nikapov | 0:704c89673b57 | 4985 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 4986 | * Function Name : LSM6DSL_ACC_GYRO_R_SIXD_THS |
nikapov | 0:704c89673b57 | 4987 | * Description : Read SIXD_THS |
nikapov | 0:704c89673b57 | 4988 | * Input : Pointer to LSM6DSL_ACC_GYRO_SIXD_THS_t |
nikapov | 0:704c89673b57 | 4989 | * Output : Status of SIXD_THS see LSM6DSL_ACC_GYRO_SIXD_THS_t |
nikapov | 0:704c89673b57 | 4990 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 4991 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 4992 | mems_status_t LSM6DSL_ACC_GYRO_R_SIXD_THS(void *handle, LSM6DSL_ACC_GYRO_SIXD_THS_t *value) |
nikapov | 0:704c89673b57 | 4993 | { |
nikapov | 0:704c89673b57 | 4994 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_THS_6D, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 4995 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 4996 | |
nikapov | 0:704c89673b57 | 4997 | *value &= LSM6DSL_ACC_GYRO_SIXD_THS_MASK; //mask |
nikapov | 0:704c89673b57 | 4998 | |
nikapov | 0:704c89673b57 | 4999 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5000 | } |
nikapov | 0:704c89673b57 | 5001 | |
nikapov | 0:704c89673b57 | 5002 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5003 | * Function Name : LSM6DSL_ACC_GYRO_W_D4D |
nikapov | 0:704c89673b57 | 5004 | * Description : Write D4D_EN |
nikapov | 0:704c89673b57 | 5005 | * Input : LSM6DSL_ACC_GYRO_D4D_t |
nikapov | 0:704c89673b57 | 5006 | * Output : None |
nikapov | 0:704c89673b57 | 5007 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5008 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5009 | mems_status_t LSM6DSL_ACC_GYRO_W_D4D(void *handle, LSM6DSL_ACC_GYRO_D4D_t newValue) |
nikapov | 0:704c89673b57 | 5010 | { |
nikapov | 0:704c89673b57 | 5011 | u8_t value; |
nikapov | 0:704c89673b57 | 5012 | |
nikapov | 0:704c89673b57 | 5013 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_THS_6D, &value, 1) ) |
nikapov | 0:704c89673b57 | 5014 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5015 | |
nikapov | 0:704c89673b57 | 5016 | value &= ~LSM6DSL_ACC_GYRO_D4D_MASK; |
nikapov | 0:704c89673b57 | 5017 | value |= newValue; |
nikapov | 0:704c89673b57 | 5018 | |
nikapov | 0:704c89673b57 | 5019 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_TAP_THS_6D, &value, 1) ) |
nikapov | 0:704c89673b57 | 5020 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5021 | |
nikapov | 0:704c89673b57 | 5022 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5023 | } |
nikapov | 0:704c89673b57 | 5024 | |
nikapov | 0:704c89673b57 | 5025 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5026 | * Function Name : LSM6DSL_ACC_GYRO_R_D4D |
nikapov | 0:704c89673b57 | 5027 | * Description : Read D4D_EN |
nikapov | 0:704c89673b57 | 5028 | * Input : Pointer to LSM6DSL_ACC_GYRO_D4D_t |
nikapov | 0:704c89673b57 | 5029 | * Output : Status of D4D_EN see LSM6DSL_ACC_GYRO_D4D_t |
nikapov | 0:704c89673b57 | 5030 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5031 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5032 | mems_status_t LSM6DSL_ACC_GYRO_R_D4D(void *handle, LSM6DSL_ACC_GYRO_D4D_t *value) |
nikapov | 0:704c89673b57 | 5033 | { |
nikapov | 0:704c89673b57 | 5034 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TAP_THS_6D, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 5035 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5036 | |
nikapov | 0:704c89673b57 | 5037 | *value &= LSM6DSL_ACC_GYRO_D4D_MASK; //mask |
nikapov | 0:704c89673b57 | 5038 | |
nikapov | 0:704c89673b57 | 5039 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5040 | } |
nikapov | 0:704c89673b57 | 5041 | |
nikapov | 0:704c89673b57 | 5042 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5043 | * Function Name : LSM6DSL_ACC_GYRO_W_SHOCK_Duration |
nikapov | 0:704c89673b57 | 5044 | * Description : Write SHOCK |
nikapov | 0:704c89673b57 | 5045 | * Input : u8_t |
nikapov | 0:704c89673b57 | 5046 | * Output : None |
nikapov | 0:704c89673b57 | 5047 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5048 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5049 | mems_status_t LSM6DSL_ACC_GYRO_W_SHOCK_Duration(void *handle, u8_t newValue) |
nikapov | 0:704c89673b57 | 5050 | { |
nikapov | 0:704c89673b57 | 5051 | u8_t value; |
nikapov | 0:704c89673b57 | 5052 | |
nikapov | 0:704c89673b57 | 5053 | newValue = newValue << LSM6DSL_ACC_GYRO_SHOCK_POSITION; //mask |
nikapov | 0:704c89673b57 | 5054 | newValue &= LSM6DSL_ACC_GYRO_SHOCK_MASK; //coerce |
nikapov | 0:704c89673b57 | 5055 | |
nikapov | 0:704c89673b57 | 5056 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT_DUR2, &value, 1) ) |
nikapov | 0:704c89673b57 | 5057 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5058 | |
nikapov | 0:704c89673b57 | 5059 | value &= ~LSM6DSL_ACC_GYRO_SHOCK_MASK; |
nikapov | 0:704c89673b57 | 5060 | value |= newValue; |
nikapov | 0:704c89673b57 | 5061 | |
nikapov | 0:704c89673b57 | 5062 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_INT_DUR2, &value, 1) ) |
nikapov | 0:704c89673b57 | 5063 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5064 | |
nikapov | 0:704c89673b57 | 5065 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5066 | } |
nikapov | 0:704c89673b57 | 5067 | |
nikapov | 0:704c89673b57 | 5068 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5069 | * Function Name : LSM6DSL_ACC_GYRO_R_SHOCK_Duration |
nikapov | 0:704c89673b57 | 5070 | * Description : Read SHOCK |
nikapov | 0:704c89673b57 | 5071 | * Input : Pointer to u8_t |
nikapov | 0:704c89673b57 | 5072 | * Output : Status of SHOCK |
nikapov | 0:704c89673b57 | 5073 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5074 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5075 | mems_status_t LSM6DSL_ACC_GYRO_R_SHOCK_Duration(void *handle, u8_t *value) |
nikapov | 0:704c89673b57 | 5076 | { |
nikapov | 0:704c89673b57 | 5077 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT_DUR2, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 5078 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5079 | |
nikapov | 0:704c89673b57 | 5080 | *value &= LSM6DSL_ACC_GYRO_SHOCK_MASK; //coerce |
nikapov | 0:704c89673b57 | 5081 | *value = *value >> LSM6DSL_ACC_GYRO_SHOCK_POSITION; //mask |
nikapov | 0:704c89673b57 | 5082 | |
nikapov | 0:704c89673b57 | 5083 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5084 | } |
nikapov | 0:704c89673b57 | 5085 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5086 | * Function Name : LSM6DSL_ACC_GYRO_W_QUIET_Duration |
nikapov | 0:704c89673b57 | 5087 | * Description : Write QUIET |
nikapov | 0:704c89673b57 | 5088 | * Input : u8_t |
nikapov | 0:704c89673b57 | 5089 | * Output : None |
nikapov | 0:704c89673b57 | 5090 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5091 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5092 | mems_status_t LSM6DSL_ACC_GYRO_W_QUIET_Duration(void *handle, u8_t newValue) |
nikapov | 0:704c89673b57 | 5093 | { |
nikapov | 0:704c89673b57 | 5094 | u8_t value; |
nikapov | 0:704c89673b57 | 5095 | |
nikapov | 0:704c89673b57 | 5096 | newValue = newValue << LSM6DSL_ACC_GYRO_QUIET_POSITION; //mask |
nikapov | 0:704c89673b57 | 5097 | newValue &= LSM6DSL_ACC_GYRO_QUIET_MASK; //coerce |
nikapov | 0:704c89673b57 | 5098 | |
nikapov | 0:704c89673b57 | 5099 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT_DUR2, &value, 1) ) |
nikapov | 0:704c89673b57 | 5100 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5101 | |
nikapov | 0:704c89673b57 | 5102 | value &= ~LSM6DSL_ACC_GYRO_QUIET_MASK; |
nikapov | 0:704c89673b57 | 5103 | value |= newValue; |
nikapov | 0:704c89673b57 | 5104 | |
nikapov | 0:704c89673b57 | 5105 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_INT_DUR2, &value, 1) ) |
nikapov | 0:704c89673b57 | 5106 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5107 | |
nikapov | 0:704c89673b57 | 5108 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5109 | } |
nikapov | 0:704c89673b57 | 5110 | |
nikapov | 0:704c89673b57 | 5111 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5112 | * Function Name : LSM6DSL_ACC_GYRO_R_QUIET_Duration |
nikapov | 0:704c89673b57 | 5113 | * Description : Read QUIET |
nikapov | 0:704c89673b57 | 5114 | * Input : Pointer to u8_t |
nikapov | 0:704c89673b57 | 5115 | * Output : Status of QUIET |
nikapov | 0:704c89673b57 | 5116 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5117 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5118 | mems_status_t LSM6DSL_ACC_GYRO_R_QUIET_Duration(void *handle, u8_t *value) |
nikapov | 0:704c89673b57 | 5119 | { |
nikapov | 0:704c89673b57 | 5120 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT_DUR2, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 5121 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5122 | |
nikapov | 0:704c89673b57 | 5123 | *value &= LSM6DSL_ACC_GYRO_QUIET_MASK; //coerce |
nikapov | 0:704c89673b57 | 5124 | *value = *value >> LSM6DSL_ACC_GYRO_QUIET_POSITION; //mask |
nikapov | 0:704c89673b57 | 5125 | |
nikapov | 0:704c89673b57 | 5126 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5127 | } |
nikapov | 0:704c89673b57 | 5128 | |
nikapov | 0:704c89673b57 | 5129 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5130 | * Function Name : LSM6DSL_ACC_GYRO_W_DUR |
nikapov | 0:704c89673b57 | 5131 | * Description : Write DUR |
nikapov | 0:704c89673b57 | 5132 | * Input : u8_t |
nikapov | 0:704c89673b57 | 5133 | * Output : None |
nikapov | 0:704c89673b57 | 5134 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5135 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5136 | mems_status_t LSM6DSL_ACC_GYRO_W_DUR(void *handle, u8_t newValue) |
nikapov | 0:704c89673b57 | 5137 | { |
nikapov | 0:704c89673b57 | 5138 | u8_t value; |
nikapov | 0:704c89673b57 | 5139 | |
nikapov | 0:704c89673b57 | 5140 | newValue = newValue << LSM6DSL_ACC_GYRO_DUR_POSITION; //mask |
nikapov | 0:704c89673b57 | 5141 | newValue &= LSM6DSL_ACC_GYRO_DUR_MASK; //coerce |
nikapov | 0:704c89673b57 | 5142 | |
nikapov | 0:704c89673b57 | 5143 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT_DUR2, &value, 1) ) |
nikapov | 0:704c89673b57 | 5144 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5145 | |
nikapov | 0:704c89673b57 | 5146 | value &= ~LSM6DSL_ACC_GYRO_DUR_MASK; |
nikapov | 0:704c89673b57 | 5147 | value |= newValue; |
nikapov | 0:704c89673b57 | 5148 | |
nikapov | 0:704c89673b57 | 5149 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_INT_DUR2, &value, 1) ) |
nikapov | 0:704c89673b57 | 5150 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5151 | |
nikapov | 0:704c89673b57 | 5152 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5153 | } |
nikapov | 0:704c89673b57 | 5154 | |
nikapov | 0:704c89673b57 | 5155 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5156 | * Function Name : LSM6DSL_ACC_GYRO_R_DUR |
nikapov | 0:704c89673b57 | 5157 | * Description : Read DUR |
nikapov | 0:704c89673b57 | 5158 | * Input : Pointer to u8_t |
nikapov | 0:704c89673b57 | 5159 | * Output : Status of DUR |
nikapov | 0:704c89673b57 | 5160 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5161 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5162 | mems_status_t LSM6DSL_ACC_GYRO_R_DUR(void *handle, u8_t *value) |
nikapov | 0:704c89673b57 | 5163 | { |
nikapov | 0:704c89673b57 | 5164 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_INT_DUR2, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 5165 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5166 | |
nikapov | 0:704c89673b57 | 5167 | *value &= LSM6DSL_ACC_GYRO_DUR_MASK; //coerce |
nikapov | 0:704c89673b57 | 5168 | *value = *value >> LSM6DSL_ACC_GYRO_DUR_POSITION; //mask |
nikapov | 0:704c89673b57 | 5169 | |
nikapov | 0:704c89673b57 | 5170 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5171 | } |
nikapov | 0:704c89673b57 | 5172 | |
nikapov | 0:704c89673b57 | 5173 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5174 | * Function Name : LSM6DSL_ACC_GYRO_W_WK_THS |
nikapov | 0:704c89673b57 | 5175 | * Description : Write WK_THS |
nikapov | 0:704c89673b57 | 5176 | * Input : u8_t |
nikapov | 0:704c89673b57 | 5177 | * Output : None |
nikapov | 0:704c89673b57 | 5178 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5179 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5180 | mems_status_t LSM6DSL_ACC_GYRO_W_WK_THS(void *handle, u8_t newValue) |
nikapov | 0:704c89673b57 | 5181 | { |
nikapov | 0:704c89673b57 | 5182 | u8_t value; |
nikapov | 0:704c89673b57 | 5183 | |
nikapov | 0:704c89673b57 | 5184 | newValue = newValue << LSM6DSL_ACC_GYRO_WK_THS_POSITION; //mask |
nikapov | 0:704c89673b57 | 5185 | newValue &= LSM6DSL_ACC_GYRO_WK_THS_MASK; //coerce |
nikapov | 0:704c89673b57 | 5186 | |
nikapov | 0:704c89673b57 | 5187 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_WAKE_UP_THS, &value, 1) ) |
nikapov | 0:704c89673b57 | 5188 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5189 | |
nikapov | 0:704c89673b57 | 5190 | value &= ~LSM6DSL_ACC_GYRO_WK_THS_MASK; |
nikapov | 0:704c89673b57 | 5191 | value |= newValue; |
nikapov | 0:704c89673b57 | 5192 | |
nikapov | 0:704c89673b57 | 5193 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_WAKE_UP_THS, &value, 1) ) |
nikapov | 0:704c89673b57 | 5194 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5195 | |
nikapov | 0:704c89673b57 | 5196 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5197 | } |
nikapov | 0:704c89673b57 | 5198 | |
nikapov | 0:704c89673b57 | 5199 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5200 | * Function Name : LSM6DSL_ACC_GYRO_R_WK_THS |
nikapov | 0:704c89673b57 | 5201 | * Description : Read WK_THS |
nikapov | 0:704c89673b57 | 5202 | * Input : Pointer to u8_t |
nikapov | 0:704c89673b57 | 5203 | * Output : Status of WK_THS |
nikapov | 0:704c89673b57 | 5204 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5205 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5206 | mems_status_t LSM6DSL_ACC_GYRO_R_WK_THS(void *handle, u8_t *value) |
nikapov | 0:704c89673b57 | 5207 | { |
nikapov | 0:704c89673b57 | 5208 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_WAKE_UP_THS, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 5209 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5210 | |
nikapov | 0:704c89673b57 | 5211 | *value &= LSM6DSL_ACC_GYRO_WK_THS_MASK; //coerce |
nikapov | 0:704c89673b57 | 5212 | *value = *value >> LSM6DSL_ACC_GYRO_WK_THS_POSITION; //mask |
nikapov | 0:704c89673b57 | 5213 | |
nikapov | 0:704c89673b57 | 5214 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5215 | } |
nikapov | 0:704c89673b57 | 5216 | |
nikapov | 0:704c89673b57 | 5217 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5218 | * Function Name : LSM6DSL_ACC_GYRO_W_SINGLE_DOUBLE_TAP_EV |
nikapov | 0:704c89673b57 | 5219 | * Description : Write SINGLE_DOUBLE_TAP |
nikapov | 0:704c89673b57 | 5220 | * Input : LSM6DSL_ACC_GYRO_SINGLE_DOUBLE_TAP_t |
nikapov | 0:704c89673b57 | 5221 | * Output : None |
nikapov | 0:704c89673b57 | 5222 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5223 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5224 | mems_status_t LSM6DSL_ACC_GYRO_W_SINGLE_DOUBLE_TAP_EV(void *handle, LSM6DSL_ACC_GYRO_SINGLE_DOUBLE_TAP_t newValue) |
nikapov | 0:704c89673b57 | 5225 | { |
nikapov | 0:704c89673b57 | 5226 | u8_t value; |
nikapov | 0:704c89673b57 | 5227 | |
nikapov | 0:704c89673b57 | 5228 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_WAKE_UP_THS, &value, 1) ) |
nikapov | 0:704c89673b57 | 5229 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5230 | |
nikapov | 0:704c89673b57 | 5231 | value &= ~LSM6DSL_ACC_GYRO_SINGLE_DOUBLE_TAP_MASK; |
nikapov | 0:704c89673b57 | 5232 | value |= newValue; |
nikapov | 0:704c89673b57 | 5233 | |
nikapov | 0:704c89673b57 | 5234 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_WAKE_UP_THS, &value, 1) ) |
nikapov | 0:704c89673b57 | 5235 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5236 | |
nikapov | 0:704c89673b57 | 5237 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5238 | } |
nikapov | 0:704c89673b57 | 5239 | |
nikapov | 0:704c89673b57 | 5240 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5241 | * Function Name : LSM6DSL_ACC_GYRO_R_SINGLE_DOUBLE_TAP_EV |
nikapov | 0:704c89673b57 | 5242 | * Description : Read SINGLE_DOUBLE_TAP |
nikapov | 0:704c89673b57 | 5243 | * Input : Pointer to LSM6DSL_ACC_GYRO_SINGLE_DOUBLE_TAP_t |
nikapov | 0:704c89673b57 | 5244 | * Output : Status of SINGLE_DOUBLE_TAP see LSM6DSL_ACC_GYRO_SINGLE_DOUBLE_TAP_t |
nikapov | 0:704c89673b57 | 5245 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5246 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5247 | mems_status_t LSM6DSL_ACC_GYRO_R_SINGLE_DOUBLE_TAP_EV(void *handle, LSM6DSL_ACC_GYRO_SINGLE_DOUBLE_TAP_t *value) |
nikapov | 0:704c89673b57 | 5248 | { |
nikapov | 0:704c89673b57 | 5249 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_WAKE_UP_THS, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 5250 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5251 | |
nikapov | 0:704c89673b57 | 5252 | *value &= LSM6DSL_ACC_GYRO_SINGLE_DOUBLE_TAP_MASK; //mask |
nikapov | 0:704c89673b57 | 5253 | |
nikapov | 0:704c89673b57 | 5254 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5255 | } |
nikapov | 0:704c89673b57 | 5256 | |
nikapov | 0:704c89673b57 | 5257 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5258 | * Function Name : LSM6DSL_ACC_GYRO_W_SLEEP_DUR |
nikapov | 0:704c89673b57 | 5259 | * Description : Write SLEEP_DUR |
nikapov | 0:704c89673b57 | 5260 | * Input : u8_t |
nikapov | 0:704c89673b57 | 5261 | * Output : None |
nikapov | 0:704c89673b57 | 5262 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5263 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5264 | mems_status_t LSM6DSL_ACC_GYRO_W_SLEEP_DUR(void *handle, u8_t newValue) |
nikapov | 0:704c89673b57 | 5265 | { |
nikapov | 0:704c89673b57 | 5266 | u8_t value; |
nikapov | 0:704c89673b57 | 5267 | |
nikapov | 0:704c89673b57 | 5268 | newValue = newValue << LSM6DSL_ACC_GYRO_SLEEP_DUR_POSITION; //mask |
nikapov | 0:704c89673b57 | 5269 | newValue &= LSM6DSL_ACC_GYRO_SLEEP_DUR_MASK; //coerce |
nikapov | 0:704c89673b57 | 5270 | |
nikapov | 0:704c89673b57 | 5271 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_WAKE_UP_DUR, &value, 1) ) |
nikapov | 0:704c89673b57 | 5272 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5273 | |
nikapov | 0:704c89673b57 | 5274 | value &= ~LSM6DSL_ACC_GYRO_SLEEP_DUR_MASK; |
nikapov | 0:704c89673b57 | 5275 | value |= newValue; |
nikapov | 0:704c89673b57 | 5276 | |
nikapov | 0:704c89673b57 | 5277 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_WAKE_UP_DUR, &value, 1) ) |
nikapov | 0:704c89673b57 | 5278 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5279 | |
nikapov | 0:704c89673b57 | 5280 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5281 | } |
nikapov | 0:704c89673b57 | 5282 | |
nikapov | 0:704c89673b57 | 5283 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5284 | * Function Name : LSM6DSL_ACC_GYRO_R_SLEEP_DUR |
nikapov | 0:704c89673b57 | 5285 | * Description : Read SLEEP_DUR |
nikapov | 0:704c89673b57 | 5286 | * Input : Pointer to u8_t |
nikapov | 0:704c89673b57 | 5287 | * Output : Status of SLEEP_DUR |
nikapov | 0:704c89673b57 | 5288 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5289 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5290 | mems_status_t LSM6DSL_ACC_GYRO_R_SLEEP_DUR(void *handle, u8_t *value) |
nikapov | 0:704c89673b57 | 5291 | { |
nikapov | 0:704c89673b57 | 5292 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_WAKE_UP_DUR, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 5293 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5294 | |
nikapov | 0:704c89673b57 | 5295 | *value &= LSM6DSL_ACC_GYRO_SLEEP_DUR_MASK; //coerce |
nikapov | 0:704c89673b57 | 5296 | *value = *value >> LSM6DSL_ACC_GYRO_SLEEP_DUR_POSITION; //mask |
nikapov | 0:704c89673b57 | 5297 | |
nikapov | 0:704c89673b57 | 5298 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5299 | } |
nikapov | 0:704c89673b57 | 5300 | |
nikapov | 0:704c89673b57 | 5301 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5302 | * Function Name : LSM6DSL_ACC_GYRO_W_TIMER_HR |
nikapov | 0:704c89673b57 | 5303 | * Description : Write TIMER_HR |
nikapov | 0:704c89673b57 | 5304 | * Input : LSM6DSL_ACC_GYRO_TIMER_HR_t |
nikapov | 0:704c89673b57 | 5305 | * Output : None |
nikapov | 0:704c89673b57 | 5306 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5307 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5308 | mems_status_t LSM6DSL_ACC_GYRO_W_TIMER_HR(void *handle, LSM6DSL_ACC_GYRO_TIMER_HR_t newValue) |
nikapov | 0:704c89673b57 | 5309 | { |
nikapov | 0:704c89673b57 | 5310 | u8_t value; |
nikapov | 0:704c89673b57 | 5311 | |
nikapov | 0:704c89673b57 | 5312 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_WAKE_UP_DUR, &value, 1) ) |
nikapov | 0:704c89673b57 | 5313 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5314 | |
nikapov | 0:704c89673b57 | 5315 | value &= ~LSM6DSL_ACC_GYRO_TIMER_HR_MASK; |
nikapov | 0:704c89673b57 | 5316 | value |= newValue; |
nikapov | 0:704c89673b57 | 5317 | |
nikapov | 0:704c89673b57 | 5318 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_WAKE_UP_DUR, &value, 1) ) |
nikapov | 0:704c89673b57 | 5319 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5320 | |
nikapov | 0:704c89673b57 | 5321 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5322 | } |
nikapov | 0:704c89673b57 | 5323 | |
nikapov | 0:704c89673b57 | 5324 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5325 | * Function Name : LSM6DSL_ACC_GYRO_R_TIMER_HR |
nikapov | 0:704c89673b57 | 5326 | * Description : Read TIMER_HR |
nikapov | 0:704c89673b57 | 5327 | * Input : Pointer to LSM6DSL_ACC_GYRO_TIMER_HR_t |
nikapov | 0:704c89673b57 | 5328 | * Output : Status of TIMER_HR see LSM6DSL_ACC_GYRO_TIMER_HR_t |
nikapov | 0:704c89673b57 | 5329 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5330 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5331 | mems_status_t LSM6DSL_ACC_GYRO_R_TIMER_HR(void *handle, LSM6DSL_ACC_GYRO_TIMER_HR_t *value) |
nikapov | 0:704c89673b57 | 5332 | { |
nikapov | 0:704c89673b57 | 5333 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_WAKE_UP_DUR, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 5334 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5335 | |
nikapov | 0:704c89673b57 | 5336 | *value &= LSM6DSL_ACC_GYRO_TIMER_HR_MASK; //mask |
nikapov | 0:704c89673b57 | 5337 | |
nikapov | 0:704c89673b57 | 5338 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5339 | } |
nikapov | 0:704c89673b57 | 5340 | |
nikapov | 0:704c89673b57 | 5341 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5342 | * Function Name : LSM6DSL_ACC_GYRO_W_WAKE_DUR |
nikapov | 0:704c89673b57 | 5343 | * Description : Write WAKE_DUR |
nikapov | 0:704c89673b57 | 5344 | * Input : u8_t |
nikapov | 0:704c89673b57 | 5345 | * Output : None |
nikapov | 0:704c89673b57 | 5346 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5347 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5348 | mems_status_t LSM6DSL_ACC_GYRO_W_WAKE_DUR(void *handle, u8_t newValue) |
nikapov | 0:704c89673b57 | 5349 | { |
nikapov | 0:704c89673b57 | 5350 | u8_t value; |
nikapov | 0:704c89673b57 | 5351 | |
nikapov | 0:704c89673b57 | 5352 | newValue = newValue << LSM6DSL_ACC_GYRO_WAKE_DUR_POSITION; //mask |
nikapov | 0:704c89673b57 | 5353 | newValue &= LSM6DSL_ACC_GYRO_WAKE_DUR_MASK; //coerce |
nikapov | 0:704c89673b57 | 5354 | |
nikapov | 0:704c89673b57 | 5355 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_WAKE_UP_DUR, &value, 1) ) |
nikapov | 0:704c89673b57 | 5356 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5357 | |
nikapov | 0:704c89673b57 | 5358 | value &= ~LSM6DSL_ACC_GYRO_WAKE_DUR_MASK; |
nikapov | 0:704c89673b57 | 5359 | value |= newValue; |
nikapov | 0:704c89673b57 | 5360 | |
nikapov | 0:704c89673b57 | 5361 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_WAKE_UP_DUR, &value, 1) ) |
nikapov | 0:704c89673b57 | 5362 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5363 | |
nikapov | 0:704c89673b57 | 5364 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5365 | } |
nikapov | 0:704c89673b57 | 5366 | |
nikapov | 0:704c89673b57 | 5367 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5368 | * Function Name : LSM6DSL_ACC_GYRO_R_WAKE_DUR |
nikapov | 0:704c89673b57 | 5369 | * Description : Read WAKE_DUR |
nikapov | 0:704c89673b57 | 5370 | * Input : Pointer to u8_t |
nikapov | 0:704c89673b57 | 5371 | * Output : Status of WAKE_DUR |
nikapov | 0:704c89673b57 | 5372 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5373 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5374 | mems_status_t LSM6DSL_ACC_GYRO_R_WAKE_DUR(void *handle, u8_t *value) |
nikapov | 0:704c89673b57 | 5375 | { |
nikapov | 0:704c89673b57 | 5376 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_WAKE_UP_DUR, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 5377 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5378 | |
nikapov | 0:704c89673b57 | 5379 | *value &= LSM6DSL_ACC_GYRO_WAKE_DUR_MASK; //coerce |
nikapov | 0:704c89673b57 | 5380 | *value = *value >> LSM6DSL_ACC_GYRO_WAKE_DUR_POSITION; //mask |
nikapov | 0:704c89673b57 | 5381 | |
nikapov | 0:704c89673b57 | 5382 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5383 | } |
nikapov | 0:704c89673b57 | 5384 | |
nikapov | 0:704c89673b57 | 5385 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5386 | * Function Name : LSM6DSL_ACC_GYRO_W_FF_THS |
nikapov | 0:704c89673b57 | 5387 | * Description : Write FF_THS |
nikapov | 0:704c89673b57 | 5388 | * Input : LSM6DSL_ACC_GYRO_FF_THS_t |
nikapov | 0:704c89673b57 | 5389 | * Output : None |
nikapov | 0:704c89673b57 | 5390 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5391 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5392 | mems_status_t LSM6DSL_ACC_GYRO_W_FF_THS(void *handle, LSM6DSL_ACC_GYRO_FF_THS_t newValue) |
nikapov | 0:704c89673b57 | 5393 | { |
nikapov | 0:704c89673b57 | 5394 | u8_t value; |
nikapov | 0:704c89673b57 | 5395 | |
nikapov | 0:704c89673b57 | 5396 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FREE_FALL, &value, 1) ) |
nikapov | 0:704c89673b57 | 5397 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5398 | |
nikapov | 0:704c89673b57 | 5399 | value &= ~LSM6DSL_ACC_GYRO_FF_THS_MASK; |
nikapov | 0:704c89673b57 | 5400 | value |= newValue; |
nikapov | 0:704c89673b57 | 5401 | |
nikapov | 0:704c89673b57 | 5402 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_FREE_FALL, &value, 1) ) |
nikapov | 0:704c89673b57 | 5403 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5404 | |
nikapov | 0:704c89673b57 | 5405 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5406 | } |
nikapov | 0:704c89673b57 | 5407 | |
nikapov | 0:704c89673b57 | 5408 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5409 | * Function Name : LSM6DSL_ACC_GYRO_R_FF_THS |
nikapov | 0:704c89673b57 | 5410 | * Description : Read FF_THS |
nikapov | 0:704c89673b57 | 5411 | * Input : Pointer to LSM6DSL_ACC_GYRO_FF_THS_t |
nikapov | 0:704c89673b57 | 5412 | * Output : Status of FF_THS see LSM6DSL_ACC_GYRO_FF_THS_t |
nikapov | 0:704c89673b57 | 5413 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5414 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5415 | mems_status_t LSM6DSL_ACC_GYRO_R_FF_THS(void *handle, LSM6DSL_ACC_GYRO_FF_THS_t *value) |
nikapov | 0:704c89673b57 | 5416 | { |
nikapov | 0:704c89673b57 | 5417 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FREE_FALL, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 5418 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5419 | |
nikapov | 0:704c89673b57 | 5420 | *value &= LSM6DSL_ACC_GYRO_FF_THS_MASK; //mask |
nikapov | 0:704c89673b57 | 5421 | |
nikapov | 0:704c89673b57 | 5422 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5423 | } |
nikapov | 0:704c89673b57 | 5424 | |
nikapov | 0:704c89673b57 | 5425 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5426 | * Function Name : LSM6DSL_ACC_GYRO_W_FF_Duration |
nikapov | 0:704c89673b57 | 5427 | * Description : Write FF_DUR |
nikapov | 0:704c89673b57 | 5428 | * Input : u8_t |
nikapov | 0:704c89673b57 | 5429 | * Output : None |
nikapov | 0:704c89673b57 | 5430 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5431 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5432 | mems_status_t LSM6DSL_ACC_GYRO_W_FF_Duration(void *handle, u8_t newValue) |
nikapov | 0:704c89673b57 | 5433 | { |
nikapov | 0:704c89673b57 | 5434 | u8_t valueH, valueL; |
nikapov | 0:704c89673b57 | 5435 | u8_t value; |
nikapov | 0:704c89673b57 | 5436 | |
nikapov | 0:704c89673b57 | 5437 | valueL = newValue & 0x1F; |
nikapov | 0:704c89673b57 | 5438 | valueH = (newValue >> 5) & 0x1; |
nikapov | 0:704c89673b57 | 5439 | |
nikapov | 0:704c89673b57 | 5440 | /* Low part in FREE_FALL reg */ |
nikapov | 0:704c89673b57 | 5441 | valueL = valueL << LSM6DSL_ACC_GYRO_FF_FREE_FALL_DUR_POSITION; //mask |
nikapov | 0:704c89673b57 | 5442 | valueL &= LSM6DSL_ACC_GYRO_FF_FREE_FALL_DUR_MASK; //coerce |
nikapov | 0:704c89673b57 | 5443 | |
nikapov | 0:704c89673b57 | 5444 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FREE_FALL, &value, 1) ) |
nikapov | 0:704c89673b57 | 5445 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5446 | |
nikapov | 0:704c89673b57 | 5447 | value &= ~LSM6DSL_ACC_GYRO_FF_FREE_FALL_DUR_MASK; |
nikapov | 0:704c89673b57 | 5448 | value |= valueL; |
nikapov | 0:704c89673b57 | 5449 | |
nikapov | 0:704c89673b57 | 5450 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_FREE_FALL, &value, 1) ) |
nikapov | 0:704c89673b57 | 5451 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5452 | |
nikapov | 0:704c89673b57 | 5453 | /* High part in WAKE_UP_DUR reg */ |
nikapov | 0:704c89673b57 | 5454 | valueH = valueH << LSM6DSL_ACC_GYRO_FF_WAKE_UP_DUR_POSITION; //mask |
nikapov | 0:704c89673b57 | 5455 | valueH &= LSM6DSL_ACC_GYRO_FF_WAKE_UP_DUR_MASK; //coerce |
nikapov | 0:704c89673b57 | 5456 | |
nikapov | 0:704c89673b57 | 5457 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_WAKE_UP_DUR, &value, 1) ) |
nikapov | 0:704c89673b57 | 5458 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5459 | |
nikapov | 0:704c89673b57 | 5460 | value &= ~LSM6DSL_ACC_GYRO_FF_WAKE_UP_DUR_MASK; |
nikapov | 0:704c89673b57 | 5461 | value |= valueH; |
nikapov | 0:704c89673b57 | 5462 | |
nikapov | 0:704c89673b57 | 5463 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_WAKE_UP_DUR, &value, 1) ) |
nikapov | 0:704c89673b57 | 5464 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5465 | |
nikapov | 0:704c89673b57 | 5466 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5467 | } |
nikapov | 0:704c89673b57 | 5468 | |
nikapov | 0:704c89673b57 | 5469 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5470 | * Function Name : LSM6DSL_ACC_GYRO_R_FF_Duration |
nikapov | 0:704c89673b57 | 5471 | * Description : Read FF_DUR |
nikapov | 0:704c89673b57 | 5472 | * Input : Pointer to u8_t |
nikapov | 0:704c89673b57 | 5473 | * Output : Status of FF_DUR |
nikapov | 0:704c89673b57 | 5474 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5475 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5476 | mems_status_t LSM6DSL_ACC_GYRO_R_FF_Duration(void *handle, u8_t *value) |
nikapov | 0:704c89673b57 | 5477 | { |
nikapov | 0:704c89673b57 | 5478 | u8_t valueH, valueL; |
nikapov | 0:704c89673b57 | 5479 | |
nikapov | 0:704c89673b57 | 5480 | /* Low part from FREE_FALL reg */ |
nikapov | 0:704c89673b57 | 5481 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FREE_FALL, (u8_t *)&valueL, 1) ) |
nikapov | 0:704c89673b57 | 5482 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5483 | |
nikapov | 0:704c89673b57 | 5484 | valueL &= LSM6DSL_ACC_GYRO_FF_FREE_FALL_DUR_MASK; //coerce |
nikapov | 0:704c89673b57 | 5485 | valueL = valueL >> LSM6DSL_ACC_GYRO_FF_FREE_FALL_DUR_POSITION; //mask |
nikapov | 0:704c89673b57 | 5486 | |
nikapov | 0:704c89673b57 | 5487 | /* High part from WAKE_UP_DUR reg */ |
nikapov | 0:704c89673b57 | 5488 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_WAKE_UP_DUR, (u8_t *)&valueH, 1) ) |
nikapov | 0:704c89673b57 | 5489 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5490 | |
nikapov | 0:704c89673b57 | 5491 | valueH &= LSM6DSL_ACC_GYRO_FF_WAKE_UP_DUR_MASK; //coerce |
nikapov | 0:704c89673b57 | 5492 | valueH = valueH >> LSM6DSL_ACC_GYRO_FF_WAKE_UP_DUR_POSITION; //mask |
nikapov | 0:704c89673b57 | 5493 | |
nikapov | 0:704c89673b57 | 5494 | *value = ((valueH << 5) & 0x20) | valueL; |
nikapov | 0:704c89673b57 | 5495 | |
nikapov | 0:704c89673b57 | 5496 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5497 | } |
nikapov | 0:704c89673b57 | 5498 | |
nikapov | 0:704c89673b57 | 5499 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5500 | * Function Name : LSM6DSL_ACC_GYRO_W_TimerEvRouteInt1 |
nikapov | 0:704c89673b57 | 5501 | * Description : Write INT1_TIMER |
nikapov | 0:704c89673b57 | 5502 | * Input : LSM6DSL_ACC_GYRO_INT1_TIMER_t |
nikapov | 0:704c89673b57 | 5503 | * Output : None |
nikapov | 0:704c89673b57 | 5504 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5505 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5506 | mems_status_t LSM6DSL_ACC_GYRO_W_TimerEvRouteInt1(void *handle, LSM6DSL_ACC_GYRO_INT1_TIMER_t newValue) |
nikapov | 0:704c89673b57 | 5507 | { |
nikapov | 0:704c89673b57 | 5508 | u8_t value; |
nikapov | 0:704c89673b57 | 5509 | |
nikapov | 0:704c89673b57 | 5510 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD1_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5511 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5512 | |
nikapov | 0:704c89673b57 | 5513 | value &= ~LSM6DSL_ACC_GYRO_INT1_TIMER_MASK; |
nikapov | 0:704c89673b57 | 5514 | value |= newValue; |
nikapov | 0:704c89673b57 | 5515 | |
nikapov | 0:704c89673b57 | 5516 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_MD1_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5517 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5518 | |
nikapov | 0:704c89673b57 | 5519 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5520 | } |
nikapov | 0:704c89673b57 | 5521 | |
nikapov | 0:704c89673b57 | 5522 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5523 | * Function Name : LSM6DSL_ACC_GYRO_R_TimerEvRouteInt1 |
nikapov | 0:704c89673b57 | 5524 | * Description : Read INT1_TIMER |
nikapov | 0:704c89673b57 | 5525 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT1_TIMER_t |
nikapov | 0:704c89673b57 | 5526 | * Output : Status of INT1_TIMER see LSM6DSL_ACC_GYRO_INT1_TIMER_t |
nikapov | 0:704c89673b57 | 5527 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5528 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5529 | mems_status_t LSM6DSL_ACC_GYRO_R_TimerEvRouteInt1(void *handle, LSM6DSL_ACC_GYRO_INT1_TIMER_t *value) |
nikapov | 0:704c89673b57 | 5530 | { |
nikapov | 0:704c89673b57 | 5531 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD1_CFG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 5532 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5533 | |
nikapov | 0:704c89673b57 | 5534 | *value &= LSM6DSL_ACC_GYRO_INT1_TIMER_MASK; //mask |
nikapov | 0:704c89673b57 | 5535 | |
nikapov | 0:704c89673b57 | 5536 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5537 | } |
nikapov | 0:704c89673b57 | 5538 | |
nikapov | 0:704c89673b57 | 5539 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5540 | * Function Name : LSM6DSL_ACC_GYRO_W_TiltEvOnInt1 |
nikapov | 0:704c89673b57 | 5541 | * Description : Write INT1_TILT |
nikapov | 0:704c89673b57 | 5542 | * Input : LSM6DSL_ACC_GYRO_INT1_TILT_t |
nikapov | 0:704c89673b57 | 5543 | * Output : None |
nikapov | 0:704c89673b57 | 5544 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5545 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5546 | mems_status_t LSM6DSL_ACC_GYRO_W_TiltEvOnInt1(void *handle, LSM6DSL_ACC_GYRO_INT1_TILT_t newValue) |
nikapov | 0:704c89673b57 | 5547 | { |
nikapov | 0:704c89673b57 | 5548 | u8_t value; |
nikapov | 0:704c89673b57 | 5549 | |
nikapov | 0:704c89673b57 | 5550 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD1_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5551 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5552 | |
nikapov | 0:704c89673b57 | 5553 | value &= ~LSM6DSL_ACC_GYRO_INT1_TILT_MASK; |
nikapov | 0:704c89673b57 | 5554 | value |= newValue; |
nikapov | 0:704c89673b57 | 5555 | |
nikapov | 0:704c89673b57 | 5556 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_MD1_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5557 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5558 | |
nikapov | 0:704c89673b57 | 5559 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5560 | } |
nikapov | 0:704c89673b57 | 5561 | |
nikapov | 0:704c89673b57 | 5562 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5563 | * Function Name : LSM6DSL_ACC_GYRO_R_TiltEvOnInt1 |
nikapov | 0:704c89673b57 | 5564 | * Description : Read INT1_TILT |
nikapov | 0:704c89673b57 | 5565 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT1_TILT_t |
nikapov | 0:704c89673b57 | 5566 | * Output : Status of INT1_TILT see LSM6DSL_ACC_GYRO_INT1_TILT_t |
nikapov | 0:704c89673b57 | 5567 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5568 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5569 | mems_status_t LSM6DSL_ACC_GYRO_R_TiltEvOnInt1(void *handle, LSM6DSL_ACC_GYRO_INT1_TILT_t *value) |
nikapov | 0:704c89673b57 | 5570 | { |
nikapov | 0:704c89673b57 | 5571 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD1_CFG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 5572 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5573 | |
nikapov | 0:704c89673b57 | 5574 | *value &= LSM6DSL_ACC_GYRO_INT1_TILT_MASK; //mask |
nikapov | 0:704c89673b57 | 5575 | |
nikapov | 0:704c89673b57 | 5576 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5577 | } |
nikapov | 0:704c89673b57 | 5578 | |
nikapov | 0:704c89673b57 | 5579 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5580 | * Function Name : LSM6DSL_ACC_GYRO_W_6DEvOnInt1 |
nikapov | 0:704c89673b57 | 5581 | * Description : Write INT1_6D |
nikapov | 0:704c89673b57 | 5582 | * Input : LSM6DSL_ACC_GYRO_INT1_6D_t |
nikapov | 0:704c89673b57 | 5583 | * Output : None |
nikapov | 0:704c89673b57 | 5584 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5585 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5586 | mems_status_t LSM6DSL_ACC_GYRO_W_6DEvOnInt1(void *handle, LSM6DSL_ACC_GYRO_INT1_6D_t newValue) |
nikapov | 0:704c89673b57 | 5587 | { |
nikapov | 0:704c89673b57 | 5588 | u8_t value; |
nikapov | 0:704c89673b57 | 5589 | |
nikapov | 0:704c89673b57 | 5590 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD1_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5591 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5592 | |
nikapov | 0:704c89673b57 | 5593 | value &= ~LSM6DSL_ACC_GYRO_INT1_6D_MASK; |
nikapov | 0:704c89673b57 | 5594 | value |= newValue; |
nikapov | 0:704c89673b57 | 5595 | |
nikapov | 0:704c89673b57 | 5596 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_MD1_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5597 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5598 | |
nikapov | 0:704c89673b57 | 5599 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5600 | } |
nikapov | 0:704c89673b57 | 5601 | |
nikapov | 0:704c89673b57 | 5602 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5603 | * Function Name : LSM6DSL_ACC_GYRO_R_6DEvOnInt1 |
nikapov | 0:704c89673b57 | 5604 | * Description : Read INT1_6D |
nikapov | 0:704c89673b57 | 5605 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT1_6D_t |
nikapov | 0:704c89673b57 | 5606 | * Output : Status of INT1_6D see LSM6DSL_ACC_GYRO_INT1_6D_t |
nikapov | 0:704c89673b57 | 5607 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5608 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5609 | mems_status_t LSM6DSL_ACC_GYRO_R_6DEvOnInt1(void *handle, LSM6DSL_ACC_GYRO_INT1_6D_t *value) |
nikapov | 0:704c89673b57 | 5610 | { |
nikapov | 0:704c89673b57 | 5611 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD1_CFG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 5612 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5613 | |
nikapov | 0:704c89673b57 | 5614 | *value &= LSM6DSL_ACC_GYRO_INT1_6D_MASK; //mask |
nikapov | 0:704c89673b57 | 5615 | |
nikapov | 0:704c89673b57 | 5616 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5617 | } |
nikapov | 0:704c89673b57 | 5618 | |
nikapov | 0:704c89673b57 | 5619 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5620 | * Function Name : LSM6DSL_ACC_GYRO_W_TapEvOnInt1 |
nikapov | 0:704c89673b57 | 5621 | * Description : Write INT1_TAP |
nikapov | 0:704c89673b57 | 5622 | * Input : LSM6DSL_ACC_GYRO_INT1_TAP_t |
nikapov | 0:704c89673b57 | 5623 | * Output : None |
nikapov | 0:704c89673b57 | 5624 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5625 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5626 | mems_status_t LSM6DSL_ACC_GYRO_W_TapEvOnInt1(void *handle, LSM6DSL_ACC_GYRO_INT1_TAP_t newValue) |
nikapov | 0:704c89673b57 | 5627 | { |
nikapov | 0:704c89673b57 | 5628 | u8_t value; |
nikapov | 0:704c89673b57 | 5629 | |
nikapov | 0:704c89673b57 | 5630 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD1_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5631 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5632 | |
nikapov | 0:704c89673b57 | 5633 | value &= ~LSM6DSL_ACC_GYRO_INT1_TAP_MASK; |
nikapov | 0:704c89673b57 | 5634 | value |= newValue; |
nikapov | 0:704c89673b57 | 5635 | |
nikapov | 0:704c89673b57 | 5636 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_MD1_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5637 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5638 | |
nikapov | 0:704c89673b57 | 5639 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5640 | } |
nikapov | 0:704c89673b57 | 5641 | |
nikapov | 0:704c89673b57 | 5642 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5643 | * Function Name : LSM6DSL_ACC_GYRO_R_TapEvOnInt1 |
nikapov | 0:704c89673b57 | 5644 | * Description : Read INT1_TAP |
nikapov | 0:704c89673b57 | 5645 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT1_TAP_t |
nikapov | 0:704c89673b57 | 5646 | * Output : Status of INT1_TAP see LSM6DSL_ACC_GYRO_INT1_TAP_t |
nikapov | 0:704c89673b57 | 5647 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5648 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5649 | mems_status_t LSM6DSL_ACC_GYRO_R_TapEvOnInt1(void *handle, LSM6DSL_ACC_GYRO_INT1_TAP_t *value) |
nikapov | 0:704c89673b57 | 5650 | { |
nikapov | 0:704c89673b57 | 5651 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD1_CFG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 5652 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5653 | |
nikapov | 0:704c89673b57 | 5654 | *value &= LSM6DSL_ACC_GYRO_INT1_TAP_MASK; //mask |
nikapov | 0:704c89673b57 | 5655 | |
nikapov | 0:704c89673b57 | 5656 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5657 | } |
nikapov | 0:704c89673b57 | 5658 | |
nikapov | 0:704c89673b57 | 5659 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5660 | * Function Name : LSM6DSL_ACC_GYRO_W_FFEvOnInt1 |
nikapov | 0:704c89673b57 | 5661 | * Description : Write INT1_FF |
nikapov | 0:704c89673b57 | 5662 | * Input : LSM6DSL_ACC_GYRO_INT1_FF_t |
nikapov | 0:704c89673b57 | 5663 | * Output : None |
nikapov | 0:704c89673b57 | 5664 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5665 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5666 | mems_status_t LSM6DSL_ACC_GYRO_W_FFEvOnInt1(void *handle, LSM6DSL_ACC_GYRO_INT1_FF_t newValue) |
nikapov | 0:704c89673b57 | 5667 | { |
nikapov | 0:704c89673b57 | 5668 | u8_t value; |
nikapov | 0:704c89673b57 | 5669 | |
nikapov | 0:704c89673b57 | 5670 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD1_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5671 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5672 | |
nikapov | 0:704c89673b57 | 5673 | value &= ~LSM6DSL_ACC_GYRO_INT1_FF_MASK; |
nikapov | 0:704c89673b57 | 5674 | value |= newValue; |
nikapov | 0:704c89673b57 | 5675 | |
nikapov | 0:704c89673b57 | 5676 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_MD1_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5677 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5678 | |
nikapov | 0:704c89673b57 | 5679 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5680 | } |
nikapov | 0:704c89673b57 | 5681 | |
nikapov | 0:704c89673b57 | 5682 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5683 | * Function Name : LSM6DSL_ACC_GYRO_R_FFEvOnInt1 |
nikapov | 0:704c89673b57 | 5684 | * Description : Read INT1_FF |
nikapov | 0:704c89673b57 | 5685 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT1_FF_t |
nikapov | 0:704c89673b57 | 5686 | * Output : Status of INT1_FF see LSM6DSL_ACC_GYRO_INT1_FF_t |
nikapov | 0:704c89673b57 | 5687 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5688 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5689 | mems_status_t LSM6DSL_ACC_GYRO_R_FFEvOnInt1(void *handle, LSM6DSL_ACC_GYRO_INT1_FF_t *value) |
nikapov | 0:704c89673b57 | 5690 | { |
nikapov | 0:704c89673b57 | 5691 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD1_CFG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 5692 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5693 | |
nikapov | 0:704c89673b57 | 5694 | *value &= LSM6DSL_ACC_GYRO_INT1_FF_MASK; //mask |
nikapov | 0:704c89673b57 | 5695 | |
nikapov | 0:704c89673b57 | 5696 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5697 | } |
nikapov | 0:704c89673b57 | 5698 | |
nikapov | 0:704c89673b57 | 5699 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5700 | * Function Name : LSM6DSL_ACC_GYRO_W_WUEvOnInt1 |
nikapov | 0:704c89673b57 | 5701 | * Description : Write INT1_WU |
nikapov | 0:704c89673b57 | 5702 | * Input : LSM6DSL_ACC_GYRO_INT1_WU_t |
nikapov | 0:704c89673b57 | 5703 | * Output : None |
nikapov | 0:704c89673b57 | 5704 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5705 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5706 | mems_status_t LSM6DSL_ACC_GYRO_W_WUEvOnInt1(void *handle, LSM6DSL_ACC_GYRO_INT1_WU_t newValue) |
nikapov | 0:704c89673b57 | 5707 | { |
nikapov | 0:704c89673b57 | 5708 | u8_t value; |
nikapov | 0:704c89673b57 | 5709 | |
nikapov | 0:704c89673b57 | 5710 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD1_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5711 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5712 | |
nikapov | 0:704c89673b57 | 5713 | value &= ~LSM6DSL_ACC_GYRO_INT1_WU_MASK; |
nikapov | 0:704c89673b57 | 5714 | value |= newValue; |
nikapov | 0:704c89673b57 | 5715 | |
nikapov | 0:704c89673b57 | 5716 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_MD1_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5717 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5718 | |
nikapov | 0:704c89673b57 | 5719 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5720 | } |
nikapov | 0:704c89673b57 | 5721 | |
nikapov | 0:704c89673b57 | 5722 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5723 | * Function Name : LSM6DSL_ACC_GYRO_R_WUEvOnInt1 |
nikapov | 0:704c89673b57 | 5724 | * Description : Read INT1_WU |
nikapov | 0:704c89673b57 | 5725 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT1_WU_t |
nikapov | 0:704c89673b57 | 5726 | * Output : Status of INT1_WU see LSM6DSL_ACC_GYRO_INT1_WU_t |
nikapov | 0:704c89673b57 | 5727 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5728 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5729 | mems_status_t LSM6DSL_ACC_GYRO_R_WUEvOnInt1(void *handle, LSM6DSL_ACC_GYRO_INT1_WU_t *value) |
nikapov | 0:704c89673b57 | 5730 | { |
nikapov | 0:704c89673b57 | 5731 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD1_CFG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 5732 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5733 | |
nikapov | 0:704c89673b57 | 5734 | *value &= LSM6DSL_ACC_GYRO_INT1_WU_MASK; //mask |
nikapov | 0:704c89673b57 | 5735 | |
nikapov | 0:704c89673b57 | 5736 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5737 | } |
nikapov | 0:704c89673b57 | 5738 | |
nikapov | 0:704c89673b57 | 5739 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5740 | * Function Name : LSM6DSL_ACC_GYRO_W_SingleTapOnInt1 |
nikapov | 0:704c89673b57 | 5741 | * Description : Write INT1_SINGLE_TAP |
nikapov | 0:704c89673b57 | 5742 | * Input : LSM6DSL_ACC_GYRO_INT1_SINGLE_TAP_t |
nikapov | 0:704c89673b57 | 5743 | * Output : None |
nikapov | 0:704c89673b57 | 5744 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5745 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5746 | mems_status_t LSM6DSL_ACC_GYRO_W_SingleTapOnInt1(void *handle, LSM6DSL_ACC_GYRO_INT1_SINGLE_TAP_t newValue) |
nikapov | 0:704c89673b57 | 5747 | { |
nikapov | 0:704c89673b57 | 5748 | u8_t value; |
nikapov | 0:704c89673b57 | 5749 | |
nikapov | 0:704c89673b57 | 5750 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD1_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5751 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5752 | |
nikapov | 0:704c89673b57 | 5753 | value &= ~LSM6DSL_ACC_GYRO_INT1_SINGLE_TAP_MASK; |
nikapov | 0:704c89673b57 | 5754 | value |= newValue; |
nikapov | 0:704c89673b57 | 5755 | |
nikapov | 0:704c89673b57 | 5756 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_MD1_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5757 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5758 | |
nikapov | 0:704c89673b57 | 5759 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5760 | } |
nikapov | 0:704c89673b57 | 5761 | |
nikapov | 0:704c89673b57 | 5762 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5763 | * Function Name : LSM6DSL_ACC_GYRO_R_SingleTapOnInt1 |
nikapov | 0:704c89673b57 | 5764 | * Description : Read INT1_SINGLE_TAP |
nikapov | 0:704c89673b57 | 5765 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT1_SINGLE_TAP_t |
nikapov | 0:704c89673b57 | 5766 | * Output : Status of INT1_SINGLE_TAP see LSM6DSL_ACC_GYRO_INT1_SINGLE_TAP_t |
nikapov | 0:704c89673b57 | 5767 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5768 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5769 | mems_status_t LSM6DSL_ACC_GYRO_R_SingleTapOnInt1(void *handle, LSM6DSL_ACC_GYRO_INT1_SINGLE_TAP_t *value) |
nikapov | 0:704c89673b57 | 5770 | { |
nikapov | 0:704c89673b57 | 5771 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD1_CFG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 5772 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5773 | |
nikapov | 0:704c89673b57 | 5774 | *value &= LSM6DSL_ACC_GYRO_INT1_SINGLE_TAP_MASK; //mask |
nikapov | 0:704c89673b57 | 5775 | |
nikapov | 0:704c89673b57 | 5776 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5777 | } |
nikapov | 0:704c89673b57 | 5778 | |
nikapov | 0:704c89673b57 | 5779 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5780 | * Function Name : LSM6DSL_ACC_GYRO_W_SleepEvOnInt1 |
nikapov | 0:704c89673b57 | 5781 | * Description : Write INT1_SLEEP |
nikapov | 0:704c89673b57 | 5782 | * Input : LSM6DSL_ACC_GYRO_INT1_SLEEP_t |
nikapov | 0:704c89673b57 | 5783 | * Output : None |
nikapov | 0:704c89673b57 | 5784 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5785 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5786 | mems_status_t LSM6DSL_ACC_GYRO_W_SleepEvOnInt1(void *handle, LSM6DSL_ACC_GYRO_INT1_SLEEP_t newValue) |
nikapov | 0:704c89673b57 | 5787 | { |
nikapov | 0:704c89673b57 | 5788 | u8_t value; |
nikapov | 0:704c89673b57 | 5789 | |
nikapov | 0:704c89673b57 | 5790 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD1_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5791 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5792 | |
nikapov | 0:704c89673b57 | 5793 | value &= ~LSM6DSL_ACC_GYRO_INT1_SLEEP_MASK; |
nikapov | 0:704c89673b57 | 5794 | value |= newValue; |
nikapov | 0:704c89673b57 | 5795 | |
nikapov | 0:704c89673b57 | 5796 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_MD1_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5797 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5798 | |
nikapov | 0:704c89673b57 | 5799 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5800 | } |
nikapov | 0:704c89673b57 | 5801 | |
nikapov | 0:704c89673b57 | 5802 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5803 | * Function Name : LSM6DSL_ACC_GYRO_R_SleepEvOnInt1 |
nikapov | 0:704c89673b57 | 5804 | * Description : Read INT1_SLEEP |
nikapov | 0:704c89673b57 | 5805 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT1_SLEEP_t |
nikapov | 0:704c89673b57 | 5806 | * Output : Status of INT1_SLEEP see LSM6DSL_ACC_GYRO_INT1_SLEEP_t |
nikapov | 0:704c89673b57 | 5807 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5808 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5809 | mems_status_t LSM6DSL_ACC_GYRO_R_SleepEvOnInt1(void *handle, LSM6DSL_ACC_GYRO_INT1_SLEEP_t *value) |
nikapov | 0:704c89673b57 | 5810 | { |
nikapov | 0:704c89673b57 | 5811 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD1_CFG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 5812 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5813 | |
nikapov | 0:704c89673b57 | 5814 | *value &= LSM6DSL_ACC_GYRO_INT1_SLEEP_MASK; //mask |
nikapov | 0:704c89673b57 | 5815 | |
nikapov | 0:704c89673b57 | 5816 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5817 | } |
nikapov | 0:704c89673b57 | 5818 | |
nikapov | 0:704c89673b57 | 5819 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5820 | * Function Name : LSM6DSL_ACC_GYRO_W_MagCorrection_Int2 |
nikapov | 0:704c89673b57 | 5821 | * Description : Write INT2_IRON |
nikapov | 0:704c89673b57 | 5822 | * Input : LSM6DSL_ACC_GYRO_INT2_IRON_t |
nikapov | 0:704c89673b57 | 5823 | * Output : None |
nikapov | 0:704c89673b57 | 5824 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5825 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5826 | mems_status_t LSM6DSL_ACC_GYRO_W_MagCorrection_Int2(void *handle, LSM6DSL_ACC_GYRO_INT2_IRON_t newValue) |
nikapov | 0:704c89673b57 | 5827 | { |
nikapov | 0:704c89673b57 | 5828 | u8_t value; |
nikapov | 0:704c89673b57 | 5829 | |
nikapov | 0:704c89673b57 | 5830 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD2_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5831 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5832 | |
nikapov | 0:704c89673b57 | 5833 | value &= ~LSM6DSL_ACC_GYRO_INT2_IRON_MASK; |
nikapov | 0:704c89673b57 | 5834 | value |= newValue; |
nikapov | 0:704c89673b57 | 5835 | |
nikapov | 0:704c89673b57 | 5836 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_MD2_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5837 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5838 | |
nikapov | 0:704c89673b57 | 5839 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5840 | } |
nikapov | 0:704c89673b57 | 5841 | |
nikapov | 0:704c89673b57 | 5842 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5843 | * Function Name : LSM6DSL_ACC_GYRO_R_MagCorrection_Int2 |
nikapov | 0:704c89673b57 | 5844 | * Description : Read INT2_IRON |
nikapov | 0:704c89673b57 | 5845 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT2_IRON_t |
nikapov | 0:704c89673b57 | 5846 | * Output : Status of INT2_IRON see LSM6DSL_ACC_GYRO_INT2_IRON_t |
nikapov | 0:704c89673b57 | 5847 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5848 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5849 | mems_status_t LSM6DSL_ACC_GYRO_R_MagCorrection_Int2(void *handle, LSM6DSL_ACC_GYRO_INT2_IRON_t *value) |
nikapov | 0:704c89673b57 | 5850 | { |
nikapov | 0:704c89673b57 | 5851 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD2_CFG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 5852 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5853 | |
nikapov | 0:704c89673b57 | 5854 | *value &= LSM6DSL_ACC_GYRO_INT2_IRON_MASK; //mask |
nikapov | 0:704c89673b57 | 5855 | |
nikapov | 0:704c89673b57 | 5856 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5857 | } |
nikapov | 0:704c89673b57 | 5858 | |
nikapov | 0:704c89673b57 | 5859 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5860 | * Function Name : LSM6DSL_ACC_GYRO_W_TiltEvOnInt2 |
nikapov | 0:704c89673b57 | 5861 | * Description : Write INT2_TILT |
nikapov | 0:704c89673b57 | 5862 | * Input : LSM6DSL_ACC_GYRO_INT2_TILT_t |
nikapov | 0:704c89673b57 | 5863 | * Output : None |
nikapov | 0:704c89673b57 | 5864 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5865 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5866 | mems_status_t LSM6DSL_ACC_GYRO_W_TiltEvOnInt2(void *handle, LSM6DSL_ACC_GYRO_INT2_TILT_t newValue) |
nikapov | 0:704c89673b57 | 5867 | { |
nikapov | 0:704c89673b57 | 5868 | u8_t value; |
nikapov | 0:704c89673b57 | 5869 | |
nikapov | 0:704c89673b57 | 5870 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD2_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5871 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5872 | |
nikapov | 0:704c89673b57 | 5873 | value &= ~LSM6DSL_ACC_GYRO_INT2_TILT_MASK; |
nikapov | 0:704c89673b57 | 5874 | value |= newValue; |
nikapov | 0:704c89673b57 | 5875 | |
nikapov | 0:704c89673b57 | 5876 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_MD2_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5877 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5878 | |
nikapov | 0:704c89673b57 | 5879 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5880 | } |
nikapov | 0:704c89673b57 | 5881 | |
nikapov | 0:704c89673b57 | 5882 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5883 | * Function Name : LSM6DSL_ACC_GYRO_R_TiltEvOnInt2 |
nikapov | 0:704c89673b57 | 5884 | * Description : Read INT2_TILT |
nikapov | 0:704c89673b57 | 5885 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT2_TILT_t |
nikapov | 0:704c89673b57 | 5886 | * Output : Status of INT2_TILT see LSM6DSL_ACC_GYRO_INT2_TILT_t |
nikapov | 0:704c89673b57 | 5887 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5888 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5889 | mems_status_t LSM6DSL_ACC_GYRO_R_TiltEvOnInt2(void *handle, LSM6DSL_ACC_GYRO_INT2_TILT_t *value) |
nikapov | 0:704c89673b57 | 5890 | { |
nikapov | 0:704c89673b57 | 5891 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD2_CFG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 5892 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5893 | |
nikapov | 0:704c89673b57 | 5894 | *value &= LSM6DSL_ACC_GYRO_INT2_TILT_MASK; //mask |
nikapov | 0:704c89673b57 | 5895 | |
nikapov | 0:704c89673b57 | 5896 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5897 | } |
nikapov | 0:704c89673b57 | 5898 | |
nikapov | 0:704c89673b57 | 5899 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5900 | * Function Name : LSM6DSL_ACC_GYRO_W_6DEvOnInt2 |
nikapov | 0:704c89673b57 | 5901 | * Description : Write INT2_6D |
nikapov | 0:704c89673b57 | 5902 | * Input : LSM6DSL_ACC_GYRO_INT2_6D_t |
nikapov | 0:704c89673b57 | 5903 | * Output : None |
nikapov | 0:704c89673b57 | 5904 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5905 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5906 | mems_status_t LSM6DSL_ACC_GYRO_W_6DEvOnInt2(void *handle, LSM6DSL_ACC_GYRO_INT2_6D_t newValue) |
nikapov | 0:704c89673b57 | 5907 | { |
nikapov | 0:704c89673b57 | 5908 | u8_t value; |
nikapov | 0:704c89673b57 | 5909 | |
nikapov | 0:704c89673b57 | 5910 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD2_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5911 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5912 | |
nikapov | 0:704c89673b57 | 5913 | value &= ~LSM6DSL_ACC_GYRO_INT2_6D_MASK; |
nikapov | 0:704c89673b57 | 5914 | value |= newValue; |
nikapov | 0:704c89673b57 | 5915 | |
nikapov | 0:704c89673b57 | 5916 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_MD2_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5917 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5918 | |
nikapov | 0:704c89673b57 | 5919 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5920 | } |
nikapov | 0:704c89673b57 | 5921 | |
nikapov | 0:704c89673b57 | 5922 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5923 | * Function Name : LSM6DSL_ACC_GYRO_R_6DEvOnInt2 |
nikapov | 0:704c89673b57 | 5924 | * Description : Read INT2_6D |
nikapov | 0:704c89673b57 | 5925 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT2_6D_t |
nikapov | 0:704c89673b57 | 5926 | * Output : Status of INT2_6D see LSM6DSL_ACC_GYRO_INT2_6D_t |
nikapov | 0:704c89673b57 | 5927 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5928 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5929 | mems_status_t LSM6DSL_ACC_GYRO_R_6DEvOnInt2(void *handle, LSM6DSL_ACC_GYRO_INT2_6D_t *value) |
nikapov | 0:704c89673b57 | 5930 | { |
nikapov | 0:704c89673b57 | 5931 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD2_CFG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 5932 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5933 | |
nikapov | 0:704c89673b57 | 5934 | *value &= LSM6DSL_ACC_GYRO_INT2_6D_MASK; //mask |
nikapov | 0:704c89673b57 | 5935 | |
nikapov | 0:704c89673b57 | 5936 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5937 | } |
nikapov | 0:704c89673b57 | 5938 | |
nikapov | 0:704c89673b57 | 5939 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5940 | * Function Name : LSM6DSL_ACC_GYRO_W_TapEvOnInt2 |
nikapov | 0:704c89673b57 | 5941 | * Description : Write INT2_TAP |
nikapov | 0:704c89673b57 | 5942 | * Input : LSM6DSL_ACC_GYRO_INT2_TAP_t |
nikapov | 0:704c89673b57 | 5943 | * Output : None |
nikapov | 0:704c89673b57 | 5944 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5945 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5946 | mems_status_t LSM6DSL_ACC_GYRO_W_TapEvOnInt2(void *handle, LSM6DSL_ACC_GYRO_INT2_TAP_t newValue) |
nikapov | 0:704c89673b57 | 5947 | { |
nikapov | 0:704c89673b57 | 5948 | u8_t value; |
nikapov | 0:704c89673b57 | 5949 | |
nikapov | 0:704c89673b57 | 5950 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD2_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5951 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5952 | |
nikapov | 0:704c89673b57 | 5953 | value &= ~LSM6DSL_ACC_GYRO_INT2_TAP_MASK; |
nikapov | 0:704c89673b57 | 5954 | value |= newValue; |
nikapov | 0:704c89673b57 | 5955 | |
nikapov | 0:704c89673b57 | 5956 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_MD2_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5957 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5958 | |
nikapov | 0:704c89673b57 | 5959 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5960 | } |
nikapov | 0:704c89673b57 | 5961 | |
nikapov | 0:704c89673b57 | 5962 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5963 | * Function Name : LSM6DSL_ACC_GYRO_R_TapEvOnInt2 |
nikapov | 0:704c89673b57 | 5964 | * Description : Read INT2_TAP |
nikapov | 0:704c89673b57 | 5965 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT2_TAP_t |
nikapov | 0:704c89673b57 | 5966 | * Output : Status of INT2_TAP see LSM6DSL_ACC_GYRO_INT2_TAP_t |
nikapov | 0:704c89673b57 | 5967 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5968 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5969 | mems_status_t LSM6DSL_ACC_GYRO_R_TapEvOnInt2(void *handle, LSM6DSL_ACC_GYRO_INT2_TAP_t *value) |
nikapov | 0:704c89673b57 | 5970 | { |
nikapov | 0:704c89673b57 | 5971 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD2_CFG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 5972 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5973 | |
nikapov | 0:704c89673b57 | 5974 | *value &= LSM6DSL_ACC_GYRO_INT2_TAP_MASK; //mask |
nikapov | 0:704c89673b57 | 5975 | |
nikapov | 0:704c89673b57 | 5976 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 5977 | } |
nikapov | 0:704c89673b57 | 5978 | |
nikapov | 0:704c89673b57 | 5979 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 5980 | * Function Name : LSM6DSL_ACC_GYRO_W_FFEvOnInt2 |
nikapov | 0:704c89673b57 | 5981 | * Description : Write INT2_FF |
nikapov | 0:704c89673b57 | 5982 | * Input : LSM6DSL_ACC_GYRO_INT2_FF_t |
nikapov | 0:704c89673b57 | 5983 | * Output : None |
nikapov | 0:704c89673b57 | 5984 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 5985 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 5986 | mems_status_t LSM6DSL_ACC_GYRO_W_FFEvOnInt2(void *handle, LSM6DSL_ACC_GYRO_INT2_FF_t newValue) |
nikapov | 0:704c89673b57 | 5987 | { |
nikapov | 0:704c89673b57 | 5988 | u8_t value; |
nikapov | 0:704c89673b57 | 5989 | |
nikapov | 0:704c89673b57 | 5990 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD2_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5991 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5992 | |
nikapov | 0:704c89673b57 | 5993 | value &= ~LSM6DSL_ACC_GYRO_INT2_FF_MASK; |
nikapov | 0:704c89673b57 | 5994 | value |= newValue; |
nikapov | 0:704c89673b57 | 5995 | |
nikapov | 0:704c89673b57 | 5996 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_MD2_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 5997 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 5998 | |
nikapov | 0:704c89673b57 | 5999 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 6000 | } |
nikapov | 0:704c89673b57 | 6001 | |
nikapov | 0:704c89673b57 | 6002 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 6003 | * Function Name : LSM6DSL_ACC_GYRO_R_FFEvOnInt2 |
nikapov | 0:704c89673b57 | 6004 | * Description : Read INT2_FF |
nikapov | 0:704c89673b57 | 6005 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT2_FF_t |
nikapov | 0:704c89673b57 | 6006 | * Output : Status of INT2_FF see LSM6DSL_ACC_GYRO_INT2_FF_t |
nikapov | 0:704c89673b57 | 6007 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 6008 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 6009 | mems_status_t LSM6DSL_ACC_GYRO_R_FFEvOnInt2(void *handle, LSM6DSL_ACC_GYRO_INT2_FF_t *value) |
nikapov | 0:704c89673b57 | 6010 | { |
nikapov | 0:704c89673b57 | 6011 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD2_CFG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 6012 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 6013 | |
nikapov | 0:704c89673b57 | 6014 | *value &= LSM6DSL_ACC_GYRO_INT2_FF_MASK; //mask |
nikapov | 0:704c89673b57 | 6015 | |
nikapov | 0:704c89673b57 | 6016 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 6017 | } |
nikapov | 0:704c89673b57 | 6018 | |
nikapov | 0:704c89673b57 | 6019 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 6020 | * Function Name : LSM6DSL_ACC_GYRO_W_WUEvOnInt2 |
nikapov | 0:704c89673b57 | 6021 | * Description : Write INT2_WU |
nikapov | 0:704c89673b57 | 6022 | * Input : LSM6DSL_ACC_GYRO_INT2_WU_t |
nikapov | 0:704c89673b57 | 6023 | * Output : None |
nikapov | 0:704c89673b57 | 6024 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 6025 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 6026 | mems_status_t LSM6DSL_ACC_GYRO_W_WUEvOnInt2(void *handle, LSM6DSL_ACC_GYRO_INT2_WU_t newValue) |
nikapov | 0:704c89673b57 | 6027 | { |
nikapov | 0:704c89673b57 | 6028 | u8_t value; |
nikapov | 0:704c89673b57 | 6029 | |
nikapov | 0:704c89673b57 | 6030 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD2_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 6031 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 6032 | |
nikapov | 0:704c89673b57 | 6033 | value &= ~LSM6DSL_ACC_GYRO_INT2_WU_MASK; |
nikapov | 0:704c89673b57 | 6034 | value |= newValue; |
nikapov | 0:704c89673b57 | 6035 | |
nikapov | 0:704c89673b57 | 6036 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_MD2_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 6037 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 6038 | |
nikapov | 0:704c89673b57 | 6039 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 6040 | } |
nikapov | 0:704c89673b57 | 6041 | |
nikapov | 0:704c89673b57 | 6042 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 6043 | * Function Name : LSM6DSL_ACC_GYRO_R_WUEvOnInt2 |
nikapov | 0:704c89673b57 | 6044 | * Description : Read INT2_WU |
nikapov | 0:704c89673b57 | 6045 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT2_WU_t |
nikapov | 0:704c89673b57 | 6046 | * Output : Status of INT2_WU see LSM6DSL_ACC_GYRO_INT2_WU_t |
nikapov | 0:704c89673b57 | 6047 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 6048 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 6049 | mems_status_t LSM6DSL_ACC_GYRO_R_WUEvOnInt2(void *handle, LSM6DSL_ACC_GYRO_INT2_WU_t *value) |
nikapov | 0:704c89673b57 | 6050 | { |
nikapov | 0:704c89673b57 | 6051 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD2_CFG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 6052 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 6053 | |
nikapov | 0:704c89673b57 | 6054 | *value &= LSM6DSL_ACC_GYRO_INT2_WU_MASK; //mask |
nikapov | 0:704c89673b57 | 6055 | |
nikapov | 0:704c89673b57 | 6056 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 6057 | } |
nikapov | 0:704c89673b57 | 6058 | |
nikapov | 0:704c89673b57 | 6059 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 6060 | * Function Name : LSM6DSL_ACC_GYRO_W_SingleTapOnInt2 |
nikapov | 0:704c89673b57 | 6061 | * Description : Write INT2_SINGLE_TAP |
nikapov | 0:704c89673b57 | 6062 | * Input : LSM6DSL_ACC_GYRO_INT2_SINGLE_TAP_t |
nikapov | 0:704c89673b57 | 6063 | * Output : None |
nikapov | 0:704c89673b57 | 6064 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 6065 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 6066 | mems_status_t LSM6DSL_ACC_GYRO_W_SingleTapOnInt2(void *handle, LSM6DSL_ACC_GYRO_INT2_SINGLE_TAP_t newValue) |
nikapov | 0:704c89673b57 | 6067 | { |
nikapov | 0:704c89673b57 | 6068 | u8_t value; |
nikapov | 0:704c89673b57 | 6069 | |
nikapov | 0:704c89673b57 | 6070 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD2_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 6071 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 6072 | |
nikapov | 0:704c89673b57 | 6073 | value &= ~LSM6DSL_ACC_GYRO_INT2_SINGLE_TAP_MASK; |
nikapov | 0:704c89673b57 | 6074 | value |= newValue; |
nikapov | 0:704c89673b57 | 6075 | |
nikapov | 0:704c89673b57 | 6076 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_MD2_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 6077 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 6078 | |
nikapov | 0:704c89673b57 | 6079 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 6080 | } |
nikapov | 0:704c89673b57 | 6081 | |
nikapov | 0:704c89673b57 | 6082 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 6083 | * Function Name : LSM6DSL_ACC_GYRO_R_SingleTapOnInt2 |
nikapov | 0:704c89673b57 | 6084 | * Description : Read INT2_SINGLE_TAP |
nikapov | 0:704c89673b57 | 6085 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT2_SINGLE_TAP_t |
nikapov | 0:704c89673b57 | 6086 | * Output : Status of INT2_SINGLE_TAP see LSM6DSL_ACC_GYRO_INT2_SINGLE_TAP_t |
nikapov | 0:704c89673b57 | 6087 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 6088 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 6089 | mems_status_t LSM6DSL_ACC_GYRO_R_SingleTapOnInt2(void *handle, LSM6DSL_ACC_GYRO_INT2_SINGLE_TAP_t *value) |
nikapov | 0:704c89673b57 | 6090 | { |
nikapov | 0:704c89673b57 | 6091 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD2_CFG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 6092 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 6093 | |
nikapov | 0:704c89673b57 | 6094 | *value &= LSM6DSL_ACC_GYRO_INT2_SINGLE_TAP_MASK; //mask |
nikapov | 0:704c89673b57 | 6095 | |
nikapov | 0:704c89673b57 | 6096 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 6097 | } |
nikapov | 0:704c89673b57 | 6098 | |
nikapov | 0:704c89673b57 | 6099 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 6100 | * Function Name : LSM6DSL_ACC_GYRO_W_SleepEvOnInt2 |
nikapov | 0:704c89673b57 | 6101 | * Description : Write INT2_SLEEP |
nikapov | 0:704c89673b57 | 6102 | * Input : LSM6DSL_ACC_GYRO_INT2_SLEEP_t |
nikapov | 0:704c89673b57 | 6103 | * Output : None |
nikapov | 0:704c89673b57 | 6104 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 6105 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 6106 | mems_status_t LSM6DSL_ACC_GYRO_W_SleepEvOnInt2(void *handle, LSM6DSL_ACC_GYRO_INT2_SLEEP_t newValue) |
nikapov | 0:704c89673b57 | 6107 | { |
nikapov | 0:704c89673b57 | 6108 | u8_t value; |
nikapov | 0:704c89673b57 | 6109 | |
nikapov | 0:704c89673b57 | 6110 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD2_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 6111 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 6112 | |
nikapov | 0:704c89673b57 | 6113 | value &= ~LSM6DSL_ACC_GYRO_INT2_SLEEP_MASK; |
nikapov | 0:704c89673b57 | 6114 | value |= newValue; |
nikapov | 0:704c89673b57 | 6115 | |
nikapov | 0:704c89673b57 | 6116 | if( !LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_MD2_CFG, &value, 1) ) |
nikapov | 0:704c89673b57 | 6117 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 6118 | |
nikapov | 0:704c89673b57 | 6119 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 6120 | } |
nikapov | 0:704c89673b57 | 6121 | |
nikapov | 0:704c89673b57 | 6122 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 6123 | * Function Name : LSM6DSL_ACC_GYRO_R_SleepEvOnInt2 |
nikapov | 0:704c89673b57 | 6124 | * Description : Read INT2_SLEEP |
nikapov | 0:704c89673b57 | 6125 | * Input : Pointer to LSM6DSL_ACC_GYRO_INT2_SLEEP_t |
nikapov | 0:704c89673b57 | 6126 | * Output : Status of INT2_SLEEP see LSM6DSL_ACC_GYRO_INT2_SLEEP_t |
nikapov | 0:704c89673b57 | 6127 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 6128 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 6129 | mems_status_t LSM6DSL_ACC_GYRO_R_SleepEvOnInt2(void *handle, LSM6DSL_ACC_GYRO_INT2_SLEEP_t *value) |
nikapov | 0:704c89673b57 | 6130 | { |
nikapov | 0:704c89673b57 | 6131 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_MD2_CFG, (u8_t *)value, 1) ) |
nikapov | 0:704c89673b57 | 6132 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 6133 | |
nikapov | 0:704c89673b57 | 6134 | *value &= LSM6DSL_ACC_GYRO_INT2_SLEEP_MASK; //mask |
nikapov | 0:704c89673b57 | 6135 | |
nikapov | 0:704c89673b57 | 6136 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 6137 | } |
nikapov | 0:704c89673b57 | 6138 | |
nikapov | 0:704c89673b57 | 6139 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 6140 | * Function Name : mems_status_t LSM6DSL_ACC_GYRO_Get_GetFIFOData(u8_t *buff) |
nikapov | 0:704c89673b57 | 6141 | * Description : Read GetFIFOData output register |
nikapov | 0:704c89673b57 | 6142 | * Input : pointer to [u8_t] |
nikapov | 0:704c89673b57 | 6143 | * Output : GetFIFOData buffer u8_t |
nikapov | 0:704c89673b57 | 6144 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 6145 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 6146 | mems_status_t LSM6DSL_ACC_GYRO_Get_GetFIFOData(void *handle, u8_t *buff) |
nikapov | 0:704c89673b57 | 6147 | { |
nikapov | 0:704c89673b57 | 6148 | u8_t i, j, k; |
nikapov | 0:704c89673b57 | 6149 | u8_t numberOfByteForDimension; |
nikapov | 0:704c89673b57 | 6150 | |
nikapov | 0:704c89673b57 | 6151 | numberOfByteForDimension=2/1; |
nikapov | 0:704c89673b57 | 6152 | |
nikapov | 0:704c89673b57 | 6153 | k=0; |
nikapov | 0:704c89673b57 | 6154 | for (i=0; i<1;i++ ) |
nikapov | 0:704c89673b57 | 6155 | { |
nikapov | 0:704c89673b57 | 6156 | for (j=0; j<numberOfByteForDimension;j++ ) |
nikapov | 0:704c89673b57 | 6157 | { |
nikapov | 0:704c89673b57 | 6158 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_FIFO_DATA_OUT_L+k, &buff[k], 1)) |
nikapov | 0:704c89673b57 | 6159 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 6160 | k++; |
nikapov | 0:704c89673b57 | 6161 | } |
nikapov | 0:704c89673b57 | 6162 | } |
nikapov | 0:704c89673b57 | 6163 | |
nikapov | 0:704c89673b57 | 6164 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 6165 | } |
nikapov | 0:704c89673b57 | 6166 | |
nikapov | 0:704c89673b57 | 6167 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 6168 | * Function Name : mems_status_t LSM6DSL_ACC_GYRO_Get_GetTimestamp(u8_t *buff) |
nikapov | 0:704c89673b57 | 6169 | * Description : Read GetTimestamp output register |
nikapov | 0:704c89673b57 | 6170 | * Input : pointer to [u8_t] |
nikapov | 0:704c89673b57 | 6171 | * Output : GetTimestamp buffer u8_t |
nikapov | 0:704c89673b57 | 6172 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 6173 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 6174 | mems_status_t LSM6DSL_ACC_GYRO_Get_GetTimestamp(void *handle, u8_t *buff) |
nikapov | 0:704c89673b57 | 6175 | { |
nikapov | 0:704c89673b57 | 6176 | u8_t i, j, k; |
nikapov | 0:704c89673b57 | 6177 | u8_t numberOfByteForDimension; |
nikapov | 0:704c89673b57 | 6178 | |
nikapov | 0:704c89673b57 | 6179 | numberOfByteForDimension=3/1; |
nikapov | 0:704c89673b57 | 6180 | |
nikapov | 0:704c89673b57 | 6181 | k=0; |
nikapov | 0:704c89673b57 | 6182 | for (i=0; i<1;i++ ) |
nikapov | 0:704c89673b57 | 6183 | { |
nikapov | 0:704c89673b57 | 6184 | for (j=0; j<numberOfByteForDimension;j++ ) |
nikapov | 0:704c89673b57 | 6185 | { |
nikapov | 0:704c89673b57 | 6186 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_TIMESTAMP0_REG+k, &buff[k], 1)) |
nikapov | 0:704c89673b57 | 6187 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 6188 | k++; |
nikapov | 0:704c89673b57 | 6189 | } |
nikapov | 0:704c89673b57 | 6190 | } |
nikapov | 0:704c89673b57 | 6191 | |
nikapov | 0:704c89673b57 | 6192 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 6193 | } |
nikapov | 0:704c89673b57 | 6194 | |
nikapov | 0:704c89673b57 | 6195 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 6196 | * Function Name : mems_status_t LSM6DSL_ACC_GYRO_Get_GetStepCounter(u8_t *buff) |
nikapov | 0:704c89673b57 | 6197 | * Description : Read GetStepCounter output register |
nikapov | 0:704c89673b57 | 6198 | * Input : pointer to [u8_t] |
nikapov | 0:704c89673b57 | 6199 | * Output : GetStepCounter buffer u8_t |
nikapov | 0:704c89673b57 | 6200 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 6201 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 6202 | mems_status_t LSM6DSL_ACC_GYRO_Get_GetStepCounter(void *handle, u8_t *buff) |
nikapov | 0:704c89673b57 | 6203 | { |
nikapov | 0:704c89673b57 | 6204 | u8_t i, j, k; |
nikapov | 0:704c89673b57 | 6205 | u8_t numberOfByteForDimension; |
nikapov | 0:704c89673b57 | 6206 | |
nikapov | 0:704c89673b57 | 6207 | numberOfByteForDimension=2/1; |
nikapov | 0:704c89673b57 | 6208 | |
nikapov | 0:704c89673b57 | 6209 | k=0; |
nikapov | 0:704c89673b57 | 6210 | for (i=0; i<1;i++ ) |
nikapov | 0:704c89673b57 | 6211 | { |
nikapov | 0:704c89673b57 | 6212 | for (j=0; j<numberOfByteForDimension;j++ ) |
nikapov | 0:704c89673b57 | 6213 | { |
nikapov | 0:704c89673b57 | 6214 | if( !LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_STEP_COUNTER_L+k, &buff[k], 1)) |
nikapov | 0:704c89673b57 | 6215 | return MEMS_ERROR; |
nikapov | 0:704c89673b57 | 6216 | k++; |
nikapov | 0:704c89673b57 | 6217 | } |
nikapov | 0:704c89673b57 | 6218 | } |
nikapov | 0:704c89673b57 | 6219 | |
nikapov | 0:704c89673b57 | 6220 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 6221 | } |
nikapov | 0:704c89673b57 | 6222 | |
nikapov | 0:704c89673b57 | 6223 | /******************************************************************************* |
nikapov | 0:704c89673b57 | 6224 | * Function Name : LSM6DSL_ACC_GYRO_W_PedoThreshold(void *handle, u8_t newValue) |
nikapov | 0:704c89673b57 | 6225 | * Description : Set accelerometer threshold for pedometer |
nikapov | 0:704c89673b57 | 6226 | * Input : pointer to [u8_t] |
nikapov | 0:704c89673b57 | 6227 | * Output : None |
nikapov | 0:704c89673b57 | 6228 | * Return : Status [MEMS_ERROR, MEMS_SUCCESS] |
nikapov | 0:704c89673b57 | 6229 | *******************************************************************************/ |
nikapov | 0:704c89673b57 | 6230 | mems_status_t LSM6DSL_ACC_GYRO_W_PedoThreshold(void *handle, u8_t newValue) |
nikapov | 0:704c89673b57 | 6231 | { |
nikapov | 0:704c89673b57 | 6232 | u8_t value; |
nikapov | 0:704c89673b57 | 6233 | |
nikapov | 0:704c89673b57 | 6234 | /* Open Embedded Function Register page*/ |
nikapov | 0:704c89673b57 | 6235 | LSM6DSL_ACC_GYRO_W_EmbeddedAccess(handle, LSM6DSL_ACC_GYRO_EMBEDDED_ACCESS_ENABLED); |
nikapov | 0:704c89673b57 | 6236 | |
nikapov | 0:704c89673b57 | 6237 | /* read current value */ |
nikapov | 0:704c89673b57 | 6238 | LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_CONFIG_PEDO_THS_MIN, &value, 1); |
nikapov | 0:704c89673b57 | 6239 | |
nikapov | 0:704c89673b57 | 6240 | value &= ~0x1F; |
nikapov | 0:704c89673b57 | 6241 | value |= (newValue & 0x1F); |
nikapov | 0:704c89673b57 | 6242 | |
nikapov | 0:704c89673b57 | 6243 | /* write new value */ |
nikapov | 0:704c89673b57 | 6244 | LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_CONFIG_PEDO_THS_MIN, &value, 1); |
nikapov | 0:704c89673b57 | 6245 | |
nikapov | 0:704c89673b57 | 6246 | /* Close Embedded Function Register page*/ |
nikapov | 0:704c89673b57 | 6247 | LSM6DSL_ACC_GYRO_W_EmbeddedAccess(handle, LSM6DSL_ACC_GYRO_EMBEDDED_ACCESS_DISABLED); |
nikapov | 0:704c89673b57 | 6248 | |
nikapov | 0:704c89673b57 | 6249 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 6250 | } |
nikapov | 0:704c89673b57 | 6251 | |
nikapov | 0:704c89673b57 | 6252 | /************** Use Sensor Hub *******************/ |
nikapov | 0:704c89673b57 | 6253 | /* |
nikapov | 0:704c89673b57 | 6254 | * Program the nine Soft Iron Matrix coefficients. |
nikapov | 0:704c89673b57 | 6255 | * The SI_Matrix buffer must provide coefficients |
nikapov | 0:704c89673b57 | 6256 | * in xx, xy, xz, yx, yy, yz, zx, zy, zz order. |
nikapov | 0:704c89673b57 | 6257 | */ |
nikapov | 0:704c89673b57 | 6258 | mems_status_t LSM6DSL_ACC_GYRO_SH_init_SI_Matrix(void *handle, u8_t *SI_matrix) |
nikapov | 0:704c89673b57 | 6259 | { |
nikapov | 0:704c89673b57 | 6260 | /* Open Embedded Function Register page*/ |
nikapov | 0:704c89673b57 | 6261 | LSM6DSL_ACC_GYRO_W_EmbeddedAccess(handle, LSM6DSL_ACC_GYRO_EMBEDDED_ACCESS_ENABLED); |
nikapov | 0:704c89673b57 | 6262 | |
nikapov | 0:704c89673b57 | 6263 | /* Write the Soft Iron Matrix coefficients */ |
nikapov | 0:704c89673b57 | 6264 | LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_MAG_SI_XX, SI_matrix, 9); |
nikapov | 0:704c89673b57 | 6265 | |
nikapov | 0:704c89673b57 | 6266 | /* Close Embedded Function Register page*/ |
nikapov | 0:704c89673b57 | 6267 | LSM6DSL_ACC_GYRO_W_EmbeddedAccess(handle, LSM6DSL_ACC_GYRO_EMBEDDED_ACCESS_DISABLED); |
nikapov | 0:704c89673b57 | 6268 | |
nikapov | 0:704c89673b57 | 6269 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 6270 | } |
nikapov | 0:704c89673b57 | 6271 | |
nikapov | 0:704c89673b57 | 6272 | /* Read a remote device through I2C Sensor Hub Slave 0 */ |
nikapov | 0:704c89673b57 | 6273 | mems_status_t LSM6DSL_ACC_GYRO_SH0_Program(void *handle, u8_t SlvAddr, u8_t Reg, u8_t len) |
nikapov | 0:704c89673b57 | 6274 | { |
nikapov | 0:704c89673b57 | 6275 | /* Open Embedded Function Register page*/ |
nikapov | 0:704c89673b57 | 6276 | LSM6DSL_ACC_GYRO_W_EmbeddedAccess(handle, LSM6DSL_ACC_GYRO_EMBEDDED_ACCESS_ENABLED); |
nikapov | 0:704c89673b57 | 6277 | |
nikapov | 0:704c89673b57 | 6278 | /* Write remote device I2C slave address */ |
nikapov | 0:704c89673b57 | 6279 | SlvAddr |= 0x1; /* Raise the read op bit */ |
nikapov | 0:704c89673b57 | 6280 | LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_SLV0_ADD, &SlvAddr, 1); |
nikapov | 0:704c89673b57 | 6281 | |
nikapov | 0:704c89673b57 | 6282 | /* Write remote device I2C subaddress */ |
nikapov | 0:704c89673b57 | 6283 | LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_SLV0_SUBADD, &Reg, 1); |
nikapov | 0:704c89673b57 | 6284 | |
nikapov | 0:704c89673b57 | 6285 | /* Write number of bytes to read [SLAVE0_CONFIG - 04h ]*/ |
nikapov | 0:704c89673b57 | 6286 | u8_t sl0_cfg = 0; |
nikapov | 0:704c89673b57 | 6287 | sl0_cfg |= 0x00; //00 bit [7-6] : no decimation |
nikapov | 0:704c89673b57 | 6288 | sl0_cfg |= 0x00; //00 bit [5-4] : one sensor |
nikapov | 0:704c89673b57 | 6289 | sl0_cfg |= 0x00; // 0 bit [3] : source mode read disabled |
nikapov | 0:704c89673b57 | 6290 | sl0_cfg |= len & 0x07; // bit [2-0] : number of bytes |
nikapov | 0:704c89673b57 | 6291 | |
nikapov | 0:704c89673b57 | 6292 | LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_SLAVE0_CONFIG, &sl0_cfg, 1); |
nikapov | 0:704c89673b57 | 6293 | |
nikapov | 0:704c89673b57 | 6294 | /* Close Embedded Function Register page*/ |
nikapov | 0:704c89673b57 | 6295 | LSM6DSL_ACC_GYRO_W_EmbeddedAccess(handle, LSM6DSL_ACC_GYRO_EMBEDDED_ACCESS_DISABLED); |
nikapov | 0:704c89673b57 | 6296 | |
nikapov | 0:704c89673b57 | 6297 | /* Enable FUNC */ |
nikapov | 0:704c89673b57 | 6298 | LSM6DSL_ACC_GYRO_W_FUNC_EN(handle, LSM6DSL_ACC_GYRO_FUNC_EN_ENABLED); |
nikapov | 0:704c89673b57 | 6299 | |
nikapov | 0:704c89673b57 | 6300 | /* MASTER_EN */ |
nikapov | 0:704c89673b57 | 6301 | LSM6DSL_ACC_GYRO_W_I2C_MASTER_Enable(handle, LSM6DSL_ACC_GYRO_MASTER_ON_ENABLED); |
nikapov | 0:704c89673b57 | 6302 | |
nikapov | 0:704c89673b57 | 6303 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 6304 | } |
nikapov | 0:704c89673b57 | 6305 | |
nikapov | 0:704c89673b57 | 6306 | /* Read a remote device through I2C Sensor Hub Slave 0 */ |
nikapov | 0:704c89673b57 | 6307 | mems_status_t LSM6DSL_ACC_GYRO_SH0_ReadMem(void *handle, u8_t SlvAddr, u8_t Reg, u8_t *Bufp, u8_t len, u8_t stop) |
nikapov | 0:704c89673b57 | 6308 | { |
nikapov | 0:704c89673b57 | 6309 | LSM6DSL_ACC_GYRO_SENS_HUB_END_t op_cmpl = LSM6DSL_ACC_GYRO_SENS_HUB_END_STILL_ONGOING; |
nikapov | 0:704c89673b57 | 6310 | LSM6DSL_ACC_GYRO_XLDA_t op_update = LSM6DSL_ACC_GYRO_XLDA_NO_DATA_AVAIL; |
nikapov | 0:704c89673b57 | 6311 | u8_t dummy[6]; |
nikapov | 0:704c89673b57 | 6312 | |
nikapov | 0:704c89673b57 | 6313 | LSM6DSL_ACC_GYRO_W_ODR_XL(handle, LSM6DSL_ACC_GYRO_ODR_XL_POWER_DOWN); |
nikapov | 0:704c89673b57 | 6314 | |
nikapov | 0:704c89673b57 | 6315 | LSM6DSL_ACC_GYRO_SH0_Program(handle, SlvAddr, Reg, len); |
nikapov | 0:704c89673b57 | 6316 | |
nikapov | 0:704c89673b57 | 6317 | /* Syncronize the SH with internal trigger (xl) */ |
nikapov | 0:704c89673b57 | 6318 | LSM6DSL_ACC_GYRO_W_ODR_XL(handle, LSM6DSL_ACC_GYRO_ODR_XL_104Hz); |
nikapov | 0:704c89673b57 | 6319 | |
nikapov | 0:704c89673b57 | 6320 | /* Wait until operation is not completed */ |
nikapov | 0:704c89673b57 | 6321 | LSM6DSL_ACC_GYRO_GetRawAccData(handle, dummy); |
nikapov | 0:704c89673b57 | 6322 | do { |
nikapov | 0:704c89673b57 | 6323 | LSM6DSL_ACC_GYRO_R_XLDA(handle, &op_update); |
nikapov | 0:704c89673b57 | 6324 | } while(op_update != LSM6DSL_ACC_GYRO_XLDA_DATA_AVAIL); |
nikapov | 0:704c89673b57 | 6325 | do { |
nikapov | 0:704c89673b57 | 6326 | LSM6DSL_ACC_GYRO_R_SENS_HUB_END(handle, &op_cmpl); |
nikapov | 0:704c89673b57 | 6327 | } while(op_cmpl != LSM6DSL_ACC_GYRO_SENS_HUB_END_OP_COMPLETED); |
nikapov | 0:704c89673b57 | 6328 | |
nikapov | 0:704c89673b57 | 6329 | |
nikapov | 0:704c89673b57 | 6330 | /* Read the result */ |
nikapov | 0:704c89673b57 | 6331 | LSM6DSL_ACC_GYRO_read_reg(handle, LSM6DSL_ACC_GYRO_SENSORHUB1_REG, Bufp, len); |
nikapov | 0:704c89673b57 | 6332 | |
nikapov | 0:704c89673b57 | 6333 | LSM6DSL_ACC_GYRO_W_ODR_XL(handle, LSM6DSL_ACC_GYRO_ODR_XL_POWER_DOWN); |
nikapov | 0:704c89673b57 | 6334 | |
nikapov | 0:704c89673b57 | 6335 | if (stop) { |
nikapov | 0:704c89673b57 | 6336 | /* Stop everything */ |
nikapov | 0:704c89673b57 | 6337 | LSM6DSL_ACC_GYRO_W_FUNC_EN(handle, LSM6DSL_ACC_GYRO_FUNC_EN_DISABLED); |
nikapov | 0:704c89673b57 | 6338 | LSM6DSL_ACC_GYRO_W_I2C_MASTER_Enable(handle, LSM6DSL_ACC_GYRO_MASTER_ON_DISABLED); |
nikapov | 0:704c89673b57 | 6339 | } |
nikapov | 0:704c89673b57 | 6340 | |
nikapov | 0:704c89673b57 | 6341 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 6342 | } |
nikapov | 0:704c89673b57 | 6343 | |
nikapov | 0:704c89673b57 | 6344 | /* Write a remote device through I2C Sensor Hub Slave 0 */ |
nikapov | 0:704c89673b57 | 6345 | mems_status_t LSM6DSL_ACC_GYRO_SH0_WriteByte(void *handle, u8_t SlvAddr, u8_t Reg, u8_t Bufp) |
nikapov | 0:704c89673b57 | 6346 | { |
nikapov | 0:704c89673b57 | 6347 | LSM6DSL_ACC_GYRO_SENS_HUB_END_t op_cmpl = LSM6DSL_ACC_GYRO_SENS_HUB_END_STILL_ONGOING; |
nikapov | 0:704c89673b57 | 6348 | LSM6DSL_ACC_GYRO_XLDA_t op_update = LSM6DSL_ACC_GYRO_XLDA_NO_DATA_AVAIL; |
nikapov | 0:704c89673b57 | 6349 | u8_t dummy[6]; |
nikapov | 0:704c89673b57 | 6350 | |
nikapov | 0:704c89673b57 | 6351 | /* Open Embedded Function Register page*/ |
nikapov | 0:704c89673b57 | 6352 | LSM6DSL_ACC_GYRO_W_EmbeddedAccess(handle, LSM6DSL_ACC_GYRO_EMBEDDED_ACCESS_ENABLED); |
nikapov | 0:704c89673b57 | 6353 | |
nikapov | 0:704c89673b57 | 6354 | /* Write remote device I2C slave address */ |
nikapov | 0:704c89673b57 | 6355 | LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_SLV0_ADD, &SlvAddr, 1); |
nikapov | 0:704c89673b57 | 6356 | |
nikapov | 0:704c89673b57 | 6357 | /* Write remote device I2C subaddress */ |
nikapov | 0:704c89673b57 | 6358 | LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_SLV0_SUBADD, &Reg, 1); |
nikapov | 0:704c89673b57 | 6359 | |
nikapov | 0:704c89673b57 | 6360 | /* Write the data */ |
nikapov | 0:704c89673b57 | 6361 | LSM6DSL_ACC_GYRO_write_reg(handle, LSM6DSL_ACC_GYRO_DATAWRITE_SRC_MODE_SUB_SLV0, &Bufp, 1); |
nikapov | 0:704c89673b57 | 6362 | |
nikapov | 0:704c89673b57 | 6363 | /* Close Embedded Function Register page*/ |
nikapov | 0:704c89673b57 | 6364 | LSM6DSL_ACC_GYRO_W_EmbeddedAccess(handle, LSM6DSL_ACC_GYRO_EMBEDDED_ACCESS_DISABLED); |
nikapov | 0:704c89673b57 | 6365 | |
nikapov | 0:704c89673b57 | 6366 | /* Enable FUNC */ |
nikapov | 0:704c89673b57 | 6367 | LSM6DSL_ACC_GYRO_W_FUNC_EN(handle, LSM6DSL_ACC_GYRO_FUNC_EN_ENABLED); |
nikapov | 0:704c89673b57 | 6368 | |
nikapov | 0:704c89673b57 | 6369 | /* Enable PULL_UP_EN and MASTER_EN */ |
nikapov | 0:704c89673b57 | 6370 | //LSM6DSL_ACC_GYRO_W_PULL_UP_EN(handle, LSM6DSL_ACC_GYRO_PULL_UP_EN_ENABLED); |
nikapov | 0:704c89673b57 | 6371 | LSM6DSL_ACC_GYRO_W_I2C_MASTER_Enable(handle, LSM6DSL_ACC_GYRO_MASTER_ON_ENABLED); |
nikapov | 0:704c89673b57 | 6372 | |
nikapov | 0:704c89673b57 | 6373 | /* Syncronize the SH with internal trigger (xl) */ |
nikapov | 0:704c89673b57 | 6374 | LSM6DSL_ACC_GYRO_W_ODR_XL(handle, LSM6DSL_ACC_GYRO_ODR_XL_104Hz); |
nikapov | 0:704c89673b57 | 6375 | |
nikapov | 0:704c89673b57 | 6376 | /* Wait until operation is not completed */ |
nikapov | 0:704c89673b57 | 6377 | LSM6DSL_ACC_GYRO_GetRawAccData(handle, dummy); |
nikapov | 0:704c89673b57 | 6378 | do { |
nikapov | 0:704c89673b57 | 6379 | LSM6DSL_ACC_GYRO_R_XLDA(handle, &op_update); |
nikapov | 0:704c89673b57 | 6380 | } while(op_update != LSM6DSL_ACC_GYRO_XLDA_DATA_AVAIL); |
nikapov | 0:704c89673b57 | 6381 | do { |
nikapov | 0:704c89673b57 | 6382 | LSM6DSL_ACC_GYRO_R_SENS_HUB_END(handle, &op_cmpl); |
nikapov | 0:704c89673b57 | 6383 | } while(op_cmpl != LSM6DSL_ACC_GYRO_SENS_HUB_END_OP_COMPLETED); |
nikapov | 0:704c89673b57 | 6384 | |
nikapov | 0:704c89673b57 | 6385 | LSM6DSL_ACC_GYRO_W_ODR_XL(handle, LSM6DSL_ACC_GYRO_ODR_XL_POWER_DOWN); |
nikapov | 0:704c89673b57 | 6386 | |
nikapov | 0:704c89673b57 | 6387 | /* Stop everything */ |
nikapov | 0:704c89673b57 | 6388 | LSM6DSL_ACC_GYRO_W_FUNC_EN(handle, LSM6DSL_ACC_GYRO_FUNC_EN_DISABLED); |
nikapov | 0:704c89673b57 | 6389 | LSM6DSL_ACC_GYRO_W_I2C_MASTER_Enable(handle, LSM6DSL_ACC_GYRO_MASTER_ON_DISABLED); |
nikapov | 0:704c89673b57 | 6390 | |
nikapov | 0:704c89673b57 | 6391 | |
nikapov | 0:704c89673b57 | 6392 | return MEMS_SUCCESS; |
nikapov | 0:704c89673b57 | 6393 | } |