Cortex Challenge Team / Mbed 2 deprecated DiscoveryF3-LED_and_Button

Dependencies:   mbed

Committer:
dousape2
Date:
Tue Mar 10 21:22:07 2015 +0000
Revision:
0:1f39a86b8daa
Child:
1:73d739c64e4c
Discovery blinking led

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dousape2 0:1f39a86b8daa 1 #include "mbed.h"
dousape2 0:1f39a86b8daa 2 #include "stm32f3xx_hal_gpio.h"
dousape2 0:1f39a86b8daa 3
dousape2 0:1f39a86b8daa 4 //DigitalOut my_led(LED1);
dousape2 0:1f39a86b8daa 5 DigitalOut out_1(D7);
dousape2 0:1f39a86b8daa 6 Ticker toggle_ticker;
dousape2 0:1f39a86b8daa 7
dousape2 0:1f39a86b8daa 8 void toggle()
dousape2 0:1f39a86b8daa 9 {
dousape2 0:1f39a86b8daa 10 HAL_GPIO_TogglePin(GPIOE,GPIO_PIN_14 | GPIO_PIN_15 | GPIO_PIN_13 | GPIO_PIN_12 | GPIO_PIN_11 | GPIO_PIN_10 | GPIO_PIN_9 | GPIO_PIN_8);
dousape2 0:1f39a86b8daa 11 //my_led = !my_led;
dousape2 0:1f39a86b8daa 12 }
dousape2 0:1f39a86b8daa 13
dousape2 0:1f39a86b8daa 14
dousape2 0:1f39a86b8daa 15 int main()
dousape2 0:1f39a86b8daa 16 {
dousape2 0:1f39a86b8daa 17 //inicialize power (clock source) to port E (GPIOE)
dousape2 0:1f39a86b8daa 18 __GPIOE_CLK_ENABLE();
dousape2 0:1f39a86b8daa 19
dousape2 0:1f39a86b8daa 20 //inicialize pins
dousape2 0:1f39a86b8daa 21 GPIO_InitTypeDef GPIO_InitStruct;
dousape2 0:1f39a86b8daa 22 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
dousape2 0:1f39a86b8daa 23 GPIO_InitStruct.Pull = GPIO_PULLUP;
dousape2 0:1f39a86b8daa 24 GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
dousape2 0:1f39a86b8daa 25 GPIO_InitStruct.Pin = GPIO_PIN_14 | GPIO_PIN_15 | GPIO_PIN_13 | GPIO_PIN_12 | GPIO_PIN_11 | GPIO_PIN_10 | GPIO_PIN_9 | GPIO_PIN_8;
dousape2 0:1f39a86b8daa 26 HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
dousape2 0:1f39a86b8daa 27
dousape2 0:1f39a86b8daa 28 // Init the ticker with the address of the function (toggle) to be attached and the interval (100 ms)
dousape2 0:1f39a86b8daa 29
dousape2 0:1f39a86b8daa 30 toggle_ticker.attach(&toggle, 0.1);
dousape2 0:1f39a86b8daa 31 while (1) {
dousape2 0:1f39a86b8daa 32 }
dousape2 0:1f39a86b8daa 33 }