Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of GA-Berkay_Alex by
PC/PC.cpp
- Committer:
- aungriah
- Date:
- 2017-12-06
- Revision:
- 0:a3b83d366423
- Child:
- 1:346279def7ac
File content as of revision 0:a3b83d366423:
#include "PC.h" #include "mbed.h" PC::PC(PinName tx, PinName rx, int baudrate) : Serial(tx, rx) { baud(baudrate); cls(); command[0] = '\0'; command_char_count = 0; } void PC::cls() { printf("\x1B[2J"); } void PC::locate(int Spalte, int Zeile) { printf("\x1B[%d;%dH", Zeile + 1, Spalte + 1); } void PC::readcommand(void (*executer)(char*)) { /* char input = getc(); // get the character from serial bus //printf("\x1B[1K"); //printf("-"); if(input == '\r') { // if return was pressed, the command must be executed command[command_char_count] = '\0'; executer(&command[0]); printf("Debug Point 5"); //printf("1"); command_char_count = 0; // reset command command[command_char_count] = '\0'; // printf("2"); } else if (command_char_count < COMMAND_MAX_LENGHT) { printf("Debug Point 4"); command[command_char_count] = input; command_char_count++; } */ while (1) { if (readable()) { scanf( "%s" , command ); break; } } executer(&command[0]); }