实用文档
/****************************************************************************** *
陀螺仪 MPU6050 IIC CC_Configuration(void);
void GPIO_Configuration(void);
void NVIC_Configuration(void);
void USART1_Configuration(void);
void WWDG_Configuration(void);
void Delay(u32 nTime);
void Delayms(vu32 m);
/* 变量定义 ----------------------------------------------*/
/*******************************/
void DATA_printf(uchar *s,short temp_data)
{
if(temp_data<0){
temp_data=-temp_data;
*s='-';
}
else *s=' ';
*++s =temp_data/100+0x30;
temp_data=temp_data%100; // 取余运算
*++s =temp_data/10+0x30;
temp_data=temp_data%10; // 取余运算
文案大全
实用文档
*++s =temp_data+0x30;
}
/******************************************************************************
*
* Function Name : I2C_GPIO_Config
* Description : Configration Simulation IIC GPIO
* Input : None
* Output : None
Return: None
******************************************************************************
*/
void I2C_GPIO_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
= GPIO_Pin_6;
= GPIO_Speed_50MHz;
= GPIO_Mode_Out_OD;
GPIO_Init(GPIOB, &GPIO_InitStructure);
= GPIO_Pin_7;
= GPIO_Speed_50MHz;
= GPIO_Mode_Out_OD;
GPIO_Init(GPIOB, &GPIO_InitStructure);
}
/******************************************************************************
*
* Function Name : I2C_delay
* Description : Simulation IIC Timing series delay
* Input : None
* Output : None
Return: None
******************************************************************************
*/
void I2C_delay(void)
{
u8 i=30; // 这里可以优化速度 ,经测试最低到 5 还能写入
while(i)
{
i--;
}
文案大全
实用文档
}
vo
mpu6050详细C语言程序 来自淘豆网www.taodocs.com转载请标明出处.