diff --git a/sketches/TestSerial/TestSerial.h b/sketches/TestSerial/TestSerial.h index 32a8a2c221d37e0b5c3730c94f524c636d03acbe..d7e8d902ca0427cb99fc1ecdfb8fb39ea8fe8d2d 100644 --- a/sketches/TestSerial/TestSerial.h +++ b/sketches/TestSerial/TestSerial.h @@ -19,7 +19,7 @@ #include "nRF52840SerE.h" #include "ComRingBuf.h" -#define TmpVerMsg "Version 20230923-10 " +#define TmpVerMsg "Version 20230925-4 " #ifdef DebugTerminal // **************************************************************************** @@ -36,6 +36,7 @@ void smPutCharRB(); void smReadPtrRB(); void smGetCntIntSer(); void smReadAllRB(); +void smWriteStrRB(); #endif diff --git a/sketches/TestSerial/TestSerial.ino b/sketches/TestSerial/TestSerial.ino index 57eb0a0bac893542efcf3b734c62768fba3350c4..ec5194b4cbab2ce5c0fc933c883522b6e7b85f03 100644 --- a/sketches/TestSerial/TestSerial.ino +++ b/sketches/TestSerial/TestSerial.ino @@ -303,6 +303,7 @@ char *smCheckRBHelp = "B Zeichen in P2 eingeben\r\n" "I Anzahl der Interrupts anzeigen\r\n" "R Inhalte der Empfangspuffer auslesen\r\n" + "Sx String in Px eingeben\r\n" "Z Zeiger/Index der Ringpuffer anzeigen\r\n" }; @@ -340,6 +341,11 @@ void smCheckRB() sm.userVar = 1; sm.enter(smReadAllRB); } + else if(mon.lastKeyIn == 'S' || mon.lastKeyIn == 's') + { + sm.userVar = 0; + sm.enter(smWriteStrRB); + } else if(mon.lastKeyIn == 'Z' || mon.lastKeyIn == 'z') { sm.userVar = 1; @@ -454,5 +460,48 @@ void smReadAllRB() sm.userVar++; } +char smWrStNr; + +void smWriteStrRB() +{ + if(sm.firstEnter()) + { + mon.print((char *) "String (Endezeichen TAB) eingeben für Puffer "); + } + + if(mon.lastKeyIn == ':') return; + + if(sm.userVar < 1) + { + if(mon.lastKeyIn < '1' || mon.lastKeyIn > '2') return; + smWrStNr = mon.lastKeyIn; + mon.cprint(smWrStNr); + mon.cprint(':'); + mon.cprint(' '); + sm.userVar++; + mon.lastKeyIn = ':'; + return; + } + + if(mon.lastKeyIn != '\t') + { + tmpCharBuf[sm.userVar - 1] = mon.lastKeyIn; + mon.cprint(mon.lastKeyIn); + sm.userVar++; + mon.lastKeyIn = ':'; + return; + } + + tmpCharBuf[sm.userVar - 1] = '\0'; + if(smWrStNr == '1') + crb1.putStr((char *) tmpCharBuf); + else if(smWrStNr == '2') + crb2.putStr((char *) tmpCharBuf); + mon.println(); + mon.lastKeyIn = ':'; + sm.enter(smCheckRB); +} + + #endif // DebugTerminal