mirror of
https://github.com/rtlsdrblog/rtl-sdr-blog.git
synced 2024-12-25 10:28:28 +01:00
tuner_fc0012: add manual gain support
Signed-off-by: Steve Markgraf <steve@steve-m.de>
This commit is contained in:
parent
6aec27c6d0
commit
e5afd9894d
@ -679,7 +679,7 @@ int rtlsdr_get_tuner_gains(rtlsdr_dev_t *dev, int *gains)
|
||||
{
|
||||
const int e4k_gains[] = { -10, 15, 40, 65, 90, 115, 140, 165, 190, 215,
|
||||
240, 290, 340, 420, 430, 450, 470, 490 };
|
||||
const int fc0012_gains[] = { 0 /* no gain values */ };
|
||||
const int fc0012_gains[] = { -99, -40, 71, 179, 192 };
|
||||
const int fc0013_gains[] = { -63, 71, 191, 197 };
|
||||
const int fc2580_gains[] = { 0 /* no gain values */ };
|
||||
|
||||
|
@ -307,6 +307,33 @@ exit:
|
||||
|
||||
int fc0012_set_gain(void *dev, int gain)
|
||||
{
|
||||
/* TODO add gain regulation */
|
||||
return 0;
|
||||
int ret;
|
||||
uint8_t tmp = 0;
|
||||
|
||||
ret = fc0012_readreg(dev, 0x13, &tmp);
|
||||
|
||||
/* mask bits off */
|
||||
tmp &= 0xe0;
|
||||
|
||||
switch (gain) {
|
||||
case -99: /* -9.9 dB */
|
||||
tmp |= 0x02;
|
||||
break;
|
||||
case -40: /* -4 dB */
|
||||
break;
|
||||
case 71:
|
||||
tmp |= 0x08; /* 7.1 dB */
|
||||
break;
|
||||
case 179:
|
||||
tmp |= 0x17; /* 17.9 dB */
|
||||
break;
|
||||
case 192:
|
||||
default:
|
||||
tmp |= 0x10; /* 19.2 dB */
|
||||
break;
|
||||
}
|
||||
|
||||
ret = fc0012_writereg(dev, 0x13, tmp);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user