Skip to content

Commit

Permalink
Merge pull request #33 from WildernessLabs/v1.5.0
Browse files Browse the repository at this point in the history
Release 1.5.0
  • Loading branch information
jorgedevs authored Nov 29, 2023
2 parents 9238ee4 + dacd9b6 commit a64b144
Show file tree
Hide file tree
Showing 14 changed files with 513 additions and 145 deletions.
Binary file added Hardware/Design Files/Schematic_v2.b.pdf
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ public void UpdateDisplay(AtmosphericModel conditions, LocationModel locationInf
: $"Lat: " +
$"{locationInfo.PositionInformation?.Position?.Latitude?.Degrees}°" +
$"{locationInfo.PositionInformation?.Position?.Latitude?.Minutes:n2}'" +
$"{locationInfo.PositionInformation?.Position?.Latitude?.seconds}\"";
$"{locationInfo.PositionInformation?.Position?.Latitude?.Seconds}\"";
LatitudeLabel.Text = lat;

string lon = locationInfo.PositionInformation == null
? $"Lon: 0°0'0.0\""
: $"Lon: " +
$"{locationInfo.PositionInformation?.Position?.Longitude?.Degrees}°" +
$"{locationInfo.PositionInformation?.Position?.Longitude?.Minutes:n2}'" +
$"{locationInfo.PositionInformation?.Position?.Longitude?.seconds}\"";
$"{locationInfo.PositionInformation?.Position?.Longitude?.Seconds}\"";
LongitudeLabel.Text = lon;

counter++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<PackageReference Include="sqlite-net-static" Version="1.8.116" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meadow.Foundation.Graphics.MicroLayout" Version="*" />
<PackageReference Include="Meadow.Foundation.Graphics.MicroLayout" Version="1.5.0" />
<ProjectReference Include="..\..\GnssTracker\GnssTracker.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public static SensorDataModel From(Logical.AtmosphericModel atmospheric, Logical
RelativeHumidityPercent = atmospheric.RelativeHumidity?.Percent,
PressureAtmos = atmospheric.Pressure?.StandardAtmosphere,
Timestamp = atmospheric.Timestamp.Value,
Latitude = $"{location.PositionInformation?.Position?.Latitude?.Degrees} {location.PositionInformation?.Position?.Latitude?.Minutes}'{location.PositionInformation?.Position?.Latitude?.seconds}\"",
Longitude = $"{location.PositionInformation?.Position?.Longitude?.Degrees} {location.PositionInformation?.Position?.Longitude?.Minutes}'{location.PositionInformation?.Position?.Longitude?.seconds}\"",
Latitude = $"{location.PositionInformation?.Position?.Latitude?.Degrees} {location.PositionInformation?.Position?.Latitude?.Minutes}'{location.PositionInformation?.Position?.Latitude?.Seconds}\"",
Longitude = $"{location.PositionInformation?.Position?.Longitude?.Degrees} {location.PositionInformation?.Position?.Longitude?.Minutes}'{location.PositionInformation?.Position?.Longitude?.Seconds}\"",
};

return dataModel;
Expand Down
126 changes: 126 additions & 0 deletions Source/GnssTracker/DisplayConnector.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
using System;
using static Meadow.Hardware.DisplayConnector;

namespace Meadow.Hardware;

/// <summary>
/// Represents the display connector on GNSS Tracker
/// </summary>
public class DisplayConnector : Connector<DisplayConnectorPinDefinitions>
{
/// <summary>
/// The set of Display connector connector pins
/// </summary>
public static class PinNames
{
/// <summary>
/// Chip Select pin
/// </summary>
public const string CS = "CS";
/// <summary>
/// Reset pin
/// </summary>
public const string RST = "RST";
/// <summary>
/// Data/Command pin
/// </summary>
public const string DC = "DC";
/// <summary>
/// Busy status pin
/// </summary>
public const string BUSY = "BUSY";
/// <summary>
/// SPI Clock pin
/// </summary>
public const string CLK = "CLK";
/// <summary>
/// SPI controller out, peripheral in pin
/// </summary>
public const string COPI = "COPI";
/// <summary>
/// SPI controller im, peripheral out pin
/// </summary>
public const string CIPO = "CIPO";
}

/// <summary>
/// Represents the pins definitions for the Display connector on GNSS Tracker
/// </summary>
public class DisplayConnectorPinDefinitions : PinDefinitionBase
{
private readonly IPin? _cs;
private readonly IPin? _rst;
private readonly IPin? _dc;
private readonly IPin? _busy;
private readonly IPin? _clk;
private readonly IPin? _copi;
private readonly IPin? _cipo;

/// <summary>
/// Chip Select pin
/// </summary>
public IPin CS => _cs ?? throw new PlatformNotSupportedException("Pin not connected");
/// <summary>
/// Reset pin
/// </summary>
public IPin RST => _rst ?? throw new PlatformNotSupportedException("Pin not connected");
/// <summary>
/// Data/Command pin
/// </summary>
public IPin DC => _dc ?? throw new PlatformNotSupportedException("Pin not connected");
/// <summary>
/// Busy status pin
/// </summary>
public IPin BUSY => _busy ?? throw new PlatformNotSupportedException("Pin not connected");
/// <summary>
/// SPI Clock pin
/// </summary>
public IPin CLK => _clk ?? throw new PlatformNotSupportedException("Pin not connected");
/// <summary>
/// SPI controller out, peripheral in pin
/// </summary>
public IPin COPI => _copi ?? throw new PlatformNotSupportedException("Pin not connected");
/// <summary>
/// SPI controller in, peripheral out pin
/// </summary>
public IPin CIPO => _cipo ?? throw new PlatformNotSupportedException("Pin not connected");

internal DisplayConnectorPinDefinitions(PinMapping mapping)
{
foreach (var m in mapping)
{
switch (m.PinName)
{
case PinNames.CS:
_cs = m.ConnectsTo;
break;
case PinNames.RST:
_rst = m.ConnectsTo;
break;
case PinNames.DC:
_dc = m.ConnectsTo;
break;
case PinNames.BUSY:
_busy = m.ConnectsTo;
break;
case PinNames.CLK:
_clk = m.ConnectsTo;
break;
case PinNames.COPI:
_copi = m.ConnectsTo;
break;
case PinNames.CIPO:
_cipo = m.ConnectsTo;
break;
}
}
}
}

/// <param name="name">The connector name</param>
/// <param name="mapping">The mappings to the host controller</param>
public DisplayConnector(string name, PinMapping mapping)
: base(name, new DisplayConnectorPinDefinitions(mapping))
{
}
}
40 changes: 36 additions & 4 deletions Source/GnssTracker/GnssTracker.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Meadow.Logging;
using Meadow;
using Meadow;
using Meadow.Hardware;
using Meadow.Logging;
using System;

namespace WildernessLabs.Hardware.GnssTracker
Expand All @@ -14,8 +15,11 @@ private GnssTracker() { }
public static IGnssTrackerHardware Create()
{
IGnssTrackerHardware hardware;

Logger? logger = Resolver.Log;

II2cBus i2cBus;

logger?.Debug("Initializing GnssTracker...");

var device = Resolver.Device;
Expand All @@ -27,10 +31,38 @@ public static IGnssTrackerHardware Create()
throw new Exception(msg);
}

try
{
logger?.Debug("Initializing I2CBus");

i2cBus = Resolver.Device.CreateI2cBus();

logger?.Debug("Initializing I2CBus initialized");
}
catch (Exception e)
{
logger?.Error($"Err initializing I2CBus: {e.Message}");
throw;
}


if (device is IF7CoreComputeMeadowDevice { } ccm)
{
logger?.Info("Instantiating GnssTracker v1 hardware");
hardware = new GnssTrackerHardwareV1(ccm);
try
{
//try to write a byte to the address of the SCD40 sensor
i2cBus.Write(0x62, new byte[] { 0 });
logger?.Info("Instantiating GnssTracker v2 hardware");
hardware = new GnssTrackerHardwareV2(ccm, i2cBus);
}
catch
{
logger?.Info("Instantiating GnssTracker v1 hardware");
hardware = new GnssTrackerHardwareV1(ccm, i2cBus);
}



}
else
{
Expand Down
12 changes: 7 additions & 5 deletions Source/GnssTracker/GnssTracker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
<None Include="icon.png" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="*" />
<PackageReference Include="Meadow.Foundation" Version="*" />
<PackageReference Include="Meadow.Foundation.Displays.ePaper" Version="*" />
<PackageReference Include="Meadow.Foundation.Sensors.Atmospheric.Bme68x" Version="*" />
<PackageReference Include="Meadow.Foundation.Sensors.Gnss.NeoM8" Version="*" />
<PackageReference Include="Meadow.F7" Version="1.5.0" />
<PackageReference Include="Meadow.Foundation" Version="1.5.0" />
<PackageReference Include="Meadow.Foundation.Displays.ePaper" Version="1.5.0" />
<PackageReference Include="Meadow.Foundation.Sensors.Atmospheric.Bme68x" Version="1.5.0" />
<PackageReference Include="Meadow.Foundation.Sensors.Environmental.Scd4x" Version="1.5.0" />
<PackageReference Include="Meadow.Foundation.Sensors.Gnss.NeoM8" Version="1.5.0" />
<PackageReference Include="Meadow.Foundation.Sensors.Motion.Bmi270" Version="1.5.0" />
</ItemGroup>
</Project>
Loading

0 comments on commit a64b144

Please sign in to comment.