代码拉取完成,页面将自动刷新
#include "ADuCM4050.h"
#include "drivers/beep/adi_beep.h"
#include "drivers/pwr/adi_pwr.h"
#include <stdio.h>
#include "GPIO.h"
#include "DELAY.h"
#include "PITCH.h"
#include "MUSIC_NOTE.h"
unsigned char BEEP0_MemorySize[ADI_BEEP_MEMORY_SIZE]; //20b+ADI_SEM_SIZE
ADI_BEEP_HANDLE handle_BEEP0;
void callback_BEEP0(void *pCBParam,uint32_t Event,void *pArg);
uint8_t i=0;
ADI_BEEP_NOTE GYZ[254]=
{
{.frequency=ADI_BEEP_FREQ_A4,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_B4,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_C5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_D5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_B4,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_C5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_C5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_C5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_B4,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_C5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_D5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_B4,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_C5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_C5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_C5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_D5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_E5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_D5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_E5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_D5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_E5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_E5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_D5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_E5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_G5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_E5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_A4,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_B4,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_C5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_D5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_B4,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_C5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_C5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_C5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_B4,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_C5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_D5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_B4,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_C5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_C5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_C5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_D5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_E5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_D5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_E5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_D5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_E5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_E5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_D5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_E5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_G5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_E5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_G5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_E5,.duration=ADI_BEEP_DUR_12_32},
{.frequency=ADI_BEEP_FREQ_G5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_E5,.duration=ADI_BEEP_DUR_12_32},
{.frequency=ADI_BEEP_FREQ_G5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_E5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_G5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_A5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_E5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_G5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_G5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_E5,.duration=ADI_BEEP_DUR_12_32},
{.frequency=ADI_BEEP_FREQ_G5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_E5,.duration=ADI_BEEP_DUR_12_32},
{.frequency=ADI_BEEP_FREQ_G5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_E5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_G5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_A5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_E5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_G5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_G5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_G5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_E5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_D5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_D5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_C5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_E5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_REST,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_D5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_D5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_C5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_A4,.duration=ADI_BEEP_DUR_32_32},
{.frequency=ADI_BEEP_FREQ_REST,.duration=ADI_BEEP_DUR_32_32},
{.frequency=ADI_BEEP_FREQ_REST,.duration=ADI_BEEP_DUR_32_32},
{.frequency=ADI_BEEP_FREQ_REST,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_G5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_G5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_E5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_D5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_D5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_C5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_E5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_REST,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_D5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_D5,.duration=ADI_BEEP_DUR_16_32},
{.frequency=ADI_BEEP_FREQ_C5,.duration=ADI_BEEP_DUR_8_32},
{.frequency=ADI_BEEP_FREQ_A4,.duration=ADI_BEEP_DUR_32_32},
};
void init_PWR_CLK(void)
{
adi_pwr_Init();
adi_pwr_EnableClockSource(ADI_CLOCK_SOURCE_HFXTAL,true);
adi_pwr_EnableClockSource(ADI_CLOCK_SOURCE_LFXTAL,true);
adi_pwr_SetClockDivider(ADI_CLOCK_HCLK,1);
adi_pwr_SetClockDivider(ADI_CLOCK_PCLK,1);
}
void init_BEEP0(void)
{
mux_PINS(0,8,1);
mux_PINS(0,9,1);
adi_beep_Open(ADI_BEEP_DEVID_0,&BEEP0_MemorySize,ADI_BEEP_MEMORY_SIZE,&handle_BEEP0);
adi_beep_RegisterCallback(handle_BEEP0,callback_BEEP0,NULL);
adi_beep_Enable(handle_BEEP0,true);
}
void play_NOTE(ADI_BEEP_NOTE_FREQUENCY f,ADI_BEEP_NOTE_DURATION d)
{
ADI_BEEP_NOTE Notes;
Notes.frequency=f;
Notes.duration=d;
adi_beep_PlayNote(handle_BEEP0,Notes);
adi_beep_Wait(handle_BEEP0);
}
void play_NOTE_Buf(ADI_BEEP_NOTE* Note_Buf,uint8_t size)
{
adi_beep_PlaySequence(handle_BEEP0,Note_Buf,size);
adi_beep_Wait(handle_BEEP0);
}
int main(void)
{
init_BEEP0();
play_NOTE_Buf(GYZ,96);
play_NOTE(ADI_BEEP_FREQ_A5,ADI_BEEP_DUR_16_32);
return 0;
}
void callback_BEEP0(void *pCBParam,uint32_t Event,void *pArg)
{
i++;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。