屏蔽TDK IMU
This commit is contained in:
parent
058d4943cc
commit
aff61940e0
@ -5,7 +5,7 @@
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1232746581911447161" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-699922888415560126" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
@ -16,7 +16,7 @@
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1232746581911447161" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-699922888415560126" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
@ -24,16 +24,6 @@ static int32_t platform_read(void *handle, uint8_t reg, uint8_t *bufp, uint16_t
|
||||
{
|
||||
uint8_t temp = reg;
|
||||
temp |= 0x80;
|
||||
// GPIO_TypeDef *GPIOx;
|
||||
// uint16_t GPIO_Pin;
|
||||
// if (handle == &hspi1) {
|
||||
// GPIOx = SPI1_CS_PORT;
|
||||
// GPIO_Pin = SPI1_CS_PIN;
|
||||
// }
|
||||
// HAL_GPIO_WritePin(GPIOx, GPIO_Pin, GPIO_PIN_RESET);
|
||||
// HAL_SPI_Transmit(handle, &temp, 1, 1000);
|
||||
// HAL_SPI_Receive(handle, bufp, len, 1000);
|
||||
// HAL_GPIO_WritePin(GPIOx, GPIO_Pin, GPIO_PIN_SET);
|
||||
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_RESET);
|
||||
HAL_SPI_Transmit(handle, &temp, 1, 1000);
|
||||
@ -94,12 +84,9 @@ void asm_sample()
|
||||
asm330.x_gyro = 0.001 * asm330lhh_from_fs2000dps_to_mdps(data_raw_angular_rate[0]);
|
||||
asm330.y_gyro = 0.001 * asm330lhh_from_fs2000dps_to_mdps(data_raw_angular_rate[1]);
|
||||
asm330.z_gyro = 0.001 * asm330lhh_from_fs2000dps_to_mdps(data_raw_angular_rate[2]);
|
||||
// angular_rate_mdps[0] = asm330lhh_from_fs2000dps_to_mdps(
|
||||
// data_raw_angular_rate[0]);
|
||||
// angular_rate_mdps[1] = asm330lhh_from_fs2000dps_to_mdps(
|
||||
// data_raw_angular_rate[1]);
|
||||
// angular_rate_mdps[2] = asm330lhh_from_fs2000dps_to_mdps(
|
||||
// data_raw_angular_rate[2]);
|
||||
// angular_rate_mdps[0] = asm330lhh_from_fs2000dps_to_mdps(data_raw_angular_rate[0]);
|
||||
// angular_rate_mdps[1] = asm330lhh_from_fs2000dps_to_mdps(data_raw_angular_rate[1]);
|
||||
// angular_rate_mdps[2] = asm330lhh_from_fs2000dps_to_mdps(data_raw_angular_rate[2]);
|
||||
}
|
||||
|
||||
asm330lhh_xl_flag_data_ready_get(&spi1_dev, ®);
|
||||
|
@ -14,20 +14,21 @@
|
||||
#define IMU_NOT_READY 1
|
||||
#define IMU_LOCK 1
|
||||
#define IMU_UNLOCK 0
|
||||
typedef struct{
|
||||
int16_t x_a; //加速度值原始数据
|
||||
int16_t y_a;
|
||||
int16_t z_a;
|
||||
int16_t x_g; //角速度值原始数据
|
||||
int16_t y_g;
|
||||
int16_t z_g;
|
||||
float x_acc; //转换为真实加速度
|
||||
float y_acc;
|
||||
float z_acc;
|
||||
float x_gyro; //转换为真实角速度
|
||||
float y_gyro;
|
||||
float z_gyro;
|
||||
}asm_value;
|
||||
typedef struct
|
||||
{
|
||||
int16_t x_a; //加速度值原始数据
|
||||
int16_t y_a;
|
||||
int16_t z_a;
|
||||
int16_t x_g; //角速度值原始数据
|
||||
int16_t y_g;
|
||||
int16_t z_g;
|
||||
float x_acc; //转换为真实加速度
|
||||
float y_acc;
|
||||
float z_acc;
|
||||
float x_gyro; //转换为真实角速度
|
||||
float y_gyro;
|
||||
float z_gyro;
|
||||
} asm_value;
|
||||
extern asm_value asm330;
|
||||
|
||||
void user_dev_init();
|
||||
|
@ -55,7 +55,7 @@ void MX_GPIO_Init(void)
|
||||
HAL_GPIO_WritePin(SPI2_CSN_GPIO_Port, SPI2_CSN_Pin, GPIO_PIN_SET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOB, LED0_Pin|LED1_Pin, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOB, LED0_Pin|LED1_Pin, GPIO_PIN_SET);
|
||||
|
||||
/*Configure GPIO pins : PAPin PAPin */
|
||||
GPIO_InitStruct.Pin = PPS_INT_Pin|SPI2_INIT1_Pin;
|
||||
|
@ -104,7 +104,7 @@ int main(void)
|
||||
/* USER CODE BEGIN 2 */
|
||||
HAL_TIM_Base_Start(&htim3);
|
||||
user_dev_init();
|
||||
user_dev_init1();
|
||||
// user_dev_init1();
|
||||
memcpy(IMU_mng_TDK.name, "TDK\0", 4);
|
||||
memcpy(IMU_mng_ST.name, "STM\0", 4);
|
||||
/* enable IMU */
|
||||
|
@ -288,9 +288,9 @@ void USART1_IRQHandler(void)
|
||||
/* USER CODE END USART1_IRQn 0 */
|
||||
HAL_UART_IRQHandler(&huart1);
|
||||
/* USER CODE BEGIN USART1_IRQn 1 */
|
||||
if(__HAL_UART_GET_FLAG(&huart1,UART_FLAG_TC) != RESET)
|
||||
if (__HAL_UART_GET_FLAG(&huart1,UART_FLAG_TC) != RESET)
|
||||
{
|
||||
__HAL_UART_CLEAR_FLAG(&huart1,UART_FLAG_TC);
|
||||
__HAL_UART_CLEAR_FLAG(&huart1, UART_FLAG_TC);
|
||||
U1_DMA_BUSY = 0;
|
||||
}
|
||||
/* USER CODE END USART1_IRQn 1 */
|
||||
@ -340,28 +340,29 @@ void USART2_IRQHandler(void)
|
||||
/* USER CODE BEGIN 1 */
|
||||
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
||||
{
|
||||
if (GPIO_Pin == SPI2_INIT1_Pin && 1 == IMU_mng_TDK.enable)
|
||||
{
|
||||
|
||||
TDK_IMU_INT = 1;
|
||||
if (0 == IMU_mng_TDK.lock)
|
||||
{
|
||||
IMU_mng_TDK.ready = 1;
|
||||
IMU_mng_TDK.gpstime = SYS_TIME.SYS_GPST_TIME;
|
||||
IMU_mng_TDK.utctime = SYS_TIME.SYS_UTC_TIME;
|
||||
IMU_mng_TDK.gpstime.sec = IMU_mng_TDK.utctime.sec = __HAL_TIM_GET_COUNTER(&htim3) / 10000.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, GPIO_PIN_RESET);
|
||||
printf("ERROR -> TDK IMU RD TIME OUT! \r\n");
|
||||
printf("Go to loop! please reboot MCU! \r\n");
|
||||
// while (1)
|
||||
// ;
|
||||
}
|
||||
HAL_GPIO_TogglePin(LED1_GPIO_Port, LED1_Pin);
|
||||
}
|
||||
else if (GPIO_Pin == SPI1_INIT1_Pin && 1 == IMU_mng_ST.enable)
|
||||
// if (GPIO_Pin == SPI2_INIT1_Pin && 1 == IMU_mng_TDK.enable)
|
||||
// {
|
||||
//
|
||||
// TDK_IMU_INT = 1;
|
||||
// if (0 == IMU_mng_TDK.lock)
|
||||
// {
|
||||
// IMU_mng_TDK.ready = 1;
|
||||
// IMU_mng_TDK.gpstime = SYS_TIME.SYS_GPST_TIME;
|
||||
// IMU_mng_TDK.utctime = SYS_TIME.SYS_UTC_TIME;
|
||||
// IMU_mng_TDK.gpstime.sec = IMU_mng_TDK.utctime.sec = __HAL_TIM_GET_COUNTER(&htim3) / 10000.0;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, GPIO_PIN_RESET);
|
||||
// printf("ERROR -> TDK IMU RD TIME OUT! \r\n");
|
||||
// printf("Go to loop! please reboot MCU! \r\n");
|
||||
//// while (1)
|
||||
//// ;
|
||||
// }
|
||||
// HAL_GPIO_TogglePin(LED1_GPIO_Port, LED1_Pin);
|
||||
// }
|
||||
// else
|
||||
if (GPIO_Pin == SPI1_INIT1_Pin && 1 == IMU_mng_ST.enable)
|
||||
{
|
||||
|
||||
ST_IMU_INT = 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user