Skip to content

Commit

Permalink
Merge pull request #15 from WildernessLabs/driver/gnss5
Browse files Browse the repository at this point in the history
Driver/gnss5
  • Loading branch information
adrianstevens authored Feb 8, 2023
2 parents 316cae1 + aaef3c8 commit 906c41d
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Source/CGNSS5/Driver/CGNSS5.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Meadow.Foundation.Sensors.Gnss;
using Meadow.Hardware;

namespace Meadow.Foundation.mikroBUS.Sensors.Gnss
{
/// <summary>
/// Represents a mikroBUS GNSS 5 board (Neo M8)
/// </summary>
public class CGNSS5 : NeoM8
{
/// <summary>
/// Creates a new CGNSS5 object using serial
/// </summary>
public CGNSS5(IMeadowDevice device, SerialPortName serialPortName, IPin resetPin, IPin ppsPin = null)
: base(device, serialPortName, resetPin, ppsPin)
{ }

/// <summary>
/// Creates a new CGNSS5 object using I2C
/// </summary>
public CGNSS5(IMeadowDevice device, II2cBus i2cBus, IPin resetPin, IPin ppsPin = null)
: base(device, i2cBus, (byte)Addresses.Default, resetPin: resetPin, ppsPin: ppsPin)
{ }
}
}
24 changes: 24 additions & 0 deletions Source/CGNSS5/Driver/CGNSS5.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Meadow.Sdk/1.1.0">
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageIcon>icon.png</PackageIcon>
<Authors>Wilderness Labs, Inc</Authors>
<TargetFramework>netstandard2.1</TargetFramework>
<OutputType>Library</OutputType>
<AssemblyName>CGNSS%</AssemblyName>
<Company>Wilderness Labs, Inc</Company>
<PackageProjectUrl>http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/</PackageProjectUrl>
<PackageId>Meadow.Foundation.mikroBUS.Sensors.Gnss.CGNSS10</PackageId>
<RepositoryUrl>https://github.com/WildernessLabs/Meadow.Foundation</RepositoryUrl>
<PackageTags>Meadow,Meadow.Foundation,MikroBus,Mikroe,MikroElectronika,GPS,GNSS,Click,5</PackageTags>
<Version>0.1.0</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>MikroElectronika Serial I2C Neo M8 GPS / GNSS MikroBus click board</Description>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\icon.png" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Meadow.Foundation\Source\Meadow.Foundation.Peripherals\Sensors.Gnss.NeoM8\Driver\Sensors.Gnss.NeoM8.csproj" />
</ItemGroup>
</Project>
13 changes: 13 additions & 0 deletions Source/CGNSS5/Sample/CGNSS5_Sample/CGNSS5_Sample.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Meadow.Sdk/1.1.0">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<OutputType>Library</OutputType>
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="0.*" />
<ProjectReference Include="..\..\..\..\..\Meadow.Core\source\implementations\f7\Meadow.F7\Meadow.F7.csproj" />
<ProjectReference Include="..\..\Driver\CGNSS5.csproj" />
</ItemGroup>
</Project>
79 changes: 79 additions & 0 deletions Source/CGNSS5/Sample/CGNSS5_Sample/MeadowApp.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using Meadow;
using Meadow.Devices;
using Meadow.Foundation.mikroBUS.Sensors.Gnss;
using Meadow.Peripherals.Sensors.Location.Gnss;
using System.Threading.Tasks;

namespace CGNSS5_Sample
{
// Change F7FeatherV2 to F7FeatherV1 for V1.x boards
public class MeadowApp : App<F7FeatherV2>
{
//<!=SNIP=>

CGNSS5 gps;

public override Task Initialize()
{
Resolver.Log.Info("Initializing ...");

//gps = new CGNSS5(Device, Device.PlatformOS.GetSerialPortName("COM1"), Device.Pins.D09, Device.Pins.D11);

gps = new CGNSS5(Device, Device.CreateI2cBus(), resetPin: Device.Pins.D09, ppsPin: Device.Pins.D11);

gps.GgaReceived += (object sender, GnssPositionInfo location) =>
{
Resolver.Log.Info("*********************************************");
Resolver.Log.Info($"{location}");
Resolver.Log.Info("*********************************************");
};
// GLL
gps.GllReceived += (object sender, GnssPositionInfo location) =>
{
Resolver.Log.Info("*********************************************");
Resolver.Log.Info($"{location}");
Resolver.Log.Info("*********************************************");
};
// GSA
gps.GsaReceived += (object sender, ActiveSatellites activeSatellites) =>
{
Resolver.Log.Info("*********************************************");
Resolver.Log.Info($"{activeSatellites}");
Resolver.Log.Info("*********************************************");
};
// RMC (recommended minimum)
gps.RmcReceived += (object sender, GnssPositionInfo positionCourseAndTime) =>
{
Resolver.Log.Info("*********************************************");
Resolver.Log.Info($"{positionCourseAndTime}");
Resolver.Log.Info("*********************************************");

};
// VTG (course made good)
gps.VtgReceived += (object sender, CourseOverGround courseAndVelocity) =>
{
Resolver.Log.Info("*********************************************");
Resolver.Log.Info($"{courseAndVelocity}");
Resolver.Log.Info("*********************************************");
};
// GSV (satellites in view)
gps.GsvReceived += (object sender, SatellitesInView satellites) =>
{
Resolver.Log.Info("*********************************************");
Resolver.Log.Info($"{satellites}");
Resolver.Log.Info("*********************************************");
};

return Task.CompletedTask;
}

public override Task Run()
{
gps.StartUpdating();

return Task.CompletedTask;
}

//<!=SNOP=>
}
}
23 changes: 23 additions & 0 deletions Source/mikroBUS.sln
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sensors.Atmospheric.Sht4x",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Displays.Max7219", "..\..\Meadow.Foundation\Source\Meadow.Foundation.Peripherals\Displays.Max7219\Driver\Displays.Max7219.csproj", "{0A92D618-C408-4A00-92E6-D36440D1E18D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CGNSS5", "CGNSS5", "{12F537E2-13DC-4023-89E4-9E8515809604}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CGNSS5", "CGNSS5\Driver\CGNSS5.csproj", "{EEDDAF1D-2E35-4A7A-8C94-9F6BCA9289FB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sample", "Sample", "{C259536A-75D7-4D8A-B4F5-8C0306A897DE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CGNSS5_Sample", "CGNSS5\Sample\CGNSS5_Sample\CGNSS5_Sample.csproj", "{1B9F8444-BAC8-423C-9D01-3D354FB8C083}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -239,6 +247,18 @@ Global
{0A92D618-C408-4A00-92E6-D36440D1E18D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A92D618-C408-4A00-92E6-D36440D1E18D}.Release|Any CPU.Build.0 = Release|Any CPU
{0A92D618-C408-4A00-92E6-D36440D1E18D}.Release|Any CPU.Deploy.0 = Release|Any CPU
{EEDDAF1D-2E35-4A7A-8C94-9F6BCA9289FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EEDDAF1D-2E35-4A7A-8C94-9F6BCA9289FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EEDDAF1D-2E35-4A7A-8C94-9F6BCA9289FB}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{EEDDAF1D-2E35-4A7A-8C94-9F6BCA9289FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EEDDAF1D-2E35-4A7A-8C94-9F6BCA9289FB}.Release|Any CPU.Build.0 = Release|Any CPU
{EEDDAF1D-2E35-4A7A-8C94-9F6BCA9289FB}.Release|Any CPU.Deploy.0 = Release|Any CPU
{1B9F8444-BAC8-423C-9D01-3D354FB8C083}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1B9F8444-BAC8-423C-9D01-3D354FB8C083}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1B9F8444-BAC8-423C-9D01-3D354FB8C083}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{1B9F8444-BAC8-423C-9D01-3D354FB8C083}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1B9F8444-BAC8-423C-9D01-3D354FB8C083}.Release|Any CPU.Build.0 = Release|Any CPU
{1B9F8444-BAC8-423C-9D01-3D354FB8C083}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -276,6 +296,9 @@ Global
{A6675803-03EC-41E5-973F-12CD684FCA81} = {20E3A0B4-6103-4EAD-BD90-90C673E07DCC}
{A5DAEA7F-86B7-4BE8-834D-248F5B0CEBE6} = {20E3A0B4-6103-4EAD-BD90-90C673E07DCC}
{0A92D618-C408-4A00-92E6-D36440D1E18D} = {20E3A0B4-6103-4EAD-BD90-90C673E07DCC}
{EEDDAF1D-2E35-4A7A-8C94-9F6BCA9289FB} = {12F537E2-13DC-4023-89E4-9E8515809604}
{C259536A-75D7-4D8A-B4F5-8C0306A897DE} = {12F537E2-13DC-4023-89E4-9E8515809604}
{1B9F8444-BAC8-423C-9D01-3D354FB8C083} = {C259536A-75D7-4D8A-B4F5-8C0306A897DE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BF2FC8CE-57C6-468C-B82D-D8204E6D9360}
Expand Down

0 comments on commit 906c41d

Please sign in to comment.