mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
50 lines
1.3 KiB
C
50 lines
1.3 KiB
C
/*
|
|
* Copyright (C) 2019 Freie Universität Berlin
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
* directory for more details.
|
|
*/
|
|
|
|
/**
|
|
* @ingroup sys
|
|
* @{
|
|
*
|
|
* @file
|
|
* @brief Interactive Sync implementation
|
|
*
|
|
*
|
|
* @author Gaëtan Harter <gaetan.harter@fu-berlin.de>
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include "test_utils/interactive_sync.h"
|
|
|
|
#if defined(__AVR__)
|
|
#include <avr/pgmspace.h>
|
|
/* For small AVR targets the extra strings generated by test interactive
|
|
can make the application overflow the .data section (RAM), we use puts_P()
|
|
to write those constant string to .txt section (FLASH)*/
|
|
#define PUTS(_s) puts_P(PSTR(_s))
|
|
#else
|
|
#define PUTS(_s) puts(_s)
|
|
#endif
|
|
|
|
void test_utils_interactive_sync(void)
|
|
{
|
|
char c = '\0'; /* Print help on first loop */
|
|
do {
|
|
if (c == 'r') {
|
|
/* This one should have a different case than the help message
|
|
* otherwise we match it when using 'expect' */
|
|
PUTS("READY");
|
|
}
|
|
else if (c != '\n' && c != '\r') {
|
|
PUTS("Help: Press s to start test, r to print it is ready");
|
|
}
|
|
c = getchar();
|
|
} while (c != 's');
|
|
|
|
PUTS("START");
|
|
}
|