Skip to content

Instantly share code, notes, and snippets.

View rheum's full-sized avatar

Robert Heumüller rheum

  • Bridgefield GmbH
View GitHub Profile
@rheum
rheum / Make: Recursively Building Git Submodules
Last active February 3, 2016 13:56
Make: Recursively Building Git Submodules
.PHONY: all submoduleX submoduleY update-submodules
all: submoduleX submoduleY
submoduleX: submoduleX/Makefile
@- make -C submoduleX
submoduleY: submoduleY/Makefile
@- make -C submoduleY
@rheum
rheum / STM32Cube Makefile for SW4STM32 Project
Last active November 12, 2016 10:22
STM32Cube Makefile for SW4STM32 Project
PROJ_NAME=main
CC=arm-none-eabi-gcc
AR=arm-none-eabi-ar
OBJCOPY=arm-none-eabi-objcopy
OBJDUMP=arm-none-eabi-objdump
SIZE=arm-none-eabi-size
CFLAGS += -DSTM32F051x8
CFLAGS += -mfloat-abi=soft
@rheum
rheum / at45db081d_spi.py
Last active August 29, 2015 14:25
Raspberry Pi - AT45DB081D SPI Flash
import spidev
def ready():
command = [0xD7, 0xFF]
recv = spi.xfer(command)
return (recv[1] & 0x80) > 0
def read_mem(page, offset=0, num=256):
if page < 2**12 and offset < 2**8:
void init_i2c(void)
{
RCC_I2CCLKConfig(RCC_I2C1CLK_SYSCLK);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C1, ENABLE);
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE);
GPIO_PinAFConfig(GPIOB, GPIO_PinSource6, GPIO_AF_1);
GPIO_PinAFConfig(GPIOB, GPIO_PinSource7, GPIO_AF_1);
GPIO_InitTypeDef gpio_conf;
@rheum
rheum / gist:881d60fecad58089ef0b
Created June 16, 2015 15:24
STM32F051 External Interrupt Example
#include "stm32f0xx_conf.h"
/*
External interrupt example for STM32F051
Turn on a LED when rising edge is detected.
- LED is on GPIOC Pin8
- Button is on GPIOA Pin0
-> This is interrupt Line 0
-> Interrupt Line0 is handled in NVIC
together with Line1 on Channel0_1
@rheum
rheum / inf.py
Last active December 29, 2015 04:09
Infinite Lists in Python
def ints(start):
        return (start, lambda: ints(start+1))
 
def map(f, (start, gen)):
        return (f(*start), lambda: map(f, gen()))
 
def zip((h1,t1), (h2,t2)):
        return ((h1,h2), lambda: zip(t1(), t2()))
 
def zip_with(f, l1, l2):