From 6a5f460c6b1397b9175f532532ee80e44e07dcf5 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Mon, 22 Dec 2014 13:04:01 +0100 Subject: Expanded the cli functions and added test program for it. --- firmware/test/uart/uarttest.c | 63 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 firmware/test/uart/uarttest.c (limited to 'firmware/test/uart/uarttest.c') diff --git a/firmware/test/uart/uarttest.c b/firmware/test/uart/uarttest.c new file mode 100644 index 0000000..fb6822c --- /dev/null +++ b/firmware/test/uart/uarttest.c @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/*************************************************************************** + * uarttest.c + * + * Sun Dec 21 20:46:19 CET 2014 + * Copyright 2014 Bent Bisballe Nyeng + * deva@aasimon.org + ****************************************************************************/ + +/* + * This file is part of Pedal2Metal. + * + * Pedal2Metal is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Pedal2Metal is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Pedal2Metal; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ +#include "../test.h" + +// For SystemCoreClock +#include + +//#include +#include +/* +volatile unsigned int temp; +static void _delay(unsigned int del) +{ + for(unsigned int i = 0; i < del; i++) temp = i; +} +*/ +int main (void) +{ + //led_init(); + + cli_init(); + + cli_printf("\rWelcome to the amazing Pedal 2 Metal version zero dot dut!\n"); + //cli_printf("clk: %d\n", SystemCoreClock); + + int cnt = 0; + while(1) { + char cmd[256]; + int sz = sizeof(cmd); + while(sz == sizeof(cmd)) { + cli_printf("# "); + sz = cli_readline(cmd, sizeof(cmd)); + } + cli_printf("\n"); + + cli_printf("command %d: '%s' (%d)\n", cnt++, cmd, sz); + //for(int i = 0; i < sz; i++) cli_printf("%c\t(%d)\n", cmd[i], (int)cmd[i]); + } +} -- cgit v1.2.3