void LD_reset(void) //芯片复位 { RST_H(); delay_ms(2); RST_L(); delay_ms(2); RST_H(); delay_ms(2); CS_L(); delay_ms(2); CS_H(); delay_ms(2); }
int AUD_Init(void) { GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD|RCC_APB2Periph_AFIO,ENABLE); GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Pin = AUD_DAT; GPIO_Init(GPIOD, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = AUD_RST; GPIO_Init(GPIOD, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Pin = AUD_BUSY; GPIO_Init(GPIOD, &GPIO_InitStructure); DAT_L(); RST_L(); Delay_Ms(1); // rt_thread_delay(1); RST_H(); // rt_thread_delay(1); Delay_Ms(1); RST_L(); return 0; }
int AUD_Play(uint32_t index) { if( index > MAX_AUD_NUM ) return -1; RST_H(); //rt_thread_delay(1); Delay_Ms(1); RST_L(); //rt_thread_delay(1); Delay_Ms(1); do { DAT_H(); //rt_thread_delay(1); Delay_Ms(1); DAT_L(); //rt_thread_delay(1); Delay_Ms(1); }while(index--); return 0; }