-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmain.cpp
More file actions
27 lines (22 loc) · 686 Bytes
/
main.cpp
File metadata and controls
27 lines (22 loc) · 686 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Example for STM32F4DISCOVERY development board
#include "FreeRTOS.h"
#include "task.h"
#include "periph/systick.hpp"
#include "periph/gpio_stm32f4.hpp"
static void heartbeat_task(void *pvParameters)
{
periph::gpio *green_led = (periph::gpio *)pvParameters;
while(1)
{
green_led->toggle();
vTaskDelay(pdMS_TO_TICKS(500));
}
}
int main(int argc, char *argv[])
{
periph::systick::init();
// Green LED
periph::gpio_stm32f4 green_led(periph::gpio_stm32f4::port::d, 12, periph::gpio::mode::digital_output);
xTaskCreate(heartbeat_task, "heartbeat", configMINIMAL_STACK_SIZE, &green_led, 1, nullptr);
vTaskStartScheduler();
}