summaryrefslogtreecommitdiff
path: root/firmware/test/uart/uarttest.c
blob: fb6822c9618cf3dc6a46216f55a7824e89d35d8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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 <LPC17xx.h>

//#include <uart.h>
#include <cli.h>
/*
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]);
  }
}