test app implementation for os
This commit is contained in:
@@ -86,7 +86,11 @@ static const struct uart __uart_1 = {
|
||||
&console_buffer,
|
||||
};
|
||||
|
||||
#ifdef TEST_APP
|
||||
static const struct driver uart_1 = {
|
||||
#else
|
||||
const struct driver uart_1 = {
|
||||
#endif
|
||||
DRIVER_TYPE_UART,
|
||||
&__uart_1,
|
||||
};
|
||||
@@ -109,12 +113,16 @@ static const struct stm32f4_gpio stm32_f4_discovery_led_3 = {
|
||||
NULL
|
||||
};
|
||||
|
||||
#ifdef TEST_APP
|
||||
static const struct gpio __led_3 = {
|
||||
#else
|
||||
const struct gpio __led_3 = {
|
||||
#endif
|
||||
(void*)&stm32_f4_discovery_led_3,
|
||||
&gpio_fp
|
||||
};
|
||||
|
||||
const struct driver led_3 = {
|
||||
static const struct driver led_3 = {
|
||||
DRIVER_TYPE_GPIO,
|
||||
&__led_3,
|
||||
};
|
||||
@@ -142,7 +150,11 @@ static const struct gpio __led_4 = {
|
||||
&gpio_fp
|
||||
};
|
||||
|
||||
#ifdef TEST_APP
|
||||
static const struct driver led_4 = {
|
||||
#else
|
||||
const struct driver led_4 = {
|
||||
#endif
|
||||
DRIVER_TYPE_GPIO,
|
||||
&__led_4,
|
||||
};
|
||||
@@ -170,7 +182,11 @@ static const struct gpio __led_5 = {
|
||||
&gpio_fp
|
||||
};
|
||||
|
||||
#ifdef TEST_APP
|
||||
static const struct driver led_5 = {
|
||||
#else
|
||||
const struct driver led_5 = {
|
||||
#endif
|
||||
DRIVER_TYPE_GPIO,
|
||||
&__led_5,
|
||||
};
|
||||
@@ -198,7 +214,11 @@ static const struct gpio __led_6 = {
|
||||
&gpio_fp
|
||||
};
|
||||
|
||||
#ifdef TEST_APP
|
||||
static const struct driver led_6 = {
|
||||
#else
|
||||
const struct driver led_6 = {
|
||||
#endif
|
||||
DRIVER_TYPE_GPIO,
|
||||
&__led_6,
|
||||
};
|
||||
|
@@ -52,7 +52,8 @@ static void rx_func(void *arg)
|
||||
ret = read(shell_object.shell_device, &buffer[index],
|
||||
sizeof(buffer) / sizeof(buffer[0]) - index);
|
||||
if(ret) {
|
||||
if(buffer[index + ret - 1] == '\n') {
|
||||
if((buffer[index + ret - 1] == '\n') || (buffer[index + ret - 1] == '\r')) {
|
||||
buffer[index + ret - 1] = '\n';
|
||||
parse(buffer, index + ret);
|
||||
index = 0;
|
||||
}
|
||||
|
39
source/test/shell/main.c
Normal file
39
source/test/shell/main.c
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* main.c
|
||||
*
|
||||
* Created on: Aug 2, 2016
|
||||
* Author: tkl
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "driver.h"
|
||||
#include "board.h"
|
||||
#include "stack.h"
|
||||
#include "queue.h"
|
||||
#include "kernel.h"
|
||||
#include "driver.h"
|
||||
#include "list.h"
|
||||
#include "shell.h"
|
||||
|
||||
void *uname_fct(const char *line)
|
||||
{
|
||||
if(NULL == line)
|
||||
return NULL;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct command cmd = {
|
||||
.command = "uname",
|
||||
.command_callback = uname_fct
|
||||
};
|
||||
|
||||
int main(void)
|
||||
{
|
||||
shell_init(&uart_1);
|
||||
shell_add_command(&cmd);
|
||||
schedule_start();
|
||||
|
||||
return 0;
|
||||
}
|
4
source/test/shell/shell.mk
Normal file
4
source/test/shell/shell.mk
Normal file
@@ -0,0 +1,4 @@
|
||||
CHECK_FOLDER += source/test/shell
|
||||
SUB_FOLDER += source/test/shell
|
||||
INCLUDES += source/test/shell
|
||||
DOC_SRC += source/test/shell
|
3
source/test/test.mk
Normal file
3
source/test/test.mk
Normal file
@@ -0,0 +1,3 @@
|
||||
ifeq ($(TEST_APP), shell)
|
||||
include source/test/shell/shell.mk
|
||||
endif
|
Reference in New Issue
Block a user