From 8a296eef72fab8a6d5d5b7a345cad8b3e4968d15 Mon Sep 17 00:00:00 2001 From: Adrian Stevens Date: Tue, 28 May 2024 11:52:54 -0700 Subject: [PATCH] Release 1.12.0 --- .github/workflows/main-ci.yml | 2 +- Source/CharlieWing/Driver/CharlieWing.cs | 45 ++++++++++++------- Source/CharlieWing/Driver/CharlieWing.csproj | 2 +- .../CharlieWing_Sample.csproj | 4 +- Source/DotstarWing/Driver/DotstarWing.csproj | 2 +- .../DotstarWing_Sample.csproj | 4 +- Source/GPSWing/Driver/GPSWing.csproj | 2 +- .../GPSWing_Sample/GPSWing_Sample.csproj | 2 +- .../KeyboardWing/Driver/KeyboardWing.csproj | 6 +-- .../KeyboardWing_Sample.csproj | 2 +- .../Driver/LedMatrix8x16Wing.csproj | 2 +- .../LedMatrix8x16Wing_Sample.csproj | 4 +- Source/MotorWing/Driver/MotorWing.csproj | 2 +- .../MotorWing_Sample/MotorWing_Sample.csproj | 2 +- .../NeoPixelWing/Driver/NeoPixelWing.csproj | 4 +- .../NeoPixelWing_Sample.csproj | 2 +- .../Driver/NineDofImuWing.csproj | 4 +- .../NineDofImuWing_Sample.csproj | 2 +- .../Driver/OLED128x32Wing.csproj | 2 +- .../OLED128x32Wing_Sample.csproj | 2 +- .../Driver/OLED128x64Wing.csproj | 2 +- .../OLED128x64Wing_Sample.csproj | 4 +- Source/ServoWing/Driver/ServoWing.csproj | 4 +- .../ServoWing_Sample/ServoWing_Sample.csproj | 2 +- 24 files changed, 60 insertions(+), 49 deletions(-) diff --git a/.github/workflows/main-ci.yml b/.github/workflows/main-ci.yml index 5cfa155..e79c43f 100644 --- a/.github/workflows/main-ci.yml +++ b/.github/workflows/main-ci.yml @@ -3,7 +3,6 @@ name: Main Build on: workflow_dispatch: pull_request: - branches: [ main ] push: branches: [ main ] @@ -18,6 +17,7 @@ jobs: uses: actions/checkout@v3 with: path: Meadow.Foundation.FeatherWings + ref: main - name: Setup .NET SDK uses: actions/setup-dotnet@v1 diff --git a/Source/CharlieWing/Driver/CharlieWing.cs b/Source/CharlieWing/Driver/CharlieWing.cs index 811809e..b33d047 100644 --- a/Source/CharlieWing/Driver/CharlieWing.cs +++ b/Source/CharlieWing/Driver/CharlieWing.cs @@ -10,10 +10,14 @@ namespace Meadow.Foundation.FeatherWings /// public class CharlieWing : IPixelDisplay { + private const int WidthInPixels = 15; + private const int HeightInPixels = 7; + private const int MaxFrames = 7; + /// - /// Is31fl3731 object to manage the leds + /// Is31fl3731 object to manage the LEDs /// - protected readonly Is31fl3731 iS31FL3731; + protected readonly Is31fl3731 is31Fl3731; /// /// Color mode of display @@ -23,12 +27,12 @@ public class CharlieWing : IPixelDisplay /// /// Width of display in pixels /// - public int Width => 15; + public int Width => WidthInPixels; /// /// Height of display in pixels /// - public int Height => 7; + public int Height => HeightInPixels; /// /// The Is31fl3731 active frame @@ -53,13 +57,13 @@ public class CharlieWing : IPixelDisplay /// The I2C address public CharlieWing(II2cBus i2cBus, byte address = (byte)Is31fl3731.Addresses.Default) { - iS31FL3731 = new Is31fl3731(i2cBus, address); - iS31FL3731.Initialize(); + is31Fl3731 = new Is31fl3731(i2cBus, address); + is31Fl3731.Initialize(); - for (byte i = 0; i <= 7; i++) + for (byte i = 0; i <= MaxFrames; i++) { - iS31FL3731.SetLedState(i, true); - iS31FL3731.Clear(i); + is31Fl3731.SetLedState(i, true); + is31Fl3731.Clear(i); } } @@ -69,7 +73,7 @@ public CharlieWing(II2cBus i2cBus, byte address = (byte)Is31fl3731.Addresses.Def /// Force a display update if true, false to clear the buffer public void Clear(bool updateDisplay = false) { - iS31FL3731.Clear(Frame); + is31Fl3731.Clear(Frame); } /// @@ -102,6 +106,11 @@ public void DrawPixel(int x, int y, bool colored) /// The led brightness from 0-255 public void DrawPixel(int x, int y, byte brightness) { + if (x < 0 || x >= WidthInPixels || y < 0 || y >= HeightInPixels) + { + throw new ArgumentOutOfRangeException($"Pixel coordinates ({x}, {y}) are out of bounds."); + } + if (x > 7) { x = 15 - x; @@ -112,10 +121,10 @@ public void DrawPixel(int x, int y, byte brightness) y = 7 - y; } - //Swap + // Swap (y, x) = (x, y); - iS31FL3731.SetLedPwm(Frame, (byte)(x + y * 16), brightness); + is31Fl3731.SetLedPwm(Frame, (byte)(x + y * 16), brightness); } /// @@ -125,7 +134,9 @@ public void DrawPixel(int x, int y, byte brightness) /// The y position in pixels 0 indexed from the top public void InvertPixel(int x, int y) { - throw new NotImplementedException(); + byte currentBrightness = is31Fl3731.GetLedPwm(Frame, (byte)(x + y * 16)); + byte invertedBrightness = (byte)(255 - currentBrightness); + DrawPixel(x, y, invertedBrightness); } /// @@ -185,7 +196,7 @@ public void Fill(int x, int y, int width, int height, Color fillColor) /// public void Show() { - iS31FL3731.DisplayFrame(Frame); + is31Fl3731.DisplayFrame(Frame); } /// @@ -201,12 +212,12 @@ public void Show(int left, int top, int right, int bottom) } /// - /// Update the display from a specific iS31FL3731 frame + /// Update the display from a specific Is31fl3731 frame /// /// The frame to show (0-7) public void Show(byte frame) { - iS31FL3731.DisplayFrame(frame); + is31Fl3731.DisplayFrame(frame); } } -} \ No newline at end of file +} diff --git a/Source/CharlieWing/Driver/CharlieWing.csproj b/Source/CharlieWing/Driver/CharlieWing.csproj index 9df2f5f..efad651 100644 --- a/Source/CharlieWing/Driver/CharlieWing.csproj +++ b/Source/CharlieWing/Driver/CharlieWing.csproj @@ -24,6 +24,6 @@ - + diff --git a/Source/CharlieWing/Samples/CharlieWing_Sample/CharlieWing_Sample.csproj b/Source/CharlieWing/Samples/CharlieWing_Sample/CharlieWing_Sample.csproj index 3737cc1..1522353 100644 --- a/Source/CharlieWing/Samples/CharlieWing_Sample/CharlieWing_Sample.csproj +++ b/Source/CharlieWing/Samples/CharlieWing_Sample/CharlieWing_Sample.csproj @@ -6,8 +6,8 @@ App - - + + diff --git a/Source/DotstarWing/Driver/DotstarWing.csproj b/Source/DotstarWing/Driver/DotstarWing.csproj index 0bb8e5d..bc91a33 100644 --- a/Source/DotstarWing/Driver/DotstarWing.csproj +++ b/Source/DotstarWing/Driver/DotstarWing.csproj @@ -24,6 +24,6 @@ - + diff --git a/Source/DotstarWing/Samples/DotstarWing_Sample/DotstarWing_Sample.csproj b/Source/DotstarWing/Samples/DotstarWing_Sample/DotstarWing_Sample.csproj index e076b21..d0a6646 100644 --- a/Source/DotstarWing/Samples/DotstarWing_Sample/DotstarWing_Sample.csproj +++ b/Source/DotstarWing/Samples/DotstarWing_Sample/DotstarWing_Sample.csproj @@ -6,8 +6,8 @@ App - - + + diff --git a/Source/GPSWing/Driver/GPSWing.csproj b/Source/GPSWing/Driver/GPSWing.csproj index bdd1515..24d24ba 100644 --- a/Source/GPSWing/Driver/GPSWing.csproj +++ b/Source/GPSWing/Driver/GPSWing.csproj @@ -24,6 +24,6 @@ - + diff --git a/Source/GPSWing/Samples/GPSWing_Sample/GPSWing_Sample.csproj b/Source/GPSWing/Samples/GPSWing_Sample/GPSWing_Sample.csproj index df2b5ee..cad8bc0 100644 --- a/Source/GPSWing/Samples/GPSWing_Sample/GPSWing_Sample.csproj +++ b/Source/GPSWing/Samples/GPSWing_Sample/GPSWing_Sample.csproj @@ -6,7 +6,7 @@ App - + diff --git a/Source/KeyboardWing/Driver/KeyboardWing.csproj b/Source/KeyboardWing/Driver/KeyboardWing.csproj index 5049a55..a231bde 100644 --- a/Source/KeyboardWing/Driver/KeyboardWing.csproj +++ b/Source/KeyboardWing/Driver/KeyboardWing.csproj @@ -24,8 +24,8 @@ - - - + + + diff --git a/Source/KeyboardWing/Samples/KeyboardWing_Sample/KeyboardWing_Sample.csproj b/Source/KeyboardWing/Samples/KeyboardWing_Sample/KeyboardWing_Sample.csproj index a22d1f5..1cae599 100644 --- a/Source/KeyboardWing/Samples/KeyboardWing_Sample/KeyboardWing_Sample.csproj +++ b/Source/KeyboardWing/Samples/KeyboardWing_Sample/KeyboardWing_Sample.csproj @@ -6,7 +6,7 @@ App - + diff --git a/Source/LedMatrix8x16Wing/Driver/LedMatrix8x16Wing.csproj b/Source/LedMatrix8x16Wing/Driver/LedMatrix8x16Wing.csproj index 7c3d36f..fb85c5f 100644 --- a/Source/LedMatrix8x16Wing/Driver/LedMatrix8x16Wing.csproj +++ b/Source/LedMatrix8x16Wing/Driver/LedMatrix8x16Wing.csproj @@ -24,6 +24,6 @@ - + diff --git a/Source/LedMatrix8x16Wing/Samples/LedMatrix8x16Wing_Sample/LedMatrix8x16Wing_Sample.csproj b/Source/LedMatrix8x16Wing/Samples/LedMatrix8x16Wing_Sample/LedMatrix8x16Wing_Sample.csproj index d263ff7..fe7b6e3 100644 --- a/Source/LedMatrix8x16Wing/Samples/LedMatrix8x16Wing_Sample/LedMatrix8x16Wing_Sample.csproj +++ b/Source/LedMatrix8x16Wing/Samples/LedMatrix8x16Wing_Sample/LedMatrix8x16Wing_Sample.csproj @@ -6,8 +6,8 @@ App - - + + diff --git a/Source/MotorWing/Driver/MotorWing.csproj b/Source/MotorWing/Driver/MotorWing.csproj index 6766581..39e0df5 100644 --- a/Source/MotorWing/Driver/MotorWing.csproj +++ b/Source/MotorWing/Driver/MotorWing.csproj @@ -24,6 +24,6 @@ - + diff --git a/Source/MotorWing/Sample/MotorWing_Sample/MotorWing_Sample.csproj b/Source/MotorWing/Sample/MotorWing_Sample/MotorWing_Sample.csproj index 8521429..c0e76c6 100644 --- a/Source/MotorWing/Sample/MotorWing_Sample/MotorWing_Sample.csproj +++ b/Source/MotorWing/Sample/MotorWing_Sample/MotorWing_Sample.csproj @@ -6,7 +6,7 @@ App - + diff --git a/Source/NeoPixelWing/Driver/NeoPixelWing.csproj b/Source/NeoPixelWing/Driver/NeoPixelWing.csproj index ec64a2a..ca2fee9 100644 --- a/Source/NeoPixelWing/Driver/NeoPixelWing.csproj +++ b/Source/NeoPixelWing/Driver/NeoPixelWing.csproj @@ -24,7 +24,7 @@ - - + + diff --git a/Source/NeoPixelWing/Sample/NeoPixelWing_Sample/NeoPixelWing_Sample.csproj b/Source/NeoPixelWing/Sample/NeoPixelWing_Sample/NeoPixelWing_Sample.csproj index 3f56e17..8389224 100644 --- a/Source/NeoPixelWing/Sample/NeoPixelWing_Sample/NeoPixelWing_Sample.csproj +++ b/Source/NeoPixelWing/Sample/NeoPixelWing_Sample/NeoPixelWing_Sample.csproj @@ -6,7 +6,7 @@ App - + diff --git a/Source/NineDofImuWing/Driver/NineDofImuWing.csproj b/Source/NineDofImuWing/Driver/NineDofImuWing.csproj index 9a1e6ff..3712066 100644 --- a/Source/NineDofImuWing/Driver/NineDofImuWing.csproj +++ b/Source/NineDofImuWing/Driver/NineDofImuWing.csproj @@ -24,7 +24,7 @@ - - + + diff --git a/Source/NineDofImuWing/Sample/NineDofImuWing_Sample/NineDofImuWing_Sample.csproj b/Source/NineDofImuWing/Sample/NineDofImuWing_Sample/NineDofImuWing_Sample.csproj index 0c5a87a..795bca3 100644 --- a/Source/NineDofImuWing/Sample/NineDofImuWing_Sample/NineDofImuWing_Sample.csproj +++ b/Source/NineDofImuWing/Sample/NineDofImuWing_Sample/NineDofImuWing_Sample.csproj @@ -6,7 +6,7 @@ App - + diff --git a/Source/OLED128x32Wing/Driver/OLED128x32Wing.csproj b/Source/OLED128x32Wing/Driver/OLED128x32Wing.csproj index 642ec79..ad1ba84 100644 --- a/Source/OLED128x32Wing/Driver/OLED128x32Wing.csproj +++ b/Source/OLED128x32Wing/Driver/OLED128x32Wing.csproj @@ -24,6 +24,6 @@ - + diff --git a/Source/OLED128x32Wing/Sample/OLED128x32Wing_Sample/OLED128x32Wing_Sample.csproj b/Source/OLED128x32Wing/Sample/OLED128x32Wing_Sample/OLED128x32Wing_Sample.csproj index 1fe4176..3a8b919 100644 --- a/Source/OLED128x32Wing/Sample/OLED128x32Wing_Sample/OLED128x32Wing_Sample.csproj +++ b/Source/OLED128x32Wing/Sample/OLED128x32Wing_Sample/OLED128x32Wing_Sample.csproj @@ -6,7 +6,7 @@ App - + diff --git a/Source/OLED128x64Wing/Driver/OLED128x64Wing.csproj b/Source/OLED128x64Wing/Driver/OLED128x64Wing.csproj index 11f314f..a5cbb39 100644 --- a/Source/OLED128x64Wing/Driver/OLED128x64Wing.csproj +++ b/Source/OLED128x64Wing/Driver/OLED128x64Wing.csproj @@ -24,6 +24,6 @@ - + diff --git a/Source/OLED128x64Wing/Sample/OLED128x64Wing_Sample/OLED128x64Wing_Sample.csproj b/Source/OLED128x64Wing/Sample/OLED128x64Wing_Sample/OLED128x64Wing_Sample.csproj index 51df2c3..b2b474c 100644 --- a/Source/OLED128x64Wing/Sample/OLED128x64Wing_Sample/OLED128x64Wing_Sample.csproj +++ b/Source/OLED128x64Wing/Sample/OLED128x64Wing_Sample/OLED128x64Wing_Sample.csproj @@ -6,8 +6,8 @@ App - - + + diff --git a/Source/ServoWing/Driver/ServoWing.csproj b/Source/ServoWing/Driver/ServoWing.csproj index f99b683..beed718 100644 --- a/Source/ServoWing/Driver/ServoWing.csproj +++ b/Source/ServoWing/Driver/ServoWing.csproj @@ -24,7 +24,7 @@ - - + + diff --git a/Source/ServoWing/Sample/ServoWing_Sample/ServoWing_Sample.csproj b/Source/ServoWing/Sample/ServoWing_Sample/ServoWing_Sample.csproj index 00a5b51..a74142c 100644 --- a/Source/ServoWing/Sample/ServoWing_Sample/ServoWing_Sample.csproj +++ b/Source/ServoWing/Sample/ServoWing_Sample/ServoWing_Sample.csproj @@ -6,7 +6,7 @@ App - +