Skip to content

Fez single board computers libraries built for GHI Electronics TinyCLR OS.

License

Notifications You must be signed in to change notification settings

bytewizer/boards

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Board libraries for TinyCLR OS.

NuGet Status Release Build

This repo contains several single board computer libraries built for GHI Electronics TinyCLR OS.

Give a Star! ⭐

If you like or are using this project to start your solution, please give it a star. Thanks!

Wireless Application

Install one of the release package from NuGet or using the Package Manager Console matching your board :

PM> Install-Package Bytewizer.TinyCLR.Boards.Bit
PM> Install-Package Bytewizer.TinyCLR.Boards.Duino
PM> Install-Package Bytewizer.TinyCLR.Boards.Feather
PM> Install-Package Bytewizer.TinyCLR.Boards.Portal
PM> Install-Package Bytewizer.TinyCLR.Boards.Switch
PM> Install-Package Bytewizer.TinyCLR.Boards.SC20100
PM> Install-Package Bytewizer.TinyCLR.Boards.SC20260
using Bytewizer.TinyCLR.Boards;
using Bytewizer.TinyCLR.Hosting;

namespace Bytewizer.Playground.Moxi
{
    internal class Program
    {
        static void Main()
        {
            IHost host = HostBoard.CreateDefaultBuilder()
                .ConfigureServices(services =>
                {
                    services.AddWireless("ssid", "password");
                    services.AddNetworkTime();

                    services.AddHostedService(typeof(NetworkStatusService));

                }).Build();

            host.Run();
        }
    }
}

Wireless Application with json configuration file on sd card

PM> Install-Package Bytewizer.TinyCLR.Hosting.Configuration.Json
{
    "wireless": {
        "ssid": "ssid",
        "psk": "passworkd"
    },
    "logging": {
        "log-level": "Information"
    },
    "timezone": {
        "offset": "-25200"
    }
}
internal class Program
{
    static void Main()
    {
        IHost host = HostBoard.CreateDefaultBuilder()
            .ConfigureAppConfiguration(builder =>
            {
                builder.AddJsonFile("appsettings.json", optional:false);
            })
            .ConfigureServices(services =>
            {
                services.AddWireless();
                services.AddNetworkTime();

                services.AddHostedService(typeof(NetworkStatusService));

            }).Build();

        host.Run();
    }
}

public static class DefaultServiceCollectionExtension
{
    public static IServiceCollection AddWireless(this IServiceCollection services)
    {
        return services.AddWireless(null, null);
    }
}

public static class DefaultConfigurationBuilderExtensions
{
    public static IConfigurationBuilder AddJsonFile(
        this IConfigurationBuilder builder, string path, bool optional)
    {
        try
        {
            var controller = StorageController.GetDefault();
            var driveProvider = FileSystem.Mount(controller.Hdc);

            return builder.AddJsonFile(driveProvider, path, optional);
        }
        catch
        {
            throw new InvalidOperationException("Failed to mount sd card.");
        }
    }
}

Requirements

Software: Visual Studio 2019/2022 and GHI Electronics TinyCLR OS.

Nuget Packages

Install releases package from NuGet. Development build packages are available as Github Packages.

Continuous Integration

main :: This is the branch containing the latest release build. No contributions should be made directly to this branch. The development branch will periodically be merged to the main branch, and be released to NuGet.

develop :: This is the development branch to which contributions should be proposed by contributors as pull requests. Development build packages are available as Github Packages.

Contributions

Contributions to this project are always welcome. Please consider forking this project on GitHub and sending a pull request to get your improvements added to the original project.

Disclaimer

All source, documentation, instructions and products of this project are provided as-is without warranty. No liability is accepted for any damages, data loss or costs incurred by its use.