This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Device.Gpio; | |
using System.Device.Gpio.Drivers; | |
var _gpioController = new GpioController( | |
numberingScheme: PinNumberingScheme.Logical, | |
driver: new SysFsDriver()); | |
var relayPin = 128 + 18; | |
Console.WriteLine("open pin"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace testchannels | |
{ | |
internal class Program | |
{ | |
private static readonly AsyncQueue<bool> _asyncQueue = new(); | |
static async Task Main(string[] args) | |
{ | |
await _asyncQueue.Enqueue(SetStateOn()); | |
var key = Console.ReadKey().Key; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace testchannels | |
{ | |
internal class Program | |
{ | |
private static BlockingCollection<Action> _queue = new(); | |
private static CancellationTokenSource _currentCts; | |
private static object _sync = new(); | |
static async Task Main(string[] args) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LedStateTimedProcessor | |
: Disposable | |
{ | |
private readonly Timer _timer; | |
private readonly object _sync = new(); | |
private OutputLedColorType _color; | |
public LedStateTimedProcessor( OutputLedColorType color ) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LedStateTimedProcessor | |
: Disposable | |
{ | |
private readonly Timer _timer; | |
private readonly object _sync = new(); | |
private OutputLedColorType _color; | |
public LedStateTimedProcessor( OutputLedColorType color ) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// запускать можно вот так: | |
/* | |
LedStateTimedProcessor buzzerStateTimedProcessor = new( OutputLedColorType.Green); | |
buzzerStateTimedProcessor.StateChanged += type => Console.WriteLine( type ); | |
buzzerStateTimedProcessor.DurationOn( arguments: new OutputLedOnArguments | |
{ | |
Duration = TimeSpan.FromSeconds(30), | |
Alternating = new OutputLedAlternatingState() | |
{ | |
Color = OutputLedColorType.Red, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Trie : ViewModelBase | |
{ | |
public Trie( | |
string part, | |
int level, | |
Trie? root = null, | |
Trie? parent = null ) | |
{ | |
Part = part; | |
Level = level; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TreeNode | |
: ViewModelBase | |
{ | |
protected TreeNode(string part) | |
: this( part, -1, null) | |
{ | |
} | |
private TreeNode( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TreeNode | |
{ | |
protected TreeNode(string part) | |
: this(part, -1, null) | |
private TreeNode( | |
string part, | |
int level, | |
TreeNode? parent) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static public class Json | |
{ | |
static private readonly ConcurrentDictionary<Type, JsonShouldSerialize> _shouldSerializeAnalyzers = | |
new(); | |
static private readonly JsonSerializerSettings DefaultSerializerSettings = | |
new JsonSerializerSettings() | |
.Apply( settings => | |
{ | |
settings.Converters.Add( new ExceptionJsonConverter() ); |
OlderNewer