본문 바로가기

[AVR]/AT90USB

[ AT90USB1287-EX] MP3(VS1033) 모듈 테스트

[ AT90USB1287-EX] MP3(VS1033) 모듈 테스트




[AT90USB1287-EX] 보드는 VS1033 MP3모듈 을 연결할 수 있어 USB메모리 스틱의 MP3파일을 출력하거나 이더넷을 이용하여 인터넷 라디오 등을 제작할 수 있다.




[AT90USB1287-EX] VS1033 MP3모듈 드라이버 소스코드
//-----------------------------------------------------------------------------
#define VS_DREQ_BIT      BIT6
#define VS_DREQ_PORT     PORTD

#define VS_CS_BIT      BIT4
#define VS_CS_PORT      PORTD

#define VS_XDCS_BIT      BIT5
#define VS_XDCS_PORT     PORTD

#define VS_RST_BIT      BIT7
#define VS_RST_PORT      PORTD


#define VS1003_CS_H()      Sbi(VS_CS_PORT, VS_CS_BIT)
#define VS1003_CS_L()      Cbi(VS_CS_PORT, VS_CS_BIT)

#define vs1003_enable()      VS1003_CS_L()
#define vs1003_disable()     VS1003_CS_H()


#define VS1003_XDCS_H()      Sbi(VS_XDCS_PORT, VS_XDCS_BIT)
#define VS1003_XDCS_L()      Cbi(VS_XDCS_PORT, VS_XDCS_BIT)


#define VS1003_RESET_H()     Sbi(VS_RST_PORT, VS_RST_BIT)
#define VS1003_RESET_L()     Cbi(VS_RST_PORT, VS_RST_BIT)

#define IsVs1003DataReady()     (PIND&VS_DREQ_BIT)

#define VS_SendByte       SPI0_WriteReadByte
#define VS_InitSpi()      SPI0_Init()
#define VS_SpiSpeed_Low()        SPI0_SetSpeed(SPI_SPEED_1MHZ)
#define VS_SpiSpeed_High()     SPI0_SetSpeed(SPI_SPEED_4MHZ)

#define MP3_PORT_INIT()         Sbi(DDRD, (BIT4|BIT5|BIT7));\
           Sbi(PORTD, BIT6);Cbi(DDRD, BIT6);\
              VS1003_CS_H();VS1003_XDCS_H()


반응형