Skip to content

Commit 3674a67

Browse files
Merge pull request #64 from WildernessLabs/adrian/lora-e5
Add Grove Lora-E5 driver
2 parents 632173b + b2481db commit 3674a67

8 files changed

Lines changed: 292 additions & 77 deletions

File tree

.github/workflows/develop-ci.yml

Lines changed: 77 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,77 @@
1-
name: Develop Build
2-
3-
on:
4-
workflow_dispatch:
5-
pull_request:
6-
branches: [ develop ]
7-
push:
8-
branches: [ develop ]
9-
10-
jobs:
11-
build:
12-
13-
runs-on: windows-latest
14-
15-
steps:
16-
- name: Checkout Meadow.Contracts
17-
uses: actions/checkout@v4
18-
with:
19-
repository: WildernessLabs/Meadow.Contracts
20-
path: Meadow.Contracts
21-
ref: develop
22-
23-
- name: Checkout Meadow.Logging
24-
uses: actions/checkout@v4
25-
with:
26-
repository: WildernessLabs/Meadow.Logging
27-
path: Meadow.Logging
28-
ref: develop
29-
30-
- name: Checkout Meadow.Units
31-
uses: actions/checkout@v4
32-
with:
33-
repository: WildernessLabs/Meadow.Units
34-
path: Meadow.Units
35-
ref: develop
36-
37-
- name: Checkout Meadow.Core
38-
uses: actions/checkout@v4
39-
with:
40-
repository: WildernessLabs/Meadow.Core
41-
path: Meadow.Core
42-
ref: develop
43-
44-
- name: Checkout MQTTnet
45-
uses: actions/checkout@v4
46-
with:
47-
repository: WildernessLabs/MQTTnet
48-
path: MQTTnet
49-
ref: develop
50-
51-
- name: Checkout Meadow.Modbus
52-
uses: actions/checkout@v4
53-
with:
54-
repository: WildernessLabs/Meadow.Modbus
55-
path: Meadow.Modbus
56-
ref: develop
57-
58-
- name: Checkout Meadow.Foundation
59-
uses: actions/checkout@v4
60-
with:
61-
repository: WildernessLabs/Meadow.Foundation
62-
path: Meadow.Foundation
63-
ref: develop
64-
65-
- name: Checkout Meadow.Foundation.Grove
66-
uses: actions/checkout@v4
67-
with:
68-
path: Meadow.Foundation.Grove
69-
70-
- name: Setup .NET SDK
71-
uses: actions/setup-dotnet@v4
72-
with:
73-
dotnet-version:
74-
8.0.x
75-
76-
- name: Build Meadow Foundation Grove
77-
run: dotnet build -c Release Meadow.Foundation.Grove/Source/Grove.sln
1+
name: Develop Build
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches: [ develop ]
7+
push:
8+
branches: [ develop ]
9+
10+
jobs:
11+
build:
12+
13+
runs-on: windows-latest
14+
15+
steps:
16+
- name: Checkout Meadow.Contracts
17+
uses: actions/checkout@v6
18+
with:
19+
repository: WildernessLabs/Meadow.Contracts
20+
path: Meadow.Contracts
21+
ref: develop
22+
23+
- name: Checkout Meadow.Logging
24+
uses: actions/checkout@v6
25+
with:
26+
repository: WildernessLabs/Meadow.Logging
27+
path: Meadow.Logging
28+
ref: develop
29+
30+
- name: Checkout Meadow.Units
31+
uses: actions/checkout@v6
32+
with:
33+
repository: WildernessLabs/Meadow.Units
34+
path: Meadow.Units
35+
ref: develop
36+
37+
- name: Checkout Meadow.Core
38+
uses: actions/checkout@v6
39+
with:
40+
repository: WildernessLabs/Meadow.Core
41+
path: Meadow.Core
42+
ref: develop
43+
44+
- name: Checkout MQTTnet
45+
uses: actions/checkout@v6
46+
with:
47+
repository: WildernessLabs/MQTTnet
48+
path: MQTTnet
49+
ref: develop
50+
51+
- name: Checkout Meadow.Modbus
52+
uses: actions/checkout@v6
53+
with:
54+
repository: WildernessLabs/Meadow.Modbus
55+
path: Meadow.Modbus
56+
ref: develop
57+
58+
- name: Checkout Meadow.Foundation
59+
uses: actions/checkout@v6
60+
with:
61+
repository: WildernessLabs/Meadow.Foundation
62+
path: Meadow.Foundation
63+
ref: develop
64+
65+
- name: Checkout Meadow.Foundation.Grove
66+
uses: actions/checkout@v6
67+
with:
68+
path: Meadow.Foundation.Grove
69+
70+
- name: Setup .NET SDK
71+
uses: actions/setup-dotnet@v5
72+
with:
73+
dotnet-version:
74+
8.0.x
75+
76+
- name: Build Meadow Foundation Grove
77+
run: dotnet build -c Release Meadow.Foundation.Grove/Source/Grove.sln

Source/Grove.sln

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MQTTnet", "..\..\MQTTnet\So
317317
EndProject
318318
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Servos", "..\..\Meadow.Foundation\Source\Meadow.Foundation.Libraries_and_Frameworks\Servos\Driver\Servos.csproj", "{D2B66A30-F2C6-45A5-951D-D0503AF2B7E3}"
319319
EndProject
320+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LoRa-E5", "LoRa-E5", "{0F1359C0-E865-4981-92B2-B15D8245BBB1}"
321+
EndProject
322+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sample", "Sample", "{131D9CE3-7869-45A5-B4C2-DD94A2299E1D}"
323+
EndProject
324+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LoRa-E5", "LoRa-E5\Driver\LoRa-E5.csproj", "{CA1CF2E7-76CC-4781-AA09-307C57F4591D}"
325+
EndProject
326+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LoRaE5_Sample", "LoRa-E5\Sample\LoRaE5_Sample\LoRaE5_Sample.csproj", "{F1C75DB2-9A48-4243-985A-3B583F876C61}"
327+
EndProject
320328
Global
321329
GlobalSection(SolutionConfigurationPlatforms) = preSolution
322330
Debug|Any CPU = Debug|Any CPU
@@ -841,6 +849,18 @@ Global
841849
{D2B66A30-F2C6-45A5-951D-D0503AF2B7E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
842850
{D2B66A30-F2C6-45A5-951D-D0503AF2B7E3}.Release|Any CPU.Build.0 = Release|Any CPU
843851
{D2B66A30-F2C6-45A5-951D-D0503AF2B7E3}.Release|Any CPU.Deploy.0 = Release|Any CPU
852+
{CA1CF2E7-76CC-4781-AA09-307C57F4591D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
853+
{CA1CF2E7-76CC-4781-AA09-307C57F4591D}.Debug|Any CPU.Build.0 = Debug|Any CPU
854+
{CA1CF2E7-76CC-4781-AA09-307C57F4591D}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
855+
{CA1CF2E7-76CC-4781-AA09-307C57F4591D}.Release|Any CPU.ActiveCfg = Release|Any CPU
856+
{CA1CF2E7-76CC-4781-AA09-307C57F4591D}.Release|Any CPU.Build.0 = Release|Any CPU
857+
{CA1CF2E7-76CC-4781-AA09-307C57F4591D}.Release|Any CPU.Deploy.0 = Release|Any CPU
858+
{F1C75DB2-9A48-4243-985A-3B583F876C61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
859+
{F1C75DB2-9A48-4243-985A-3B583F876C61}.Debug|Any CPU.Build.0 = Debug|Any CPU
860+
{F1C75DB2-9A48-4243-985A-3B583F876C61}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
861+
{F1C75DB2-9A48-4243-985A-3B583F876C61}.Release|Any CPU.ActiveCfg = Release|Any CPU
862+
{F1C75DB2-9A48-4243-985A-3B583F876C61}.Release|Any CPU.Build.0 = Release|Any CPU
863+
{F1C75DB2-9A48-4243-985A-3B583F876C61}.Release|Any CPU.Deploy.0 = Release|Any CPU
844864
EndGlobalSection
845865
GlobalSection(SolutionProperties) = preSolution
846866
HideSolutionNode = FALSE
@@ -968,6 +988,9 @@ Global
968988
{0B9B964B-9D87-4E75-88D5-0B3BD04DBAFC} = {669A65E7-D76B-48E4-98AE-DE7D33662054}
969989
{4C745DAD-5077-45D5-A4FC-6A02F25748D4} = {669A65E7-D76B-48E4-98AE-DE7D33662054}
970990
{D2B66A30-F2C6-45A5-951D-D0503AF2B7E3} = {669A65E7-D76B-48E4-98AE-DE7D33662054}
991+
{131D9CE3-7869-45A5-B4C2-DD94A2299E1D} = {0F1359C0-E865-4981-92B2-B15D8245BBB1}
992+
{CA1CF2E7-76CC-4781-AA09-307C57F4591D} = {0F1359C0-E865-4981-92B2-B15D8245BBB1}
993+
{F1C75DB2-9A48-4243-985A-3B583F876C61} = {131D9CE3-7869-45A5-B4C2-DD94A2299E1D}
971994
EndGlobalSection
972995
GlobalSection(ExtensibilityGlobals) = postSolution
973996
SolutionGuid = {803C75D4-CF94-4881-BC4C-7CBE9D272949}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<Project Sdk="Meadow.Sdk/1.1.0">
2+
<PropertyGroup>
3+
<PackageReadmeFile>Readme.md</PackageReadmeFile>
4+
<Nullable>enable</Nullable>
5+
<LangVersion>12</LangVersion>
6+
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
7+
<Authors>Wilderness Labs, Inc</Authors>
8+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
9+
<TargetFramework>netstandard2.1</TargetFramework>
10+
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
11+
<OutputType>Library</OutputType>
12+
<AssemblyName>LoRa-E5</AssemblyName>
13+
<Company>Wilderness Labs, Inc</Company>
14+
<PackageProjectUrl>http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/</PackageProjectUrl>
15+
<PackageId>Meadow.Foundation.Grove.Transceivers.LoRa-E5</PackageId>
16+
<RepositoryUrl>https://github.com/WildernessLabs/Meadow.Foundation.Grove</RepositoryUrl>
17+
<PackageTags>Meadow.Foundation, Grove, LoRa, LoRaWAN, WioE5, Seeed, Transceiver</PackageTags>
18+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
19+
<Description>Grove Lora-E5 LoRa transceiver module driver</Description>
20+
<PackageIcon>icon.png</PackageIcon>
21+
</PropertyGroup>
22+
<ItemGroup>
23+
<None Include=".\Readme.md" Pack="true" PackagePath="" />
24+
<None Include="..\..\icon.png" Pack="true" PackagePath="" />
25+
<ProjectReference Include="..\..\..\..\Meadow.Foundation\Source\Meadow.Foundation.Peripherals\Transceivers.SeeedWioE5\Driver\Transceivers.SeeedWioE5.csproj" />
26+
</ItemGroup>
27+
</Project>

Source/LoRa-E5/Driver/LoRaE5.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using Meadow.Hardware;
2+
3+
namespace Meadow.Foundation.Grove.Transceivers
4+
{
5+
/// <summary>
6+
/// Represents the Seeed Studio Grove Lora-E5 LoRa transceiver module
7+
/// </summary>
8+
public class LoRaE5 : Meadow.Foundation.Transceivers.WioE5
9+
{
10+
/// <summary>
11+
/// Creates a new Grove Lora-E5 driver
12+
/// </summary>
13+
/// <param name="portName">The serial port the Grove UART connector is wired to</param>
14+
/// <param name="baudRate">Baud rate (default 9600)</param>
15+
public LoRaE5(SerialPortName portName, int baudRate = 9600)
16+
: base(portName, baudRate)
17+
{
18+
}
19+
}
20+
}

Source/LoRa-E5/Driver/Readme.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Meadow.Foundation.Grove.Transceivers.LoRa-E5
2+
3+
**Grove Lora-E5 LoRa transceiver module**
4+
5+
The **LoRa-E5** library is included in the **Meadow.Foundation.Grove.Transceivers.LoRa-E5** nuget package and is designed for the [Wilderness Labs](www.wildernesslabs.co) Meadow .NET IoT platform.
6+
7+
This driver is part of the [Meadow.Foundation](https://developer.wildernesslabs.co/Meadow/Meadow.Foundation/) peripherals library, an open-source repository of drivers and libraries that streamline and simplify adding hardware to your C# .NET Meadow IoT applications.
8+
9+
For more information on developing for Meadow, visit [developer.wildernesslabs.co](http://developer.wildernesslabs.co/).
10+
11+
To view all Wilderness Labs open-source projects, including samples, visit [github.com/wildernesslabs](https://github.com/wildernesslabs/).
12+
13+
## Installation
14+
15+
You can install the library from within Visual studio using the the NuGet Package Manager or from the command line using the .NET CLI:
16+
17+
`dotnet add package Meadow.Foundation.Grove.Transceivers.LoRa-E5`
18+
19+
## Usage
20+
21+
```csharp
22+
LoRa-E5 radio;
23+
24+
public override async Task Initialize()
25+
{
26+
Resolver.Log.Info("Initialize...");
27+
28+
// Grove UART connector on Project Lab V1: com1 (RX=D13, TX=D12)
29+
var portName = Device.PlatformOS.GetSerialPortName("com1")!;
30+
radio = new LoRa-E5(portName);
31+
32+
radio.PacketReceived += (s, pkt) =>
33+
{
34+
var text = System.Text.Encoding.ASCII.GetString(pkt.Payload);
35+
Resolver.Log.Info($"RX: \"{text}\" RSSI:{pkt.Rssi}dBm SNR:{pkt.Snr}dB");
36+
};
37+
38+
var ok = await radio.Initialize();
39+
Resolver.Log.Info($"Initialize: {(ok ? "OK" : "FAILED")}");
40+
}
41+
42+
public override async Task Run()
43+
{
44+
await radio.SetTestMode();
45+
await radio.ConfigureRf(frequencyHz: 868_000_000);
46+
47+
await radio.SendPacket(System.Text.Encoding.ASCII.GetBytes("Hello from Meadow"));
48+
await radio.StartReceiving();
49+
}
50+
```
51+
52+
## How to Contribute
53+
54+
- **Found a bug?** [Report an issue](https://github.com/WildernessLabs/Meadow_Issues/issues)
55+
- Have a **feature idea or driver request?** [Open a new feature request](https://github.com/WildernessLabs/Meadow_Issues/issues)
56+
- Want to **contribute code?** Fork the [Meadow.Foundation.Grove](https://github.com/WildernessLabs/Meadow.Foundation.Grove) repository and submit a pull request against the `develop` branch
57+
58+
## Need Help?
59+
60+
If you have questions or need assistance, please join the Wilderness Labs [community on Slack](http://slackinvite.wildernesslabs.co/).
61+
62+
## About Meadow
63+
64+
Meadow is a complete, IoT platform with defense-grade security that runs full .NET applications on embeddable microcontrollers and Linux single-board computers including Raspberry Pi and NVIDIA Jetson.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Meadow.Sdk/1.1.0">
2+
<PropertyGroup>
3+
<Company>Wilderness Labs, Inc</Company>
4+
<Authors>Wilderness Labs, Inc</Authors>
5+
<LangVersion>12</LangVersion>
6+
<TargetFramework>netstandard2.1</TargetFramework>
7+
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
8+
<OutputType>Library</OutputType>
9+
<AssemblyName>App</AssemblyName>
10+
</PropertyGroup>
11+
<ItemGroup>
12+
<ProjectReference Include="..\..\..\..\..\Meadow.Core\Source\implementations\f7\Meadow.F7\Meadow.F7.csproj" />
13+
<ProjectReference Include="..\..\Driver\LoRa-E5.csproj" />
14+
</ItemGroup>
15+
</Project>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
using Meadow;
2+
using Meadow.Devices;
3+
using Meadow.Foundation.Grove.Transceivers;
4+
using Meadow.Foundation.Transceivers;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace Grove.LoRaE5_Sample
9+
{
10+
// Change F7FeatherV2 to F7FeatherV1 for V1.x boards
11+
public class MeadowApp : App<F7FeatherV2>
12+
{
13+
//<!=SNIP=>
14+
15+
LoRaE5? radio;
16+
17+
public override async Task Initialize()
18+
{
19+
Resolver.Log.Info("Initializing Grove Lora-E5...");
20+
21+
// Grove UART connector on Project Lab V1: com1 (RX=D13, TX=D12)
22+
var portName = Device.PlatformOS.GetSerialPortName("com1")!;
23+
radio = new LoRaE5(portName);
24+
25+
radio.PacketReceived += (s, pkt) =>
26+
{
27+
var text = Encoding.ASCII.GetString(pkt.Payload);
28+
Resolver.Log.Info($"RX: \"{text}\" RSSI:{pkt.Rssi}dBm SNR:{pkt.Snr}dB");
29+
};
30+
31+
var ok = await radio.Initialize();
32+
Resolver.Log.Info($"Initialize: {(ok ? "OK" : "FAILED")}");
33+
}
34+
35+
public override async Task Run()
36+
{
37+
if (radio == null) return;
38+
39+
var version = await radio.GetVersion();
40+
Resolver.Log.Info($"Firmware: {version}");
41+
42+
await radio.SetTestMode();
43+
await radio.ConfigureRf(
44+
frequencyHz: 868_000_000,
45+
sf: SpreadingFactor.SF7,
46+
bandwidth: Bandwidth.BW125,
47+
powerDbm: 14);
48+
Resolver.Log.Info("RF configured: 868MHz SF7 BW125 14dBm");
49+
50+
while (true)
51+
{
52+
Resolver.Log.Info("Sending packet...");
53+
var sent = await radio.SendPacket(Encoding.ASCII.GetBytes("Hello from Meadow"));
54+
Resolver.Log.Info($"TX: {(sent ? "DONE" : "FAILED")}");
55+
56+
Resolver.Log.Info("Listening for reply...");
57+
await radio.StartReceiving();
58+
await Task.Delay(5000);
59+
await radio.StopReceiving();
60+
}
61+
}
62+
63+
//<!=SNOP=>
64+
}
65+
}

0 commit comments

Comments
 (0)