From 0716b65a3e0732641cfed971f347a70d61b09b4e Mon Sep 17 00:00:00 2001 From: but0n Date: Thu, 22 Sep 2016 20:59:22 +0800 Subject: [PATCH] [MOD]: Enhancement --- .../Libraries/STM32F10x_StdPeriph_Driver/src/i2c.c | 3 ++- src/main.c | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libs/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32F10x_StdPeriph_Driver/src/i2c.c b/libs/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32F10x_StdPeriph_Driver/src/i2c.c index 5aeb07d..737321f 100644 --- a/libs/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32F10x_StdPeriph_Driver/src/i2c.c +++ b/libs/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32F10x_StdPeriph_Driver/src/i2c.c @@ -8,7 +8,8 @@ void delay_us(volatile unsigned int nus) { } void IIC_init() { - RCC->APB2ENR |= 1<<3; //GPIOB enable +// RCC->APB2ENR |= 1<<3; //GPIOB enable + RCC->APB2ENR |= RCC_APB2RSTR_IOPBRST; GPIOB->CRH &= 0x0F0FFFFF; //reset B13 & B15 GPIOB->CRH |= 0x70700000; //Set B13 & B15 b0111 GPIOB->ODR |= 5<<5; diff --git a/src/main.c b/src/main.c index 62c3b85..d32f3e0 100644 --- a/src/main.c +++ b/src/main.c @@ -98,17 +98,21 @@ void Comput(SixAxis cache) { g_Yaw = atan2(2 * (g_q1 * g_q2 + g_q0 * g_q3), g_q0*g_q0 + g_q1*g_q1 - g_q2*g_q2 - g_q3*g_q3) * 57.3; } -#define DEBUG_WIFI +//#define DEBUG_WIFI +#define DEBUG_MPU6050_EULER //Do not comment this, even not work int main() { + SixAxis sourceData; wifi_Config(); - while(0) { +#ifdef DEBUG_WIFI + while(1) { wifi_sendCmd("AT+CIPSEND=0,20"); delay(50); wifi_sendCmd("aki
"); delay(1000); } +#endif initLED(); @@ -119,7 +123,6 @@ int main() { MPU_init(); - SixAxis sourceData; while(1) {