Skip to content

Commit

Permalink
Merge pull request #3 from WildernessLabs/b65
Browse files Browse the repository at this point in the history
Update all samples to b6.5
  • Loading branch information
adrianstevens committed Jul 22, 2022
2 parents 05eb685 + 5cb6f51 commit e6f2006
Show file tree
Hide file tree
Showing 22 changed files with 142 additions and 151 deletions.
36 changes: 25 additions & 11 deletions Source/C16x9/Driver/C16x9.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ public class C16x9 : IGraphicsDisplay

readonly IDigitalOutputPort onOffPort;

readonly IDisplayBuffer displayBuffer;
/// <summary>
/// The buffer to hold the display data
/// </summary>
public IPixelBuffer PixelBuffer { get; protected set; }

/// <summary>
/// Color mode of display
Expand Down Expand Up @@ -70,7 +73,7 @@ public C16x9(IDigitalOutputPort onOffPort, II2cBus i2cBus, byte address = (byte)
iS31FL3731 = new Is31fl3731(i2cBus, address);
iS31FL3731.Initialize();

displayBuffer = new BufferGray8(Width, Height);
PixelBuffer = new BufferGray8(Width, Height);

//enable the display
this.onOffPort.State = true;
Expand Down Expand Up @@ -100,7 +103,7 @@ public C16x9(IMeadowDevice device, IPin onOffPin, II2cBus i2cBus) :
/// <param name="updateDisplay"></param>
public void Clear(bool updateDisplay = false)
{
displayBuffer.Clear();
PixelBuffer.Clear();

if (updateDisplay == true)
{
Expand All @@ -122,7 +125,7 @@ public void DrawPixel(int x, int y, Color color)
{ return; }
}

displayBuffer.SetPixel(x, y, color);
PixelBuffer.SetPixel(x, y, color);
}

/// <summary>
Expand All @@ -143,9 +146,9 @@ public void DrawPixel(int x, int y, bool colored)
/// <param name="y">y location in pixels</param>
public void InvertPixel(int x, int y)
{
var brightness = 255 - displayBuffer.GetPixel(x, y).Color8bppGray;
var brightness = 255 - PixelBuffer.GetPixel(x, y).Color8bppGray;

displayBuffer.SetPixel(x, y, new Color(brightness, brightness, brightness));
PixelBuffer.SetPixel(x, y, new Color(brightness, brightness, brightness));
}

/// <summary>
Expand All @@ -154,9 +157,9 @@ public void InvertPixel(int x, int y)
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="displayBuffer"></param>
public void DrawBuffer(int x, int y, IDisplayBuffer displayBuffer)
public void DrawBuffer(int x, int y, IPixelBuffer displayBuffer)
{
this.displayBuffer.WriteBuffer(x, y, displayBuffer);
this.PixelBuffer.WriteBuffer(x, y, displayBuffer);
}

/// <summary>
Expand All @@ -166,7 +169,7 @@ public void DrawBuffer(int x, int y, IDisplayBuffer displayBuffer)
/// <param name="updateDisplay"></param>
public void Fill(Color clearColor, bool updateDisplay = false)
{
displayBuffer.Fill(clearColor);
PixelBuffer.Fill(clearColor);

if(updateDisplay)
{
Expand All @@ -184,7 +187,7 @@ public void Fill(Color clearColor, bool updateDisplay = false)
/// <param name="fillColor"></param>
public void Fill(int x, int y, int width, int height, Color fillColor)
{
displayBuffer.Fill(fillColor, x, y, width, height);
PixelBuffer.Fill(x, y, width, height, fillColor);
}

/// <summary>
Expand All @@ -199,7 +202,7 @@ public void Show()
{
for(int y = 0; y < Height; y++)
{
iS31FL3731.SetLedPwm(frame, (byte)(x + y * Width), displayBuffer.GetPixel(x, y).Color8bppGray);
iS31FL3731.SetLedPwm(frame, (byte)(x + y * Width), PixelBuffer.GetPixel(x, y).Color8bppGray);
}
}

Expand All @@ -226,5 +229,16 @@ public void Show(byte frame)
{
iS31FL3731.DisplayFrame(frame);
}

/// <summary>
/// Write an external buffer to the display buffer
/// </summary>
/// <param name="x">X postion to write buffer in pixels</param>
/// <param name="y">Y postion to write buffer in pixels</param>
/// <param name="buffer">The buffer to write</param>
public void WriteBuffer(int x, int y, IPixelBuffer buffer)
{
PixelBuffer.WriteBuffer(x, y, buffer);
}
}
}
13 changes: 8 additions & 5 deletions Source/C16x9/Driver/C16x9.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Meadow.Sdk/1.1.0">
<Project Sdk="Meadow.Sdk/1.1.0">
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageIcon>icon.png</PackageIcon>
Expand All @@ -16,9 +16,12 @@
<Description>MikroElectronika I2C 16x9 Click LED board</Description>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\icon.png" Pack="true" PackagePath="" />
<PackageReference Include="Meadow.Foundation" Version="0.*" />
<PackageReference Include="Meadow.Foundation.Displays.MicroGraphics" Version="0.*" />
<PackageReference Include="Meadow.Foundation.ICs.IOExpanders.Is31fl3731" Version="0.*" />
<None Include="..\..\icon.png" Pack="true" PackagePath="" />
<!--<PackageReference Include="Meadow.Foundation.Displays.MicroGraphics" Version="0.*" />
<PackageReference Include="Meadow.Foundation.ICs.IOExpanders.Is31fl3731" Version="0.*" />-->
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Meadow.Foundation\Source\Meadow.Foundation.Libraries_and_Frameworks\Graphics.MicroGraphics\Driver\Graphics.MicroGraphics.csproj" />
<ProjectReference Include="..\..\..\..\Meadow.Foundation\Source\Meadow.Foundation.Peripherals\ICs.IOExpanders.Is31fl3731\Driver\ICs.IOExpanders.Is31fl3731.csproj" />
</ItemGroup>
</Project>
8 changes: 4 additions & 4 deletions Source/C16x9/Sample/C16x9G_Sample/C16x9_Sample.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Meadow.Sdk/1.1.0">
<Project Sdk="Meadow.Sdk/1.1.0">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<OutputType>Exe</OutputType>
<OutputType>Library</OutputType>
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="0.*" />
<ProjectReference Include="..\..\..\..\..\Meadow.Core\source\Meadow.F7\Meadow.F7.csproj" />
<ProjectReference Include="..\..\Driver\C16x9.csproj" />
</ItemGroup>
</Project>
</Project>
2 changes: 1 addition & 1 deletion Source/C16x9/Sample/C16x9G_Sample/MeadowApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace C16x9_Sample
{
// Change F7FeatherV2 to F7FeatherV1 for V1.x boards
public class MeadowApp : App<F7FeatherV2, MeadowApp>
public class MeadowApp : App<F7FeatherV2>
{
//<!=SNIP=>

Expand Down
19 changes: 0 additions & 19 deletions Source/C16x9/Sample/C16x9G_Sample/Program.cs

This file was deleted.

11 changes: 7 additions & 4 deletions Source/C8x8/Driver/C8x8.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
<Description>MikroElectronika SPI 8x8 Click LED board</Description>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\icon.png" Pack="true" PackagePath="" />
<PackageReference Include="Meadow.Foundation" Version="0.*" />
<PackageReference Include="Meadow.Foundation.Displays.Max7219" Version="0.*" />
<PackageReference Include="Meadow.Foundation.Displays.MicroGraphics" Version="0.*" />
<None Include="..\..\icon.png" Pack="true" PackagePath="" />
<!--<PackageReference Include="Meadow.Foundation.Displays.Max7219" Version="0.*" />
<PackageReference Include="Meadow.Foundation.Displays.MicroGraphics" Version="0.*" />-->
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Meadow.Foundation\Source\Meadow.Foundation.Libraries_and_Frameworks\Graphics.MicroGraphics\Driver\Graphics.MicroGraphics.csproj" />
<ProjectReference Include="..\..\..\..\Meadow.Foundation\Source\Meadow.Foundation.Peripherals\Displays.Max7219\Driver\Displays.Max7219.csproj" />
</ItemGroup>
</Project>
6 changes: 3 additions & 3 deletions Source/C8x8/Sample/C8x8_Sample/C8x8_Sample.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Meadow.Sdk/1.1.0">
<Project Sdk="Meadow.Sdk/1.1.0">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<OutputType>Exe</OutputType>
<OutputType>Library</OutputType>
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="0.*" />
<ProjectReference Include="..\..\..\..\..\Meadow.Core\source\Meadow.F7\Meadow.F7.csproj" />
<ProjectReference Include="..\..\Driver\C8x8.csproj" />
</ItemGroup>
</Project>
6 changes: 2 additions & 4 deletions Source/C8x8/Sample/C8x8_Sample/MeadowApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace C8x8_Sample
{
// Change F7FeatherV2 to F7FeatherV1 for V1.x boards
public class MeadowApp : App<F7FeatherV2, MeadowApp>
public class MeadowApp : App<F7FeatherV2>
{
//<!=SNIP=>

Expand All @@ -18,12 +18,10 @@ public MeadowApp()
Console.WriteLine("Initializing ...");

c8x8 = new C8x8(Device, Device.CreateSpiBus(), Device.Pins.D14);
c8x8.IgnoreOutOfBoundsPixels = true;

c8x8.Clear();

var graphics = new MicroGraphics(c8x8)
{
IgnoreOutOfBoundsPixels = true,
Rotation = RotationType._270Degrees
};
graphics.CurrentFont = new Font4x8();
Expand Down
19 changes: 0 additions & 19 deletions Source/C8x8/Sample/C8x8_Sample/Program.cs

This file was deleted.

6 changes: 4 additions & 2 deletions Source/CButton/Driver/CButton.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
</PropertyGroup>
<ItemGroup>
<None Include="..\..\icon.png" Pack="true" PackagePath="" />
<PackageReference Include="Meadow.Foundation" Version="0.*" />
<PackageReference Include="Meadow.Foundation.Sensors.Hid.As5013" Version="0.*" />
<!--<PackageReference Include="Meadow.Foundation.Sensors.Hid.As5013" Version="0.*" />-->
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Meadow.Foundation\Source\Meadow.Foundation.Peripherals\Sensors.Hid.As5013\Driver\Sensors.Hid.As5013.csproj" />
</ItemGroup>
</Project>
8 changes: 4 additions & 4 deletions Source/CButton/Sample/CButton_Sample/CButton_Sample.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Meadow.Sdk/1.1.0">
<Project Sdk="Meadow.Sdk/1.1.0">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<OutputType>Exe</OutputType>
<OutputType>Library</OutputType>
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="0.*" />
<ProjectReference Include="..\..\..\..\..\Meadow.Core\source\Meadow.F7\Meadow.F7.csproj" />
<ProjectReference Include="..\..\Driver\CButton.csproj" />
</ItemGroup>
</Project>
</Project>
2 changes: 1 addition & 1 deletion Source/CButton/Sample/CButton_Sample/MeadowApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace CButton_Sample
{
// Change F7FeatherV2 to F7FeatherV1 for V1.x boards
public class MeadowApp : App<F7FeatherV2, MeadowApp>
public class MeadowApp : App<F7FeatherV2>
{
//<!=SNIP=>

Expand Down
19 changes: 0 additions & 19 deletions Source/CButton/Sample/CButton_Sample/Program.cs

This file was deleted.

10 changes: 6 additions & 4 deletions Source/CJoystick/Driver/CJoystick.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Meadow.Sdk/1.1.0">
<Project Sdk="Meadow.Sdk/1.1.0">
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageIcon>icon.png</PackageIcon>
Expand All @@ -16,8 +16,10 @@
<Description>MikroElectronika I2C Joystick MikroBus click board</Description>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\icon.png" Pack="true" PackagePath="" />
<PackageReference Include="Meadow.Foundation" Version="0.*" />
<PackageReference Include="Meadow.Foundation.Sensors.Hid.As5013" Version="0.*" />
<None Include="..\..\icon.png" Pack="true" PackagePath="" />
<!--<PackageReference Include="Meadow.Foundation.Sensors.Hid.As5013" Version="0.*" />-->
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Meadow.Foundation\Source\Meadow.Foundation.Peripherals\Sensors.Hid.As5013\Driver\Sensors.Hid.As5013.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Meadow.Sdk/1.1.0">
<Project Sdk="Meadow.Sdk/1.1.0">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<OutputType>Exe</OutputType>
<OutputType>Library</OutputType>
<AssemblyName>App</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="0.*" />
<ProjectReference Include="..\..\..\..\..\Meadow.Core\source\Meadow.F7\Meadow.F7.csproj" />
<ProjectReference Include="..\..\Driver\CJoystick.csproj" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Source/CJoystick/Sample/CJoystick_Sample/MeadowApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace CJoystick_Sample
{
// Change F7FeatherV2 to F7FeatherV1 for V1.x boards
public class MeadowApp : App<F7FeatherV2, MeadowApp>
public class MeadowApp : App<F7FeatherV2>
{
//<!=SNIP=>

Expand Down
19 changes: 0 additions & 19 deletions Source/CJoystick/Sample/CJoystick_Sample/Program.cs

This file was deleted.

Loading

0 comments on commit e6f2006

Please sign in to comment.