Skip to content

Commit

Permalink
Add CanBusWing readme and update csproj metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianstevens committed Oct 22, 2024
1 parent 943d183 commit 854a151
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Source/CanBusWing/Driver/CanBusWing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<AssemblyName>CanBusWing</AssemblyName>
<Company>Wilderness Labs, Inc</Company>
<PackageProjectUrl>http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/</PackageProjectUrl>
<PackageId>Meadow.Foundation.FeatherWings.GPSWing</PackageId>
<PackageId>Meadow.Foundation.FeatherWings.CanBusWing</PackageId>
<RepositoryUrl>https://github.com/WildernessLabs/Meadow.Foundation.FeatherWings</RepositoryUrl>
<PackageTags>Meadow.Foundation, CanBusWing, CAN</PackageTags>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
Expand Down
99 changes: 99 additions & 0 deletions Source/CanBusWing/Driver/Readme.md
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.


0 comments on commit 854a151

Please sign in to comment.