From e3f0598f1b5e8d0594c69a4d089e85dc3c0e7118 Mon Sep 17 00:00:00 2001 From: but0n Date: Sat, 20 Aug 2016 23:50:22 +0800 Subject: [PATCH] Brushless motor auto startup:v: --- .../Libraries/STM32F10x_StdPeriph_Driver/inc/motor.h | 3 +-- .../Libraries/STM32F10x_StdPeriph_Driver/src/motor.c | 2 +- .../Libraries/STM32F10x_StdPeriph_Driver/src/mpu6050.c | 2 +- src/main.c | 7 ++++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libs/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32F10x_StdPeriph_Driver/inc/motor.h b/libs/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32F10x_StdPeriph_Driver/inc/motor.h index 053aa55..65c1a51 100644 --- a/libs/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32F10x_StdPeriph_Driver/inc/motor.h +++ b/libs/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32F10x_StdPeriph_Driver/inc/motor.h @@ -9,7 +9,6 @@ #define MOTOR_MAX 27360 #define MOTOR_MIN 10080 -void PWM_Init(unsigned short arr, unsigned short psc); //72MHz / (arr + 1)*(psc + 1) - +void motor_PWM_Init(unsigned short arr, unsigned short psc); //72MHz / (arr + 1)*(psc + 1) #endif diff --git a/libs/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32F10x_StdPeriph_Driver/src/motor.c b/libs/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32F10x_StdPeriph_Driver/src/motor.c index b67dfd3..c218a17 100644 --- a/libs/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32F10x_StdPeriph_Driver/src/motor.c +++ b/libs/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32F10x_StdPeriph_Driver/src/motor.c @@ -2,7 +2,7 @@ #include "motor.h" //A7 -void PWM_Init(unsigned short arr, unsigned short psc) { +void motor_PWM_Init(unsigned short arr, unsigned short psc) { RCC->APB1ENR |= 1<<1; //TIM3 enable RCC->APB2ENR |= 1<<2; //GPIOA enable diff --git a/libs/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32F10x_StdPeriph_Driver/src/mpu6050.c b/libs/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32F10x_StdPeriph_Driver/src/mpu6050.c index 3b73042..db8cc86 100644 --- a/libs/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32F10x_StdPeriph_Driver/src/mpu6050.c +++ b/libs/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32F10x_StdPeriph_Driver/src/mpu6050.c @@ -56,7 +56,7 @@ short MPU_GetData(unsigned char REG_Addr) { } void MPU_init() { IIC_init(); - delay(500); + //delay(500); MPU_Sigle_Write(PWR_MGMT_1, 0x00); MPU_Sigle_Write(SMPLRT_DIV, 0x07); MPU_Sigle_Write(CONFIG, 0x06); diff --git a/src/main.c b/src/main.c index f5f529f..0e75e1c 100644 --- a/src/main.c +++ b/src/main.c @@ -101,12 +101,13 @@ void Comput(SixAxis cache) { int main() { initLED(); Key_init(); + motor_PWM_Init(28800,5); - PWM_Init(28800,5); +//Brushless motor auto init MOTOR1 = MOTOR_MAX; - PAUSE(); + delay(3000); MOTOR1 = MOTOR_MIN; - PAUSE(); + delay(8000); uart_init(72, 115200);