-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
191 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* blinky.c | ||
* Demo task | ||
* | ||
*/ | ||
|
||
|
||
#include "FreeRTOS.h" | ||
#include "stm32h7xx_hal.h" | ||
#include "task.h" | ||
|
||
#include "printf.h" | ||
|
||
// FreeRTOS task functions always have the function signature `void taskname(void *argument)` | ||
void blinkyTask(void *argument) { | ||
// This loop repeats for infinity and must never exit! (tasks never end) | ||
for (;;) { | ||
// Write 0 to the LED pin (turn it off) | ||
// HAL functions are provided by STM32 to easily interact with hardware | ||
// LEDs are wired to the STM32's GPIO pins - this one specifically is wired to GPIO_B pin 5 | ||
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, 0); | ||
|
||
// FreeRTOS function that puts this task on pause for 500 ticks (0.5 sec) | ||
// Other tasks will run while this task is paused | ||
vTaskDelay(500); | ||
|
||
// Write 1 to the LED pin (turn it on) | ||
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_5, 1); | ||
|
||
// Pause task for 500 ticks (0.5 sec) | ||
vTaskDelay(500); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* blinky.h | ||
* | ||
*/ | ||
|
||
#ifndef BLINKY_H_ | ||
#define BLINKY_H_ | ||
|
||
void blinkyTask(void *argument); | ||
|
||
#endif /* BLINKY_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* fast_blinky.c | ||
* Demo task | ||
* | ||
*/ | ||
|
||
|
||
#include "FreeRTOS.h" | ||
#include "stm32h7xx_hal.h" | ||
#include "task.h" | ||
|
||
#include "printf.h" | ||
|
||
|
||
void fastBlinkyTask(void *argument) { | ||
for (;;) { | ||
// TODO: blink the green LED FAST! | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* fast_blinky.h | ||
* | ||
*/ | ||
|
||
#ifndef FAST_BLINKY_H_ | ||
#define FAST_BLINKY_H_ | ||
|
||
void fastBlinkyTask(void *argument); | ||
|
||
#endif /* FAST_BLINKY_H_ */ |
Oops, something went wrong.