Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Commit

Permalink
API fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgedevs committed Feb 8, 2024
1 parent f82836c commit 0273957
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 30 deletions.
3 changes: 2 additions & 1 deletion Source/Azure/AzureIoTHub/Controllers/DisplayController.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Meadow;
using Meadow.Foundation.Graphics;
using Meadow.Foundation.Graphics.MicroLayout;
using Meadow.Peripherals.Displays;
using Meadow.Units;
using System.Threading;

Expand Down Expand Up @@ -36,7 +37,7 @@ public class DisplayController

Label Humidity;

public DisplayController(IGraphicsDisplay display)
public DisplayController(IPixelDisplay display)
{
displayScreen = new DisplayScreen(display, RotationType._90Degrees)
{
Expand Down
23 changes: 14 additions & 9 deletions Source/Games/Tetris/Tetris/MeadowApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Meadow.Foundation.Displays;
using Meadow.Foundation.Graphics;
using Meadow.Hardware;
using Meadow.Peripherals.Displays;
using Meadow.Units;
using System;
using System.Threading;
Expand Down Expand Up @@ -61,7 +62,7 @@ public override Task Initialize()

void StartGameLoop()
{
while(true)
while (true)
{
tick++;
CheckInput(tick);
Expand All @@ -81,16 +82,20 @@ void CheckInput(int tick)
game.OnDown(true);
}

if (portLeft.State == true) {
if (portLeft.State == true)
{
game.OnLeft();
}
else if (portRight.State == true) {
else if (portRight.State == true)
{
game.OnRight();
}
else if (portUp.State == true) {
else if (portUp.State == true)
{
game.OnRotate();
}
else if (portDown.State == true) {
else if (portDown.State == true)
{
game.OnDown();
}
}
Expand All @@ -102,14 +107,14 @@ void DrawTetrisField()

graphics.DrawText(xIndent, 0, $"Lines: {game.LinesCleared}");

graphics.DrawRectangle(6, 10, 52, 112);
graphics.DrawRectangle(6, 10, 52, 112);

//draw current piece
for(int i = 0; i < 4; i++)
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
if(game.IsPieceLocationSet(i, j))
if (game.IsPieceLocationSet(i, j))
{
// graphics.DrawPixel(i, j);
graphics.DrawRectangle((game.CurrentPiece.X + i) * BLOCK_SIZE + xIndent,
Expand All @@ -131,7 +136,7 @@ void DrawTetrisField()
BLOCK_SIZE + 1, BLOCK_SIZE, true, true);//+1 hack until we fix the graphics lib
}
}
}
}
}

public override Task Run()
Expand Down
1 change: 1 addition & 0 deletions Source/Games/Tetris/Tetris_Max7219/MeadowApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Meadow.Foundation.Displays;
using Meadow.Foundation.Graphics;
using Meadow.Foundation.Sensors.Hid;
using Meadow.Peripherals.Displays;
using Meadow.Peripherals.Sensors.Hid;
using System;
using System.Threading;
Expand Down
2 changes: 1 addition & 1 deletion Source/Hackster/GalleryViewer/MeadowApp.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Meadow;
using Meadow.Devices;
using Meadow.Foundation;
using Meadow.Foundation.Displays;
using Meadow.Foundation.Graphics;
using Meadow.Foundation.Leds;
using Meadow.Foundation.Sensors.Buttons;
using Meadow.Peripherals.Displays;
using SimpleJpegDecoder;
using System;
using System.IO;
Expand Down
2 changes: 1 addition & 1 deletion Source/Hackster/MeadowClockGraphics/MeadowApp.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Meadow;
using Meadow.Devices;
using Meadow.Foundation;
using Meadow.Foundation.Displays;
using Meadow.Foundation.Graphics;
using Meadow.Foundation.Leds;
using Meadow.Peripherals.Displays;
using System;
using System.Threading;
using System.Threading.Tasks;
Expand Down
2 changes: 1 addition & 1 deletion Source/Hackster/MemoryGame/MeadowApp.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Meadow;
using Meadow.Devices;
using Meadow.Foundation;
using Meadow.Foundation.Displays;
using Meadow.Foundation.Graphics;
using Meadow.Foundation.Leds;
using Meadow.Hardware;
using Meadow.Peripherals.Displays;
using System;
using System.Threading;
using System.Threading.Tasks;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Meadow;
using Meadow.Foundation.Displays;
using Meadow.Foundation.Graphics;
using Meadow.Peripherals.Displays;

namespace MorseCodeTrainer
{
Expand Down
2 changes: 1 addition & 1 deletion Source/Hackster/MotionDetector/MeadowApp.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using Meadow;
using Meadow.Devices;
using Meadow.Foundation;
using Meadow.Foundation.Displays;
using Meadow.Foundation.Graphics;
using Meadow.Foundation.Leds;
using Meadow.Foundation.Sensors.Motion;
using Meadow.Hardware;
using Meadow.Peripherals.Displays;
using SimpleJpegDecoder;
using System;
using System.IO;
Expand Down
2 changes: 1 addition & 1 deletion Source/Hackster/ObstacleRadar/MeadowApp.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using Meadow;
using Meadow.Devices;
using Meadow.Foundation;
using Meadow.Foundation.Displays;
using Meadow.Foundation.Graphics;
using Meadow.Foundation.Leds;
using Meadow.Foundation.Sensors.Distance;
using Meadow.Foundation.Servos;
using Meadow.Hardware;
using Meadow.Peripherals.Displays;
using Meadow.Units;
using System;
using System.Threading;
Expand Down
6 changes: 3 additions & 3 deletions Source/Hackster/RadioPlayer/MeadowApp.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using Meadow;
using Meadow.Devices;
using Meadow.Foundation;
using Meadow.Foundation.Audio.Radio;
using Meadow.Foundation.Displays;
using Meadow.Foundation.Graphics;
using Meadow.Foundation.Leds;
using Meadow.Foundation.Sensors.Buttons;
using Meadow.Peripherals.Displays;
using Meadow.Units;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -62,10 +62,10 @@ public override Task Initialize()

void BtnNextClicked(object sender, EventArgs e)
{
if (currentStation < stations.Count-1)
if (currentStation < stations.Count - 1)
{
DisplayText(" >>>> ", 0);
currentStation++;
currentStation++;
radio.SelectFrequency(stations[currentStation]);
DisplayText($"<- FM {stations[currentStation].Megahertz} ->");
}
Expand Down
1 change: 1 addition & 0 deletions Source/Hackster/TemperatureMonitor/MeadowApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Meadow.Foundation.Graphics;
using Meadow.Foundation.Leds;
using Meadow.Foundation.Sensors.Temperature;
using Meadow.Peripherals.Displays;
using System;
using System.Threading.Tasks;

Expand Down
2 changes: 1 addition & 1 deletion Source/Hackster/TouchKeypad/MeadowApp.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using Meadow;
using Meadow.Devices;
using Meadow.Foundation;
using Meadow.Foundation.Displays;
using Meadow.Foundation.Graphics;
using Meadow.Foundation.Leds;
using Meadow.Foundation.Sensors.Hid;
using Meadow.Hardware;
using Meadow.Peripherals.Displays;
using System.Threading.Tasks;

namespace TouchKeypad
Expand Down
21 changes: 10 additions & 11 deletions Source/Hackster/WifiClock/MeadowApp.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
using Meadow;
using Meadow.Devices;
using Meadow.Foundation;
using Meadow.Foundation.Displays;
using Meadow.Foundation.Graphics;
using Meadow.Foundation.Leds;
using Meadow.Foundation.Sensors.Buttons;
using Meadow.Foundation.Sensors.Temperature;
using Meadow.Gateway.WiFi;
using Meadow.Hardware;
using Meadow.Peripherals.Displays;
using System;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -24,25 +23,25 @@ public class MeadowApp : App<F7FeatherV2>
bool showDate;

public override async Task Initialize()
{
{
var onboardLed = new RgbPwmLed(
redPwmPin: Device.Pins.OnboardLedRed,
greenPwmPin: Device.Pins.OnboardLedGreen,
bluePwmPin: Device.Pins.OnboardLedBlue);
onboardLed.SetColor(Color.Red);

var display = new Max7219(
spiBus: Device.CreateSpiBus(),
chipSelectPin: Device.Pins.D01,
deviceCount: 4,
spiBus: Device.CreateSpiBus(),
chipSelectPin: Device.Pins.D01,
deviceCount: 4,
maxMode: Max7219.Max7219Mode.Display);
graphics = new MicroGraphics(display);
graphics.CurrentFont = new Font4x8();
graphics.Rotation = RotationType._180Degrees;

graphics.Clear();
graphics.DrawText(0, 1, "WI");
graphics.DrawText(0, 9, "FI");
graphics.DrawText(0, 1, "WI");
graphics.DrawText(0, 9, "FI");
graphics.DrawText(0, 17, "TI");
graphics.DrawText(0, 25, "ME");
graphics.Show();
Expand All @@ -69,7 +68,7 @@ void PushButtonClicked(object sender, EventArgs e)
showDate = false;
}

public override async Task Run()
public override async Task Run()
{
while (true)
{
Expand All @@ -94,9 +93,9 @@ public override async Task Run()

var temperature = await analogTemperature.Read();

graphics.DrawText(0, 26, $"{(int) temperature.Celsius}");
graphics.DrawText(0, 26, $"{(int)temperature.Celsius}");
}

graphics.Show();
Thread.Sleep(1000);
}
Expand Down
1 change: 1 addition & 0 deletions Source/Hackster/WifiWeather/Views/WeatherView.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Meadow;
using Meadow.Foundation.Displays;
using Meadow.Foundation.Graphics;
using Meadow.Peripherals.Displays;
using SimpleJpegDecoder;
using System;
using System.IO;
Expand Down

0 comments on commit 0273957

Please sign in to comment.