use Getopt::Long::Subcommand;
use HADES::TrbNet;
# use ExtUtils::testlib;
-# use lib '/d/jspc37/mimosis/scripts/modules/Mimosis/blib/lib';
+# use lib '/d/jspc37/mimosis/scripts/modules/Mimosis/lib';
# use lib '/d/jspc37/mimosis/scripts';
use Mimosis;
use Time::HiRes qw(usleep sleep);
-use Data::Dump qw(dump);
+use Data::Dump qw(dump dd);
use File::Copy;
return
$dos eq 'jspc29:109' ||
$dos eq 'jspc29:150' ||
+ $dos eq 'jspc29:26' ||
$dos eq 'jspc29:7';
}
my $dos = $ENV{'DAQOPSERVER'};
-
-if ( !dos_valid($dos) ) {
-
- print "\nDAQOPSERVER not defined or wrong value!!\n";
-
- do {
- print("Which setup?\n");
- print("1 Lab317\n");
- print("2 Probestation\n");
- print("3 Lab318\n");
- print("Choose [1,2,3]: ");
-
- my $choice = <STDIN>;
- chomp $choice;
-
- if( $choice ne '2' and
- $choice ne '1' and
- $choice ne '3' ) {
- print("Not a valid input.\n");
- } elsif( $choice eq '1' ) {
- $dos = 'jspc29:150';
- } elsif( $choice eq '2' ) {
- $dos = 'jspc29:109';
- } elsif( $choice eq '3' ) {
- $dos = 'jspc29:7';
- }
- } while !dos_valid($dos);
-
- $ENV{'DAQOPSERVER'} = $dos;
-
- do "mimosis " . join( " ", @ARGV );
-}
+#
+# if ( !dos_valid($dos) ) {
+#
+# print "\nDAQOPSERVER not defined or wrong value!!\n";
+#
+# do {
+# print("Which setup?\n");
+# print("1 Lab317\n");
+# print("2 Probestation\n");
+# print("3 Lab318\n");
+# print("4 Whatever...\n");
+# print("Choose [1,2,3,4]: ");
+#
+# my $choice = <STDIN>;
+# chomp $choice;
+#
+# if( $choice ne '2' and
+# $choice ne '1' and
+# $choice ne '4' and
+# $choice ne '3' ) {
+# print("Not a valid input.\n");
+# } elsif( $choice eq '1' ) {
+# $dos = 'jspc29:150';
+# } elsif( $choice eq '2' ) {
+# $dos = 'jspc29:109';
+# } elsif( $choice eq '3' ) {
+# $dos = 'jspc29:26';
+# } elsif( $choice eq '4' ) {
+# $dos = 'jspc29:7';
+# }
+# } while !dos_valid($dos);
+#
+# $ENV{'DAQOPSERVER'} = $dos;
+#
+# do "mimosis " . join( " ", @ARGV );
+# }
-c, --chipid=CHIPID -> Use ChIPID to address sensor.
-u, --uart -> Use UART backend in TRBNet.
-i, --ikf -> Use settings for IKF proxy.
+ --feb -> Sensor name on FEB
-m, --mbs -> Set stream link for Go4analysis, like mbss://localhost:36789
-d, --i2cspeed=VAL -> Use VAL as I2C speed (default: 30).
-p, --printall -> Print all informations possible.
mask Mask pixels.
pulse Pulse pixles.
load Write registers from configuration file.
- adc
+ analog Select analog pixel.
vnc Open a vncviewer with preconfigured setup.
+ adc Read value of --channel
+ initsca Reset & Activate SCA
For every <command> a short description is accessible with the -h and --help options.
END_MESSAGE
}
+sub help_analog {
+ my $message = <<'END_MESSAGE';
+
+usage: mimosis [GLOBAL OPTIONS] analog XOUT
+
+GLOBAL OPTIONS are:
+ -f, --fpga=FPGA -> Hex address of the FPGA. Defaults to 0xa000.
+ -s, --sleepval1=VAL -> Execute I2C commands with a pause of NUM microseconds in between.
+ -a, --singleaccess -> Select single access mode.
+ -c, --chipid=CHIPID -> Use ChIPID to address sensor.
+ -u, --uart -> Use UART backend in TRBNet.
+ -i, --ikf -> Use settings for IKF proxy.
+ -m, --mbs -> Set stream link for Go4analysis, like mbss://localhost:36789
+ -d, --i2cspeed=VAL -> Use VAL as I2C speed (default: 30).
+ -p, --printall -> Print all informations possible.
+ -h, --help -> Print this or <command> specific help.
+
+EXAMPLES:
+# Select pixel row 3 in range 0-1023:
+mimosis analog 4
+# Reset analog output with 0
+mimosis analog 0
+
+END_MESSAGE
+
+ print $message;
+ exit 0;
+}
+
+
+
sub help_adc {
my $message = <<'END_MESSAGE';
-usage: mimosis adc
+usage: mimosis adc CHANNEL
+
+CHANNELS: BB, TB, PT1, PT2, P6, P7, P8, PMON, IMON, VMON
+
+END_MESSAGE
+
+ print $message;
+ exit 0;
+}
+
+sub help_mux {
+ my $message = <<'END_MESSAGE';
+
+Activates one monitoring channel on VMON, IMON or PMON
+usage: mimosis mux CHANNEL
+
+CHANNELS: NONE,
+ IBIAS,ITHR,IDB,
+ VRESET,VPL,VPH,VPHFINE,VCASP,VCASNA,VCASNB,VCASNC,VCASND,VCASN2,VCLIP,
+ VDD0 .. VDD7, VDA0 .. VDA7, GND0 .. GND7, AGND0 .. AGND7
END_MESSAGE
$modexpPulse,
);
+my ($adcchannel);
handler => sub { Mimosis::set_sleepVal1($_[1]); }
},
'chipid|c=s' => {
- handler => sub { Mimosis::set_chipid($_[1]); },
+ handler => sub { Mimosis::set_chipid(hex($_[1])); },
},
+ 'feb=s' => {
+ handler => sub { Mimosis::set_feb($_[1]); },
+ },
+ 'channel=s' => \$adcchannel,
+
'uart|u=s' => {
handler => sub {
require("/d/jspc37/mimosis/scripts/TrbNetUart.pm");
},
},
+ analog => {
+ options => {
+ 'help|h' => {
+ handler => \&help_analog,
+ }
+ },
+ },
+
+ initsca => {
+ options => {
+ 'help|h' => {
+ handler => \&help_global,
+ }
+ },
+ },
adc => {
options => {
'help|h' => {
handler => \&help_adc,
}
},
- },
-
+ },
+ mux => {
+ options => {
+ 'help|h' => {
+ handler => \&help_mux,
+ }
+ },
+ },
vnc => {
options => {
'help|h' => {
}
-
+if( $res->{subcommand}[0] eq 'initsca' ) {
+ Mimosis::initSca();
+}
if( $res->{subcommand}[0] eq 'load' ) {
}
} elsif( $res->{subcommand}[0] eq 'adc' ) {
+ die "No ADC input provided\n" unless defined $ARGV[-1];
+ my $adcmap = Mimosis::getAdcMap( $ARGV[-1] );
+
+ if (defined $adcmap) {
+
+ my $channel = $adcmap->{channel};
+
+ if ($adcmap->{type} eq "PT") {
+ Mimosis::writeScaRegister(0xae,0x14,0x60,1 << $channel);
+ }
+
+ my $ret = Mimosis::adc_conversion("ADC",$channel);
+ $ret = $ret / 4.000 * $adcmap->{conversion};
+
+ if ($adcmap->{type} eq "PT") {
+ Mimosis::writeScaRegister(0xae,0x14,0x60,0);
+ $ret = ($ret - 100)/0.385;
+ print "$ret °C\n";
+ }
+ else {
+ print "$ret mV\n";
+ }
+ }
+
+} elsif( $res->{subcommand}[0] eq 'mux' ) {
+ my $mux = $ARGV[-1];
+ die "No output provided\n" unless defined $mux;
+
+ Mimosis::mimosis_register_write(0x25,0);
+ Mimosis::mimosis_register_write(0x26,0);
+ Mimosis::mimosis_register_write(0x2F,0); #doesn't do anything on M2
+
+ if ($mux ne "NONE") {
+ my $c = Mimosis::getMuxChannel($mux);
+ Mimosis::mimosis_register_write($c->{MONITOR},$c->{MONVAL});
+ }
- my $adc_addr = 0x48;
- my $adc_wreg = 0x1;
- my $adc_rreg = 0x0;
- my $adc_data = hex $ARGV[-1];
-
- if( defined $ARGV[-1] ) {
-
- printf("Write to ADC: 0x%04x\n", $adc_data);
-
- Mimosis::adc_i2c_command (
- $adc_addr,
- $adc_wreg,
- $adc_data,
- 0, 0, 1
- );
-
- } else {
+
+} elsif( $res->{subcommand}[0] eq 'analog' ) {
- my $adcConv = ( 2 * 4096 ) / 2**16;
-
- # printf( "0x%04x\n",
- printf( "%f\n",
- Mimosis::adc_i2c_command(
- $adc_addr,
- $adc_rreg,
- 0,
- 1,0,1
- )*$adcConv
- );
- }
+ Mimosis::mimosis_analog(
+ xout => hex($ARGV[-1])
+);
} elsif( $res->{subcommand}[0] eq 'vnc' ) {
# Preloaded methods go here.
-
-my $fpga = 0xa000;
+our $mapping = {
+"BUH00" => {id => 0, dat => 0, rst => 31, vmon => 4, imon => 3, pmon => 5, i2c => 1, links => 8},
+"BUH01" => {id => 1, dat => 1, rst => 31, vmon => 1, imon => 0, pmon => 2, i2c => 1, links => 8},
+"BUH10" => {id => 0, dat => 2, rst => 30, vmon => 10, imon => 9, pmon => 11, i2c => 0, links => 8},
+"BUH11" => {id => 1, dat => 3, rst => 30, vmon => 7, imon => 6, pmon => 8, i2c => 0, links => 8},
+"BUV00" => {id => 0, dat => 4, rst => 29, vmon => 16, imon => 15, pmon => 17, i2c => 7, links => 8},
+"BUV01" => {id => 1, dat => 5, rst => 29, vmon => 13, imon => 12, pmon => 14, i2c => 7, links => 4},
+"BUV10" => {id => 0, dat => 6, rst => 27, vmon => 18, imon => 18, pmon => 23, i2c => 5, links => 8},
+"BUV11" => {id => 1, dat => 7, rst => 27, vmon => 18, imon => 18, pmon => 20, i2c => 5, links => 4},
+};
+
+our $adcmapping = {
+"BUBB" => {channel => 30, conversion => 1, type =>"Bias"},
+"BUTB" => {channel => 29, conversion => 7.25, type => "Bias"},
+"BUPT1" => {channel => 25, conversion => 1, type => "PT"},
+"BUPT2" => {channel => 24, conversion => 1, type => "PT"},
+"BUP6" => {channel => 27, conversion => 1, type => "P"},
+"BUP7" => {channel => 26, conversion => 1, type => "P"},
+"BUP8" => {channel => 28, conversion => 1, type => "P"},
+
+"PMON" => {channel => -1, conversion => 2, type => "Bias"},
+"IMON" => {channel => -1, conversion => 2, type => "Bias"},
+"VMON" => {channel => -1, conversion => 2, type => "Bias"},
+};
+
+
+my $fpga = 0xffff;
my $chipid = 0x1;
+my $i2cchannel = 0;
my $singleAccess = 0;
my $sleepVal1 = 1000;
my $sleepVal2 = 1000000;
my $collect_i2c_errors = 0;
-
+my $sensorInfo;
sub set_fpga {
$fpga = $_[0] if defined $_[0];
return $fpga }
sub set_chipid {
- $chipid = $_[0] if defined $_[0];
+ if (defined $_[0]) {
+ $chipid = $_[0] & 0xf;
+ $i2cchannel = -1;
+ $i2cchannel = ($_[0] >> 4) & 0xf if ($_[0] >> 4);
+ }
}
-sub get_chipid { return $chipid; }
+sub get_chipid { return $chipid + ($i2cchannel << 4); }
sub set_singleAccess {
$singleAccess = $_[0] if defined $_[0];
return $fpgaHub }
+sub set_feb {
+ my $code = shift @_;
+ die "FEB sensor name unknown\n" unless $mapping->{$code};
+ $sensorInfo = $mapping->{$code};
+ $sensorInfo->{name} = $code;
+ set_chipid(0x100 + ($sensorInfo->{i2c} << 4) + $sensorInfo->{id});
+ }
sub set_mbsStream {
}
-
sub set_collect_i2c_errors {
$collect_i2c_errors = $_[0] if defined $_[0];
}
sub get_collect_i2c_errors { return $collect_i2c_errors; }
-our %DAC = (
+my %DAC = (
IBIAS => { ADDR => 0x40, MONITOR => 0x25, MONVAL => 1, TYPE => 'CURRENT', RESET => 0x40, },
ITHR => { ADDR => 0x41, MONITOR => 0x25, MONVAL => 3, TYPE => 'CURRENT', RESET => 0x34, },
IDB => { ADDR => 0x42, MONITOR => 0x25, MONVAL => 2, TYPE => 'CURRENT', RESET => 0x1c, },
IBUFBIAS => { ADDR => 0x4e, MONITOR => undef, MONVAL => undef, TYPE => 'CURRENT', RESET => 0x7d, },
);
-
+sub writeScaRegister {
+ my ($tid,$channel,$command,$value) = @_;
+ trb_register_write_mem( $fpga, 0xd602, 0, [($command << 16) + ($channel << 8) + $tid, $value, 0x4], 3);
+ usleep(10000);
+
+}
+
+sub initSca {
+ trb_register_write( $fpga, 0xd600, 0);
+ trb_register_write( $fpga, 0xd604, 0x2); #connect
+ usleep(10000);
+ trb_register_write( $fpga, 0xd604, 0x1); #reset
+ usleep(10000);
+ writeScaRegister(0x11,0,0x2,0xfc000000);
+ writeScaRegister(0x11,0,0x4,0xff000000);
+ writeScaRegister(0x11,0,0x6,0x17000000);
+}
sub mimosis_trb_reset {
}
+sub getMuxChannel {
+ my $chan = shift @_;
+ if(defined $DAC{$chan}) {
+ return $DAC{$chan};
+ }
+
+ my ($p,$i) = $chan =~ /^([A-Z]+)([0-9a-f])$/;
+ die "No valid mux channel provided" unless defined $p && defined $i;
+
+ my $val = hex($i);
+ $val += 0x10 if ($p eq 'VDD');
+ $val += 0x30 if ($p eq 'VDA');
+ $val += 0x00 if ($p eq 'GND');
+ $val += 0x20 if ($p eq 'AGND');
+ my $ret = {MONITOR => 0x2f, MONVAL => $val};
+ return $ret;
+ #IBIAS => { ADDR => 0x40, MONITOR => 0x25, MONVAL => 1, TYPE => 'CURRENT', RESET => 0x40, },
+}
+
+sub getAdcMap {
+ my $chan = shift @_;
+ if($chan eq "PMON" || $chan eq "IMON" || $chan eq "VMON") {
+ $adcmapping->{$chan}{channel} = $sensorInfo->{pmon} if($chan eq "PMON");
+ $adcmapping->{$chan}{channel} = $sensorInfo->{imon} if($chan eq "IMON");
+ $adcmapping->{$chan}{channel} = $sensorInfo->{vmon} if($chan eq "VMON");
+ }
+ else {
+ $chan = substr($sensorInfo->{name},0,2).$chan ;
+ die "No such ADC channel" unless defined $adcmapping->{$chan};
+ }
+ return $adcmapping->{$chan};
+}
+
+sub adc_conversion {
+ my ($type,$dac) = @_;
+
+ if($i2cchannel == -1) {
+ my $adcCmd = $Mimosis::DAC{$dac}{'TYPE'} eq "VOLTAGE" ? $adc_cmdV : $adc_cmdI;
+ adc_i2c_command($adc_addr, $adc_wreg, $adcCmd, 0, 0, 1 );
+ usleep(8000);
+ my $raw = adc_i2c_command($adc_addr, $adc_rreg, 0x0, 1, 0, 1 );
+ return $raw;
+ }
+
+ else {
+ my $channel = $dac;
+ $channel = $sensorInfo->{vmon} if($type eq 'DAC') && $Mimosis::DAC{$dac}{'TYPE'} eq "VOLTAGE";
+ $channel = $sensorInfo->{imon} if($type eq 'DAC') && $Mimosis::DAC{$dac}{'TYPE'} eq "CURRENT";
+ die "no valid ADC channel: $channel" unless ($channel =~ /^\d+$/);
+
+ writeScaRegister(0xac,0x14,0x50,$channel);
+ getSCAStatus() if $printall;
+ writeScaRegister(0xad,0x14,0x02,1);
+ return getSCAStatus() & 0xfff;
+
+ }
+}
sub adc_i2c_command {
$wordByte
) = @_;
- my $regData =
+ my $regData =
( $data << 16 ) + ( $cmd << 8 ) + 0x80 + $addr;
my $regFlag =
sub mimosis_i2c_command {
- my (
- $addr,
- $cmd,
- $data,
- $rw,
- $skipCmd,
- $wordByte
- ) = @_;
-
- # print "$_\t" foreach @_;
- # print "\n";
+ my (
+ $addr,
+ $cmd,
+ $data,
+ $rw,
+ $skipCmd,
+ $wordByte
+ ) = @_;
- my $regData =
- ( $data << 16 ) + ( $cmd << 8 ) + ( $addr << 1 );
-
- my $regFlag =
- ( $rw << 8 ) + ( $skipCmd << 4 ) + $wordByte;
+ if($i2cchannel ==-1) {
+
+ my $regData = ( $data << 16 ) + ( $cmd << 8 ) + ( $addr << 1 );
+ my $regFlag = ( $rw << 8 ) + ( $skipCmd << 4 ) + $wordByte;
my $regReturn;
my $regBuf;
if ( $rw == 0 ) {
+ trb_register_write_mem(
+ $fpga,
+ $trbMimRegWrMem,
+ 0,
+ [ $regFlag, $regData, 0x1 ],
+ 3 );
+ usleep($sleepVal1);
- trb_register_write_mem(
- $fpga,
- $trbMimRegWrMem,
- 0,
- [ $regFlag, $regData, 0x1 ],
- 3 );
-
- usleep($sleepVal1);
-
- $regBuf =
- trb_register_read( $fpga, $trbMimRegRdMem );
+ $regBuf = trb_register_read( $fpga, $trbMimRegRdMem );
} elsif ( $rw == 1 ) {
- trb_register_write_mem(
- $fpga,
- $trbMimRegWrMem,
- 0,
- [ $regFlag, $regData, 0x1 ],
- 3 );
-
- usleep($sleepVal1);
-
- $regBuf =
- trb_register_read( $fpga, $trbMimRegRdMem );
-
- usleep($sleepVal1);
+ trb_register_write_mem(
+ $fpga,
+ $trbMimRegWrMem,
+ 0,
+ [ $regFlag, $regData, 0x1 ],
+ 3 );
+ usleep($sleepVal1);
+ $regBuf = trb_register_read( $fpga, $trbMimRegRdMem );
}
if ( $printall ) {
-
- my $status =
- (($regBuf->{$fpga}//0) >> 16 ) & 0xff;
- printf("I2CStatus: 0x%02x\n", $status);
+ my $status = (($regBuf->{$fpga}//0) >> 16 ) & 0xff;
+ printf("I2CStatus: 0x%02x\n", $status);
}
collect_i2c_errors() if $collect_i2c_errors;
+ if ( $rw == 1) {
+ if ($fpga < 0xfe00) {
+ return $regBuf->{$fpga} & 0xffff;
+ }
+ else {
+ return $regBuf->{(keys %$regBuf)[0]};
+ }
+ }
+ }
+ else {
+ my $regAddr = $addr << 24;
+
+ my $regData = ($cmd << 24) + ($data << 8) if ($skipCmd == 0 && $wordByte == 1);
+ $regData = ($data << 16) if ($skipCmd == 1 && $wordByte == 1);
+ $regData = ($cmd << 24) + ($data << 16) if ($skipCmd == 0 && $wordByte == 0);
+ $regData = ($data << 24) if ($skipCmd == 1 && $wordByte == 0);
+ my $regLength = 3 if ($skipCmd == 0 && $wordByte == 1);
+ $regLength = 2 if ($skipCmd == 1 && $wordByte == 1);
+ $regLength = 2 if ($skipCmd == 0 && $wordByte == 0);
+ $regLength = 1 if ($skipCmd == 1 && $wordByte == 0);
+
+
+ my $channel = ($i2cchannel & 0xf) + 3;
+
+ printf( "Channel: %02x\tAddress %02x\tData %08x\tLength %x\n", $channel, $addr, $regData, $regLength ) if $printall;
+
+ if ( $rw == 0 ) {
+ my $SCAdata = $regLength << 26;
+ writeScaRegister(0x1,$channel,0x30,$SCAdata);
+ getSCAStatus() if $printall;
+
+ writeScaRegister(0x2,$channel,0x40,$regData);
+ getSCAStatus() if $printall;
+
+ writeScaRegister(0x3,$channel,0xda,$regAddr);
+ getSCAStatus() if $printall;
+ }
+
if ( $rw == 1 ) {
-
- if ($fpga < 0xfe00)
- {
- return $regBuf->{$fpga} & 0xffff;
- }
+ writeScaRegister(0xa,$channel,0x86,$regAddr);
+ return (getSCAStatus() >> 16) & 0xff;
}
-
+ }
}
-
+sub getSCAStatus {
+ usleep(1000);
+ my $ret = trb_register_read_mem($fpga,0xd60a,0,3);
+ $fpga = (keys %$ret)[0] if $fpga >= 0xfe00;
+ $ret = $ret->{$fpga};
+
+ printf("Address 0x%02x\tControl 0x%02x\tTransID 0x%02x\tChannel 0x%02x\tError 0x%02x\tLength 0x%02x\tData 0x%08x\n",
+ ($ret->[0] >> 0) & 0xff,
+ ($ret->[0] >> 8) & 0xff,
+ ($ret->[1] >> 0) & 0xff,
+ ($ret->[1] >> 8) & 0xff,
+ ($ret->[1] >> 16) & 0xff,
+ ($ret->[1] >> 24) & 0xff,
+ ($ret->[2]))
+ if $printall;
+ return $ret->[2];
+}
sub mimosis_register_write {
# CHIPID???
trb_register_write_mem(
$fpga, $trbMimRegWrMem, 0,
- [ 0x0, ( $cmd << 8 ) + ( 0x11 << 1 ), 0x1 ],
+ [ 0x0, ( $cmd << 8 ) + ($chipid<< 5) + ( 0x1 << 1 ), 0x1 ],
3 );
usleep($sleepVal1);
mimosis_register_write( $Mimosis::DAC{$dac}{'ADDR'}, $set );
- my $adcCmd =
- $Mimosis::DAC{$dac}{'TYPE'} eq "VOLTAGE" ?
- $adc_cmdV : $adc_cmdI;
-
-
- adc_i2c_command(
- $adc_addr, $adc_wreg, $adcCmd, 0, 0, 1 );
-
- usleep(8000);
-
- my $raw = adc_i2c_command(
- $adc_addr, $adc_rreg, 0x0, 1, 0, 1 );
+ my $raw = adc_conversion("DAC",$dac);
+ $raw = $raw * $adcConv if $i2cchannel == -1;
+ $raw = $raw / 2 if $i2cchannel >= 0;
+
printf( FH "%x\t%d\t%f\n",
- $Mimosis::DAC{$dac}{'ADDR'}, $set, $raw * $adcConv );
+ $Mimosis::DAC{$dac}{'ADDR'}, $set, $raw );
- push ( @resVals, $raw*$adcConv );
+ push ( @resVals, $raw );
push ( @resTicks, $set );
}
my $regAddY = $y/8;
my $regBitY = 1<<( $y % 8 );
- my $regWordY = ($regAddY<<8) + 0x84;
+ my $regWordY = ($regAddY << 8) + 0x84;
mimosis_register_write($regWordY, $regBitY );
if($word82 == $word81) {
- my $addr = ($currRegX<<8) + 0x83;
+ my $addr = ($currRegX << 8) + 0x83;
mimosis_register_write( $addr, $word81 );
mimosis_instr_write( 0x05 );
mimosis_register_write( $addr, 0 );
} else {
- my $addr81 = ($currRegX<<8) + 0x81;
- my $addr82 = ($currRegX<<8) + 0x82;
+ my $addr81 = ($currRegX << 8) + 0x81;
+ my $addr82 = ($currRegX << 8) + 0x82;
mimosis_register_write( $addr81, $word81 );
mimosis_register_write( $addr82, $word82 );
mimosis_loop_vph(
$mbsStream, # source
$fpga, # fpga
+ $chipid,
$singleAccess, # sa
$yLow, # yLow
$yHigh, # yHig
);
}
+sub mimosis_analog {
+ my %params = @_;
+ my $xout = $params{'xout'};
+ #die "Invalid xout. 0 <= xout <= 1024." if ($xout > 1024 || $xout < 0);
+ mimosis_register_write(0x8020, $xout & 0x00FF );
+ mimosis_register_write(0x8021, ($xout & 0xFF00)>>8 );
+}
1;