feat: 新增编码器驱动

This commit is contained in:
bmy
2023-12-13 21:54:20 +08:00
parent eaa7cc0eea
commit ece70343e5
4 changed files with 179 additions and 203 deletions

20
app/by_peripheral_init.c Normal file
View File

@@ -0,0 +1,20 @@
#include "by_peripheral_init.h"
#include "zf_common_headfile.h"
uint8_t potate_button;
void by_gpio_init(void)
{
gpio_init(E10, GPI, GPIO_HIGH, GPI_PULL_UP);
}
void by_exit_init(void)
{
exti_init(E9, EXTI_TRIGGER_FALLING);
exti_init(E11, EXTI_TRIGGER_FALLING);
}
uint8_t by_get_pb_statu(void)
{
uint8_t temp_s = potate_button;
potate_button = 0;
return temp_s;
}

15
app/by_peripheral_init.h Normal file
View File

@@ -0,0 +1,15 @@
#ifndef _BY_PERIPHERAL_INIT_H__
#define _BY_PERIPHERAL_INIT_H__
#include "stdio.h"
#include "ch32v30x.h"
#define POTATE_BUTTOM_PRESS 1
#define POTATE_BUTTOM_FOREWARD 2
#define POTATE_BUTTOM_BACKWARD 3
extern uint8_t potate_button;
extern void by_exit_init(void);
extern void by_gpio_init(void);
extern uint8_t by_get_pb_statu(void);
#endif

334
app/isr.c
View File

@@ -1,73 +1,75 @@
/********************************************************************************************************************* /*********************************************************************************************************************
* CH32V307VCT6 Opensourec Library 即CH32V307VCT6 开源库)是一个基于官方 SDK 接口的第三方开源库 * CH32V307VCT6 Opensourec Library 即CH32V307VCT6 开源库)是一个基于官方 SDK 接口的第三方开源库
* Copyright (c) 2022 SEEKFREE 逐飞科技 * Copyright (c) 2022 SEEKFREE 逐飞科技
* *
* 本文件是CH32V307VCT6 开源库的一部分 * 本文件是CH32V307VCT6 开源库的一部分
* *
* CH32V307VCT6 开源库 是免费软件 * CH32V307VCT6 开源库 是免费软件
* 您可以根据自由软件基金会发布的 GPLGNU General Public License即 GNU通用公共许可证的条款 * 您可以根据自由软件基金会发布的 GPLGNU General Public License即 GNU通用公共许可证的条款
* 即 GPL 的第3版即 GPL3.0)或(您选择的)任何后来的版本,重新发布和/或修改它 * 即 GPL 的第3版即 GPL3.0)或(您选择的)任何后来的版本,重新发布和/或修改它
* *
* 本开源库的发布是希望它能发挥作用,但并未对其作任何的保证 * 本开源库的发布是希望它能发挥作用,但并未对其作任何的保证
* 甚至没有隐含的适销性或适合特定用途的保证 * 甚至没有隐含的适销性或适合特定用途的保证
* 更多细节请参见 GPL * 更多细节请参见 GPL
* *
* 您应该在收到本开源库的同时收到一份 GPL 的副本 * 您应该在收到本开源库的同时收到一份 GPL 的副本
* 如果没有,请参阅<https://www.gnu.org/licenses/> * 如果没有,请参阅<https://www.gnu.org/licenses/>
* *
* 额外注明: * 额外注明:
* 本开源库使用 GPL3.0 开源许可证协议 以上许可申明为译文版本 * 本开源库使用 GPL3.0 开源许可证协议 以上许可申明为译文版本
* 许可申明英文版在 libraries/doc 文件夹下的 GPL3_permission_statement.txt 文件中 * 许可申明英文版在 libraries/doc 文件夹下的 GPL3_permission_statement.txt 文件中
* 许可证副本在 libraries 文件夹下 即该文件夹下的 LICENSE 文件 * 许可证副本在 libraries 文件夹下 即该文件夹下的 LICENSE 文件
* 欢迎各位使用并传播本程序 但修改内容时必须保留逐飞科技的版权声明(即本声明) * 欢迎各位使用并传播本程序 但修改内容时必须保留逐飞科技的版权声明(即本声明)
* *
* 文件名称 isr * 文件名称 isr
* 公司名称 成都逐飞科技有限公司 * 公司名称 成都逐飞科技有限公司
* 版本信息 查看 libraries/doc 文件夹内 version 文件 版本说明 * 版本信息 查看 libraries/doc 文件夹内 version 文件 版本说明
* 开发环境 MounRiver Studio V1.8.1 * 开发环境 MounRiver Studio V1.8.1
* 适用平台 CH32V307VCT6 * 适用平台 CH32V307VCT6
* 店铺链接 https://seekfree.taobao.com/ * 店铺链接 https://seekfree.taobao.com/
* *
* 修改记录 * 修改记录
* 日期 作者 备注 * 日期 作者 备注
* 2022-09-15 大W first version * 2022-09-15 大W first version
********************************************************************************************************************/ ********************************************************************************************************************/
#include "zf_common_headfile.h" #include "zf_common_headfile.h"
void NMI_Handler(void) __attribute__((interrupt())); #include "by_peripheral_init.h"
void NMI_Handler(void) __attribute__((interrupt()));
void HardFault_Handler(void) __attribute__((interrupt())); void HardFault_Handler(void) __attribute__((interrupt()));
void USART1_IRQHandler(void) __attribute__((interrupt())); void USART1_IRQHandler(void) __attribute__((interrupt()));
void USART2_IRQHandler(void) __attribute__((interrupt())); void USART2_IRQHandler(void) __attribute__((interrupt()));
void USART3_IRQHandler(void) __attribute__((interrupt())); void USART3_IRQHandler(void) __attribute__((interrupt()));
void UART4_IRQHandler (void) __attribute__((interrupt())); void UART4_IRQHandler(void) __attribute__((interrupt()));
void UART5_IRQHandler (void) __attribute__((interrupt())); void UART5_IRQHandler(void) __attribute__((interrupt()));
void UART6_IRQHandler (void) __attribute__((interrupt())); void UART6_IRQHandler(void) __attribute__((interrupt()));
void UART7_IRQHandler (void) __attribute__((interrupt())); void UART7_IRQHandler(void) __attribute__((interrupt()));
void UART8_IRQHandler (void) __attribute__((interrupt())); void UART8_IRQHandler(void) __attribute__((interrupt()));
void DVP_IRQHandler (void) __attribute__((interrupt())); void DVP_IRQHandler(void) __attribute__((interrupt()));
//void TIM1_BRK_IRQHandler (void) __attribute__((interrupt())); // void TIM1_BRK_IRQHandler (void) __attribute__((interrupt()));
void TIM1_UP_IRQHandler (void) __attribute__((interrupt())); void TIM1_UP_IRQHandler(void) __attribute__((interrupt()));
//void TIM1_TRG_COM_IRQHandler (void) __attribute__((interrupt())); // void TIM1_TRG_COM_IRQHandler (void) __attribute__((interrupt()));
//void TIM1_CC_IRQHandler (void) __attribute__((interrupt())); // void TIM1_CC_IRQHandler (void) __attribute__((interrupt()));
void TIM2_IRQHandler (void) __attribute__((interrupt())); void TIM2_IRQHandler(void) __attribute__((interrupt()));
void TIM3_IRQHandler (void) __attribute__((interrupt())); void TIM3_IRQHandler(void) __attribute__((interrupt()));
void TIM4_IRQHandler (void) __attribute__((interrupt())); void TIM4_IRQHandler(void) __attribute__((interrupt()));
void TIM5_IRQHandler (void) __attribute__((interrupt())); void TIM5_IRQHandler(void) __attribute__((interrupt()));
void TIM6_IRQHandler (void) __attribute__((interrupt())); void TIM6_IRQHandler(void) __attribute__((interrupt()));
void TIM7_IRQHandler (void) __attribute__((interrupt())); void TIM7_IRQHandler(void) __attribute__((interrupt()));
//void TIM8_BRK_IRQHandler (void) __attribute__((interrupt())); // void TIM8_BRK_IRQHandler (void) __attribute__((interrupt()));
void TIM8_UP_IRQHandler (void) __attribute__((interrupt())); void TIM8_UP_IRQHandler(void) __attribute__((interrupt()));
//void TIM8_TRG_COM_IRQHandler (void) __attribute__((interrupt())); // void TIM8_TRG_COM_IRQHandler (void) __attribute__((interrupt()));
//void TIM8_CC_IRQHandler (void) __attribute__((interrupt())); // void TIM8_CC_IRQHandler (void) __attribute__((interrupt()));
//void TIM9_BRK_IRQHandler (void) __attribute__((interrupt())); // void TIM9_BRK_IRQHandler (void) __attribute__((interrupt()));
void TIM9_UP_IRQHandler (void) __attribute__((interrupt())); void TIM9_UP_IRQHandler(void) __attribute__((interrupt()));
//void TIM9_TRG_COM_IRQHandler (void) __attribute__((interrupt())); // void TIM9_TRG_COM_IRQHandler (void) __attribute__((interrupt()));
//void TIM9_CC_IRQHandler (void) __attribute__((interrupt())); // void TIM9_CC_IRQHandler (void) __attribute__((interrupt()));
//void TIM10_BRK_IRQHandler (void) __attribute__((interrupt())); // void TIM10_BRK_IRQHandler (void) __attribute__((interrupt()));
void TIM10_UP_IRQHandler (void) __attribute__((interrupt())); void TIM10_UP_IRQHandler(void) __attribute__((interrupt()));
//void TIM10_TRG_COM_IRQHandler (void) __attribute__((interrupt())); // void TIM10_TRG_COM_IRQHandler (void) __attribute__((interrupt()));
//void TIM10_CC_IRQHandler (void) __attribute__((interrupt())); // void TIM10_CC_IRQHandler (void) __attribute__((interrupt()));
void EXTI0_IRQHandler(void) __attribute__((interrupt())); void EXTI0_IRQHandler(void) __attribute__((interrupt()));
void EXTI1_IRQHandler(void) __attribute__((interrupt())); void EXTI1_IRQHandler(void) __attribute__((interrupt()));
@@ -79,162 +81,134 @@ void EXTI15_10_IRQHandler(void) __attribute__((interrupt()));
void USART1_IRQHandler(void) void USART1_IRQHandler(void)
{ {
if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET) if (USART_GetITStatus(USART1, USART_IT_RXNE) != RESET) {
{
USART_ClearITPendingBit(USART1, USART_IT_RXNE); USART_ClearITPendingBit(USART1, USART_IT_RXNE);
} }
} }
void USART2_IRQHandler(void) void USART2_IRQHandler(void)
{ {
if(USART_GetITStatus(USART2, USART_IT_RXNE) != RESET) if (USART_GetITStatus(USART2, USART_IT_RXNE) != RESET) {
{
USART_ClearITPendingBit(USART2, USART_IT_RXNE); USART_ClearITPendingBit(USART2, USART_IT_RXNE);
} }
} }
void USART3_IRQHandler(void) void USART3_IRQHandler(void)
{ {
if(USART_GetITStatus(USART3, USART_IT_RXNE) != RESET) if (USART_GetITStatus(USART3, USART_IT_RXNE) != RESET) {
{ #if DEBUG_UART_USE_INTERRUPT // 如果开启 debug 串口中断
#if DEBUG_UART_USE_INTERRUPT // 如果开启 debug 串口中断 debug_interrupr_handler(); // 调用 debug 串口接收处理函数 数据会被 debug 环形缓冲区读取
debug_interrupr_handler(); // 调用 debug 串口接收处理函数 数据会被 debug 环形缓冲区读取 #endif // 如果修改了 DEBUG_UART_INDEX 那这段代码需要放到对应的串口中断去
#endif // 如果修改了 DEBUG_UART_INDEX 那这段代码需要放到对应的串口中断去
USART_ClearITPendingBit(USART3, USART_IT_RXNE); USART_ClearITPendingBit(USART3, USART_IT_RXNE);
} }
} }
void UART4_IRQHandler (void) void UART4_IRQHandler(void)
{ {
if(USART_GetITStatus(UART4, USART_IT_RXNE) != RESET) if (USART_GetITStatus(UART4, USART_IT_RXNE) != RESET) {
{
USART_ClearITPendingBit(UART4, USART_IT_RXNE); USART_ClearITPendingBit(UART4, USART_IT_RXNE);
} }
} }
void UART5_IRQHandler (void) void UART5_IRQHandler(void)
{ {
if(USART_GetITStatus(UART5, USART_IT_RXNE) != RESET) if (USART_GetITStatus(UART5, USART_IT_RXNE) != RESET) {
{
camera_uart_handler(); camera_uart_handler();
USART_ClearITPendingBit(UART5, USART_IT_RXNE); USART_ClearITPendingBit(UART5, USART_IT_RXNE);
} }
} }
void UART6_IRQHandler (void) void UART6_IRQHandler(void)
{ {
if(USART_GetITStatus(UART6, USART_IT_RXNE) != RESET) if (USART_GetITStatus(UART6, USART_IT_RXNE) != RESET) {
{
USART_ClearITPendingBit(UART6, USART_IT_RXNE); USART_ClearITPendingBit(UART6, USART_IT_RXNE);
} }
} }
void UART7_IRQHandler (void) void UART7_IRQHandler(void)
{ {
if(USART_GetITStatus(UART7, USART_IT_RXNE) != RESET) if (USART_GetITStatus(UART7, USART_IT_RXNE) != RESET) {
{
wireless_module_uart_handler(); wireless_module_uart_handler();
USART_ClearITPendingBit(UART7, USART_IT_RXNE); USART_ClearITPendingBit(UART7, USART_IT_RXNE);
} }
} }
void UART8_IRQHandler (void) void UART8_IRQHandler(void)
{ {
if(USART_GetITStatus(UART8, USART_IT_RXNE) != RESET) if (USART_GetITStatus(UART8, USART_IT_RXNE) != RESET) {
{
gps_uart_callback(); gps_uart_callback();
USART_ClearITPendingBit(UART8, USART_IT_RXNE); USART_ClearITPendingBit(UART8, USART_IT_RXNE);
} }
} }
void DVP_IRQHandler(void) void DVP_IRQHandler(void)
{ {
if (DVP->IFR & RB_DVP_IF_FRM_DONE) if (DVP->IFR & RB_DVP_IF_FRM_DONE) {
{
camera_dvp_handler(); camera_dvp_handler();
DVP->IFR &= ~RB_DVP_IF_FRM_DONE; DVP->IFR &= ~RB_DVP_IF_FRM_DONE;
} }
} }
void EXTI0_IRQHandler(void) void EXTI0_IRQHandler(void)
{ {
if(SET == EXTI_GetITStatus(EXTI_Line0)) if (SET == EXTI_GetITStatus(EXTI_Line0)) {
{
EXTI_ClearITPendingBit(EXTI_Line0); EXTI_ClearITPendingBit(EXTI_Line0);
} }
} }
void EXTI1_IRQHandler(void) void EXTI1_IRQHandler(void)
{ {
if(SET == EXTI_GetITStatus(EXTI_Line1)) if (SET == EXTI_GetITStatus(EXTI_Line1)) {
{
EXTI_ClearITPendingBit(EXTI_Line1); EXTI_ClearITPendingBit(EXTI_Line1);
} }
} }
void EXTI2_IRQHandler(void) void EXTI2_IRQHandler(void)
{ {
if(SET == EXTI_GetITStatus(EXTI_Line2)) if (SET == EXTI_GetITStatus(EXTI_Line2)) {
{
EXTI_ClearITPendingBit(EXTI_Line2); EXTI_ClearITPendingBit(EXTI_Line2);
} }
} }
void EXTI3_IRQHandler(void) void EXTI3_IRQHandler(void)
{ {
if(SET == EXTI_GetITStatus(EXTI_Line3)) if (SET == EXTI_GetITStatus(EXTI_Line3)) {
{
EXTI_ClearITPendingBit(EXTI_Line3); EXTI_ClearITPendingBit(EXTI_Line3);
} }
} }
void EXTI4_IRQHandler(void) void EXTI4_IRQHandler(void)
{ {
if(SET == EXTI_GetITStatus(EXTI_Line4)) if (SET == EXTI_GetITStatus(EXTI_Line4)) {
{
EXTI_ClearITPendingBit(EXTI_Line4); EXTI_ClearITPendingBit(EXTI_Line4);
} }
} }
void EXTI9_5_IRQHandler(void) void EXTI9_5_IRQHandler(void)
{ {
if(SET == EXTI_GetITStatus(EXTI_Line5)) if (SET == EXTI_GetITStatus(EXTI_Line5)) {
{
EXTI_ClearITPendingBit(EXTI_Line5); EXTI_ClearITPendingBit(EXTI_Line5);
} }
if(SET == EXTI_GetITStatus(EXTI_Line6)) if (SET == EXTI_GetITStatus(EXTI_Line6)) {
{
EXTI_ClearITPendingBit(EXTI_Line6); EXTI_ClearITPendingBit(EXTI_Line6);
} }
if(SET == EXTI_GetITStatus(EXTI_Line7)) if (SET == EXTI_GetITStatus(EXTI_Line7)) {
{
EXTI_ClearITPendingBit(EXTI_Line7); EXTI_ClearITPendingBit(EXTI_Line7);
} }
if(SET == EXTI_GetITStatus(EXTI_Line8)) if (SET == EXTI_GetITStatus(EXTI_Line8)) {
{
EXTI_ClearITPendingBit(EXTI_Line8); EXTI_ClearITPendingBit(EXTI_Line8);
} }
if(SET == EXTI_GetITStatus(EXTI_Line9)) if (SET == EXTI_GetITStatus(EXTI_Line9)) {
{
EXTI_ClearITPendingBit(EXTI_Line9); EXTI_ClearITPendingBit(EXTI_Line9);
if (SET == gpio_get_level(E10)) {
potate_button = POTATE_BUTTOM_BACKWARD;
} else {
potate_button = POTATE_BUTTOM_FOREWARD;
}
} }
} }
void EXTI15_10_IRQHandler(void) void EXTI15_10_IRQHandler(void)
{ {
if(SET == EXTI_GetITStatus(EXTI_Line10)) if (SET == EXTI_GetITStatus(EXTI_Line10)) {
{
// 此处编写用户代码 (A10/B10..E10) 引脚触发 // 此处编写用户代码 (A10/B10..E10) 引脚触发
@@ -242,18 +216,18 @@ void EXTI15_10_IRQHandler(void)
EXTI_ClearITPendingBit(EXTI_Line10); EXTI_ClearITPendingBit(EXTI_Line10);
} }
if(SET == EXTI_GetITStatus(EXTI_Line11)) if (SET == EXTI_GetITStatus(EXTI_Line11)) {
{
EXTI_ClearITPendingBit(EXTI_Line11); EXTI_ClearITPendingBit(EXTI_Line11);
system_delay_us(200);
if (SET == !gpio_get_level(E11)) {
potate_button = POTATE_BUTTOM_PRESS;
}
} }
if(SET == EXTI_GetITStatus(EXTI_Line12)) if (SET == EXTI_GetITStatus(EXTI_Line12)) {
{
EXTI_ClearITPendingBit(EXTI_Line12); EXTI_ClearITPendingBit(EXTI_Line12);
} }
if(SET == EXTI_GetITStatus(EXTI_Line13)) if (SET == EXTI_GetITStatus(EXTI_Line13)) {
{
// -----------------* ToF INT 更新中断 预置中断处理函数 *----------------- // -----------------* ToF INT 更新中断 预置中断处理函数 *-----------------
tof_module_exti_handler(); tof_module_exti_handler();
// -----------------* ToF INT 更新中断 预置中断处理函数 *----------------- // -----------------* ToF INT 更新中断 预置中断处理函数 *-----------------
@@ -262,17 +236,14 @@ void EXTI15_10_IRQHandler(void)
// 此处编写用户代码 (A13/B13..E13) 引脚触发 // 此处编写用户代码 (A13/B13..E13) 引脚触发
EXTI_ClearITPendingBit(EXTI_Line13); EXTI_ClearITPendingBit(EXTI_Line13);
} }
if(SET == EXTI_GetITStatus(EXTI_Line14)) if (SET == EXTI_GetITStatus(EXTI_Line14)) {
{
// -----------------* DM1XA 光信号 预置中断处理函数 *----------------- // -----------------* DM1XA 光信号 预置中断处理函数 *-----------------
dm1xa_light_callback(); dm1xa_light_callback();
// -----------------* DM1XA 光信号 预置中断处理函数 *----------------- // -----------------* DM1XA 光信号 预置中断处理函数 *-----------------
EXTI_ClearITPendingBit(EXTI_Line14); EXTI_ClearITPendingBit(EXTI_Line14);
} }
if(SET == EXTI_GetITStatus(EXTI_Line15)) if (SET == EXTI_GetITStatus(EXTI_Line15)) {
{
// -----------------* DM1XA 声/反馈信号 预置中断处理函数 *----------------- // -----------------* DM1XA 声/反馈信号 预置中断处理函数 *-----------------
dm1xa_sound_callback(); dm1xa_sound_callback();
// -----------------* DM1XA 声/反馈信号 预置中断处理函数 *----------------- // -----------------* DM1XA 声/反馈信号 预置中断处理函数 *-----------------
@@ -280,108 +251,76 @@ void EXTI15_10_IRQHandler(void)
} }
} }
void TIM1_UP_IRQHandler(void) void TIM1_UP_IRQHandler(void)
{ {
if(TIM_GetITStatus(TIM1, TIM_IT_Update) != RESET) if (TIM_GetITStatus(TIM1, TIM_IT_Update) != RESET) {
{
TIM_ClearITPendingBit(TIM1, TIM_IT_Update); TIM_ClearITPendingBit(TIM1, TIM_IT_Update);
} }
} }
void TIM2_IRQHandler(void) void TIM2_IRQHandler(void)
{ {
if(TIM_GetITStatus(TIM2, TIM_IT_Update) != RESET) if (TIM_GetITStatus(TIM2, TIM_IT_Update) != RESET) {
{ TIM_ClearITPendingBit(TIM2, TIM_IT_Update);
TIM_ClearITPendingBit(TIM2, TIM_IT_Update );
} }
} }
void TIM3_IRQHandler(void) void TIM3_IRQHandler(void)
{ {
if(TIM_GetITStatus(TIM3, TIM_IT_Update) != RESET) if (TIM_GetITStatus(TIM3, TIM_IT_Update) != RESET) {
{ TIM_ClearITPendingBit(TIM3, TIM_IT_Update);
TIM_ClearITPendingBit(TIM3, TIM_IT_Update );
} }
} }
void TIM4_IRQHandler(void) void TIM4_IRQHandler(void)
{ {
if(TIM_GetITStatus(TIM4, TIM_IT_Update) != RESET) if (TIM_GetITStatus(TIM4, TIM_IT_Update) != RESET) {
{ TIM_ClearITPendingBit(TIM4, TIM_IT_Update);
TIM_ClearITPendingBit(TIM4, TIM_IT_Update );
} }
} }
void TIM5_IRQHandler(void) void TIM5_IRQHandler(void)
{ {
if(TIM_GetITStatus(TIM5, TIM_IT_Update) != RESET) if (TIM_GetITStatus(TIM5, TIM_IT_Update) != RESET) {
{ TIM_ClearITPendingBit(TIM5, TIM_IT_Update);
TIM_ClearITPendingBit(TIM5, TIM_IT_Update );
} }
} }
void TIM6_IRQHandler(void) void TIM6_IRQHandler(void)
{ {
if(TIM_GetITStatus(TIM6, TIM_IT_Update) != RESET) if (TIM_GetITStatus(TIM6, TIM_IT_Update) != RESET) {
{ TIM_ClearITPendingBit(TIM6, TIM_IT_Update);
TIM_ClearITPendingBit(TIM6, TIM_IT_Update );
} }
} }
void TIM7_IRQHandler(void) void TIM7_IRQHandler(void)
{ {
if(TIM_GetITStatus(TIM7, TIM_IT_Update) != RESET) if (TIM_GetITStatus(TIM7, TIM_IT_Update) != RESET) {
{ TIM_ClearITPendingBit(TIM7, TIM_IT_Update);
TIM_ClearITPendingBit(TIM7, TIM_IT_Update );
} }
} }
void TIM8_UP_IRQHandler(void) void TIM8_UP_IRQHandler(void)
{ {
if(TIM_GetITStatus(TIM8, TIM_IT_Update) != RESET) if (TIM_GetITStatus(TIM8, TIM_IT_Update) != RESET) {
{
TIM_ClearITPendingBit(TIM8, TIM_IT_Update); TIM_ClearITPendingBit(TIM8, TIM_IT_Update);
} }
} }
void TIM9_UP_IRQHandler(void) void TIM9_UP_IRQHandler(void)
{ {
if(TIM_GetITStatus(TIM9, TIM_IT_Update) != RESET) if (TIM_GetITStatus(TIM9, TIM_IT_Update) != RESET) {
{
TIM_ClearITPendingBit(TIM9, TIM_IT_Update); TIM_ClearITPendingBit(TIM9, TIM_IT_Update);
} }
} }
void TIM10_UP_IRQHandler(void) void TIM10_UP_IRQHandler(void)
{ {
if(TIM_GetITStatus(TIM10, TIM_IT_Update) != RESET) if (TIM_GetITStatus(TIM10, TIM_IT_Update) != RESET) {
{
TIM_ClearITPendingBit(TIM10, TIM_IT_Update); TIM_ClearITPendingBit(TIM10, TIM_IT_Update);
} }
} }
//.section .text.vector_handler, "ax", @progbits //.section .text.vector_handler, "ax", @progbits
// .weak EXTI0_IRQHandler /* EXTI Line 0 */ // .weak EXTI0_IRQHandler /* EXTI Line 0 */
@@ -468,26 +407,23 @@ void TIM10_UP_IRQHandler(void)
// .weak DMA2_Channel11_IRQHandler /* DMA2 Channel 11 */ // .weak DMA2_Channel11_IRQHandler /* DMA2 Channel 11 */
/******************************************************************************* /*******************************************************************************
* Function Name : NMI_Handler * Function Name : NMI_Handler
* Description : This function handles NMI exception. * Description : This function handles NMI exception.
* Input : None * Input : None
* Return : None * Return : None
*******************************************************************************/ *******************************************************************************/
void NMI_Handler(void) void NMI_Handler(void)
{ {
} }
/******************************************************************************* /*******************************************************************************
* Function Name : HardFault_Handler * Function Name : HardFault_Handler
* Description : This function handles Hard Fault exception. * Description : This function handles Hard Fault exception.
* Input : None * Input : None
* Return : None * Return : None
*******************************************************************************/ *******************************************************************************/
void HardFault_Handler(void) void HardFault_Handler(void)
{ {
while (1) while (1) {
{ }
}
} }

View File

@@ -33,6 +33,7 @@
* 2022-09-15 大W first version * 2022-09-15 大W first version
********************************************************************************************************************/ ********************************************************************************************************************/
#include "zf_common_headfile.h" #include "zf_common_headfile.h"
#include "by_peripheral_init.h"
int main (void) int main (void)
@@ -42,15 +43,19 @@ int main (void)
// 此处编写用户代码 例如外设初始化代码等 // 此处编写用户代码 例如外设初始化代码等
ips114_init(); ips114_init();
mt9v03x_init(); by_gpio_init();
by_exit_init();
// mt9v03x_init();
// 此处编写用户代码 例如外设初始化代码等 // 此处编写用户代码 例如外设初始化代码等
while(1) while(1)
{ {
// 此处编写需要循环执行的代码 // 此处编写需要循环执行的代码
if(mt9v03x_finish_flag){ // if(mt9v03x_finish_flag){
ips114_show_gray_image(0, 0, mt9v03x_image[0], 188, 120, 188, 120,0); // ips114_show_gray_image(0, 0, mt9v03x_image[0], 188, 120, 188, 120,0);
} // }
printf("%d\r\n",by_get_pb_statu());
system_delay_ms(100);
// 此处编写需要循环执行的代码 // 此处编写需要循环执行的代码
} }
} }