添加一些关于midi播放的项目

This commit is contained in:
terryLP
2025-03-24 14:30:56 +08:00
parent e31eb22077
commit 498b4ef13b
699 changed files with 186162 additions and 1 deletions
@@ -0,0 +1,84 @@
/**********************************************************************
*
* 实验名称:PIT定时中断
* 实验平台:NV32开发板
* 板载芯片:NV32F100FL64E
* 实验说明:PIT例程设置定时器1链接至定时器0产生每秒1次的中断.
* 以总线时钟在本例程中为40MHZ,所以说,时钟周期为25ns ,产生一秒的中断需要40,000,000个时钟周期,中断任务函数中LED灯翻转.
*
* 设定PIT0触发1,000,000个周期, PIT1定时器1触发40次,总周期为40,000,000个时钟周期
*
************************************************************************/
#include "common.h"
#include "uart.h"
#include "pit.h"
#include "sysinit.h"
int main (void);
void PIT_Task(void);
/*****************************************************************************
*****************************************************************************/
int main (void)
{
uint8_t u8Ch;
uint32_t u32LoadValue0, u32LoadValue1;
PIT_ConfigType sPITConfig0, sPITConfig1;
PIT_ConfigType *pPIT_Config1 =&sPITConfig1;
PIT_ConfigType *pPIT_Config0 =&sPITConfig0;
/* 系统初始化 */
sysinit();
printf("\nRunning the PIT_demo project.\r\n");
LED0_Init();
/* PIT时钟源为总线时钟 */
/* 通道0装载值为 = (1000000-1),通道1装载值为 = (40-1) */
u32LoadValue0 = 0xF423F; /* 通道0装载值 */
u32LoadValue1 = 0x13; /* 通道1装载值 */
/* 配置通道1为链接模式,开启中断并且使能 */
pPIT_Config1->u32LoadValue = u32LoadValue1;
pPIT_Config1->bFreeze = FALSE; //定时器在调试模式下继续运行
pPIT_Config1->bModuleDis = FALSE; //使能定时器模块
pPIT_Config1->bInterruptEn = TRUE; //开启对应通道的IRQ中断
pPIT_Config1->bChainMode = TRUE; //定时器链接到PIT0
pPIT_Config1->bETMerEn = TRUE; //定时器使能
/* 配置通道0, 仅仅使能 */
pPIT_Config0->u32LoadValue = u32LoadValue0;
pPIT_Config0->bFreeze = FALSE; //定时器在调试模式下继续运行
pPIT_Config0->bModuleDis = FALSE; //使能定时器模块
pPIT_Config0->bInterruptEn = FALSE;
pPIT_Config0->bChainMode = FALSE;
pPIT_Config0->bETMerEn = TRUE; //定时器使能
PIT_Init(PIT_CHANNEL0, pPIT_Config0); //初始化PIT模块通道0
PIT_Init(PIT_CHANNEL1, pPIT_Config1); //初始化PIT模块通道1
PIT_SetCallback(PIT_CHANNEL1, PIT_Task); //设置通道1中断回调函数
while(1)
{
}
}
/*****************************************************************************//*!
*
* @PIT中断任务函数
*
* @无输入
*
* @无返回
*
*****************************************************************************/
void PIT_Task(void)
{
LED0_Toggle(); /*!< 闪烁 */
}
/********************************************************************/
@@ -0,0 +1,37 @@
/******************************************************************************
* @brief define interrupt service routines referenced by the vector table.
*
* Note: Only "vectors.c" should include this header file.
*
*******************************************************************************
******************************************************************************/
#ifndef __ISR_H
#define __ISR_H
/* Example */
/*
#undef VECTOR_036
#define VECTOR_036 RTC_Isr
// ISR(s) are defined in your project directory.
extern void RTC_Isr(void);
*/
/*!
* @brief define interrupt service routine for different vectors.
*
*/
#undef VECTOR_038
#define VECTOR_038 PIT_Ch0Isr /*!< Vector 38 points to PIT channel 0 interrupt service routine */
#undef VECTOR_039
#define VECTOR_039 PIT_Ch1Isr /*!< Vector 39 points to PIT channel 1 interrupt service routine */
extern void PIT_Ch1Isr(void);
extern void PIT_Ch0Isr(void);
#endif //__ISR_H
/* End of "isr.h" */