This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

keil mcbstm32f400 codec

I have written the code for cs42l52 codec for keil mcbstm32f400 shown below,i am sure about the other part of my code but there is something wrong with the attached code which i am not able to figure out.I have written the register addresses using the datasheet.Please guide somewhat to correct the code or provide a sample codec program.


uint8_t CS42L52_BEEP_VOL;//=0x07;// uint8_t val
 uint8_t CS42L52_BEEP_FREQ;
 uint8_t CS42L52_BEEP_TONE_CTL;
 //uint8_t CS42L52_BEEP_VOL;
 //uint8_t reg note.pitch;
 //uint8_t val note.duration;


//#define CS42L52_BEEP_VOL 0x1D;

 void Beep(noteInfo note ) {
/* Beep off time 1.23s and volume 0dB */
//Codec_Write(CS42L52_BEEP_VOL, 0x07);
         Codec_Write(0x1D, 0x07);

/* Set beep note and beep duration */
//Codec_Write(CS42L52_BEEP_FREQ,note.pitch | note.duration);
         //Codec_Write(CS42L52_BEEP_FREQ,G5 | ONE_SECOND );
         Codec_Write(0x1C,G5 | ONE_SECOND );

/* play single beep */
//Codec_Write(CS42L52_BEEP_TONE_CTL, 0x40);
         Codec_Write(0x1F, 0x40);

/* Disable beep */
//Codec_Write(CS42L52_BEEP_TONE_CTL, 0x00);
         Codec_Write(0x1F, 0x40);
}