Part of MicroGen4 Music Synthesizer Program. (But not test it yet.) I2S ,DMA ,Stereo ,16Bit Dac(PCM1781) See detail: http://www.geocities.jp/micro_diys/index2
Now added generate Saw Wave to DAC function in generate(); You will hear Stereo saw wave sound now.
more info: http://www.geocities.jp/micro_diys/i2s_test_sample/i2s_test_sample.html
main.cpp@1:48f506a7b488, 2017-09-21 (annotated)
- Committer:
- p_igmon
- Date:
- Thu Sep 21 10:20:50 2017 +0000
- Revision:
- 1:48f506a7b488
- Parent:
- 0:dc88722ab141
Added Sample Saw Wave in Function Generate.
; DAC PCM1781 Can Output Saw Wave now.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
p_igmon | 0:dc88722ab141 | 1 | /* |
p_igmon | 0:dc88722ab141 | 2 | COPYRIGHT(c) 2014 p.igmon |
p_igmon | 0:dc88722ab141 | 3 | */ |
p_igmon | 0:dc88722ab141 | 4 | |
p_igmon | 0:dc88722ab141 | 5 | #include "synthesizer.h" |
p_igmon | 0:dc88722ab141 | 6 | |
p_igmon | 0:dc88722ab141 | 7 | Serial pc(SERIAL_TX, SERIAL_RX); |
p_igmon | 0:dc88722ab141 | 8 | |
p_igmon | 0:dc88722ab141 | 9 | DigitalOut myled(LED1); |
p_igmon | 0:dc88722ab141 | 10 | |
p_igmon | 0:dc88722ab141 | 11 | extern S16 * DMA_Buffer; |
p_igmon | 0:dc88722ab141 | 12 | extern __IO BUFFER_StateTypeDef BufferOffset; |
p_igmon | 0:dc88722ab141 | 13 | |
p_igmon | 0:dc88722ab141 | 14 | int main(){ |
p_igmon | 0:dc88722ab141 | 15 | uGen4_device_init(); |
p_igmon | 0:dc88722ab141 | 16 | pc.baud(9600); |
p_igmon | 0:dc88722ab141 | 17 | // pc.printf("CPU SystemCoreClock is %d Hz\r\n", SystemCoreClock); |
p_igmon | 0:dc88722ab141 | 18 | |
p_igmon | 0:dc88722ab141 | 19 | i2s_dma_init(); |
p_igmon | 0:dc88722ab141 | 20 | |
p_igmon | 0:dc88722ab141 | 21 | while(1) { |
p_igmon | 0:dc88722ab141 | 22 | if(BufferOffset != DMA_Idle) wave_generate(); |
p_igmon | 0:dc88722ab141 | 23 | |
p_igmon | 0:dc88722ab141 | 24 | /* other work */ |
p_igmon | 0:dc88722ab141 | 25 | |
p_igmon | 0:dc88722ab141 | 26 | } |
p_igmon | 0:dc88722ab141 | 27 | } |
p_igmon | 0:dc88722ab141 | 28 | |
p_igmon | 0:dc88722ab141 | 29 |