#include "stm32f4xx.h" #include "system_stm32f4xx.h" #include "stm32f4xx_rcc.h" #include "stm32f4xx_gpio.h" #include "delay.h" #include "spi_sd.h" #include "ff.h" #include "diskio.h" #include "mp3codec.h" #include "mp3_config_pins.h" #include "vs1011_rejestry.h" #include "typy_zmiennych.h" #include "integer.h" //typy zmiennych dla fatfs FATFS fatfs; ///* Work area (file system object) for logical drive */ FIL plik; ///* File object */ FRESULT fresult; /* FatFs return code */ UINT zapisanych_bajtow = 0; UINT odczytanych_bajtow = 0; char * buffor = "123456789abcdefghijklmnoprstuwxyz\r\n"; u_int8 buffor2[56000]; //u_int8 buffor3[56000]; u_int8 i=0,k=0; int main( void ) { SystemInit(); SPI_SD_Init(); MP3_CONFIG_PIN(); GPIO_InitTypeDef gpio; // obiekt gpio z konfiguracja portow GPIO RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD,ENABLE); // uruchomienie zegara modulu GPIO GPIO_StructInit(&gpio); // domyslna konfiguracja gpio.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13; // konfigurujemy pin 5 gpio.GPIO_PuPd = GPIO_PuPd_NOPULL; gpio.GPIO_Mode = GPIO_Mode_OUT; gpio.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOD, &gpio); // inicjalizacja modulu GPIOA delay_init( 168 ); delay_ms(10); fresult = f_mount( 0, &fatfs ); if (fresult == FR_OK) { GPIO_SetBits(GPIOD, GPIO_Pin_12); // zapalenie diody sygnalizuje ze nastapilo poprawne zamontowanie karty } fresult = f_open( &plik, "odpal.wav",FA_READ); fresult = f_read(&plik, buffor2, sizeof buffor2, &odczytanych_bajtow); /* Read a chunk of source file */ fresult = f_close(&plik); ustaw_dekoder_mp3(); while(1) { SendStreamForDecode(buffor2,odczytanych_bajtow); } ResetSDIMode(); return 0; } void SysTick_Handler() { disk_timerproc(); }