forked from PA7T/sdr_wspr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first version to set DC2PD preamplifier gain via MCP4725 chip on I2C bus
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
|
||
if [ "$#" -lt "2" ] | ||
then | ||
echo "No arguments supplied" | ||
else | ||
CHIPADDRESS=$1 | ||
dB=$2 | ||
|
||
echo "Setting DC2PD preamplifier at address $CHIPADDRESS to $dB dB gain." | ||
|
||
DAC=`echo "(4095 * ($dB - 7.5))/(55.5 - 7.5)" | bc` | ||
|
||
HIGHBYTE=`echo $(($DAC >> 4))` | ||
LOWBYTE=`echo $((($DAC << 4) & 255))` | ||
|
||
i2cset -y 0 $CHIPADDRESS 0x60 $HIGHBYTE $LOWBYTE i # write 3000 to DAC & EEPROM | ||
fi | ||
|