view python/stm32f4/blink.c3 @ 231:521567d17388

simplify blink.c3
author Windel Bouwman
date Sat, 13 Jul 2013 20:20:44 +0200
parents 7f18ed9b6b7e
children e621e3ba78d2
line wrap: on
line source

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

type struct {
    int MODER;
    int OTYPER;
    int OSPEEDR;
    int PUPDR;
    int IDR;
    int ODR;
}* GPIO_Type;

type struct {
} RCC_Type;


// Functions:
function void main()
{
    var int APB1PERIPH_BASE;
    APB1PERIPH_BASE = 0x40000000
    //var int 
    var GPIO_Type GPIOD;
    GPIOD = cast<GPIO_Type>(0x400000);

    var int* RCC_AHB1ENR;
    RCC_AHB1ENR = cast<int*>(0x40003022);
    *RCC_AHB1ENR = *RCC_AHB1ENR | 8943;
    /*
	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) {}
}