Created
May 1, 2020 20:28
-
-
Save dheeptuck/61c88ec3d1edddf3af927f2bf58926e8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
void portable_delay_cycles(unsigned long n) | |
{ | |
while (n--) | |
{ | |
asm volatile (""); | |
} | |
} | |
volatile void Task0() | |
{ | |
while(1) | |
{ | |
/// Toggle @ 50 ms | |
portable_delay_cycles(100000); | |
HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_2); | |
} | |
} | |
volatile void Task1() | |
{ | |
while(1) | |
{ | |
/// Toggle @ 100 ms | |
portable_delay_cycles(200000); | |
HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_3); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment