?? main.c
字號:
//main.c
//
// This file initializes the system, and then synchronizes the sweeping of the LEDs
// with the playback of the audio sample.
#include "Sample Playback.h"
void main(void)
{
Csample* SamplePtr;
FirstSample = (Csample*)malloc(sizeof(Csample));
//initialize first sample descriptor (sweep sound)
FirstSample->StartAddr = 0x01040000;
FirstSample->CurrentAddr = 0x01040000;
FirstSample->Bytes = 111180;
FirstSample->Next = 0;
// Connect SPORT2B to DAC4 of the 1836
InitDAI();
// This function will configures the codec (the default example uses the
// default settings including a 48kHz sample rate.)
Init1835viaSPI();
// Finally initialize Sport2B to transmits audio data
InitSPORT();
// when the SPORT2 interrupt occurs, call play_sample_ISR.
interrupts (SIG_SP2, play_sample_ISR);
//In VDSP 3.0 SP1, there was an anomaly which caused the interrupt for odd-numbered
// SPORTS to incorrectly be enabled any time the corresponding even-numbered SPORT
// was enabled. This work around disables that odd# interrupt.
interrupts (SIG_SP1, SIG_IGN);
//start_sweep is global semaphore. The audio sample in the flash is accessed
//as a circular buffer in software, so when the pointer reaches the end of the
//sample it is reset to the beginning. When this happens, start_sweep is also
//reset to 1 to indicate that the sample is starting again.
while(1)
{
//Synchronize LED sweeping with sample wrapping
if (start_sweep == 1){
//reset semaphore
start_sweep = 0;
//and sweep LED's up and down [sweep(), which writes to a latch using
//the PP, is constantly interrupted by the SP2 interrupt to fetch
//samples from the flash.
sweep();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -