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
.PHONY: all submoduleX submoduleY update-submodules | |
all: submoduleX submoduleY | |
submoduleX: submoduleX/Makefile | |
@- make -C submoduleX | |
submoduleY: submoduleY/Makefile | |
@- make -C submoduleY |
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
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 |
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
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: |
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
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; |
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
#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 |
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
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): |