将ICM42688改为硬件SPI通讯。

This commit is contained in:
2024-02-22 10:16:24 +08:00
parent 08cbf4ba74
commit 7749d1d7b7
19 changed files with 1391 additions and 468 deletions

View File

@ -6,6 +6,7 @@
void mymain()
{
HAL_UART_Receive_IT(&huart1, (uint8_t *)g_rx_buffer, RXBUFFERSIZE); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
HAL_Delay(2000);
led_init();
tle5012b_init();
@ -17,13 +18,13 @@ void mymain()
float x = 0,y=0;
unsigned int i =0;
HAL_TIM_Base_Start(&htim5); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
while(i<3300*3)
{
Angel_closed_loop(motorx,&FOCStruct_X,-0.2);
Angel_closed_loop(motory,&FOCStruct_Y,2.3);
i++;
}
i=0;
// while(i<3300*3)
// {
// Angel_closed_loop(motorx,&FOCStruct_X,-0.2);
// Angel_closed_loop(motory,&FOCStruct_Y,2.3);
// i++;
// }
// i=0;
LED_ON;
while(1)
{
@ -33,6 +34,7 @@ void mymain()
y = Angle.roll ;
Zitai_closed_loop(motorx,&FOCStruct_X,x);
Zitai_closed_loop(motory,&FOCStruct_Y,-y);
commander_run();
// x = getAngle(motorx);
// y = getAngle(motory);
// printf("%fY%f\n",x,y);
@ -45,7 +47,10 @@ void mymain()
// }
// i++;
//
Data_send(x,y);
// Data_send(x,y);
// HAL_Delay(3);
}
}
}