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
Rajmund Szymanski
committed
Nov 16, 2018
1 parent
ed60ee6
commit 1932b3e
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
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,45 @@ | ||
#include <stm32f4_discovery.h> | ||
#include <os.h> | ||
|
||
Led led; | ||
ListTT<unsigned> *lst; | ||
MemoryPoolTT<1, unsigned> *mem; | ||
TaskT<512> *sla; | ||
TaskT<768> *mas; | ||
|
||
void slave() | ||
{ | ||
unsigned*p; | ||
|
||
lst->wait(&p); | ||
led = *p; | ||
mem->give(p); | ||
|
||
ThisTask::stop(); | ||
} | ||
|
||
void master() | ||
{ | ||
unsigned*p; | ||
unsigned x = 1; | ||
|
||
for (;;) | ||
{ | ||
sla = TaskT<512>::detached(0, slave); | ||
ThisTask::delay(SEC); | ||
|
||
mem->wait(&p); | ||
*p=x; | ||
lst->give(p); | ||
x = (x << 1) | (x >> 3); | ||
} | ||
} | ||
|
||
int main() | ||
{ | ||
lst = ListTT<unsigned>::create(); | ||
mem = MemoryPoolTT<1, unsigned>::create(); | ||
mas = TaskT<768>::create(0, master); | ||
|
||
ThisTask::stop(); | ||
} |