attenuator.c: DAT-31A-S+ has 6th unused bit

So In reality DAT-31A-S+ seems to have steps of 0.5dB, but the LSB
is "defined" to be alwasy 0.  This means we have to multiply the
dB value by 2 (shift one left) to make sure the LSB in 0.5dB steps
remains 0, and to make sure we actually step n steps of 1dB
This commit is contained in:
Harald Welte 2021-04-13 17:19:08 +02:00
parent b4781312f9
commit 2a91fc857b
1 changed files with 4 additions and 0 deletions

View File

@ -68,6 +68,10 @@ int attenuator_set(uint8_t channel, uint8_t stage, uint8_t val_qdb)
if (val > 0x1f)
return -ERANGE;
/* the DAT-31A-SP actually has a B0 which works in half-dB steps,
* but according to the manual it must alsays be 0 */
val = val * 2;
/* The shift register should be loaded while LE is held low to
* prevent the attenuator value from changing as data is
* entered */