-
Book Overview & Buying
-
Table Of Contents
ARM?? Cortex?? M4 Cookbook
By :
To further illustrate how to use the features of CMSIS-RTOS that we've introduced in this chapter, we'll return to the Pong program that we first introduced in Chapter 2, C Language Programming. We'll call this recipe: RTOS_Pong_v8v0. Due to space limitations, we're only showing those parts of the code that are relevant to the RTOS implementation. Refer to Chapter 2, C Language Programming for details of helper functions defined in the pong_utils.c file.
To create a multithreaded pong game, follow the steps given:
Create a new project (new folder) called RTOS_Pong. Set the RTE to include board support for the ADC and GLCD. Include CMSIS-RTOS.
Create a file named RTOS_Pong.c and add a task to handle the GLCD:
void taskGLCD (void const *argument) {
BallInfo init_pstn = thisGame.ball;
for (;;) {
osEvent evt = osMailGet(mail_box, osWaitForever);
if (evt.status == osEventMail) {
mail_t *mail = (mail_t*)evt.value.p;
thisGame...