Skip to content

Instantly share code, notes, and snippets.

@RoadieRich
RoadieRich / SoftwarePWM.cs
Created June 15, 2012 18:51
SoftwarePWMPort
using System.Threading;
using Microsoft.SPOT.Hardware;
public class SoftwarePWMPort : OutputPort
{
private bool OffState;
public SoftwarePWMPort(Cpu.Pin portID, bool initialState)
: base(portID, initialState)
{
_t = new Thread(modulate);
@RoadieRich
RoadieRich / AsComparable.cs
Created March 22, 2016 13:50
AsComparable, A wrapper around objects implementing IComparable, to allow use of comparison operators (<, >, != etc)
public sealed class Comparable<T> : IComparable<Comparable<T>>, IComparable<T>, IEquatable<Comparable<T>>,
IEquatable<T> where T : IComparable<T>
{
/// <summary>
/// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.
/// </summary>
/// <returns>
/// true if the specified object is equal to the current object; otherwise, false.
/// </returns>
/// <param name="obj">The object to compare with the current object. </param>