mirror of
https://github.com/avem-labs/Avem.git
synced 2023-09-01 15:18:49 +08:00
Brushless motor auto startup✌️
This commit is contained in:
parent
8cfaa6b14b
commit
e3f0598f1b
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user