Cortex Challenge Team / Mbed 2 deprecated DiscoveryF3-LED_and_Button

Dependencies:   mbed

main.cpp

Committer:
dousape2
Date:
2015-03-10
Revision:
0:1f39a86b8daa
Child:
1:73d739c64e4c

File content as of revision 0:1f39a86b8daa:

#include "mbed.h"
#include "stm32f3xx_hal_gpio.h"

//DigitalOut  my_led(LED1);
DigitalOut  out_1(D7);
Ticker toggle_ticker;

void toggle()
{
    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);
    //my_led = !my_led;
}


int main()
{
    //inicialize power (clock source) to port E (GPIOE)
    __GPIOE_CLK_ENABLE();

    //inicialize pins
    GPIO_InitTypeDef        GPIO_InitStruct;
    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
    GPIO_InitStruct.Pull = GPIO_PULLUP;
    GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
    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;
    HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);

    // Init the ticker with the address of the function (toggle) to be attached and the interval (100 ms)

    toggle_ticker.attach(&toggle, 0.1);
    while (1) {
    }
}