This is the DW1000 driver and our self developed distance measurement application based on it. We do this as a semester thesis at ETH Zürich under the Automatic Control Laboratory in the Department of electrical engineering.

Dependencies:   mbed

Committer:
manumaet
Date:
Thu Mar 19 12:54:28 2015 +0000
Revision:
47:b6120c152ad1
Parent:
0:f50e671ffff7
final release with the code used in the verification test case

Who changed what in which revision?

UserRevisionLine numberNew contents of line
manumaet 0:f50e671ffff7 1 #include "PC.h"
manumaet 0:f50e671ffff7 2 #include "mbed.h"
manumaet 0:f50e671ffff7 3
manumaet 0:f50e671ffff7 4 PC::PC(PinName tx, PinName rx, int baudrate) : Serial(tx, rx)
manumaet 0:f50e671ffff7 5 {
manumaet 0:f50e671ffff7 6 baud(baudrate);
manumaet 0:f50e671ffff7 7 cls();
manumaet 0:f50e671ffff7 8
manumaet 0:f50e671ffff7 9 command[0] = '\0';
manumaet 0:f50e671ffff7 10 command_char_count = 0;
manumaet 0:f50e671ffff7 11 }
manumaet 0:f50e671ffff7 12
manumaet 0:f50e671ffff7 13
manumaet 0:f50e671ffff7 14 void PC::cls()
manumaet 0:f50e671ffff7 15 {
manumaet 0:f50e671ffff7 16 printf("\x1B[2J");
manumaet 0:f50e671ffff7 17 }
manumaet 0:f50e671ffff7 18
manumaet 0:f50e671ffff7 19
manumaet 0:f50e671ffff7 20 void PC::locate(int Spalte, int Zeile)
manumaet 0:f50e671ffff7 21 {
manumaet 0:f50e671ffff7 22 printf("\x1B[%d;%dH", Zeile + 1, Spalte + 1);
manumaet 0:f50e671ffff7 23 }
manumaet 0:f50e671ffff7 24
manumaet 0:f50e671ffff7 25 void PC::readcommand(void (*executer)(char*))
manumaet 0:f50e671ffff7 26 {
manumaet 0:f50e671ffff7 27 char input = getc(); // get the character from serial bus
manumaet 0:f50e671ffff7 28 if(input == '\r') { // if return was pressed, the command must be executed
manumaet 0:f50e671ffff7 29 command[command_char_count] = '\0';
manumaet 0:f50e671ffff7 30 executer(&command[0]);
manumaet 0:f50e671ffff7 31
manumaet 0:f50e671ffff7 32 command_char_count = 0; // reset command
manumaet 0:f50e671ffff7 33 command[command_char_count] = '\0';
manumaet 0:f50e671ffff7 34 } else if (command_char_count < COMMAND_MAX_LENGHT) {
manumaet 0:f50e671ffff7 35 command[command_char_count] = input;
manumaet 0:f50e671ffff7 36 command_char_count++;
manumaet 0:f50e671ffff7 37 }
manumaet 0:f50e671ffff7 38 }