Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start of virtual devices #1104

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Meadow.Sdk/1.1.0">
<PropertyGroup>
<Version>1.11.0</Version>
<PackageReadmeFile>Readme.md</PackageReadmeFile>
<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>VirtualDisplays</AssemblyName>
<Company>Wilderness Labs, Inc</Company>
<PackageProjectUrl>http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/</PackageProjectUrl>
<PackageId>Meadow.Foundation.Displays.Virtual</PackageId>
<RepositoryUrl>https://github.com/WildernessLabs/Meadow.Foundation</RepositoryUrl>
<PackageTags>Meadow,Meadow.Foundation,Displays</PackageTags>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>Meadow Desktop virtual displays</Description>
</PropertyGroup>
<ItemGroup>
<None Include=".\Readme.md" Pack="true" PackagePath="" />
<None Include="..\..\..\icon.png" Pack="true" PackagePath="" />
<ProjectReference Include="..\..\..\Meadow.Foundation.Libraries_and_Frameworks\Graphics.MicroGraphics\Driver\Graphics.MicroGraphics.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Meadow.Peripherals.Displays;

namespace Meadow.Foundation.Displays;

/// <summary>
/// A virtual display instance of the Epd5in65 epaper display.
///
/// TODO: Move to epapers project when finished.
/// </summary>
public class Epd5in65fVirtual : VirtualDisplayBase
{
public Epd5in65fVirtual() : base(600, 448, RotationType.Normal, ColorMode.Format4bppIndexed)
{
base.SupportedColorModes = ColorMode.Format4bppIndexed;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using Meadow.Peripherals.Displays;

namespace Meadow.Foundation.Displays;

public interface IVirtualDisplay : IPixelDisplay
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Meadow.Peripherals.Displays;

namespace Meadow.Foundation.Displays;

/// <summary>
/// Sample named virtual display
///
/// TODO: Move this to the TFT Displays project after we're happy with implementation. Only in here right now for
/// convenience as a WiP.
/// </summary>
public class Ili9341Virtual : VirtualDisplayBase
{
public Ili9341Virtual(RotationType rotationType = RotationType._270Degrees)
: base(240, 320, rotationType)
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Meadow.Foundation.Displays.Uc1609c

**Uc1609c SPI monochrome OLED display**

The **Uc1609c** library is included in the **Meadow.Foundation.Displays.Uc1609c** 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.Displays.Uc1609c`
## Usage

```csharp
MicroGraphics graphics;

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

var uc1609c = new Uc1609c
(
spiBus: Device.CreateSpiBus(),
chipSelectPin: Device.Pins.A03,
dcPin: Device.Pins.A04,
resetPin: Device.Pins.A05,
width: 192,
height: 64
);

graphics = new MicroGraphics(uc1609c)
{
CurrentFont = new Font8x8()
};

return base.Initialize();
}

public override Task Run()
{
graphics.Clear();
graphics.DrawTriangle(10, 10, 50, 50, 10, 50, false);
graphics.DrawRectangle(20, 15, 40, 20, true);
graphics.DrawText(5, 5, "UC1609C");
graphics.DrawCircle(96, 32, 16);
graphics.Show();

Resolver.Log.Info("Run complete");

return base.Run();
}

```
## 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](https://github.com/WildernessLabs/Meadow.Foundation) 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.


Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
using Meadow.Peripherals.Displays;

namespace Meadow.Foundation.Displays;

public class VirtualDisplayBase : IResizablePixelDisplay
{
public RotationType Rotation { get; }
/// <inheritdoc/>
public ColorMode ColorMode { get; }
/// <inheritdoc/>
public ColorMode SupportedColorModes { get; protected set; }
/// <inheritdoc/>
public int Width { get; }
/// <inheritdoc/>
public int Height { get; }

protected VirtualDisplayBase(
int width, int height,
RotationType rotationType,
ColorMode colorMode = ColorMode.Format24bppRgb888)
{
Width = width;
Height = height;
Rotation = rotationType;
ColorMode = colorMode;
}

/// <inheritdoc/>
public IPixelBuffer PixelBuffer => throw new System.NotImplementedException();

/// <inheritdoc/>
public void Clear(bool updateDisplay = false)
{
throw new System.NotImplementedException();
}

/// <inheritdoc/>
public void DrawPixel(int x, int y, Color color)
{
throw new System.NotImplementedException();
}

/// <inheritdoc/>
public void DrawPixel(int x, int y, bool enabled)
{
throw new System.NotImplementedException();
}

/// <inheritdoc/>
public void Fill(Color fillColor, bool updateDisplay = false)
{
throw new System.NotImplementedException();
}

/// <inheritdoc/>
public void Fill(int x, int y, int width, int height, Color fillColor)
{
throw new System.NotImplementedException();
}

/// <inheritdoc/>
public void InvertPixel(int x, int y)
{
throw new System.NotImplementedException();
}

/// <inheritdoc/>
public void Show()
{
throw new System.NotImplementedException();
}

/// <inheritdoc/>
public void Show(int left, int top, int right, int bottom)
{
throw new System.NotImplementedException();
}

/// <inheritdoc/>
public void WriteBuffer(int x, int y, IPixelBuffer displayBuffer)
{
throw new System.NotImplementedException();
}

public void Resize(int width, int height, float displayScale = 1)
{
throw new System.NotImplementedException();
}
}
13 changes: 13 additions & 0 deletions Source/Meadow.Foundation.sln
Original file line number Diff line number Diff line change
Expand Up @@ -1632,8 +1632,13 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Keller XLine", "Keller XLine", "{2240AB38-3CC6-4800-8556-D3BB5C44B720}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sensors.Environmental.Keller.XLine", "Meadow.Foundation.Peripherals\Sensors.Environmental.Keller.XLine\Driver\Sensors.Environmental.Keller.XLine.csproj", "{729B86E1-49EE-4668-A599-8D7C28842F9E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Epd2in15g_Sample", "Meadow.Foundation.Peripherals\Displays.ePaperWaveShare\Samples\Epd2in15g_Sample\Epd2in15g_Sample.csproj", "{EA8D8CA1-BB32-49D6-88CF-9EB50ABDC44B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Virtual", "Virtual", "{B3A7C8DE-0F13-43DF-AEAC-3A545CEABB41}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Displays.Virtual", "Meadow.Foundation.Peripherals\Displays.Virtual\Driver\Displays.Virtual.csproj", "{108AA141-D896-4D9B-8675-89714104B2AB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -3954,6 +3959,12 @@ Global
{EA8D8CA1-BB32-49D6-88CF-9EB50ABDC44B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EA8D8CA1-BB32-49D6-88CF-9EB50ABDC44B}.Release|Any CPU.Build.0 = Release|Any CPU
{EA8D8CA1-BB32-49D6-88CF-9EB50ABDC44B}.Release|Any CPU.Deploy.0 = Release|Any CPU
{108AA141-D896-4D9B-8675-89714104B2AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{108AA141-D896-4D9B-8675-89714104B2AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{108AA141-D896-4D9B-8675-89714104B2AB}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{108AA141-D896-4D9B-8675-89714104B2AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{108AA141-D896-4D9B-8675-89714104B2AB}.Release|Any CPU.Build.0 = Release|Any CPU
{108AA141-D896-4D9B-8675-89714104B2AB}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -4768,6 +4779,8 @@ Global
{2240AB38-3CC6-4800-8556-D3BB5C44B720} = {78E463DA-0FA1-4AAE-A281-D3297C9388C9}
{729B86E1-49EE-4668-A599-8D7C28842F9E} = {2240AB38-3CC6-4800-8556-D3BB5C44B720}
{EA8D8CA1-BB32-49D6-88CF-9EB50ABDC44B} = {7311794D-7D2F-47E8-A5B0-C216CBD64A13}
{B3A7C8DE-0F13-43DF-AEAC-3A545CEABB41} = {2B794146-DFEE-475A-B919-7D3ED48587B8}
{108AA141-D896-4D9B-8675-89714104B2AB} = {B3A7C8DE-0F13-43DF-AEAC-3A545CEABB41}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AF7CA16F-8C38-4546-87A2-5DAAF58A1520}
Expand Down
Loading