I2S DAC

Source code can be downloaded from source:/Examples/I2S_DAC

Description
This demo example allows to test I2S and DAC Interfaces of the I2S and DAC Extension Board.

From the main.c source file:

Initialization
1     SystemInit();
2     CGU_Init();
Prepare buffer
 1 for (i = 0; i < 360; i++)
 2     {
 3         double res;
 4         int intval;
 5
 6         res = sin((double)i * PI / 180.0);
 7
 8         intval = (int)(res * 511.0) + 512;
 9         if (intval < 0) intval = 0;
10         else if (intval > 1023) intval = 1023;
11         dacbuf[i] = DAC_VALUE(intval);
12
13         intval = (int)(res * 32767.0);
14         i2sbuf[i] = (uint16_t)intval;
15     }
Configure DAC
1     ConfigureDAC(dacbuf, 360, 48000);
Configure I2S audio codec
1     ConfigureTLV320(i2sbuf, 360, 48000);
2
3     while (1)
4     {
5     }

Undefined