Files
QDAC-firmware/app/main.c

98 lines
3.5 KiB
C
Raw Normal View History

2023-12-11 21:45:06 +08:00
/*********************************************************************************************************************
* CH32V307VCT6 Opensourec Library CH32V307VCT6 SDK
* Copyright (c) 2022 SEEKFREE
*
* CH32V307VCT6
*
* CH32V307VCT6
* GPLGNU 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-15 22:50:20 +08:00
#include "zf_common_headfile.h"
#include "gl_headfile.h"
2024-02-15 22:50:20 +08:00
#include "page.h"
#include "by_tiny_frame.h"
2024-01-08 22:08:43 +08:00
#include "by_buzzer.h"
2024-01-31 17:43:48 +08:00
#include "by_led.h"
2024-01-31 17:55:16 +08:00
#include "jj_param.h"
#include "jj_blueteeth.h"
2024-02-23 18:56:53 +08:00
/** 测试完成后移除 **/
2024-02-15 22:50:20 +08:00
#include "by_tiny_frame_parse.h"
2024-02-23 18:56:53 +08:00
#include "by_tiny_frame_pack.h"
uint32_t data_test;
2024-02-23 18:56:53 +08:00
/** 测试完成后移除 **/
2024-02-15 22:50:20 +08:00
void test(by_tf_parse_frame_t frame_s, uint8_t status)
{
printf("parse done\r\n");
printf("--cmd: %0.2X\n--reg_addr: %0.4X\n--data: %0.8X\r\n", frame_s.cmd, frame_s.reg_addr, frame_s.data);
if (status) {
printf("noooooooo!\r\n");
} else {
printf("hhhhhhok\r\n");
}
}
int main(void)
2023-12-11 21:45:06 +08:00
{
2024-01-07 17:20:10 +08:00
clock_init(SYSTEM_CLOCK_144M);
system_delay_init();
debug_init();
2024-01-16 20:03:21 +08:00
mt9v03x_init();
ips200_init(IPS200_TYPE_SPI);
2024-01-31 17:43:48 +08:00
by_led_init();
2024-03-02 18:17:30 +08:00
// by_buzzer_init();
by_button_init();
2024-01-31 17:43:48 +08:00
2024-01-07 16:58:53 +08:00
jj_bt_init();
jj_param_eeprom_init();
2024-01-31 17:55:16 +08:00
Page_Init();
2024-03-02 18:17:30 +08:00
pit_ms_init(TIM1_PIT, 1);
2024-01-31 17:55:16 +08:00
2024-02-15 22:50:20 +08:00
by_tiny_frame_init();
printf("start running\r\n");
2024-03-02 18:17:30 +08:00
tiny_frame_param[0].f32 = 100.5f;
// by_tiny_frame_read(0x0D, 0x4059, &data_test);
while (1) {
Page_Run();
2024-03-02 18:17:30 +08:00
// by_buzzer_run();
by_tiny_frame_write(0x0D, 0x0000, tiny_frame_param[0].u32);
by_tiny_frame_run();
system_delay_ms(10);
if (mt9v03x_finish_flag) {
2024-01-06 16:22:49 +08:00
// 该操作消耗大概 1970 个 tick折合约 110us
memcpy(mt9v03x_image_copy[0], mt9v03x_image[0], (sizeof(mt9v03x_image_copy) / sizeof(uint8_t)));
// adaptiveThreshold((uint8_t*)mt9v03x_image_copy, (uint8_t*)mt9v03x_image_copy, 188, 120, 7, 17);
// ips200_show_gray_image(0, 0, mt9v03x_image_copy[0], MT9V03X_W, MT9V03X_H, MT9V03X_W, MT9V03X_H, 0);
mt9v03x_finish_flag = 0;
by_led_info_blink();
// state_type = COMMON_STATE;
// img_processing();
// get_corners();
// aim_distance = COMMON_AIM;
// tracking();
// ElementJudge();
// ElementRun();
// MidLineTrack();
2023-12-11 21:45:06 +08:00
}
}
2024-01-16 20:03:21 +08:00
}