view python/stm32f4/blink.c3 @ 205:d77cb5962cc5

Added some handcoded arm code generation
author Windel Bouwman
date Sun, 23 Jun 2013 18:23:18 +0200
parents de3a68f677a5
children 8b2f20aae086
line wrap: on
line source


// This file blinks a LED on the STM32F4 discovery board.

package blink;

// Globals:
var int divider;

// Functions:
function void tim2_handler()
{
    divider = 0;
/*	if (TIM2->SR & TIM_SR_UIF)
	{
		divider++;
		if (divider > 100000)
		{
			divider = 0;
			GPIOD->ODR ^= (1 << 13);
		}
	}
    */
}

function void main()
{
    divider = 0;
    /*
	RCC->AHB1ENR |= RCC_AHB1ENR_GPIODEN;
	RCC->APB1ENR |= RCC_APB1ENR_TIM2EN;
	
	GPIOD->MODER = (1<<26);
	
	NVIC->ISER[0] |= 1<< (TIM2_IRQn);
	
	TIM2->PSC = 0xE000;
	TIM2->DIER |= TIM_DIER_UIE;
	TIM2->ARR = 0xE000;
	TIM2->CR1 |= TIM_CR1_ARPE | TIM_CR1_CEN;
	TIM2->EGR = 1;
	
    */
    while(true) {}
}