Fix: Make demo selector more user friendly (#249)

Co-authored-by: Alfred Gedeon <gedeonag@amazon.com>
pull/250/head
alfred gedeon 5 years ago committed by GitHub
parent 21644934d7
commit 939daef2f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -28,13 +28,18 @@
/****************************************************************************** /******************************************************************************
* This project provides three demo applications. A simple blinky style project, * This project provides three demo applications. A simple blinky style project,
* a more comprehensive test and demo application, and a TCP echo application. * a more comprehensive test and demo application, and a TCP echo application.
* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is used to select between * The mainSELECTED_APPLICATION setting is used to select between
* the two if mainCREATE_TCP_ECHO_TASKS_SINGLE is 0. * the three
* The simply blinky demo is implemented and described in main_blinky.c. The *
* more comprehensive test and demo application is implemented and described in * if mainSELECTED_APPLICATION is BLINKY_DEMO.
* main_full.c. * The simply blinky demo is implemented and described in main_blinky.c.
* The mainCREATE_TCP_ECHO_TASKS_SINGLE setting is used to select the tcp echo *
* application regardless of the value of mainCREATE_SIMPLE_BLINKY_DEMO_ONLY. * The more comprehensive test and demo application is implemented
* and described in main_full.c and activated by
* setting mainSELECTED_APPLICATION FULL_DEMO.
*
* The ECHO_CLIENT_DEMO setting is used to select the tcp echo
* application implemeted in main_networking.c
* *
* This file implements the code that is not demo specific, including the * This file implements the code that is not demo specific, including the
* hardware setup and FreeRTOS hook functions. * hardware setup and FreeRTOS hook functions.
@ -63,37 +68,15 @@
/* Local includes. */ /* Local includes. */
#include "console.h" #include "console.h"
/* This project provides three demo applications. A simple blinky style demo #define BLINKY_DEMO 0
application, a more comprehensive test and demo application, and a TCP #define FULL_DEMO 1
echo application. The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY and #define ECHO_CLIENT_DEMO 2
mainCREATE_TCP_ECHO_TASKS_SINGLE settings are used to select between the three.
If mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is 1 & mainCREATE_TCP_ECHO_TASKS_SINGLE
is not 1 then the blinky demo will be built.
The blinky demo is implemented and described in main_blinky.c.
If mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is not 1 &
mainCREATE_TCP_ECHO_TASKS_SINGLE is not 1 then the comprehensive test and
demo application will be built. The comprehensive test and demo application is
implemented and described in main_full.c the tcp echo demo application
is implemented in main_networking.c. */
#ifndef mainCREATE_SIMPLE_BLINKY_DEMO_ONLY
#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0
#endif
#ifndef mainCREATE_TCP_ECHO_TASKS_SINGLE #define mainSELECTED_APPLICATION FULL_DEMO
#define mainCREATE_TCP_ECHO_TASKS_SINGLE 0
#endif
/* This demo uses heap_3.c (the libc provided malloc() and free()). */ /* This demo uses heap_3.c (the libc provided malloc() and free()). */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
/*
* main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.
* main_full() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0.
*/
extern void main_blinky( void ); extern void main_blinky( void );
extern void main_full( void ); extern void main_full( void );
extern void main_tcp_echo_client_tasks( void ); extern void main_tcp_echo_client_tasks( void );
@ -158,19 +141,27 @@ int main( void )
#endif #endif
console_init(); console_init();
#if ( mainCREATE_TCP_ECHO_TASKS_SINGLE == 1 ) #if ( mainSELECTED_APPLICATION == ECHO_CLIENT_DEMO )
{ {
console_print("sgtaring echo clientdemo\n");
main_tcp_echo_client_tasks(); main_tcp_echo_client_tasks();
} }
#elif ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) #elif ( mainSELECTED_APPLICATION == BLINKY_DEMO )
{ {
console_print("sgtaring echo blinky\n");
main_blinky(); main_blinky();
} }
#else #elif ( mainSELECTED_APPLICATION == FULL_DEMO)
{ {
console_print("sgtaring full demo\n");
main_full(); main_full();
} }
#endif /* if ( mainCREATE_TCP_ECHO_TASKS_SINGLE == 1 ) */ #else
{
#error "The selected demo is not valid"
}
#endif /* if ( mainSELECTED_APPLICATION ) */
return 0; return 0;
} }
@ -208,11 +199,11 @@ void vApplicationIdleHook( void )
sleep( 1 ); sleep( 1 );
#if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 ) #if ( mainSELECTED_APPLICATION == FULL_DEMO )
{ {
/* Call the idle task processing used by the full demo. The simple /* Call the idle task processing used by the full demo. The simple
blinky demo does not use the idle task hook. */ blinky demo does not use the idle task hook. */
/*vFullDemoIdleFunction();*/ /* vFullDemoIdleFunction(); */
} }
#endif #endif
} }
@ -241,12 +232,11 @@ void vApplicationTickHook( void )
code must not attempt to block, and only the interrupt safe FreeRTOS API code must not attempt to block, and only the interrupt safe FreeRTOS API
functions can be used (those that end in FromISR()). */ functions can be used (those that end in FromISR()). */
#if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 && \ #if (mainSELECTED_APPLICATION == FULL_DEMO )
mainCREATE_TCP_ECHO_TASKS_SINGLE != 1 ) {
{ vFullDemoTickHookFunction();
vFullDemoTickHookFunction(); }
} #endif /* mainSELECTED_APPLICATION */
#endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */
} }
void vLoggingPrintf( const char *pcFormat, void vLoggingPrintf( const char *pcFormat,

Loading…
Cancel
Save