-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from WildernessLabs/v2.0.1.2
Release 2.0.1.2
- Loading branch information
Showing
40 changed files
with
605 additions
and
420 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Meadow.Foundation.ICs.CAN; | ||
using Meadow.Hardware; | ||
using Meadow.Units; | ||
|
||
namespace Meadow.Foundation.FeatherWings | ||
{ | ||
/// <summary> | ||
/// Represents an Adafruit CAN Bus featherwing | ||
/// </summary> | ||
public class CanBusWing : Mcp2515 | ||
{ | ||
/// <summary> | ||
/// Creates a CanBusWing driver | ||
/// </summary> | ||
public CanBusWing(IF7FeatherMeadowDevice feather) | ||
: base( | ||
bus: feather.CreateSpiBus(3, 1_000_000.Hertz()), | ||
chipSelect: feather.Pins.D09.CreateDigitalOutputPort(true), | ||
interruptPort: feather.Pins.D10.CreateDigitalInterruptPort(InterruptMode.EdgeFalling), | ||
oscillator: CanOscillator.Osc_16MHz) | ||
{ } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<Project Sdk="Meadow.Sdk/1.1.0"> | ||
<PropertyGroup> | ||
<Version>1.11.0</Version> | ||
<Nullable>enable</Nullable> | ||
<LangVersion>10.0</LangVersion> | ||
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
<PackageIcon>icon.png</PackageIcon> | ||
<Authors>Wilderness Labs, Inc</Authors> | ||
<TargetFramework>netstandard2.1</TargetFramework> | ||
<OutputType>Library</OutputType> | ||
<AssemblyName>CanBusWing</AssemblyName> | ||
<Company>Wilderness Labs, Inc</Company> | ||
<PackageProjectUrl>http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/</PackageProjectUrl> | ||
<PackageId>Meadow.Foundation.FeatherWings.CanBusWing</PackageId> | ||
<RepositoryUrl>https://github.com/WildernessLabs/Meadow.Foundation.FeatherWings</RepositoryUrl> | ||
<PackageTags>Meadow.Foundation, CanBusWing, CAN</PackageTags> | ||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> | ||
<Description>AdaFruit CAN Bus FeatherWing</Description> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<None Include=".\Readme.md" Pack="true" PackagePath="" /> | ||
<None Include="..\..\icon.png" Pack="true" PackagePath="" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Meadow.F7" Version="2.0.1.2" /> | ||
<PackageReference Include="Meadow.Foundation.ICs.CAN.Mcp2515" Version="2.0.1.2" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# Meadow.Foundation.FeatherWings.CanBusWing | ||
|
||
**AdaFruit CAN Bus FeatherWing** | ||
|
||
The **CanBusWing** library is included in the **Meadow.Foundation.FeatherWings.CanBusWing** nuget package and is designed for the [Wilderness Labs](www.wildernesslabs.co) Meadow .NET IoT platform. | ||
|
||
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. | ||
|
||
For more information on developing for Meadow, visit [developer.wildernesslabs.co](http://developer.wildernesslabs.co/). | ||
|
||
To view all Wilderness Labs open-source projects, including samples, visit [github.com/wildernesslabs](https://github.com/wildernesslabs/). | ||
|
||
## Installation | ||
|
||
You can install the library from within Visual studio using the the NuGet Package Manager or from the command line using the .NET CLI: | ||
|
||
`dotnet add package Meadow.Foundation.FeatherWings.CanBusWing` | ||
## Usage | ||
|
||
```csharp | ||
private CanBusWing wing; | ||
|
||
public override Task Initialize() | ||
{ | ||
Console.WriteLine("Initialize..."); | ||
|
||
wing = new CanBusWing(Device); | ||
|
||
return Task.CompletedTask; | ||
} | ||
|
||
public override async Task Run() | ||
{ | ||
var bus = wing.CreateCanBus(CanBitrate.Can_250kbps); | ||
|
||
Console.WriteLine($"Listening for CAN data..."); | ||
|
||
var tick = 0; | ||
|
||
while (true) | ||
{ | ||
var frame = bus.ReadFrame(); | ||
if (frame != null) | ||
{ | ||
if (frame is StandardDataFrame sdf) | ||
{ | ||
Console.WriteLine($"Standard Frame: {sdf.ID:X3} {BitConverter.ToString(sdf.Payload)}"); | ||
} | ||
else if (frame is ExtendedDataFrame edf) | ||
{ | ||
Console.WriteLine($"Extended Frame: {edf.ID:X8} {BitConverter.ToString(edf.Payload)}"); | ||
} | ||
} | ||
else | ||
{ | ||
await Task.Delay(100); | ||
} | ||
|
||
if (tick++ % 50 == 0) | ||
{ | ||
Console.WriteLine($"Sending Standard Frame..."); | ||
|
||
bus.WriteFrame(new StandardDataFrame | ||
{ | ||
ID = 0x700, | ||
Payload = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, (byte)(tick & 0xff) } | ||
}); | ||
} | ||
} | ||
} | ||
|
||
``` | ||
## How to Contribute | ||
|
||
- **Found a bug?** [Report an issue](https://github.com/WildernessLabs/Meadow_Issues/issues) | ||
- Have a **feature idea or driver request?** [Open a new feature request](https://github.com/WildernessLabs/Meadow_Issues/issues) | ||
- Want to **contribute code?** Fork the [Meadow.Foundation.Featherwings](https://github.com/WildernessLabs/Meadow.Foundation.Featherwings) repository and submit a pull request against the `develop` branch | ||
|
||
|
||
## Need Help? | ||
|
||
If you have questions or need assistance, please join the Wilderness Labs [community on Slack](http://slackinvite.wildernesslabs.co/). | ||
## About Meadow | ||
|
||
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. | ||
|
||
### Build | ||
|
||
Use the full .NET platform and tooling such as Visual Studio and plug-and-play hardware drivers to painlessly build IoT solutions. | ||
|
||
### Connect | ||
|
||
Utilize native support for WiFi, Ethernet, and Cellular connectivity to send sensor data to the Cloud and remotely control your peripherals. | ||
|
||
### Deploy | ||
|
||
Instantly deploy and manage your fleet in the cloud for OtA, health-monitoring, logs, command + control, and enterprise backend integrations. | ||
|
||
|
12 changes: 12 additions & 0 deletions
12
Source/CanBusWing/Samples/CanBusWing_Sample/CanBusWing_Sample.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<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="2.0.1.2" /> | ||
<ProjectReference Include="..\..\Driver\CanBusWing.csproj" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
using Meadow; | ||
using Meadow.Devices; | ||
using Meadow.Foundation.FeatherWings; | ||
using Meadow.Hardware; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace MeadowApp | ||
{ | ||
public class MeadowApp : App<F7FeatherV2> | ||
{ | ||
//<!=SNIP=> | ||
|
||
private CanBusWing wing; | ||
|
||
public override Task Initialize() | ||
{ | ||
Console.WriteLine("Initialize..."); | ||
|
||
wing = new CanBusWing(Device); | ||
|
||
return Task.CompletedTask; | ||
} | ||
|
||
public override async Task Run() | ||
{ | ||
var bus = wing.CreateCanBus(CanBitrate.Can_250kbps); | ||
|
||
Console.WriteLine($"Listening for CAN data..."); | ||
|
||
var tick = 0; | ||
|
||
while (true) | ||
{ | ||
var frame = bus.ReadFrame(); | ||
if (frame != null) | ||
{ | ||
if (frame is StandardDataFrame sdf) | ||
{ | ||
Console.WriteLine($"Standard Frame: {sdf.ID:X3} {BitConverter.ToString(sdf.Payload)}"); | ||
} | ||
else if (frame is ExtendedDataFrame edf) | ||
{ | ||
Console.WriteLine($"Extended Frame: {edf.ID:X8} {BitConverter.ToString(edf.Payload)}"); | ||
} | ||
} | ||
else | ||
{ | ||
await Task.Delay(100); | ||
} | ||
|
||
if (tick++ % 50 == 0) | ||
{ | ||
Console.WriteLine($"Sending Standard Frame..."); | ||
|
||
bus.WriteFrame(new StandardDataFrame | ||
{ | ||
ID = 0x700, | ||
Payload = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, (byte)(tick & 0xff) } | ||
}); | ||
} | ||
} | ||
} | ||
|
||
//<!=SNOP=> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.