Skip to content

Instantly share code, notes, and snippets.

@solidgoldbomb
solidgoldbomb / hk-t6a-ser.py
Last active December 20, 2015 19:09
Joystick emulation via configuration cable for Hobby King T6A v2 6-channel 2.4GHz RC transmitter
#
# Serial protocol for channel data from Hobby King HK-T6A v2 6-channel 2.4GHz transmitter
# Frame structure obtained from: https://github.com/minghuascode/SampleCode/blob/master/rcprogram/t6src/bin/helico/src/mainwindowimpl.cpp
#
# Baud rate 115200 8N1
# Frame: 0x55 0xFC 1HI 1LO 2HI 2LO 3HI 3LO 4HI 4LO 5HI 5LO 6HI 6LO 7HI 7LO 8HI 8LO
#
#
# python-uinput is from:
@solidgoldbomb
solidgoldbomb / bootloader.py
Last active December 19, 2015 04:28
Tool to dump flash partitions to a file. This only works with bootloaders from the common-bl branch. Still requires manually specifying partition sizes.
#!/usr/bin/python
import os
import zlib
import usb
import threading
import time
import struct
import array
@solidgoldbomb
solidgoldbomb / gist:5896605
Last active December 19, 2015 04:19
Tau Labs Board Early Init Sequence

The F4 starts execution by reading the initial SP and PC from address 0/4 in flash. The set of interrupt vectors follows immediately after that.

The entry point and the vectors are defined in flight/PiOS/STM32F4xx/startup.c:

struct cm3_vectors cpu_vectors __attribute((section(".cpu_vectors"))) = {
		.initial_stack = &irq_stack[sizeof(irq_stack)],
		.entry = (vector *)_main,
		.vectors = {
				NMI_Handler,
 HardFault_Handler,
@solidgoldbomb
solidgoldbomb / joystick-gcsreceiver.py
Created April 6, 2013 04:36
Joystick to GCSReceiver Glue
#!/usr/bin/env python
import pygame
import socket
import struct
class crc8:
def __init__(self):
self.crcTable = ( 0x00, 0x07, 0x0e, 0x09, 0x1c, 0x1b, 0x12, 0x15, 0x38, 0x3f, 0x36, 0x31, 0x24, 0x23, 0x2a, 0x2d,
0x70, 0x77, 0x7e, 0x79, 0x6c, 0x6b, 0x62, 0x65, 0x48, 0x4f, 0x46, 0x41, 0x54, 0x53, 0x5a, 0x5d,