2023-12-11 21:45:06 +08:00
|
|
|
|
/*********************************************************************************************************************
|
2024-01-04 22:07:13 +08:00
|
|
|
|
* CH32V307VCT6 Opensourec Library 即(CH32V307VCT6 开源库)是一个基于官方 SDK 接口的第三方开源库
|
|
|
|
|
|
* Copyright (c) 2022 SEEKFREE 逐飞科技
|
|
|
|
|
|
*
|
|
|
|
|
|
* 本文件是 CH32V307VCT6 开源库的一部分
|
|
|
|
|
|
*
|
|
|
|
|
|
* CH32V307VCT6 开源库 是免费软件
|
|
|
|
|
|
* 您可以根据自由软件基金会发布的 GPL(GNU General Public License,即 GNU 通用公共许可证)的条款
|
|
|
|
|
|
* 即 GPL 的第 3 版(即 GPL3.0)或(您选择的)任何后来的版本,重新发布和/或修改它
|
|
|
|
|
|
*
|
|
|
|
|
|
* 本开源库的发布是希望它能发挥作用,但并未对其作任何的保证
|
|
|
|
|
|
* 甚至没有隐含的适销性或适合特定用途的保证
|
|
|
|
|
|
* 更多细节请参见 GPL
|
|
|
|
|
|
*
|
|
|
|
|
|
* 您应该在收到本开源库的同时收到一份 GPL 的副本
|
|
|
|
|
|
* 如果没有,请参阅<https://www.gnu.org/licenses/>
|
|
|
|
|
|
*
|
|
|
|
|
|
* 额外注明:
|
|
|
|
|
|
* 本开源库使用 GPL3.0 开源许可证协议 以上许可申明为译文版本
|
|
|
|
|
|
* 许可申明英文版在 libraries/doc 文件夹下的 GPL3_permission_statement.txt 文件中
|
|
|
|
|
|
* 许可证副本在 libraries 文件夹下 即该文件夹下的 LICENSE 文件
|
|
|
|
|
|
* 欢迎各位使用并传播本程序 但修改内容时必须保留逐飞科技的版权声明(即本声明)
|
|
|
|
|
|
********************************************************************************************************************/
|
2024-02-25 11:49:10 +08:00
|
|
|
|
|
|
|
|
|
|
#include "page.h"
|
|
|
|
|
|
#include "page_ui_widget.h"
|
|
|
|
|
|
|
2024-01-08 22:30:20 +08:00
|
|
|
|
#include "jj_param.h"
|
2024-01-16 20:03:21 +08:00
|
|
|
|
#include "jj_motion.h"
|
2024-02-25 11:49:10 +08:00
|
|
|
|
#include "jj_blueteeth.h"
|
|
|
|
|
|
|
2024-01-16 20:03:21 +08:00
|
|
|
|
#include "by_imu.h"
|
2024-02-25 11:49:10 +08:00
|
|
|
|
#include "by_buzzer.h"
|
2024-03-04 15:05:40 +08:00
|
|
|
|
#include "by_frame.h"
|
2024-02-25 11:49:10 +08:00
|
|
|
|
#include "by_rt_button.h"
|
|
|
|
|
|
#include "by_fan_control.h"
|
|
|
|
|
|
|
2023-12-16 11:31:25 +08:00
|
|
|
|
int main(void)
|
2023-12-11 21:45:06 +08:00
|
|
|
|
{
|
2024-03-04 15:07:54 +08:00
|
|
|
|
TYPE_UNION test_data[2];
|
2023-12-24 22:21:15 +08:00
|
|
|
|
clock_init(SYSTEM_CLOCK_120M);
|
2024-01-05 09:13:10 +08:00
|
|
|
|
system_delay_init();
|
2023-12-24 22:21:15 +08:00
|
|
|
|
debug_init();
|
2024-02-07 10:24:11 +08:00
|
|
|
|
|
2024-03-03 19:23:21 +08:00
|
|
|
|
encoder_quad_init(TIM5_ENCOEDER, TIM5_ENCOEDER_MAP0_CH1_A0, TIM5_ENCOEDER_MAP0_CH2_A1);
|
2023-12-21 22:33:36 +08:00
|
|
|
|
ips200_init(IPS200_TYPE_SPI);
|
2024-03-02 16:05:24 +08:00
|
|
|
|
while (imu660ra_init())
|
|
|
|
|
|
;
|
|
|
|
|
|
jj_param_eeprom_init();
|
|
|
|
|
|
jj_bt_init();
|
2024-02-07 10:24:11 +08:00
|
|
|
|
by_rb_init();
|
|
|
|
|
|
by_pwm_init();
|
2024-03-04 22:33:43 +08:00
|
|
|
|
by_buzzer_init();
|
2024-03-04 15:05:40 +08:00
|
|
|
|
by_frame_init();
|
|
|
|
|
|
|
2024-02-07 10:24:11 +08:00
|
|
|
|
Page_Init();
|
2024-03-02 16:05:24 +08:00
|
|
|
|
sport_pid_init();
|
|
|
|
|
|
|
2024-03-02 16:13:54 +08:00
|
|
|
|
pit_ms_init(TIM1_PIT, 1); // 运动解算,bianmaqi
|
2024-01-16 20:03:21 +08:00
|
|
|
|
|
2024-02-25 11:49:10 +08:00
|
|
|
|
printf("ok\r\n");
|
2024-03-04 15:05:40 +08:00
|
|
|
|
|
2024-02-07 10:24:11 +08:00
|
|
|
|
while (1) {
|
|
|
|
|
|
Page_Run();
|
2024-03-04 22:33:43 +08:00
|
|
|
|
by_frame_parse(2, &test_data[0].u32);
|
|
|
|
|
|
// uart_write_byte(UART_8, 0x1F);
|
2024-03-03 19:23:21 +08:00
|
|
|
|
by_buzzer_run();
|
2024-03-02 16:05:24 +08:00
|
|
|
|
jj_bt_run();
|
2024-03-04 22:33:43 +08:00
|
|
|
|
in_pos=test_data[1].f32;
|
|
|
|
|
|
in_angle=test_data[0].f32;
|
|
|
|
|
|
ips200_show_float(40, 40, test_data[0].f32, 4, 1);
|
|
|
|
|
|
ips200_show_float(40, 60, test_data[1].f32, 4, 1);
|
|
|
|
|
|
ips200_show_float(40, 80, in_gyro, 4, 2);
|
|
|
|
|
|
ips200_show_float(40, 100, in_speed, 4, 4);
|
|
|
|
|
|
ips200_show_string(0,120,"outang"); ips200_show_float(80,120,out_angle,4,1);
|
|
|
|
|
|
ips200_show_string(0,140,"outgyr"); ips200_show_float(80,140,out_gyro,4,1);
|
2023-12-11 21:45:06 +08:00
|
|
|
|
}
|
2024-01-16 20:09:12 +08:00
|
|
|
|
}
|