I am using app_usb_aud_mic_array[sw_usb_audio - usb_audio6.15.2] as base firmware for further devlopment. I am able to control headphone amplifier(CS43L21 mounted on board) gain by writing fairly simple code in AudioHwConfig()
Code: Select all
/*Set DAC gain*/
val = 0b11100000; // 111 -> required gain value
DAC_REGWRITE(8, val);
DAC_REGREAD_ASSERT(8, data, val);
PS. Since I was getting compilation errors like (multiple definition, parallel usage) accessing struct r_i2c and p_gpio in pdm_user.xc, I implemented below way in pdm_user.xc:
Code: Select all
on tile[0] : struct r_i2c _r_i2c = {XS1_PORT_4E};
on tile[0] : out port _p_gpio = XS1_PORT_4F;
#define DAC_REGWRITE(reg, val) {data[0] = val; i2c_master_write_reg(0x4a, reg, data, 1, _r_i2c);}
#define DAC_REGREAD_ASSERT(reg, data, expected) {data[0] = 0xAA; i2c_master_read_reg(0x4a, reg, data, 1, _r_i2c); assert(data[0] == expected);}
What's wrong over here? I can share complete edited source if required.
Thanks,
Shailesh