Projekte
BirgerT
nibo2_fork#01
bt_lib_terminal.h
Projekte
Forum
Doku
Öffentliche Projekte
Startseite
Beispielprogramme
Projekte von anderen
Welcome
Username
Passwort
Eingeloggt bleiben
Zugangsdaten vergessen?
Registrieren
Projektverwaltung
⇨ Please choose! ⇦
——————————————————
✎ Create new project...
★ Browse existing projects...
——————————————————
⚬ MotorTest#1
⚬ C Tutorial 8#1
⚬ NIBO2 C Project#1
⚙ C Tutorial 15#1
⚬ 2010_11_18_el_test001#1
nibo2_fork#01
BSD_license.h
bt_lib_debugutil.c
bt_lib_debugutil.h
bt_lib_glcd.c
bt_lib_glcd.h
bt_lib_grafix.c
bt_lib_grafix.h
bt_lib_terminal.c
bt_lib_terminal.h
bt_lib_uart.c
bt_lib_uart.h
bt_lib_utils.h
lumpylumpy.h
main.c
nibo2_audio.c
nibo2_audio.h
nibo2_copro.c
nibo2_copro.h
nibo2_copro_cmd.h
nibo2_font.h
nibo2_global.h
nibo2_main_menu.h
nibo2_pwm_leds.c
nibo2_pwm_leds.h
nibo2_register.c
nibo2_register.h
nibo2_sensors.c
nibo2_sensors.h
test_debugutil.h
test_gfx_draw.h
xmas1.h
Project details
Compiler settings
Nachrichten
Sie sind nicht eingeloggt.
Neuigkeiten
★
NiboRoboLib 3.6
2017-01-17: Neue Version 3.6
★
NiboRoboLib 3.4.1
2016-04-16: Neue Version 3.4.1
★
Coding Tutorial
2015-11-22: Jetzt auch für den NIBO burger!
Site-Statistic
7426 private projects
385 public projects
16180353 lines compiled
58212 builds
NIBO
@
nibo2_fork_01/bt_lib_terminal.h [read only]
////////////////////////////////////////////////////////////////////////// // // NIBO2 TERMINAL // // (c) Birger Töpelmann toepelmann(A)web.de Version 141005a // // Funktionen für die (serielle) Kommunikation mit dem Nibo2 über // GLCD, UART0 und UART1 im Textmodus mit 8 Zeilen a 21 Zeichen: // // Das Grafik-LCD fährt auf dem Nibo2 spazieren. // // UART0 ist die Standard Schnittstelle am ISP-Anschluß; mit dem UCOM-IR2X // kann abwechselnd programmiert oder mit einer Terminalsoftware auf // dem PC kommuniziert werden. Anstelle der "Draht"-Verbindung ist // auch eine Funkverbindung möglich. // // UART1 ist am EXTension Port (NDS3 Anschluß) zugänglich, // Pin PD2 = EXT C = RxD; Pin PD3 = EXT D = TxD. // // TEXTBUFFER // Alle Ausgaben der Funktionen werden mit Zeichen und Attributen im // Textbuffer zwischengespeichert; der Bufferinhalt wird dann an GLCD, // UART0 und/oder UART1 (oder etwas anderes) weitergeleitet. // // Vorteile: // - die Ausgabefunktion ist schnell fertig // - es müssen keine Bufferüberläufe beachtet werden // - das Blink Attribut ist auch am GLCD realisierbar // Nachteile: // - RAM Bedarf ist (uint16_t buffer[8 * 21];) = 336 Bytes // // AUSGABEN (Textanzeige) // // // // EINGABEN (Bedienung) // Im Terminalprogramm auf dem PC ist eine Tastatur verfügbar.. // Die Bedienung muss auch Standalone möglich sein, also nur mit SW3, // der Odometrie- oder Distanz-Sensoren sowie einer IR Fernbedienung. // // // // TODO, wenn alle UART0 Funktionen stehen, diese auch für UART1 realisieren // ////////////////////////////////////////////////////////////////////////// // // BSD License see "license.h" #include "BSD_license.h" // #ifndef _BTLIB_TERMINAL_H_ #define _BTLIB_TERMINAL_H_ // #include "bt_lib_utils.h" // Sammlung von Makros und Typedefs #include "bt_lib_uart.h" // UART Kommunikation mit FIFOs // // ////////////////////////////////////////////////////////////////////////// // // VT100 / ANSI Controls // ////////////////////////////////////////////////////////////////////////// // #define ESC "\x1b" // Escape #define ED ESC"[2J" // Erase Display #define RST ESC"2c" // Display Reset #define CUP(z,s) ESC"["#z";"#s"H" // Cursor Position Zeile,Spalte #define CUU(z) ESC"["#z"A" // Cursor Up z Zeilen #define CUD(z) ESC"["#z"B" // Cursor Down z Zeilen #define CUF(s) ESC"["#s"C" // Cursor Forward s Spalten #define CUB(s) ESC"["#s"D" // Cursor Backward s Spalten #define SCP ESC"[s" // Save Cursor Position #define RCP ESC"[u" // Restore Cursor Position // // Zeichenattribute setzen #define SGR(p) ESC"["#p"m" // Set Grafics Rendition p // - Nibo2 GLCD - Tera Term - PuTTYtel // SGR(0) -> Standard Werte // SGR(1) -> Intensität (Fett) - ignoriert - Gelbe Schrift - hell // SGR(4) -> Unterstreichen ein - i.O. - i.O. - i.O. // SGR(5) -> Blinken ein - invers - Rote Schrift - i.O. (Setup) // SGR(7) -> Inverse Schrift - i.O. - i.O. - i.O. // SGR(8) -> Unsichtbare Schrift - ignoriert - ohne Funktion - ohne Funktion // // Lineattribute - Nibo2 GLCD = Attribut, Teraterm ohne Funktion, PuTTYtel = i.O. (ganze Zeile) #define DHO ESC"#3" // doppelte Höhe + doppelte Breite (obere Hälfte) #define DHU ESC"#4" // doppelte Höhe + doppelte Breite (untere Hälfte) #define DZB ESC"#6" // doppelte Zeichenbreite #define NRM ESC"#5" // Normale Zeichenbreite und -höhe extern const char term_curset_str[] PROGMEM; //enum{INIT=0, ENABLE, DISABLE, READ, WRITE}; // Terminal an UART 0 oder 1 //#define TERM_UART 0 #define UART0 0x01 #define UART1 0x02 #define GLCD 0x04 extern uint8_t term_dev; // Device Mask = Geräte an die Ausgabe erfolgen soll extern uint8_t term_state; // ////////////////////////////////////////////////////////////////////////// // // PROTOTYPEN // ////////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////// // // PRINT FUNKTIONEN // // Mit dem Parameter dev (="device") wird bestimmt an welche Geräte die // Zeichenausgabe über print_char() erfolgt. // Der Parameter dev ist eine Bitmaske, so dass die Zeichenausgabe an ein // oder mehrere Geräte gleichzeitig erfolgen kann: // UART0 | UART1| GLCD // // // Integer nach ASCII wandeln und an Device ausgeben // print_i16d = int16 -> Dezimalzahl 5-stellig -32768..+32767 // print_u16d = uint16 -> Dezimalzahl 5-stellig 0..65535 // print_i8d = int8 -> Dezimalzahl 4-stellig -128..+127 // print_u8d = uint8 -> Dezimalzahl 3-stellig 0..255 // print_99 = uint8 -> Dezimalzahl 2-stellig 0..99 o. "ON" // print_h16 = uint16 -> Hexadezimal 4-Stellig // print_h8 = uint8 -> Hexadezimal 2-Stellig // print_b8 = uint8 -> Binärzahl 8-Stellig // // @ term_dev = Ausgabe"gerät(e)" = UART0, UART1, GLCD // -> str = Adresse des auszugebenden Strings // ch = Auszugebendes Zeichen // val = der nach ASCII zu wandelnde Wert // ////////////////////////////////////////////////////////////////////////// // void terminal_init(); void terminal_curpos(uint8_t zeile, uint8_t spalte); void terminal_put_char(char ch); char* terminal_put_str(char* str); PGM_P terminal_put_str_P(PGM_P str); void print_strvar_P(PGM_P str,uint8_t var1, uint8_t var2); void print_i16d(int16_t val); void print_u16d(uint16_t val); void print_i8d( int8_t val); void print_u8d( uint8_t val); void print_99(uint8_t val); void print_h16(uint16_t val); void print_h8(uint8_t val); void print_b8(uint8_t val); void terminal_grafix(); // #endif //_NIBO2_TERMINAL_H_ // EOF
Compiler results:
Werbung
Online
Antonioyzc
calebalmeida1046603
candidaharrell99753
chasitycraddock1
warrenhinder6456