Mercurial > lcfOS
annotate python/stm32f4/blink.c3 @ 259:ac603eb66b63
Added function call
author | Windel Bouwman |
---|---|
date | Mon, 05 Aug 2013 20:41:25 +0200 |
parents | 6ed3d3a82a63 |
children |
rev | line source |
---|---|
232 | 1 /* This file blinks a LED on the STM32F4 discovery board. |
2 | |
3 the board has 4 leds on PD12, PD13, PD14 and PD15 | |
4 | |
5 */ | |
6 | |
207 | 7 package blink; |
204 | 8 |
251
6ed3d3a82a63
Added another c3 example. First import attempt
Windel Bouwman
parents:
232
diff
changeset
|
9 import stm32f4xx; |
204 | 10 |
11 // Functions: | |
12 function void main() | |
13 { | |
232 | 14 // Memory mapped control registers: |
231 | 15 var GPIO_Type GPIOD; |
232 | 16 GPIOD = cast<GPIO_Type>(0x40020C00); |
17 var RCC_Type RCC; | |
18 RCC = cast<RCC_Type>(0x40023800); | |
228 | 19 |
232 | 20 // Enable the clock to port D: |
21 RCC->AHB1ENR = RCC->AHB1ENR | 0x8; | |
22 | |
23 | |
24 // PD13 == output (01) | |
25 GPIOD->MODER = (1 << 26); | |
26 GPIOD->ODR = (1 << 13); | |
27 | |
205 | 28 while(true) {} |
204 | 29 } |
30 |