Skip to content

Commit

Permalink
Compatibility to FW rev 0.30
Browse files Browse the repository at this point in the history
  • Loading branch information
Manawyrm committed Jan 16, 2019
1 parent 0ddd7ca commit ab289b5
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 122 deletions.
47 changes: 10 additions & 37 deletions PlutoSDR/IIOHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,49 +10,16 @@ namespace SDRSharp.PlutoSDR
{
class IIOHelper
{
public static bool SetAttribute(Device phy, string Channel, string Attribute, long Value)
public static bool SetAttribute(Device phy, string Channel, string Attribute, string Value, bool direction)
{
/*MessageBox.Show("Channel: " + Channel + " - ");
MessageBox.Show("Attr: " + Attribute);
MessageBox.Show("Val: " + Value);*/

foreach (Channel chn in phy.channels)
{
if (chn.attrs.Count == 0)
continue;

//if (!chn.output)
// continue;

if (chn.id.Equals(Channel))
{
foreach (Attr attr in chn.attrs)
{
//MessageBox.Show("1: " + attr.name + " - 2:" + Attribute);
if (attr.name.CompareTo(Attribute) == 0)
{
attr.write(Value);
return true;
}
}
}
}
/*MessageBox.Show("not found Channel: " + Channel + " - ");
MessageBox.Show("not found Attr: " + Attribute);
MessageBox.Show("not found Val: " + Value);*/

return false;
}
public static bool SetAttribute(Device phy, string Channel, string Attribute, string Value)
{
foreach (Channel chn in phy.channels)
{
if (chn.attrs.Count == 0)
if (chn.output == direction)
continue;

//if (!chn.output)
// continue;

if (chn.id.Equals(Channel))
{
foreach (Attr attr in chn.attrs)
Expand All @@ -68,13 +35,16 @@ public static bool SetAttribute(Device phy, string Channel, string Attribute, st
return false;
}

public static long GetAttribute(Device phy, string Channel, string Attribute)
public static long GetAttribute(Device phy, string Channel, string Attribute, bool direction)
{
foreach (Channel chn in phy.channels)
{
if (chn.attrs.Count == 0)
continue;

if (chn.output == direction)
continue;

if (chn.id.Equals(Channel))
{
foreach (Attr attr in chn.attrs)
Expand All @@ -88,13 +58,16 @@ public static long GetAttribute(Device phy, string Channel, string Attribute)
}
return -1;
}
public static string GetAttributeString(Device phy, string Channel, string Attribute)
public static string GetAttributeString(Device phy, string Channel, string Attribute, bool direction)
{
foreach (Channel chn in phy.channels)
{
if (chn.attrs.Count == 0)
continue;

if (chn.output == direction)
continue;

if (chn.id.Equals(Channel))
{
foreach (Attr attr in chn.attrs)
Expand Down
146 changes: 73 additions & 73 deletions PlutoSDR/PlutoSDRControllerDialog.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions PlutoSDR/PlutoSDRDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public int ManualGain
{
_manualGain = value;
if (_dev != null)
IIOHelper.SetAttribute(_dev, "voltage0", "hardwaregain", value);
IIOHelper.SetAttribute(_dev, "voltage0", "hardwaregain", value.ToString(), true);
}
}

Expand Down Expand Up @@ -130,7 +130,7 @@ public int Bandwidth
_gui.bandwidthLabel.Text = _bandwidth.ToString() + " Hz";
if (_dev != null)
{
IIOHelper.SetAttribute(_dev, "voltage0", "rf_bandwidth", value);
IIOHelper.SetAttribute(_dev, "voltage0", "rf_bandwidth", value.ToString(), true);
}
}
}
Expand All @@ -139,7 +139,7 @@ public string RSSI
{
get
{
return IIOHelper.GetAttributeString(_dev, "voltage0", "rssi");
return IIOHelper.GetAttributeString(_dev, "voltage0", "rssi", true);
}
}

Expand All @@ -155,8 +155,8 @@ public string GainControlMode
{
_gainControlMode = value;
}
IIOHelper.SetAttribute(_dev, "voltage0", "gain_control_mode", value);
IIOHelper.SetAttribute(_dev, "voltage1", "gain_control_mode", value);
IIOHelper.SetAttribute(_dev, "voltage0", "gain_control_mode", value, true);
IIOHelper.SetAttribute(_dev, "voltage1", "gain_control_mode", value, true);
}
}

Expand All @@ -174,7 +174,7 @@ public long Frequency
{
try
{
IIOHelper.SetAttribute(_dev, "altvoltage0", "frequency", _centerFrequency);
IIOHelper.SetAttribute(_dev, "altvoltage0", "frequency", _centerFrequency.ToString(), false);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -250,7 +250,7 @@ private unsafe void ReceiveSamples_sync()
try
{
_buf.refill();

samplesI = _rx0_i.read(_buf);
samplesQ = _rx0_q.read(_buf);

Expand Down
2 changes: 1 addition & 1 deletion PlutoSDR/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SDR#")]
[assembly: AssemblyCopyright("Copyright © Tobias Mädel 2017")]
[assembly: AssemblyCopyright("Copyright © Tobias Mädel 2017-2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand Down
8 changes: 4 additions & 4 deletions PlutoSDR/SDRSharp.PlutoSDR.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<OutputPath>..\..\..\..\Programme\SDR\sdrsharp\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
Expand Down Expand Up @@ -81,15 +81,15 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="libiio-sharp">
<HintPath>..\..\..\..\Desktop\libiio-win32\libiio-win32\libiio-sharp.dll</HintPath>
<HintPath>..\..\..\..\Programme\SDR\sdrsharp\libiio-sharp.dll</HintPath>
</Reference>
<Reference Include="SDRSharp.Common, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\SDR\sdrsharp-x86\SDRSharp.Common.dll</HintPath>
<HintPath>..\..\..\..\Programme\SDR\sdrsharp\SDRSharp.Common.dll</HintPath>
</Reference>
<Reference Include="SDRSharp.Radio, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\SDR\sdrsharp-x86\SDRSharp.Radio.dll</HintPath>
<HintPath>..\..\..\..\Programme\SDR\sdrsharp\SDRSharp.Radio.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Drawing" />
Expand Down

0 comments on commit ab289b5

Please sign in to comment.