我使用 unico GUI 将 .ucf 文件转换为 .h。但我无法通过 HAL I2C 函数设置寄存器值。我无法获得任何决策树结果。
- /*
- ******************************************************************************
- * @file LSM6DSOX_configuration.h
- * @author Sensors Software Solution Team
- * @brief This file contains the configuration for LSM6DSOX_configuration.
- *
- ******************************************************************************
- * @attention
- *
- *
© Copyright (c) 2020 STMicroelectronics.- * All rights reserved.
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- */
- /* Define to prevent recursive inclusion -------------------------------------*/
- #ifndef LSM6DSOX_CONFIGURATION_H
- #define LSM6DSOX_CONFIGURATION_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- /* Includes ------------------------------------------------------------------*/
- #include
- #ifndef MEMS_UCF_SHARED_TYPES
- #define MEMS_UCF_SHARED_TYPES
- /** Common data block definition **/
- typedef struct {
- uint8_t address;
- uint8_t data;
- } ucf_line_t;
- #endif /* MEMS_UCF_SHARED_TYPES */
- /** Configuration array generated from Unico Tool **/
- const ucf_line_t LSM6DSOX_configuration[] = {
- {.address = 0x10, .data = 0x00,},
- {.address = 0x11, .data = 0x00,},
- {.address = 0x01, .data = 0x80,},
- {.address = 0x05, .data = 0x00,},
- {.address = 0x17, .data = 0x40,},
- {.address = 0x02, .data = 0x11,},
- {.address = 0x08, .data = 0xEA,},
- {.address = 0x09, .data = 0x52,},
- {.address = 0x09, .data = 0x03,},
- {.address = 0x09, .data = 0x5E,},
- {.address = 0x09, .data = 0x03,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x0A,},
- {.address = 0x02, .data = 0x11,},
- {.address = 0x08, .data = 0xF2,},
- {.address = 0x09, .data = 0x1A,},
- {.address = 0x02, .data = 0x11,},
- {.address = 0x08, .data = 0xFA,},
- {.address = 0x09, .data = 0x3C,},
- {.address = 0x09, .data = 0x03,},
- {.address = 0x09, .data = 0x64,},
- {.address = 0x09, .data = 0x03,},
- {.address = 0x09, .data = 0x70,},
- {.address = 0x09, .data = 0x03,},
- {.address = 0x02, .data = 0x31,},
- {.address = 0x08, .data = 0x3C,},
- {.address = 0x09, .data = 0x01,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x3F,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x0C,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x18,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x01,},
- {.address = 0x09, .data = 0x10,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x1F,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x02, .data = 0x31,},
- {.address = 0x08, .data = 0x64,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x01, .data = 0x00,},
- {.address = 0x12, .data = 0x00,},
- {.address = 0x01, .data = 0x80,},
- {.address = 0x17, .data = 0x40,},
- {.address = 0x02, .data = 0x31,},
- {.address = 0x08, .data = 0x70,},
- {.address = 0x09, .data = 0x00,},
- {.address = 0x09, .data = 0x1A,},
- {.address = 0x09, .data = 0x80,},
- {.address = 0x09, .data = 0xA2,},
- {.address = 0x09, .data = 0xC1,},
- {.address = 0x09, .data = 0xBA,},
- {.address = 0x09, .data = 0x04,},
- {.address = 0x09, .data = 0xE0,},
- {.address = 0x01, .data = 0x80,},
- {.address = 0x17, .data = 0x00,},
- {.address = 0x04, .data = 0x00,},
- {.address = 0x05, .data = 0x10,},
- {.address = 0x02, .data = 0x01,},
- {.address = 0x01, .data = 0x00,},
- {.address = 0x12, .data = 0x44,},
- {.address = 0x01, .data = 0x80,},
- {.address = 0x60, .data = 0x15,},
- {.address = 0x01, .data = 0x00,},
- {.address = 0x10, .data = 0x20,},
- {.address = 0x11, .data = 0x00,},
- {.address = 0x5E, .data = 0x02,},
- {.address = 0x01, .data = 0x80,},
- {.address = 0x0D, .data = 0x01,},
- {.address = 0x01, .data = 0x00,}
- };
- #ifdef __cplusplus
- }
- #endif
- #endif /* LSM6DSOX_CONFIGURATION_H */
- #include
- .
- .
- .
- for(j = 0 ; j < 93 ; j++){
- i2c_buffer[0] = LSM6DSOX_configuration[j].data;
- HAL_I2C_Mem_Write(&hi2c1, 214, LSM6DSOX_configuration[j].address, 1, i2c_buffer, 1, 1000);
- }
- .
- .
- .
- HAL_I2C_Mem_Read (&hi2c1, 214, 0x70, 1, data_rec, 1, 1000); //MLC0_SRC Register
- Dec_Tree_Result = data_rec[0];
0
|
1个回答
|
|
|