Operating System

Dependencies:   UnitTest wolfssh mDNS wolfcrypt wolfSSL

This is an embedded operating system for K64F. It includes a ssh server, a web-server and mDNS server. It has POST on boot. The main purpose of the OS is a router for the thing network.

Files at this revision

API Documentation at this revision

Comitter:
sPymbed
Date:
Tue Nov 26 11:18:09 2019 +0000
Parent:
9:aaa1c9d3afee
Commit message:
added: serial input

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r aaa1c9d3afee -r 38b716b7534f main.cpp
--- a/main.cpp	Mon Nov 25 14:25:19 2019 +0000
+++ b/main.cpp	Tue Nov 26 11:18:09 2019 +0000
@@ -5,7 +5,8 @@
 #include "mDNSResponder.h"
 #include "UnitTest.h"
 #include <user_settings.h>
- 
+#include <string>
+
 #define MAXDATASIZE (1024*4)
 
 //#define GRAPHICSMODE
@@ -112,12 +113,13 @@
  
 void onCharReceived()
 {
-    c = pc.getc();
-    //pc.putc(c);
+    //c = pc.getc();
+    pc.putc(c);
 }
     
 int main() {
     //pc.attach(&onCharReceived);
+    pc.baud(115200);
     red = 1;
     blue = 0;
     green = 1;
@@ -126,7 +128,7 @@
     
     unitest.assertOn(red, 1);
     
-    printf("Hello World! --- http://www.AlgorithMan.de\n\r");
+    pc.printf("Hello World! --- http://www.AlgorithMan.de\n\r");
     
     //write("HTTP/1.1 200 OK\r\nServer: MyOS\r\nContent-Type: text/html\r\n\r\n<html><head><title>My Operating System</title></head><body><b>My Operating System</b> http://www.AlgorithMan.de</body></html>\r\n", 184);
     
@@ -135,7 +137,7 @@
 
     //InterruptManager interrupts(0x20, &gdt, &taskManager);
 
-    printf("Initializing Hardware, Stage 1\n\r");
+    pc.printf("Initializing Hardware, Stage 1\n\r");
     
     #ifdef GRAPHICSMODE
         Desktop desktop(320, 200, 0x00, 0x00, 0xA8);
@@ -161,7 +163,7 @@
             VideoGraphicsArray vga;
         #endif
         
-    printf("Initializing Hardware, Stage 2\n\r");
+    pc.printf("Initializing Hardware, Stage 2\n\r");
 
     #ifdef GRAPHICSMODE
         vga.SetMode(320, 200, 8);
@@ -175,7 +177,7 @@
 
     // Show the network address
     const char *ip = interface.get_ip_address();
-    printf("IP address is: %s\n\r", ip ? ip : "No IP");
+    pc.printf("IP address is: %s\n\r", ip ? ip : "No IP");
 
     //interrupts.Activate();
 
@@ -191,9 +193,16 @@
     //udp.Bind(udpsocket, &udphandler);
     task1.start(mDNS);
     task2.start(http);
+    string input;
     while (true){
         //sockUDP.sendto(SERVER_IP, PORT, screen, sizeof(screen));
-        //pc.putc(pc.getc());
+        char c = pc.getc();
+        if (c == ';'){
+            pc.printf("%s\n\r", input.c_str());
+            input.clear();
+        } else {
+            input += c;
+        }
         wait(0.03333333);
     }
 }
\ No newline at end of file