Textspeicher fertig gestellt mit Speicherung im EEprom. Texte lassen
sich über USB Kabel mit serieller Console ändern (Putty, Miniterm).
Dieser Commit ist enthalten in:
Ursprung
704eb9faad
Commit
1e89eccab2
@ -1,5 +1,5 @@
|
||||
:1000000000000000000000000000000000000000F0
|
||||
:1000100000000000000000000000000000000000E0
|
||||
:100000000605050C580200321E0000000101000028
|
||||
:10001000550000000000000000000000000000008B
|
||||
:1000200000000000000000000000000000000000D0
|
||||
:1000300000000000000000000000000000000000C0
|
||||
:1000400000000000000000000000000000000000B0
|
||||
@ -17,18 +17,5 @@
|
||||
:1001000000000000000000000000000000000000EF
|
||||
:1001100000000000000000000000000000000000DF
|
||||
:1001200000000000000000000000000000000000CF
|
||||
:1001300000000000000000000000000000000000BF
|
||||
:1001400000000000000000000000000000000000AF
|
||||
:10015000000000000000000000000000000000009F
|
||||
:10016000000000000000000000000000000000008F
|
||||
:10017000000000000000000000000000000000007F
|
||||
:10018000000000000000000000000000000000006F
|
||||
:10019000000000000000000000000000000000005F
|
||||
:1001A000000000000000000000000000000000004F
|
||||
:1001B000000000000000000000000000000000003F
|
||||
:1001C000000000000000000000000000000000002F
|
||||
:1001D000000000000000000000000000000000001F
|
||||
:1001E000000000000000000000000000000000000F
|
||||
:1001F000000000000605050C580200321E00000039
|
||||
:050200000101000055A2
|
||||
:0D01300000000000000000000000000000C2
|
||||
:00000001FF
|
||||
|
@ -6,23 +6,29 @@
|
||||
#include "controls.h"
|
||||
|
||||
// Stringkonstanten für das Display
|
||||
const char sTrx1[] = "TRX 1";
|
||||
const char sTrx2[] = "TRX 2";
|
||||
const char IambicA[] = "Iambic A";
|
||||
const char IambicB[] = "Iambic B";
|
||||
const char Ultimatic[] = "Ultimat.";
|
||||
const char Memory[] = "Memory";
|
||||
const char Ratio[] = "Ratio";
|
||||
const char Weight[] = "Weight";
|
||||
const char ReverseRL[] = " L - R °";
|
||||
const char ReverseLR[] = " L ° R -";
|
||||
const char SideToneOnOff[] = "Mithörton";
|
||||
const char SideToneFreq[] = "Frequenz";
|
||||
const char RiseTime[] = "Anstieg";
|
||||
const char DebounceTime[] = "Entprl.";
|
||||
const char Yes[] = "J";
|
||||
const char No[] = "N";
|
||||
const char Hz[] = "Hz";
|
||||
static const char* const sTrx1 PROGMEM = "TRX 1";
|
||||
static const char* const sTrx2 PROGMEM = "TRX 2";
|
||||
static const char* const IambicA PROGMEM = "Iambic A";
|
||||
static const char* const IambicB PROGMEM = "Iambic B";
|
||||
static const char* const Ultimatic PROGMEM = "Ultimat.";
|
||||
static const char* const Memory PROGMEM = "Memory";
|
||||
static const char* const Ratio PROGMEM = "Ratio";
|
||||
static const char* const Weight PROGMEM = "Weight";
|
||||
static const char* const ReverseRL PROGMEM = " L - R °";
|
||||
static const char* const ReverseLR PROGMEM = " L ° R -";
|
||||
static const char* const SideToneOnOff PROGMEM = "Mithörton";
|
||||
static const char* const SideToneFreq PROGMEM = "Frequenz";
|
||||
static const char* const RiseTime PROGMEM = "Anstieg";
|
||||
static const char* const DebounceTime PROGMEM = "Entprl.";
|
||||
static const char* const Yes PROGMEM = "J";
|
||||
static const char* const No PROGMEM = "N";
|
||||
static const char* const Hz PROGMEM = "Hz";
|
||||
static const char* const Einstellungen PROGMEM = "Einstellungen";
|
||||
static const char* const Ton PROGMEM = "Ton";
|
||||
static const char* const TonAn PROGMEM = "Ton an";
|
||||
static const char* const TonAus PROGMEM = "Ton aus";
|
||||
static const char* const MemAus PROGMEM = "Mem AUS";
|
||||
static const char* const MemAn PROGMEM = "Mem EIN";
|
||||
|
||||
void Drehencoder(void)
|
||||
{
|
||||
@ -90,7 +96,6 @@ void Drehencoder(void)
|
||||
{
|
||||
EncoderMinMax(1,M_MAX);
|
||||
st = EncoderRead(1);
|
||||
sprintf(sdebug,"Encoder %i\r\n",st);
|
||||
if(last != st)
|
||||
{
|
||||
bMenuCtrl.CurMenue = st;
|
||||
@ -269,9 +274,9 @@ void ConfigMenue(void)
|
||||
lcd_puts(CLEARLINE);
|
||||
lcd_gotoxy(0,0);
|
||||
if(bMenuCtrl.SubMenue == 0)
|
||||
sprintf(line,"%s - %i","Einstellungen", bMenuCtrl.CurMenue);
|
||||
sprintf(line,"%s - %i",Einstellungen, bMenuCtrl.CurMenue);
|
||||
else
|
||||
sprintf(line,"%s * %i","Einstellungen", bMenuCtrl.CurMenue);
|
||||
sprintf(line,"%s * %i",Einstellungen, bMenuCtrl.CurMenue);
|
||||
lcd_puts(line);
|
||||
lcd_charMode(DOUBLESIZE);
|
||||
lcd_gotoxy(0,3);
|
||||
@ -281,17 +286,17 @@ void ConfigMenue(void)
|
||||
case M_TRX1:
|
||||
lcd_gotoxy(0,3);
|
||||
if(bConfig.Trx1)
|
||||
sprintf(line,"[%s]", "TRX 1");
|
||||
sprintf(line,"[%s]", sTrx1);
|
||||
else
|
||||
sprintf(line," %s ", "TRX 1");
|
||||
sprintf(line," %s ", sTrx1);
|
||||
lcd_puts(line);
|
||||
break;
|
||||
case M_TRX2:
|
||||
lcd_gotoxy(0,3);
|
||||
if(bConfig.Trx2)
|
||||
sprintf(line,"[%s]", "TRX 2");
|
||||
sprintf(line,"[%s]", sTrx2);
|
||||
else
|
||||
sprintf(line," %s ", "TRX 2");
|
||||
sprintf(line," %s ", sTrx2);
|
||||
lcd_puts(line);
|
||||
break;
|
||||
case M_IAMBICA:
|
||||
@ -328,7 +333,7 @@ void ConfigMenue(void)
|
||||
break;
|
||||
case M_RATIO:
|
||||
lcd_gotoxy(0,3);
|
||||
sprintf(line,"%s %.1f", "Ratio", (float)bConfig.Ratio/10);
|
||||
sprintf(line,"%s %.1f", Ratio, (float)bConfig.Ratio/10);
|
||||
lcd_puts(line);
|
||||
break;
|
||||
case M_WEIGHT:
|
||||
@ -346,15 +351,15 @@ void ConfigMenue(void)
|
||||
break;
|
||||
case M_TON_FREQ:
|
||||
lcd_gotoxy(0,3);
|
||||
sprintf(line,"%s %uHz", "Ton", bConfig.SidetoneFreq);
|
||||
sprintf(line,"%s %uHz", Ton, bConfig.SidetoneFreq);
|
||||
lcd_puts(line);
|
||||
break;
|
||||
case M_TON:
|
||||
lcd_gotoxy(0,3);
|
||||
if(bConfig.SidetoneEnabled == 1)
|
||||
sprintf(line,"%s", "Ton an");
|
||||
sprintf(line,"%s", TonAn);
|
||||
else
|
||||
sprintf(line,"%s", "Ton aus");
|
||||
sprintf(line,"%s", TonAus);
|
||||
lcd_puts(line);
|
||||
break;
|
||||
case M_WPMBPM:
|
||||
@ -458,9 +463,9 @@ void UpdateDisplay(void)
|
||||
lcd_puts(line);
|
||||
lcd_gotoxy(14,6);
|
||||
if(bConfig.Memory)
|
||||
sprintf(line,"Mem ON");
|
||||
sprintf(line,MemAn);
|
||||
else
|
||||
sprintf(line,"Mem OFF");
|
||||
sprintf(line,MemAus);
|
||||
lcd_puts(line);
|
||||
|
||||
|
||||
|
@ -23,12 +23,6 @@ uint8_t ee_WpM EEMEM = 12; // Geschwindigkeit WpM
|
||||
uint8_t ee_RiseTime EEMEM = 5; // Anstiegszeit Sinuston
|
||||
uint8_t ee_RiseTimeCounter EEMEM = 5; // Anzahl Sinusschwingungen für den Anstieg
|
||||
uint8_t ee_DebounceTime EEMEM = 6; // Entprellzeit für Straight Key Eingang
|
||||
// Textspeicher
|
||||
uint8_t ee_Msg1[100] EEMEM;
|
||||
uint8_t ee_Msg2[100] EEMEM;
|
||||
uint8_t ee_Msg3[100] EEMEM;
|
||||
uint8_t ee_Msg4[100] EEMEM;
|
||||
uint8_t ee_Msg5[100] EEMEM;
|
||||
//
|
||||
//
|
||||
/** @fn void DelayMilliSeconds(uint16_t ms)
|
||||
@ -173,6 +167,9 @@ void SetEEprom(void)
|
||||
bConfig.RiseTimeCounter = 8;
|
||||
bConfig.DebounceTime = 5;
|
||||
WriteEEprom();
|
||||
SetStandardMsg();
|
||||
for(uint8_t i = 1; i < 6; i++)
|
||||
WriteMsgEEprom(i);
|
||||
}
|
||||
/** @fn void ReadEEprom(void)
|
||||
* @brief Einstellungen aus dem EEprom lesen
|
||||
|
@ -3,15 +3,6 @@
|
||||
|
||||
#include "main.h"
|
||||
|
||||
#define TRUE 0x1
|
||||
#define FALSE 0x0
|
||||
|
||||
#define PI 3.1415926535897932384626433832795
|
||||
#define HALF_PI 1.5707963267948966192313216916398
|
||||
#define TWO_PI 6.283185307179586476925286766559
|
||||
#define DEG_TO_RAD 0.017453292519943295769236907684886
|
||||
#define RAD_TO_DEG 57.295779513082320876798154814105
|
||||
|
||||
uint8_t sreg_tmp;
|
||||
|
||||
// Prototypes
|
||||
|
@ -8,11 +8,6 @@
|
||||
#define USART_BAUDRATE 9600
|
||||
#define UBRR_VALUE (((F_CPU/(USART_BAUDRATE*16UL)))-1)
|
||||
|
||||
#define LENGTH 256
|
||||
#define AMP 127
|
||||
#define OFFSET 128
|
||||
#define PI2 6.283185
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@ -45,7 +40,7 @@
|
||||
|
||||
#define CALL " DL7BJ "
|
||||
#define PRG " BJ-Keyer "
|
||||
#define VER " V1.02 "
|
||||
#define VER " V1.03 "
|
||||
|
||||
// Keying states
|
||||
#define NOTHING 0
|
||||
@ -116,15 +111,13 @@
|
||||
// LCD
|
||||
#define CLEARLINE " "
|
||||
#define NORMAL 0
|
||||
// Debugausgabe
|
||||
char sdebug[64];
|
||||
|
||||
// Structs für Status, Menü und Einstellungen
|
||||
struct State
|
||||
{
|
||||
uint8_t WpMChanged: 1; // Geschwindigkeit geändert
|
||||
uint8_t WriteWpMEEprom: 1; // nicht gespeicherte Geschwindigkeit
|
||||
uint8_t WriteEEprom: 1; // nicht gespeicherte EEprom Werte
|
||||
uint8_t WriteMsgEEprom: 2; // nicht gespeicherte Textnachrichten
|
||||
uint8_t SidetoneOff: 1; // Mithörton an oder aus
|
||||
uint8_t SidetoneEnabled: 1; // Mithörton ein- oder ausgeschaltet
|
||||
uint8_t SendStatus; // Status, ob Symbol gesendet wird
|
||||
@ -169,15 +162,20 @@ struct Config
|
||||
uint8_t RiseTimeCounter; // Anzahl Sinusschwingungen für den Anstieg
|
||||
uint8_t DebounceTime; // Entprellzeit für Straight Key Eingang
|
||||
};
|
||||
struct Message
|
||||
|
||||
#define MSGSIZE 60 // 60 Zeichen für jeden Textspeicher
|
||||
|
||||
struct Message
|
||||
{
|
||||
char Msg1[80];
|
||||
char Msg2[80];
|
||||
char Msg3[80];
|
||||
char Msg4[80];
|
||||
char Msg5[80];
|
||||
char Msg1[MSGSIZE];
|
||||
char Msg2[MSGSIZE];
|
||||
char Msg3[MSGSIZE];
|
||||
char Msg4[MSGSIZE];
|
||||
char Msg5[MSGSIZE];
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Pin Change Interrupt Merker für Port
|
||||
uint8_t LastPINDState;
|
||||
|
||||
|
@ -297,6 +297,7 @@ ISR(USART_RX_vect)
|
||||
unsigned char data;
|
||||
data = UDR0;
|
||||
SerialWriteChar(data);
|
||||
SerialReceive(data);
|
||||
}
|
||||
/** @fn void ReStart(void)
|
||||
* @brief Initialisierung bei Reset und Power On
|
||||
@ -319,13 +320,16 @@ void ReStart(void)
|
||||
bState.KeyTX = 1;
|
||||
bState.KeyState = 0;
|
||||
bState.Automatic = 0;
|
||||
bState.WriteMsgEEprom = 0;
|
||||
bState.WriteEEprom = 0;
|
||||
if(bConfig.SidetoneEnabled)
|
||||
SidetoneEnable();
|
||||
else
|
||||
SidetoneDisable();
|
||||
SetRatio();
|
||||
SetWeight();
|
||||
SetStandardMsg();
|
||||
for(uint8_t i = 1; i < 6; i++)
|
||||
ReadMsgEEprom(i);
|
||||
}
|
||||
/** @fn int main(void)
|
||||
* @brief One Infinite Loop
|
||||
@ -335,8 +339,7 @@ void ReStart(void)
|
||||
int main(void)
|
||||
{
|
||||
ReStart();
|
||||
SerialAbout();
|
||||
SerialMenue();
|
||||
SerialReset();
|
||||
while(1)
|
||||
{
|
||||
// Wenn Geschwindigkeit verändert und Zeit abgelaufen,
|
||||
@ -354,6 +357,13 @@ int main(void)
|
||||
WriteEEprom();
|
||||
bState.WriteEEprom = 0;
|
||||
}
|
||||
if(bState.WriteMsgEEprom == 2)
|
||||
{
|
||||
for(uint8_t i = 1; i < 6; i++)
|
||||
WriteMsgEEprom(i);
|
||||
bState.WriteMsgEEprom = 0;
|
||||
SerialReset();
|
||||
}
|
||||
Drehencoder(); // Drehencoder abfragen
|
||||
UpdateDisplay(); // Display aktualisieren
|
||||
CheckStraightKey(); // Handtaste auf Betätigung prüfen
|
||||
|
@ -29,7 +29,9 @@ extern void CheckButtons(void);
|
||||
extern void SetFrequency(uint16_t f);
|
||||
extern void DitDahBuffers(void);
|
||||
extern void SetStandardMsg(void);
|
||||
|
||||
extern void DahPaddle(void);
|
||||
extern void DitPaddle(void);
|
||||
|
||||
extern void SerialReceive(char c);
|
||||
extern void SerialReset(void);
|
||||
#endif // BJ-KEYER_H_INCLUDED
|
||||
|
@ -5,6 +5,12 @@
|
||||
|
||||
#include "globals.h"
|
||||
#include "functions.h"
|
||||
// Textspeicher
|
||||
char ee_Msg1[MSGSIZE] EEMEM;
|
||||
char ee_Msg2[MSGSIZE] EEMEM;
|
||||
char ee_Msg3[MSGSIZE] EEMEM;
|
||||
char ee_Msg4[MSGSIZE] EEMEM;
|
||||
char ee_Msg5[MSGSIZE] EEMEM;
|
||||
|
||||
extern void SendChar(unsigned char c);
|
||||
extern void SendString(char *s);
|
||||
@ -17,8 +23,10 @@ extern void SendString(char *s);
|
||||
*/
|
||||
void SetStandardMsg(void)
|
||||
{
|
||||
// 1 2 3 4 5 6 7 8 9
|
||||
// 123456789012345678901234567890123456789012345678901234567890123456789012345678901235678901234567890
|
||||
// 1 2 3 4 5 6
|
||||
// 123456789012345678901234567890123456789012345678901234567890
|
||||
sprintf(bMessage.Msg5,
|
||||
"BJ-KEYER by DL7BJ");
|
||||
sprintf(bMessage.Msg4,
|
||||
"CQ CQ CQ DE DL7BJ DL7BJ DL7BJ PSE K");
|
||||
sprintf(bMessage.Msg3,
|
||||
@ -26,10 +34,10 @@ void SetStandardMsg(void)
|
||||
sprintf(bMessage.Msg2,
|
||||
"QSL VIA BUREAU OK = TNX FER NICE QSO = 73");
|
||||
sprintf(bMessage.Msg1,
|
||||
"CQ RBN TEST CQ RBN TEST CQ RBN TEST DE DL7BJ DL7BJ DL7BJ PSE NO QSO");
|
||||
"CQ CQ CQ RBN TEST DE DL7BJ DL7BJ DL7BJ PSE NO QSO");
|
||||
}
|
||||
|
||||
/** @fn endMemory(uint8_t MemoryIndex)
|
||||
/** @fn void SendMemory(uint8_t MemoryIndex)
|
||||
* @brief Sendet den Text eines Speichers
|
||||
*
|
||||
* @param Nummer des Speichers
|
||||
@ -56,16 +64,55 @@ void SendMemory(uint8_t MemoryIndex)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ReadTextMsg(unsigned char *s)
|
||||
{
|
||||
}
|
||||
/** @fn WriteMsg(unsigned char *)
|
||||
* @brief Textspeicher schreiben
|
||||
* @param Zeiger auf Zeichenkette
|
||||
/** @fn void WriteMsgEEprom(uint8_t idx)
|
||||
* @brief Textspeicher in EEprom schreiben
|
||||
* @param Nummer des Textspeichers
|
||||
* @return none
|
||||
*/
|
||||
void WriteTextMsg(unsigned char *s)
|
||||
void WriteMsgEEprom(uint8_t idx)
|
||||
{
|
||||
|
||||
switch(idx)
|
||||
{
|
||||
case 1:
|
||||
eeprom_write_block(bMessage.Msg1,ee_Msg1,MSGSIZE);
|
||||
break;
|
||||
case 2:
|
||||
eeprom_write_block(bMessage.Msg2,ee_Msg2,MSGSIZE);
|
||||
break;
|
||||
case 3:
|
||||
eeprom_write_block(bMessage.Msg3,ee_Msg3,MSGSIZE);
|
||||
break;
|
||||
case 4:
|
||||
eeprom_write_block(bMessage.Msg4,ee_Msg4,MSGSIZE);
|
||||
break;
|
||||
case 5:
|
||||
eeprom_write_block(bMessage.Msg5,ee_Msg5,MSGSIZE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/** @fn void ReadMsgEEprom(uint8_t idx)
|
||||
* @brief Textspeicher aus EEprom lesen
|
||||
* @param Nummer des Textspeichers
|
||||
* @return none
|
||||
*/
|
||||
void ReadMsgEEprom(uint8_t idx)
|
||||
{
|
||||
switch(idx)
|
||||
{
|
||||
case 1:
|
||||
eeprom_read_block(bMessage.Msg1,ee_Msg1,MSGSIZE);
|
||||
break;
|
||||
case 2:
|
||||
eeprom_read_block(bMessage.Msg2,ee_Msg2,MSGSIZE);
|
||||
break;
|
||||
case 3:
|
||||
eeprom_read_block(bMessage.Msg3,ee_Msg3,MSGSIZE);
|
||||
break;
|
||||
case 4:
|
||||
eeprom_read_block(bMessage.Msg4,ee_Msg4,MSGSIZE);
|
||||
break;
|
||||
case 5:
|
||||
eeprom_read_block(bMessage.Msg5,ee_Msg5,MSGSIZE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
225
Source/vt100.c
225
Source/vt100.c
@ -12,46 +12,54 @@
|
||||
void SerialMenue(void)
|
||||
{
|
||||
SerialWriteString("(1) Einstellungen anzeigen\r\n");
|
||||
SerialWriteString("(2) Einstellungen ändern\r\n");
|
||||
if(bState.WriteMsgEEprom)
|
||||
SerialWriteString("\033[5m(2) Texte speichern\033[m\r\n");
|
||||
else
|
||||
SerialWriteString("(2) Texte speichern\r\n");
|
||||
SerialWriteString("(3) Texte anzeigen\r\n");
|
||||
SerialWriteString("(4) Texte ändern\r\n");
|
||||
SerialWriteString("(5) Texte anhören\r\n");
|
||||
SerialWriteString("\r\nEingabe: ");
|
||||
bSerialState.Ausgabe = SERMENUE;
|
||||
}
|
||||
/** @brief Aktuelle Einstellungen über serielle Schnittstelle ausgeben
|
||||
* @param none
|
||||
* @return none
|
||||
*/
|
||||
void SerialSetup(void)
|
||||
{
|
||||
sprintf(sdebug,"WpM : %i\r\n", bConfig.WpM);
|
||||
SerialWriteString(sdebug);
|
||||
sprintf(sdebug,"KeyerMode : %i\r\n", bConfig.KeyerMode);
|
||||
SerialWriteString(sdebug);
|
||||
sprintf(sdebug,"SidetoneFreq : %u\r\n", bConfig.SidetoneFreq);
|
||||
SerialWriteString(sdebug);
|
||||
sprintf(sdebug,"TRX1 : %i\r\n", bConfig.Trx1);
|
||||
SerialWriteString(sdebug);
|
||||
sprintf(sdebug,"TRX2 : %i\r\n", bConfig.Trx2);
|
||||
SerialWriteString(sdebug);
|
||||
sprintf(sdebug,"SidetoneEnabled : %i\r\n", bConfig.SidetoneEnabled);
|
||||
SerialWriteString(sdebug);
|
||||
sprintf(sdebug,"Ratio : %i\r\n", bConfig.Ratio);
|
||||
SerialWriteString(sdebug);
|
||||
sprintf(sdebug,"WpMBpM : %i\r\n", bConfig.WpMBpM);
|
||||
SerialWriteString(sdebug);
|
||||
sprintf(sdebug,"Reverse : %i\r\n", bConfig.Reverse);
|
||||
SerialWriteString(sdebug);
|
||||
sprintf(sdebug,"Memory : %i\r\n", bConfig.Memory);
|
||||
SerialWriteString(sdebug);
|
||||
sprintf(sdebug,"MemButtonMode : %i\r\n", bConfig.MemButtonMode);
|
||||
SerialWriteString(sdebug);
|
||||
sprintf(sdebug,"RiseTime : %i\r\n", bConfig.RiseTime);
|
||||
SerialWriteString(sdebug);
|
||||
sprintf(sdebug,"RiseTimeCounter : %i\r\n", bConfig.RiseTimeCounter);
|
||||
SerialWriteString(sdebug);
|
||||
sprintf(sdebug,"DebounceTime : %i\r\n", bConfig.DebounceTime);
|
||||
SerialWriteString(sdebug);
|
||||
{
|
||||
sprintf(out,"%s",CLRSCR);
|
||||
SerialWriteString(out);
|
||||
SerialWriteString("Einstellungen\r\n\r\n");
|
||||
sprintf(out,"WpM : %i\r\n", bConfig.WpM);
|
||||
SerialWriteString(out);
|
||||
sprintf(out,"KeyerMode : %i\r\n", bConfig.KeyerMode);
|
||||
SerialWriteString(out);
|
||||
sprintf(out,"SidetoneFreq : %u\r\n", bConfig.SidetoneFreq);
|
||||
SerialWriteString(out);
|
||||
sprintf(out,"TRX1 : %i\r\n", bConfig.Trx1);
|
||||
SerialWriteString(out);
|
||||
sprintf(out,"TRX2 : %i\r\n", bConfig.Trx2);
|
||||
SerialWriteString(out);
|
||||
sprintf(out,"SidetoneEnabled : %i\r\n", bConfig.SidetoneEnabled);
|
||||
SerialWriteString(out);
|
||||
sprintf(out,"Ratio : %i\r\n", bConfig.Ratio);
|
||||
SerialWriteString(out);
|
||||
sprintf(out,"WpMBpM : %i\r\n", bConfig.WpMBpM);
|
||||
SerialWriteString(out);
|
||||
sprintf(out,"Reverse : %i\r\n", bConfig.Reverse);
|
||||
SerialWriteString(out);
|
||||
sprintf(out,"Memory : %i\r\n", bConfig.Memory);
|
||||
SerialWriteString(out);
|
||||
sprintf(out,"MemButtonMode : %i\r\n", bConfig.MemButtonMode);
|
||||
SerialWriteString(out);
|
||||
sprintf(out,"RiseTime : %i\r\n", bConfig.RiseTime);
|
||||
SerialWriteString(out);
|
||||
sprintf(out,"RiseTimeCounter : %i\r\n", bConfig.RiseTimeCounter);
|
||||
SerialWriteString(out);
|
||||
sprintf(out,"DebounceTime : %i\r\n", bConfig.DebounceTime);
|
||||
SerialWriteString(out);
|
||||
SerialWriteString("\r\nTaste ...");
|
||||
bSerialState.Ausgabe = SERSETUP;
|
||||
}
|
||||
/** @brief Versionsinformation über serielle Schnittstelle ausgeben
|
||||
* @param none
|
||||
@ -59,10 +67,153 @@ void SerialSetup(void)
|
||||
*/
|
||||
void SerialAbout(void)
|
||||
{
|
||||
sprintf(sdebug,"%s", CLRSCR);
|
||||
SerialWriteString(sdebug);
|
||||
sprintf(sdebug,"%s %s %s\r\n\r\n",PRG,VER,CALL);
|
||||
SerialWriteString(sdebug);
|
||||
sprintf(out,"%s", CLRSCR);
|
||||
SerialWriteString(out);
|
||||
sprintf(out,"%s %s %s\r\n\r\n",PRG,VER,CALL);
|
||||
SerialWriteString(out);
|
||||
}
|
||||
void SerialReset(void)
|
||||
{
|
||||
SerialAbout();
|
||||
SerialMenue();
|
||||
bSerialState.Eingabe = SERMSG0;
|
||||
i = 0;
|
||||
o = 0;
|
||||
}
|
||||
void SerialReceive(char c)
|
||||
{
|
||||
// CTRL Steuercodes
|
||||
if(c == 0x1a) SerialReset();
|
||||
if(c == 0x03) SerialReset();
|
||||
switch(bSerialState.Ausgabe)
|
||||
{
|
||||
case SERMENUE:
|
||||
switch(c)
|
||||
{
|
||||
case 0x30:
|
||||
break;
|
||||
case 0x31:
|
||||
SerialSetup();
|
||||
break;
|
||||
case 0x32:
|
||||
bState.WriteMsgEEprom = 2;
|
||||
break;
|
||||
case 0x33:
|
||||
SerialMsgOut();
|
||||
break;
|
||||
case 0x34:
|
||||
sprintf(out,"%s",CLRSCR);
|
||||
SerialWriteString(out);
|
||||
SerialWriteString("Welcher Speicher? (1-5)");
|
||||
bSerialState.Eingabe = SERMSG0;
|
||||
bSerialState.Ausgabe = SERMSGMENUE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SERMSG:
|
||||
SerialReset();
|
||||
break;
|
||||
case SERSETUP:
|
||||
SerialReset();
|
||||
break;
|
||||
case SERMSGMENUE:
|
||||
SerialMsgMenue(c);
|
||||
break;
|
||||
default:
|
||||
SerialReset();
|
||||
}
|
||||
}
|
||||
void SerialMsgOut(void)
|
||||
{
|
||||
sprintf(out,"%s",CLRSCR);
|
||||
SerialWriteString(out);
|
||||
SerialWriteString("Textspeicher\r\n\r\n");
|
||||
sprintf(out,"1: %s\r\n",bMessage.Msg1);
|
||||
SerialWriteString(out);
|
||||
sprintf(out,"2: %s\r\n",bMessage.Msg2);
|
||||
SerialWriteString(out);
|
||||
sprintf(out,"3: %s\r\n",bMessage.Msg3);
|
||||
SerialWriteString(out);
|
||||
sprintf(out,"4: %s\r\n",bMessage.Msg4);
|
||||
SerialWriteString(out);
|
||||
sprintf(out,"5: %s\r\n",bMessage.Msg5);
|
||||
SerialWriteString(out);
|
||||
bSerialState.Ausgabe = SERMSG;
|
||||
SerialWriteString("\r\nTaste ...");
|
||||
}
|
||||
void SerialMsgMenue(char c)
|
||||
{
|
||||
bSerialState.Ausgabe = SERMSGMENUE;
|
||||
if(bSerialState.Eingabe == SERMSG0)
|
||||
{
|
||||
switch(c)
|
||||
{
|
||||
case 0x31:
|
||||
sprintf(out,"\r\n%s\r\n",bMessage.Msg1);
|
||||
SerialWriteString(out);
|
||||
bSerialState.Eingabe = SERMSG1;
|
||||
break;
|
||||
case 0x32:
|
||||
sprintf(out,"\r\n%s\r\n",bMessage.Msg2);
|
||||
SerialWriteString(out);
|
||||
bSerialState.Eingabe = SERMSG2;
|
||||
break;
|
||||
case 0x33:
|
||||
sprintf(out,"\r\n%s\r\n",bMessage.Msg3);
|
||||
SerialWriteString(out);
|
||||
bSerialState.Eingabe = SERMSG3;
|
||||
break;
|
||||
case 0x34:
|
||||
sprintf(out,"\r\n%s\r\n",bMessage.Msg4);
|
||||
SerialWriteString(out);
|
||||
bSerialState.Eingabe = SERMSG4;
|
||||
break;
|
||||
case 0x35:
|
||||
sprintf(out,"\r\n%s\r\n",bMessage.Msg5);
|
||||
SerialWriteString(out);
|
||||
bSerialState.Eingabe = SERMSG5;
|
||||
break;
|
||||
|
||||
}
|
||||
i = 0; inp[i] = 0x00;
|
||||
} else
|
||||
if(bSerialState.Eingabe > SERMSG0)
|
||||
{
|
||||
if(c == '\r')
|
||||
{
|
||||
SerialWriteString("\r\n\r\nOk! Druecke ESC\r\n");
|
||||
bState.WriteMsgEEprom = 1;
|
||||
inp[i] = 0x00;
|
||||
switch(bSerialState.Eingabe)
|
||||
{
|
||||
case SERMSG1:
|
||||
sprintf(bMessage.Msg1,"%s",inp);
|
||||
break;
|
||||
case SERMSG2:
|
||||
sprintf(bMessage.Msg2,"%s",inp);
|
||||
break;
|
||||
case SERMSG3:
|
||||
sprintf(bMessage.Msg3,"%s",inp);
|
||||
break;
|
||||
case SERMSG4:
|
||||
sprintf(bMessage.Msg4,"%s",inp);
|
||||
break;
|
||||
case SERMSG5:
|
||||
sprintf(bMessage.Msg5,"%s",inp);
|
||||
break;
|
||||
}
|
||||
} else if (c == 0x08) {
|
||||
if(i > 0) i--;
|
||||
SerialWriteChar(0x7f);
|
||||
} else {
|
||||
if(i < 60)
|
||||
{
|
||||
if((c > 96) && (c < 123))
|
||||
c = c - 32;
|
||||
inp[i++] = c;
|
||||
} else
|
||||
SerialWriteChar(0x08);
|
||||
}
|
||||
}
|
||||
if(c == 0x1b) SerialReset();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/** @file vt100.h
|
||||
* @brief VT100 Termial
|
||||
* @brief VT100 Terminal
|
||||
* @author Tom, DL7BJ
|
||||
*/
|
||||
|
||||
@ -8,15 +8,43 @@
|
||||
|
||||
#include "functions.h"
|
||||
|
||||
#define SERMENUE 1
|
||||
#define SERMSG 2
|
||||
#define SERMSGMENUE 3
|
||||
#define SERMSGCHANGE 4
|
||||
#define SERMSG1 5
|
||||
#define SERMSG2 6
|
||||
#define SERMSG3 7
|
||||
#define SERMSG4 8
|
||||
#define SERMSG5 9
|
||||
#define SERMSG0 0
|
||||
#define SERSETUP 10
|
||||
|
||||
void SerialInfo(void);
|
||||
void SerialAbout(void);
|
||||
void SerialSetup(void);
|
||||
void SerialMenue(void);
|
||||
void SerialMsgOut(void);
|
||||
void SerialMsgMenue(char c);
|
||||
// Externals
|
||||
extern void WriteMsgEEprom(uint8_t idx);
|
||||
|
||||
// Stringkonstanten für VT100 Terminals
|
||||
static const char* const CLRSCR = "\033[2J";
|
||||
static const char* const CLRSCR PROGMEM = "\033[2J";
|
||||
|
||||
unsigned char line[64];
|
||||
char out[120]; // Ausgabebuffer
|
||||
char inp[120]; // Eingabebuffer
|
||||
|
||||
uint8_t i; // Position Eingabebuffer
|
||||
uint8_t o; // Position Ausgabebuffer
|
||||
|
||||
// Status der seriellen Schnittstelle
|
||||
struct SerialState
|
||||
{
|
||||
uint8_t Ausgabe; // Welches Menue oder Ausgabe gerade aktiv ist
|
||||
uint8_t Eingabe; // Eingabe Textspeicher
|
||||
};
|
||||
|
||||
struct SerialState bSerialState;
|
||||
|
||||
#endif
|
||||
|
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren