Mercurial > lcfOS
diff 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 diff
--- a/python/stm32f4/blink.c3 Sat Jul 13 19:53:44 2013 +0200 +++ b/python/stm32f4/blink.c3 Sat Jul 13 20:20:44 2013 +0200 @@ -1,11 +1,6 @@ // This file blinks a LED on the STM32F4 discovery board. package blink; -// import bla -type struct { -// uint32_t SR; -} TIM_Type; - type struct { int MODER; int OTYPER; @@ -13,42 +8,20 @@ int PUPDR; int IDR; int ODR; -} GPIO_Type; - -const GPIO_Type* GPIOD = cast<GPIO_Type*>(0x400000); +}* GPIO_Type; -function void delay(int count) -{ - while (count > 0) - { - count = count - 1; - } -} +type struct { +} RCC_Type; -// Globals: -var int divider; -//const TIM2_s *TIM2;// = (TIM2_s*)0x40004; // Functions: -function void tim2_handler() -{ -// if (TIM2->SR & TIM_SR_UIF) - if (true) - { - divider = divider + 1; - if (divider == 100000) - { - divider = 0; - //GPIOD->ODR ^= (1 << 13); - } - } -} - function void main() { - divider = 0; - - // delay(100); + 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);