Skip to content

Repository files navigation

Build License

CCSWE.nanoFramework

A collection of libraries for .NET nanoFramework targeting embedded/IoT devices such as ESP32 and STM32.

Prerequisites

Samples

Working examples for several libraries can be found in the samples directory:

Libraries included in this repository

Simple thread-safe collections. Includes ConcurrentList (a thread-safe ArrayList) and ConcurrentQueue (a thread-safe Queue).

Pluggable configuration management for nanoFramework applications. Defines IConfigurationManager (get/save/clear with change events), IConfigurationStorage (swappable backends), and IValidateConfiguration. Supports in-memory and file-system storage backends via CCSWE.nanoFramework.FileStorage.

Shared utility classes used across the CCSWE.nanoFramework libraries. Includes Ensure/ThrowHelper for argument validation, StringExtensions (case-insensitive compare, truncate), and reflection extension helpers.

A RFC 2131 compliant DHCP server for nanoFramework. Supports the full DHCP message set, lease time with renewal and rebinding, captive portal URL, DNS server configuration, and an extensible option system. Written as a corrected rewrite of the official Iot.Device.DhcpServer. See the DhcpServer sample.

An IFileStorage abstraction over the device file system. Covers Create, Delete, Exists, GetDirectories, GetFiles, OpenRead, OpenWrite, OpenText, ReadAllBytes, ReadAllText, WriteAllBytes, and WriteAllText — making storage access testable and swappable.

Color utility library for nanoFramework. Provides ColorConverter (RGB/HSB/HSL conversion and brightness scaling), ColorWheel (255-step rainbow), and ColorExtensions (color-to-byte-array for any ColorOrder). Designed to pair with CCSWE.nanoFramework.NeoPixel but usable independently.

Hosting and startup infrastructure for nanoFramework applications, modelled after the .NET Generic Host. DeviceHostBuilder/DeviceHost wire up dependency injection with IDeviceInitializer support — initializers run before hosted services start and can abort startup on failure.

Logging infrastructure for nanoFramework backed by Microsoft.Extensions.Logging. Provides ConsoleLogger and ConsoleLoggerFactory with configurable minimum log level via LoggerOptions.

A fast, but not necessarily IEEE 754:2019 compliant, implementation of System.Math for nanoFramework. The primary optimization is removing NaN-handling overhead. Exposes a FastMath class with Abs, Clamp, Max, and Min. Any compliant improvements are contributed back to nanoFramework/System.Math.

A reusable mDNS responder for nanoFramework with dependency injection support. Automatically answers A, PTR, SRV, and TXT queries based on the device's registered hostname, IP address, and service instances. Integrates with CCSWE.nanoFramework.Hosting via AddMdnsServer(). See the MdnsServer sample.

A simple asynchronous publisher/subscriber mediator for nanoFramework. Events implement IMediatorEvent; handlers implement IMediatorEventHandler. Keeps publishers and subscribers fully decoupled. Supports singleton handlers registered via DI and transient handlers registered at runtime.

A fast ESP32 RMT library for controlling LED chipsets (NeoPixel, WS2812B, etc.). Significantly faster than the official Ws28xx.Esp32 device. Supports multiple color orders via NeoPixelStrip and integrates with CCSWE.nanoFramework.Graphics for brightness scaling. See the NeoPixel sample.

Utilities to simplify thread management. Provides ThreadPool (general-purpose managed worker pool), ConsumerThreadPool (queue-backed pool that processes items via ConsumerCallback), and WaitHandles (multi-handle wait helpers).

Helpers for managing ThreadPool state in nanoFramework unit tests. ThreadPoolTestHelper.ExecuteAndReset(action) runs a test action and resets the pool on completion; ThreadPoolManager.Reset() reinitializes the pool between tests.

A simple asynchronous web server for nanoFramework modelled after ASP.NET Core. Features attribute-based controllers with routing and parameter binding, custom middleware via IMiddleware, a request thread pool, pluggable authentication via IAuthenticationProvider, and HTTPS support. See the WebServer sample.

About

A collection of production-quality libraries for .NET nanoFramework targeting embedded/IoT devices (ESP32, STM32) — Generic Host, DI, WebServer, NeoPixel, threading, and more. MIT licensed, on NuGet.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages