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
Diff: synthesizer.h
- Revision:
- 0:dc88722ab141
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/synthesizer.h Thu Jul 03 11:59:07 2014 +0000 @@ -0,0 +1,53 @@ +/* + COPYRIGHT(c) 2014 p.igmon +*/ + +#ifndef SYNTHESIZER_H +#define SYNTHESIZER_H + +typedef signed long S32; +typedef signed short S16; +typedef signed char S8; +typedef unsigned long U32; +typedef unsigned short U16; +typedef unsigned char U8; + +#include "mbed.h" +#include "cmsis.h" +#include "stm32f401xe.h" +#include "stm32f4xx.h" +#include "stm32f4xx_hal.h" +#include "stm32f4xx_hal_dma_ex.h" +#include "stm32f4xx_hal_dma.h" +#include "stm32f4xx_hal_i2s.h" + +#include "stm32f4xx_hal_conf.h" +#include "stm32f4xx_it.h" + +#include "error.h" +#include "pinmap.h" +#include "PinNames.h" +#include "gpio_irq_api.h" + +#define I2S2 SPI2 +#define DMA_BUFFERSIZE 2048 + + +typedef enum +{ + DMA_Idle = 0, + DMA_HalfComplete, + DMA_FullComplete, +}BUFFER_StateTypeDef; + +void MX_GPIO_Init(void); +void uGen4_device_init(void); +void init_dmabuffer(void); +void i2s_dma_init(void); + +void wave_generate(void); + +void test_loop(void); +void test_loop2(void); + +#endif