Skip to content

Commit 8ae32bf

Browse files
authored
Move to main (#128)
***NO_CI***
2 parents 07fa92a + d20269f commit 8ae32bf

File tree

95 files changed

+3852
-803
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+3852
-803
lines changed

.github/workflows/update-dependencies.yml

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ name: Daily update dependencies
77

88
on:
99
schedule:
10-
# At 00:00 UTC every Mon, Wed and Friday.
11-
- cron: '00 00 * * 1,3,5'
10+
# At 03:00 UTC daily.
11+
# This has to run after the automated updated in IoT bindings as it depends from several bindings there.
12+
- cron: '00 03 * * *'
1213
repository_dispatch:
1314
types: update-dependencies
1415

@@ -21,32 +22,12 @@ jobs:
2122
name: Update .NET nanoFramework dependencies
2223
timeout-minutes: 30 # Non default because this solution has lots of projects to update!
2324
runs-on: windows-latest
25+
env:
26+
GITHUB_TOKEN: ${{ github.token }}
2427
steps:
2528
- name: Checkout
2629
uses: actions/checkout@v2
27-
with:
28-
path: main
29-
- name: Checkout tools repo
30-
uses: actions/checkout@v2
31-
with:
32-
repository: nanoframework/nf-tools
33-
path: tools
3430
- name: Update dependencies
35-
run: ./github-actions/update-nf-dependencies.ps1
36-
working-directory: tools
37-
- name: Create Pull Request
38-
uses: peter-evans/create-pull-request@v3
39-
if: env.CREATE_PR == 'true'
31+
uses: nanoframework/nanodu@v1
4032
with:
41-
title: '${{ env.PR_TITLE }}'
42-
body: |
43-
${{ env.PR_MESSAGE }}
44-
45-
[version update]
46-
47-
### :warning: This is an automated update. :warning:
48-
committer: 'nfbot <[email protected]>'
49-
branch: ${{ env.BRANCH_NAME }}
50-
path: main
51-
labels: |
52-
Type: dependencies
33+
solutionsToCheck: 'nanoFramework.M5Stack.sln'

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,3 +331,6 @@ ASALocalRun/
331331

332332
#SoundCloud
333333
*.sonarqube/
334+
335+
#VSCode
336+
*.vscode/

AtomCommon/AtomBase.cs

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using Iot.Device.Button;
5+
using nanoFramework.Hardware.Esp32;
6+
using nanoFramework.Hardware.Esp32.Rmt;
7+
using System;
8+
using System.Device.Adc;
9+
using System.Device.Dac;
10+
using System.Device.Gpio;
11+
using System.Device.I2c;
12+
using System.Device.Spi;
13+
14+
#if ATOM_MATRIX
15+
namespace nanoFramework.AtomMatrix
16+
{
17+
/// <summary>
18+
/// The AtomMatrix Board.
19+
/// </summary>
20+
public static partial class AtomMatrix
21+
#else
22+
namespace nanoFramework.AtomLite
23+
{
24+
/// <summary>
25+
/// M5Stack board
26+
/// </summary>
27+
public static partial class AtomLite
28+
#endif
29+
{
30+
private static GpioButton _button;
31+
private static GpioController _gpio;
32+
private static DacChannel _dac1;
33+
private static DacChannel _dac2;
34+
private static AdcController _adc;
35+
private static TransmitterChannel _irLed;
36+
37+
/// <summary>
38+
/// Main button.
39+
/// </summary>
40+
public static GpioButton Button
41+
{
42+
get
43+
{
44+
if (_button == null)
45+
{
46+
_button = new(39, _gpio, false);
47+
}
48+
49+
return _button;
50+
}
51+
}
52+
53+
/// <summary>
54+
/// Gets the main <see cref="GpioController"/>.
55+
/// </summary>
56+
public static GpioController GpioController => _gpio;
57+
58+
/// <summary>
59+
/// Gets <see cref="DacChannel"/> connected to GPIO 25.
60+
/// </summary>
61+
public static DacChannel Dac1
62+
{
63+
get
64+
{
65+
// We are creating it on demand
66+
if (_dac1 == null)
67+
{
68+
_dac1 = DacController.GetDefault().OpenChannel(0);
69+
}
70+
71+
return _dac1;
72+
}
73+
}
74+
75+
/// <summary>
76+
/// Gets <see cref="DacChannel"/> connected to GPIO 26.
77+
/// </summary>
78+
public static DacChannel Dac2
79+
{
80+
get
81+
{
82+
// We are creating it on demand
83+
if (_dac2 == null)
84+
{
85+
86+
_dac2 = DacController.GetDefault().OpenChannel(1);
87+
}
88+
89+
return _dac2;
90+
}
91+
}
92+
93+
/// <summary>
94+
/// Gets an <see cref="I2cDevice"/>.
95+
/// </summary>
96+
/// <param name="i2cDeviceAddress">The address of the <see cref="I2cDevice"/> on the bus.</param>
97+
/// <returns>The I2cDevice.</returns>
98+
public static I2cDevice GetI2cDevice(int i2cDeviceAddress) => new(new I2cConnectionSettings(1, i2cDeviceAddress));
99+
100+
/// <summary>
101+
/// Gets an <see cref="I2cDevice"/>.
102+
/// </summary>
103+
/// <param name="i2cDeviceAddress">The address of the <see cref="I2cDevice"/> on the bus.</param>
104+
/// <returns>The I2cDevice.</returns>
105+
public static I2cDevice GetGrove(int i2cDeviceAddress) => new(new I2cConnectionSettings(1, i2cDeviceAddress));
106+
107+
/// <summary>
108+
/// Gets the infrared led as a RMT transmitter channel.
109+
/// </summary>
110+
public static TransmitterChannel InfraredLed
111+
{
112+
get
113+
{
114+
if (_irLed == null)
115+
{
116+
_irLed = new(12);
117+
}
118+
119+
return _irLed;
120+
}
121+
}
122+
123+
/// <summary>
124+
/// Gets an <see cref="SpiDevice"/>.
125+
/// </summary>
126+
/// <param name="chipSelect">The chip select of the device, needs to be any valid GPIO.</param>
127+
/// <returns>An SpiDevice.</returns>
128+
public static SpiDevice GetSpiDevice(int chipSelect) => new(new SpiConnectionSettings(1, chipSelect));
129+
130+
/// <summary>
131+
/// Gets an <see cref="AdcChannel"/>
132+
/// </summary>
133+
/// <param name="gpioNumber">The GPIO pin number where the <see cref="AdcChannel"/> is connected to.</param>
134+
/// <returns>An AdcChannel</returns>
135+
public static AdcChannel GetAdcGpio(int gpioNumber)
136+
{
137+
if (_adc == null)
138+
{
139+
_adc = new();
140+
}
141+
142+
switch (gpioNumber)
143+
{
144+
case 33:
145+
Configuration.SetPinFunction(12, DeviceFunction.ADC1_CH5);
146+
return _adc.OpenChannel(5);
147+
case 32:
148+
Configuration.SetPinFunction(25, DeviceFunction.ADC1_CH4);
149+
return _adc.OpenChannel(4);
150+
default:
151+
throw new ArgumentException(nameof(gpioNumber));
152+
}
153+
}
154+
}
155+
}

AtomCommon/AtomCommon.projitems

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<MSBuildAllProjects Condition="'$(MSBuildVersion)' == '' Or '$(MSBuildVersion)' &lt; '16.0'">$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
5+
<HasSharedItems>true</HasSharedItems>
6+
<SharedGUID>79f09006-ab5d-4e3e-ad12-2efbee536ca9</SharedGUID>
7+
</PropertyGroup>
8+
<PropertyGroup Label="Configuration">
9+
<Import_RootNamespace>AtomCommon</Import_RootNamespace>
10+
</PropertyGroup>
11+
<ItemGroup>
12+
<Compile Include="$(MSBuildThisFileDirectory)AtomBase.cs" />
13+
</ItemGroup>
14+
</Project>

AtomCommon/AtomCommon.shproj

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup Label="Globals">
4+
<ProjectGuid>79f09006-ab5d-4e3e-ad12-2efbee536ca9</ProjectGuid>
5+
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
6+
</PropertyGroup>
7+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
8+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
9+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
10+
<PropertyGroup />
11+
<Import Project="AtomCommon.projitems" Label="Shared" />
12+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
13+
</Project>

M5StackCommon/Console.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33

44
using nanoFramework.Presentation.Media;
55
using nanoFramework.UI;
6-
using System;
76

8-
namespace nanoFramework
7+
namespace nanoFramework.M5Stack
98
{
109
/// <summary>
1110
/// Console class to display text on screens

M5StackCommon/ScreenBase.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using nanoFramework.Presentation.Media;
55
using nanoFramework.UI;
6-
using System;
76
using System.Device.Gpio;
87

98
namespace nanoFramework.M5Stack

0 commit comments

Comments
 (0)