Mercurial > lcfOS
annotate python/stm32f4/blink.c3 @ 220:3f6c30a5d234
Major change in expression parsing to enable pointers and structs
author | Windel Bouwman |
---|---|
date | Sat, 06 Jul 2013 21:32:20 +0200 |
parents | 1fa3e0050b49 |
children | 848c4b15fd0b |
rev | line source |
---|---|
207 | 1 // This file blinks a LED on the STM32F4 discovery board. |
2 package blink; | |
204 | 3 |
207 | 4 // import bla |
5 //type struct TIM2_s { | |
6 // uint32_t SR; | |
7 //}; | |
204 | 8 |
9 // Globals: | |
10 var int divider; | |
212 | 11 //const TIM2_s *TIM2;// = (TIM2_s*)0x40004; |
204 | 12 |
13 // Functions: | |
14 function void tim2_handler() | |
15 { | |
207 | 16 // if (TIM2->SR & TIM_SR_UIF) |
17 if (true) | |
204 | 18 { |
207 | 19 divider = divider + 1; |
219 | 20 if (divider == 100000) |
204 | 21 { |
22 divider = 0; | |
212 | 23 //GPIOD->ODR ^= (1 << 13); |
204 | 24 } |
25 } | |
26 } | |
27 | |
28 function void main() | |
29 { | |
30 divider = 0; | |
219 | 31 |
32 var int* RCC_AHB1ENR; | |
33 RCC_AHB1ENR = 0x40003022; | |
220
3f6c30a5d234
Major change in expression parsing to enable pointers and structs
Windel Bouwman
parents:
219
diff
changeset
|
34 *RCC_AHB1ENR = *RCC_AHB1ENR | 8943; |
204 | 35 /* |
36 RCC->AHB1ENR |= RCC_AHB1ENR_GPIODEN; | |
37 RCC->APB1ENR |= RCC_APB1ENR_TIM2EN; | |
38 | |
39 GPIOD->MODER = (1<<26); | |
40 | |
41 NVIC->ISER[0] |= 1<< (TIM2_IRQn); | |
42 | |
43 TIM2->PSC = 0xE000; | |
44 TIM2->DIER |= TIM_DIER_UIE; | |
45 TIM2->ARR = 0xE000; | |
46 TIM2->CR1 |= TIM_CR1_ARPE | TIM_CR1_CEN; | |
47 TIM2->EGR = 1; | |
48 | |
49 */ | |
205 | 50 while(true) {} |
204 | 51 } |
52 |