Mercurial > lcfOS
annotate 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 |
rev | line source |
---|---|
207 | 1 // This file blinks a LED on the STM32F4 discovery board. |
2 package blink; | |
204 | 3 |
228 | 4 type struct { |
5 int MODER; | |
6 int OTYPER; | |
7 int OSPEEDR; | |
8 int PUPDR; | |
9 int IDR; | |
10 int ODR; | |
231 | 11 }* GPIO_Type; |
228 | 12 |
231 | 13 type struct { |
14 } RCC_Type; | |
204 | 15 |
16 | |
17 // Functions: | |
18 function void main() | |
19 { | |
231 | 20 var int APB1PERIPH_BASE; |
21 APB1PERIPH_BASE = 0x40000000 | |
22 //var int | |
23 var GPIO_Type GPIOD; | |
24 GPIOD = cast<GPIO_Type>(0x400000); | |
228 | 25 |
219 | 26 var int* RCC_AHB1ENR; |
221 | 27 RCC_AHB1ENR = cast<int*>(0x40003022); |
220
3f6c30a5d234
Major change in expression parsing to enable pointers and structs
Windel Bouwman
parents:
219
diff
changeset
|
28 *RCC_AHB1ENR = *RCC_AHB1ENR | 8943; |
204 | 29 /* |
30 RCC->AHB1ENR |= RCC_AHB1ENR_GPIODEN; | |
31 RCC->APB1ENR |= RCC_APB1ENR_TIM2EN; | |
32 | |
33 GPIOD->MODER = (1<<26); | |
34 | |
35 NVIC->ISER[0] |= 1<< (TIM2_IRQn); | |
36 | |
37 TIM2->PSC = 0xE000; | |
38 TIM2->DIER |= TIM_DIER_UIE; | |
39 TIM2->ARR = 0xE000; | |
40 TIM2->CR1 |= TIM_CR1_ARPE | TIM_CR1_CEN; | |
41 TIM2->EGR = 1; | |
42 | |
43 */ | |
205 | 44 while(true) {} |
204 | 45 } |
46 |