+22
-8
@@ -10,6 +10,9 @@
|
||||
#define morse_t1 200
|
||||
#define morse_t2 (morse_t1*3)
|
||||
|
||||
#define morse_play_t1 50
|
||||
#define morse_play_t2 (morse_play_t1*3)
|
||||
|
||||
char push_key=0,last_key=1;
|
||||
uint32_t morse_t=0;
|
||||
uint32_t morse_time_out=0;
|
||||
@@ -22,7 +25,8 @@ char morse_flah=0;
|
||||
uint8_t morse_letter_temp=0;
|
||||
uint8_t morse_letter_flag=0;
|
||||
|
||||
const struct morsecode morsecodes[36]=
|
||||
#define morsecodenum 38
|
||||
const struct morsecode morsecodes[morsecodenum]=
|
||||
{
|
||||
{
|
||||
2,0b01000000,'A'
|
||||
@@ -132,6 +136,12 @@ const struct morsecode morsecodes[36]=
|
||||
{
|
||||
5,0b11111000,'0'
|
||||
},
|
||||
{
|
||||
6,0b00110000,'?'
|
||||
},
|
||||
{
|
||||
5,0b10010000,'/'
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
@@ -152,7 +162,7 @@ void APP_morsecode_init(window *a_window)
|
||||
|
||||
char getmorsecode(uint8_t len,uint8_t code)
|
||||
{
|
||||
for(int a=0;a<36;a++)
|
||||
for(int a=0;a<morsecodenum;a++)
|
||||
{
|
||||
if((morsecodes[a].len==len)&&(morsecodes[a].code==code))
|
||||
{
|
||||
@@ -184,10 +194,10 @@ void APP_morsecode_loop()
|
||||
|
||||
if(morse_input_buff[a]==' ')
|
||||
{
|
||||
add_a_note(0, 50, 300);
|
||||
add_a_note(0, 50, morse_play_t2);
|
||||
}else
|
||||
{
|
||||
for(int b=0;b<36;b++)
|
||||
for(int b=0;b<morsecodenum;b++)
|
||||
{
|
||||
if(morsecodes[b].letter==morse_input_buff[a])
|
||||
{
|
||||
@@ -195,18 +205,18 @@ void APP_morsecode_loop()
|
||||
{
|
||||
if(morsecodes[b].code&(0x80>>c))
|
||||
{
|
||||
add_a_note(1000, 50, 200);
|
||||
add_a_note(1000, 50, morse_play_t2);
|
||||
}else
|
||||
{
|
||||
add_a_note(1000, 50, 100);
|
||||
add_a_note(1000, 50, morse_play_t1);
|
||||
}
|
||||
add_a_note(0, 50, 100);
|
||||
add_a_note(0, 50, morse_play_t1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
add_a_note(0, 50, 100);
|
||||
add_a_note(0, 50, morse_play_t2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,6 +229,10 @@ void APP_morsecode_loop()
|
||||
{
|
||||
sprintf(morse_input_buff,"HELLO WORLD");
|
||||
}
|
||||
if(k2.code==3)
|
||||
{
|
||||
sprintf(morse_input_buff,"CQCQ DE HELLO");
|
||||
}
|
||||
if(k2.code==1)
|
||||
{
|
||||
morse_x=morsecode_window->x;
|
||||
|
||||
Reference in New Issue
Block a user