Skip to content

Commit 3b78918

Browse files
authored
Merge pull request #54 from WildernessLabs/develop
Update to 1.13.0
2 parents 2536709 + bbb3e94 commit 3b78918

File tree

29 files changed

+3101
-23
lines changed

29 files changed

+3101
-23
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<AssemblyName>App</AssemblyName>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Meadow.Linux" Version="*" />
11+
<PackageReference Include="Meadow.Foundation" Version="*" />
12+
<PackageReference Include="Meadow.Foundation.ICs.CAN.Mcp2515" Version="*" />
13+
<PackageReference Include="Meadow.Foundation.Sensors.Atmospheric.Bmx280" Version="*" />
14+
</ItemGroup>
15+
16+
<ItemGroup>
17+
<None Update="app.config.yaml">
18+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
19+
</None>
20+
</ItemGroup>
21+
</Project>
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
using Meadow;
2+
using Meadow.Foundation.ICs.CAN;
3+
using Meadow.Foundation.Sensors.Atmospheric;
4+
using Meadow.Hardware;
5+
using Meadow.Units;
6+
using System.Threading.Tasks;
7+
8+
namespace Validation;
9+
10+
public class MeadowApp : App<BeagleBoneBlack>
11+
{
12+
public override async Task Run()
13+
{
14+
Resolver.Log.Info("Run...");
15+
16+
await ValidateSPI();
17+
}
18+
19+
public async Task ValidateSPI()
20+
{
21+
Resolver.Log.Info("BeagleBone SPI stuff...");
22+
23+
var transceiver = new Mcp2515(
24+
Device.CreateSpiBus(0, 1_000_000.Hertz()),
25+
Device.Pins.GPIO_49.CreateDigitalOutputPort(),
26+
Mcp2515.CanOscillator.Osc_8MHz);
27+
28+
var bus = transceiver.CreateCanBus(CanBitrate.Can_250kbps);
29+
30+
while (true)
31+
{
32+
Resolver.Log.Info("Checking bus...");
33+
34+
if (bus.IsFrameAvailable())
35+
{
36+
var frame = bus.ReadFrame();
37+
if (frame != null)
38+
{
39+
Resolver.Log.Info($"Received a {frame!.GetType().Name}");
40+
}
41+
else
42+
{
43+
Resolver.Log.Info("Frame available but not readable?");
44+
}
45+
}
46+
else
47+
{
48+
Resolver.Log.Info("No data");
49+
}
50+
51+
await Task.Delay(1000);
52+
}
53+
54+
}
55+
56+
public async Task ValidateI2C()
57+
{
58+
Resolver.Log.Info("BeagleBone reading BMP280 over I2C...");
59+
60+
var sensor = new Bmp280(Device.CreateI2cBus(Device.Pins.I2C2_SCL, Device.Pins.I2C2_SDA, Meadow.Hardware.I2cBusSpeed.Standard));
61+
//var sensor = new Bmp280(Device.CreateI2cBus());
62+
63+
while (true)
64+
{
65+
var reading = await sensor.Read();
66+
Resolver.Log.Info($"Temp: {reading.Temperature?.Fahrenheit:N1} F");
67+
await Task.Delay(1000);
68+
}
69+
70+
}
71+
72+
public async Task ValidatePWMs()
73+
{
74+
var ports = new[]
75+
{
76+
// sudo config-pin P9.22 pwm
77+
Device.Pins.ECAPPWM0.CreatePwmPort(50.Hertz(), 0.5f),
78+
// Device.Pins.ECAPPWM2.CreatePwmPort(50.Hertz(), 0.5f),
79+
// Device.Pins.EHRPWM1A.CreatePwmPort(50.Hertz(), 0.5f),
80+
// Device.Pins.EHRPWM1B.CreatePwmPort(50.Hertz(), 0.5f),
81+
// Device.Pins.EHRPWM2A.CreatePwmPort(50.Hertz(), 0.5f),
82+
// Device.Pins.EHRPWM2B.CreatePwmPort(50.Hertz(), 0.5f),
83+
};
84+
85+
while (true)
86+
{
87+
foreach (var port in ports)
88+
{
89+
Resolver.Log.Info($"Starting {port.Pin.Name}");
90+
port.Start();
91+
92+
Resolver.Log.Info($" {port.Pin.Key} {port.State} {port.Frequency.Hertz}Hz {port.DutyCycle:N1}");
93+
}
94+
95+
await Task.Delay(1000);
96+
97+
foreach (var port in ports)
98+
{
99+
Resolver.Log.Info($"Stopping {port.Pin.Name}");
100+
port.Stop();
101+
102+
Resolver.Log.Info($" {port.Pin.Key} {port.State} {port.Frequency.Hertz}Hz {port.DutyCycle:N1}");
103+
}
104+
105+
await Task.Delay(1000);
106+
}
107+
}
108+
109+
public async Task ValidateAnalogInputs()
110+
{
111+
var pins = new[]
112+
{
113+
Device.Pins.AIN0.CreateAnalogInputPort(1),
114+
Device.Pins.AIN1.CreateAnalogInputPort(1),
115+
Device.Pins.AIN2.CreateAnalogInputPort(1),
116+
Device.Pins.AIN3.CreateAnalogInputPort(1),
117+
Device.Pins.AIN4.CreateAnalogInputPort(1),
118+
Device.Pins.AIN5.CreateAnalogInputPort(1),
119+
Device.Pins.AIN6.CreateAnalogInputPort(1),
120+
};
121+
122+
while (true)
123+
{
124+
foreach (var pin in pins)
125+
{
126+
var voltage = await pin.Read();
127+
128+
Resolver.Log.Info($"{pin.Pin.Name} = {voltage.Volts:N2} V");
129+
}
130+
131+
await Task.Delay(1000);
132+
}
133+
}
134+
135+
public async Task ValidateDigitalOutputs()
136+
{
137+
var state = false;
138+
139+
var pins = new[]
140+
{
141+
Device.Pins.GPIO_48.CreateDigitalOutputPort(state),
142+
Device.Pins.GPIO_60.CreateDigitalOutputPort(state),
143+
Device.Pins.GPIO_66.CreateDigitalOutputPort(state),
144+
Device.Pins.GPIO_67.CreateDigitalOutputPort(state),
145+
};
146+
147+
while (true)
148+
{
149+
state = !state;
150+
151+
foreach (var pin in pins)
152+
{
153+
Resolver.Log.Info($"{pin.Pin.Name} Set State = {state}");
154+
pin.State = state;
155+
Resolver.Log.Info($"{pin.Pin.Name} Read State = {pin.State}");
156+
}
157+
158+
await Task.Delay(1000);
159+
}
160+
}
161+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using Meadow;
2+
using System.Threading.Tasks;
3+
4+
namespace Validation;
5+
6+
public class Program
7+
{
8+
public static async Task Main(string[] args)
9+
{
10+
await MeadowOS.Start(args);
11+
}
12+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Lifecycle:
2+
RestartOnAppFailure: false
3+
4+
Logging:
5+
LogLevel:
6+
# Trace, Debug, Information, Warning, or Error
7+
Default: Trace

Source/Juego/Eyeball/Eyeball.Juego/Eyeball.Juego.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,9 @@
1010
<PackageReference Include="Meadow.Juego" Version="*" />
1111
<ProjectReference Include="..\Eyeball.Core\Eyeball.Core.csproj" />
1212
</ItemGroup>
13+
<ItemGroup>
14+
<None Update="app.build.yaml">
15+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
16+
</None>
17+
</ItemGroup>
1318
</Project>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Deploy:
2+
NoLink: [ Juego ]

Source/Juego/FallingSand/FallingSand.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,9 @@
99
<ItemGroup>
1010
<PackageReference Include="Meadow.Juego" Version="*" />
1111
</ItemGroup>
12+
<ItemGroup>
13+
<None Update="app.build.yaml">
14+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
15+
</None>
16+
</ItemGroup>
1217
</Project>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Deploy:
2+
NoLink: [ Juego ]

Source/Juego/Froggit/Froggit.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
<PackageReference Include="Meadow.Juego" Version="*" />
1111
</ItemGroup>
1212
<ItemGroup>
13+
<None Update="app.build.yaml">
14+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
15+
</None>
1316
<None Update="meadow.config.yaml">
1417
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
1518
</None>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Deploy:
2+
NoLink: [ Juego ]

0 commit comments

Comments
 (0)