Fork of SerialTerminal

Dependents:   IMP_projekt

Files at this revision

API Documentation at this revision

Comitter:
lpiwowar
Date:
Fri Dec 13 10:10:41 2019 +0000
Parent:
2:64e7d86dbac1
Commit message:
Add functions for cleaning screen

Changed in this revision

SerialTerminal.cpp Show annotated file Show diff for this revision Revisions of this file
SerialTerminal.h Show annotated file Show diff for this revision Revisions of this file
--- a/SerialTerminal.cpp	Fri Oct 16 16:31:49 2015 +0000
+++ b/SerialTerminal.cpp	Fri Dec 13 10:10:41 2019 +0000
@@ -45,4 +45,28 @@
 void SerialTerminal::showCursor() {
     //Hide cursor from terminal
     this->printf("\33[[?25h");    
+}
+
+void SerialTerminal::move_cursor_up(int step_num) {
+    this->printf("\033[%dA", step_num);
+}
+    
+void SerialTerminal::move_cursor_down(int step_num) {
+    this->printf("\033[%dB", step_num);
+}
+    
+void SerialTerminal::move_cursor_right(int step_num) {
+    this->printf("\033[%dC", step_num);
+}
+    
+void SerialTerminal::move_cursor_left(int step_num) {
+    this->printf("\033[%dD", step_num);
+}
+
+void SerialTerminal::hide_cursor() {
+    this->printf("\e[?25l");
+}
+    
+void SerialTerminal::show_cursor() {
+    this->printf("\e[?25h");
 }
\ No newline at end of file
--- a/SerialTerminal.h	Fri Oct 16 16:31:49 2015 +0000
+++ b/SerialTerminal.h	Fri Dec 13 10:10:41 2019 +0000
@@ -56,6 +56,24 @@
     
     /** Hide Cursor from terminal*/
     void showCursor();
+    
+        /** Moves cursor up by @var step_num */
+    void move_cursor_up(int step_num);
+    
+    /** Moves cursor down by @var step_num */
+    void move_cursor_down(int step_num);
+    
+    /** Moves cursor righ by @var step_num */
+    void move_cursor_right(int step_num);
+    
+    /** Move cursor left by @var step_num */
+    void move_cursor_left(int step_num);
+    
+    /** Hides cursor */
+    void hide_cursor();
+    
+    /** Enables cursor */
+    void show_cursor();
 };
 
 #endif