GeBalanceBot/Reference/USER/MiniBalance.c

46 lines
1.5 KiB
C
Raw Permalink Normal View History

2024-01-14 19:28:00 +08:00
/***********************************************
<EFBFBD><EFBFBD>˾<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD>Ƽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޹<EFBFBD>˾
Ʒ<EFBFBD>ƣ<EFBFBD>WHEELTEC
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>wheeltec.net
<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD>shop114407458.taobao.com
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ: https://minibalance.aliexpress.com/store/4455017
<EFBFBD><EFBFBD><EFBFBD>5.7
<EFBFBD>޸<EFBFBD>ʱ<EFBFBD>2021-04-29
Brand: WHEELTEC
Website: wheeltec.net
Taobao shop: shop114407458.taobao.com
Aliexpress: https://minibalance.aliexpress.com/store/4455017
Version:5.7
Update<EFBFBD><EFBFBD>2021-04-29
All rights reserved
***********************************************/
#include "stm32f10x.h"
#include "sys.h"
u8 Flag_Stop=1; //<2F><><EFBFBD><EFBFBD>ֹͣ<CDA3><D6B9>־λ<D6BE><CEBB>Ĭ<EFBFBD>Ϲر<CFB9>
int Encoder_Left,Encoder_Right; //<2F><><EFBFBD>ұ<EFBFBD><D2B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
float Angle_Balance,Gyro_Balance; //ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int main(void)
{
MY_NVIC_PriorityGroupConfig(2); //<2F><><EFBFBD><EFBFBD><EFBFBD>жϷ<D0B6><CFB7><EFBFBD>
delay_init(); //<2F><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
JTAG_Set(JTAG_SWD_DISABLE); //<2F>ر<EFBFBD>JTAG<41>ӿ<EFBFBD>
JTAG_Set(SWD_ENABLE); //<2F><><EFBFBD><EFBFBD>SWD<57>ӿ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SWD<57>ӿڵ<D3BF><DAB5><EFBFBD>
KEY_Init(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
MiniBalance_PWM_Init(7199,0); //<2F><>ʼ<EFBFBD><CABC>PWM 10KHZ<48><5A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD> <20><>ΪMiniBalance_PWM_Init(9999,35) 200HZ
Encoder_Init_TIM2(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>
Encoder_Init_TIM4(); //<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2
IIC_Init(); //IIC<49><43>ʼ<EFBFBD><CABC>
OLED_Init(); //OLED<45><44>ʼ<EFBFBD><CABC>
MPU6050_initialize(); //MPU6050<35><30>ʼ<EFBFBD><CABC>
DMP_Init(); //<2F><>ʼ<EFBFBD><CABC>DMP
MiniBalance_EXTI_Init(); //MPU6050 5ms<6D><73>ʱ<EFBFBD>жϳ<D0B6>ʼ<EFBFBD><CABC>
while(1)
{
oled_show(); //<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
}