forked from len0rd/rockbox
Added left/right/deemphasis functionality of dac_volume
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1227 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e24a897de4
commit
a8f141978d
2 changed files with 9 additions and 6 deletions
|
@ -16,23 +16,26 @@
|
|||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#include "stdbool.h"
|
||||
#include "i2c.h"
|
||||
#include "debug.h"
|
||||
#include "dac.h"
|
||||
|
||||
int dac_volume(unsigned int volume)
|
||||
int dac_volume(unsigned int left, unsigned int right, bool deemph)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned char buf[3];
|
||||
|
||||
i2c_begin();
|
||||
|
||||
if(volume > 0x38)
|
||||
volume = 0x38;
|
||||
if (left > 0x38)
|
||||
left = 0x38;
|
||||
if (right > 0x38)
|
||||
right = 0x38;
|
||||
|
||||
buf[0] = DAC_REG_WRITE | DAC_AVOL;
|
||||
buf[1] = (volume & 0x3f) | 0x40; /* Deemphasis ON */
|
||||
buf[2] = volume & 0x3f;
|
||||
buf[1] = (left & 0x3f) | (deemph ? 0x40 : 0);
|
||||
buf[2] = right & 0x3f;
|
||||
|
||||
/* send read command */
|
||||
if (i2c_write(DAC_DEV_WRITE,buf,3))
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#define DAC_AVOL 2
|
||||
#define DAC_GCFG 3
|
||||
|
||||
extern int dac_volume(unsigned int volume);
|
||||
extern int dac_volume(unsigned int left, unsigned int right, bool deemph);
|
||||
extern int dac_config(int value);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue