Brushless motor auto startup✌️

This commit is contained in:
but0n 2016-08-20 23:50:22 +08:00
parent 8cfaa6b14b
commit e3f0598f1b
4 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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);