Skip to content

Instantly share code, notes, and snippets.

View HakanL's full-sized avatar

Hakan Lindestaf HakanL

View GitHub Profile
@jblang
jblang / tpm2.md
Last active January 25, 2024 17:00
TPM2 Protocol Description

TPM2 Protocol Implementation

Introduction

Frame data is transferred inside packets (similar to DMX, for example). A frame is an image representing a matrix or a light scene.

The packets start and end with one-byte characters. In between are a few control bytes followed by the payload. There is no set size for a payload; it is transmitted with each packet. This makes the protocol quite flexible. There are enough bytes in a single packet for an RGB matrix with 21,845 pixels, but if you just want to control an RGBW lamp, that only requires 9 bytes. The variable frame size means there is no overhead, allowing for maximum transfer speed.

TPM2 Packet Structure

@HakanL
HakanL / Merger.cs
Created November 6, 2013 19:25
Class that handles merging of two lists, returning the difference as InsertList, DeleteList, MatchKeyList and ModifiedList. Also handles comparison of two different types of lists, and composite keys
using System;
using System.Collections.Generic;
using System.Linq;
namespace Haukcode
{
/// <summary>
/// Main interface for merger that requires you to set the KeySelector. Supports two different types
/// (with comparable key). Supports composite-key
/// </summary>
@HakanL
HakanL / StatsMixClient.cs
Created September 29, 2011 09:57 — forked from johnsheehan/StatsMixClient.cs
basic client for StatsMix REST API (updated to RestSharp 102)
using System;
using RestSharp;
namespace StatsMix
{
// Requires RestSharp
// http://restsharp.org
// http://github.com/johnsheehan/RestSharp
// Usage
@johnsheehan
johnsheehan / StatsMixClient.cs
Created December 10, 2010 07:54
basic client for StatsMix REST API
using System;
using RestSharp;
namespace StatsMix
{
// Requires RestSharp
// http://restsharp.org
// http://github.com/johnsheehan/RestSharp
// Usage