diff options
author | root <root@avtech.domain.avtechpulse.com> | 1970-01-01 09:53:54 +0900 |
---|---|---|
committer | root <root@avtech.domain.avtechpulse.com> | 1970-01-01 09:53:54 +0900 |
commit | 5cb33d9fe5a65b681d1dbe131c9b1c6c0a2156ce (patch) | |
tree | 3df7f784e6104889eea216bb3caaac719aac455c | |
parent | 5116292db1fb4003980fa0a4d828eeb8bbf561bb (diff) |
multi-attenuator control using PCB 244A
-rw-r--r-- | device-functions.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/device-functions.c b/device-functions.c index fb6ea45..f79017c 100644 --- a/device-functions.c +++ b/device-functions.c @@ -319,13 +319,20 @@ int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int w if (attenuator_count(channel) == 1) { // deal with attenuator range - haven't done for CH2 yet - // only implement one attenuator so far (range 0), out of possible max_attens (8!) - // use I2C driver in future? if (atten_range == 0) { set_shiftreg_bits(SR_2, XTR_POS + 1, ONE_BIT, BIT_HIGH); } else { set_shiftreg_bits(SR_2, XTR_POS + 1, ONE_BIT, BIT_LOW); } + } else if (attenuator_count(channel) > 1) { + + // octal relay driver is inverted + if ((atten_range < 0) || (atten_range >= max_attens)) { + I2C_Write(PCF8574+Octal_Relay_Driver,0xff); + } else { + int atten_ctl = ~((1 << (atten_range+1)) - 1); + I2C_Write(PCF8574+Octal_Relay_Driver, atten_ctl); + } } } else { |