forked from QuantumLeaps/qpc
-
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
QL
committed
Jan 17, 2019
1 parent
ed54e9b
commit 988adc5
Showing
17 changed files
with
274 additions
and
186 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
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
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,25 @@ | ||
QXSemaphore BTN_sema; /* semaphore to signal a button press */ | ||
|
||
int main() { | ||
. . . | ||
/* initialize the BTN_sema semaphore as binary, signaling semaphore */ | ||
QXSemaphore_init(&BTN_sema, /* pointer to semaphore to initialize */ | ||
0U, /* initial semaphore count (singaling semaphore) */ | ||
1U); /* maximum semaphore count (binary semaphore) */ | ||
. . . | ||
} | ||
|
||
void main_threadXYZ(QXThread * const me) { | ||
while (1) { | ||
. . . | ||
QXSemaphore_wait(&BTN_sema, /* pointer to semaphore to wait on */ | ||
QXTHREAD_NO_TIMEOUT); /* timeout for waiting */ | ||
. . . | ||
} | ||
} | ||
|
||
void GPIO_Handler(void) { | ||
. . . | ||
QXSemaphore_signal(&BTN_sema); /* pointer to semaphore to signal */ | ||
. . . | ||
} |
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,27 @@ | ||
QXThread blinky; /* QXK extended-thread object */ | ||
|
||
uint32_t stack_blinky[80]; /* stack for the thread */ | ||
|
||
void main_blinky(QXThread * const me) { /* thread function */ | ||
while (1) { | ||
uint32_t volatile i; | ||
for (i = 1500U; i != 0U; --i) { | ||
BSP_ledGreenOn(); | ||
BSP_ledGreenOff(); | ||
} | ||
QXThread_delay(1U); /* block for 1 tick */ | ||
} | ||
} | ||
|
||
int main() { | ||
. . . | ||
/* initialize and start blinky thread */ | ||
QXThread_ctor(&blinky, &main_blinky, 0); | ||
QXTHREAD_START(&blinky, | ||
5U, /* priority */ | ||
(void *)0, 0, /* message queue (not used) */ | ||
stack_blinky, sizeof(stack_blinky), /* stack */ | ||
(void *)0); /* extra parameter (not used) */ | ||
. . . | ||
return QF_run(); /* run the application */ | ||
} |
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
Oops, something went wrong.