@@ -1,6 +1,6 @@
|
||||
{
|
||||
"board": {
|
||||
"active_layer": 0,
|
||||
"active_layer": 31,
|
||||
"active_layer_preset": "",
|
||||
"auto_track_width": true,
|
||||
"hidden_nets": [],
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-575759949326102004" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="309133228080626451" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
@@ -18,7 +18,7 @@
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-575759949326102004" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="309133228080626451" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
||||
@@ -350,8 +350,8 @@ static void MX_GPIO_Init(void)
|
||||
|
||||
/*Configure GPIO pin : SW_C_Pin */
|
||||
GPIO_InitStruct.Pin = SW_C_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
HAL_GPIO_Init(SW_C_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
}
|
||||
|
||||
@@ -8,18 +8,226 @@
|
||||
|
||||
#include "my.h"
|
||||
|
||||
#define morse_t1 150
|
||||
#define morse_t2 (morse_t1*3)
|
||||
#define morse_hz 100
|
||||
|
||||
#define morse_play_t1 50
|
||||
#define morse_play_t2 (morse_play_t1*3)
|
||||
#define morse_play_hz 100
|
||||
|
||||
char push_key=0,last_key=1;
|
||||
uint32_t morse_t=0;
|
||||
uint32_t morse_time_out=0;
|
||||
uint16_t morse_temp;
|
||||
|
||||
#define morse_input_buff_num 64
|
||||
char morse_input_buff[morse_input_buff_num+1];
|
||||
int morse_input_flag=0;
|
||||
int morse_char_flag=0;
|
||||
int morse_x,morse_y;
|
||||
char morse_flah=0;
|
||||
uint8_t morse_letter_temp=0;
|
||||
uint8_t morse_letter_flag=0;
|
||||
#define morsecodenum 38
|
||||
const struct morsecode morsecodes[morsecodenum]=
|
||||
{
|
||||
{
|
||||
2,0b01000000,'A'
|
||||
},
|
||||
{
|
||||
4,0b10000000,'B'
|
||||
},
|
||||
{
|
||||
4,0b10100000,'C'
|
||||
},
|
||||
{
|
||||
3,0b10000000,'D'
|
||||
},
|
||||
{
|
||||
1,0b00000000,'E'
|
||||
},
|
||||
{
|
||||
4,0b00100000,'F'
|
||||
},
|
||||
{
|
||||
3,0b11000000,'G'
|
||||
},
|
||||
{
|
||||
4,0b00000000,'H'
|
||||
},
|
||||
{
|
||||
2,0b00000000,'I'
|
||||
},
|
||||
{
|
||||
4,0b01110000,'J'
|
||||
},
|
||||
{
|
||||
3,0b10100000,'K'
|
||||
},
|
||||
{
|
||||
4,0b01000000,'L'
|
||||
},
|
||||
{
|
||||
2,0b11000000,'M'
|
||||
},
|
||||
{
|
||||
2,0b10000000,'N'
|
||||
},
|
||||
{
|
||||
3,0b11100000,'O'
|
||||
},
|
||||
{
|
||||
4,0b01100000,'P'
|
||||
},
|
||||
{
|
||||
4,0b11010000,'Q'
|
||||
},
|
||||
{
|
||||
3,0b01000000,'R'
|
||||
},
|
||||
{
|
||||
3,0b00000000,'S'
|
||||
},
|
||||
{
|
||||
1,0b10000000,'T'
|
||||
},
|
||||
{
|
||||
3,0b00100000,'U'
|
||||
},
|
||||
{
|
||||
4,0b00010000,'V'
|
||||
},
|
||||
{
|
||||
3,0b01100000,'W'
|
||||
},
|
||||
{
|
||||
4,0b10010000,'X'
|
||||
},
|
||||
{
|
||||
4,0b10110000,'Y'
|
||||
},
|
||||
{
|
||||
4,0b11000000,'Z'
|
||||
},
|
||||
{
|
||||
5,0b01111000,'1'
|
||||
},
|
||||
{
|
||||
5,0b00111000,'2'
|
||||
},
|
||||
{
|
||||
5,0b00011000,'3'
|
||||
},
|
||||
{
|
||||
5,0b00001000,'4'
|
||||
},
|
||||
{
|
||||
5,0b00000000,'5'
|
||||
},
|
||||
{
|
||||
5,0b10000000,'6'
|
||||
},
|
||||
{
|
||||
5,0b11000000,'7'
|
||||
},
|
||||
{
|
||||
5,0b11100000,'8'
|
||||
},
|
||||
{
|
||||
5,0b11110000,'9'
|
||||
},
|
||||
{
|
||||
5,0b11111000,'0'
|
||||
},
|
||||
{
|
||||
6,0b00110000,'?'
|
||||
},
|
||||
{
|
||||
5,0b10010000,'/'
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
char getmorsecode(uint8_t len,uint8_t code)
|
||||
{
|
||||
for(int a=0;a<morsecodenum;a++)
|
||||
{
|
||||
if((morsecodes[a].len==len)&&(morsecodes[a].code==code))
|
||||
{
|
||||
return morsecodes[a].letter;
|
||||
}
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mymain()
|
||||
{
|
||||
|
||||
char get_char_temp;
|
||||
|
||||
OLED_Init();
|
||||
OLED_Init_Display_Buffer(0);
|
||||
|
||||
OLED_ShowStr(0,0,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
//OLED_ShowStr(0,0,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
|
||||
|
||||
while(1)
|
||||
{
|
||||
|
||||
push_key=SW_C;
|
||||
if(push_key!=last_key)
|
||||
{
|
||||
|
||||
if(push_key==0)
|
||||
{
|
||||
morse_t=HAL_GetTick();
|
||||
//play_ones(morse_hz,50);
|
||||
//OLED_ShowStr(0,0,"1");
|
||||
}else
|
||||
{
|
||||
morse_temp=HAL_GetTick()-morse_t;
|
||||
if(morse_temp>morse_t2)
|
||||
{
|
||||
//time out error
|
||||
}else if(morse_temp>morse_t1)
|
||||
{
|
||||
//-
|
||||
morse_input_buff[morse_input_flag]='-';
|
||||
morse_letter_temp|=(0x80>>morse_letter_flag);
|
||||
}else
|
||||
{
|
||||
//.
|
||||
morse_input_buff[morse_input_flag]='.';
|
||||
|
||||
}
|
||||
morse_input_flag++;
|
||||
morse_letter_flag++;
|
||||
//if(morse_input_flag>=morse_char_flag+8){morse_input_flag=morse_char_flag;morse_letter_flag=0;}
|
||||
//play_ones(0,0);
|
||||
}
|
||||
|
||||
|
||||
last_key=push_key;
|
||||
morse_time_out=HAL_GetTick();
|
||||
}
|
||||
|
||||
if(push_key==1)
|
||||
{
|
||||
//Get cursor on the screen
|
||||
if((HAL_GetTick()-morse_time_out)>morse_t1)
|
||||
{
|
||||
if((morse_input_flag-morse_char_flag)>0)
|
||||
{
|
||||
|
||||
get_char_temp=getmorsecode(morse_letter_flag,morse_letter_temp);
|
||||
morse_letter_flag=0;
|
||||
morse_letter_temp=0;
|
||||
OLED_ShowStr(0,0,morse_input_buff);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,18 @@
|
||||
#include "main.h"
|
||||
#include "OLED.h"
|
||||
|
||||
#define KEY0 HAL_GPIO_ReadPin(tack_A_GPIO_Port, tack_A_Pin)
|
||||
#define KEY1 HAL_GPIO_ReadPin(tack_B_GPIO_Port, tack_B_Pin)
|
||||
#define SW_C HAL_GPIO_ReadPin(SW_C_GPIO_Port, SW_C_Pin)
|
||||
|
||||
|
||||
struct morsecode
|
||||
{
|
||||
uint8_t len;
|
||||
uint8_t code;
|
||||
char letter;
|
||||
};
|
||||
|
||||
void mymain();
|
||||
|
||||
#endif /* MY_H_ */
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_txt_serial_number" value=""/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.watchdog_config" value="none"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkenable_rtos" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkrestart_configurations" value="{"fItems":[{"fDisplayName":"Reset","fIsSuppressible":false,"fResetAttribute":"Software system reset","fResetStrategies":[{"fDisplayName":"Software system reset","fLaunchAttribute":"system_reset","fGdbCommands":["monitor reset\r\n"],"fCmdOptions":["-g"]},{"fDisplayName":"Hardware reset","fLaunchAttribute":"hardware_reset","fGdbCommands":["monitor reset hardware\r\n"],"fCmdOptions":["-g"]},{"fDisplayName":"Core reset","fLaunchAttribute":"core_reset","fGdbCommands":["monitor reset core\r\n"],"fCmdOptions":["-g"]},{"fDisplayName":"None","fLaunchAttribute":"no_reset","fGdbCommands":[],"fCmdOptions":["-g"]}],"fGdbCommandGroup":{"name":"Additional commands","commands":[]}}]}"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkrestart_configurations" value="{"fVersion":1,"fItems":[{"fDisplayName":"Reset","fIsSuppressible":false,"fResetAttribute":"Software system reset","fResetStrategies":[{"fDisplayName":"Software system reset","fLaunchAttribute":"system_reset","fGdbCommands":["monitor reset\r\n"],"fCmdOptions":["-g"]},{"fDisplayName":"Hardware reset","fLaunchAttribute":"hardware_reset","fGdbCommands":["monitor reset hardware\r\n"],"fCmdOptions":["-g"]},{"fDisplayName":"Core reset","fLaunchAttribute":"core_reset","fGdbCommands":["monitor reset core\r\n"],"fCmdOptions":["-g"]},{"fDisplayName":"None","fLaunchAttribute":"no_reset","fGdbCommands":[],"fCmdOptions":["-g"]}],"fGdbCommandGroup":{"name":"Additional commands","commands":[]},"fStartApplication":true}]}"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.enableRtosProxy" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyCustomProperties" value=""/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyDriver" value="threadx"/>
|
||||
|
||||
@@ -62,10 +62,11 @@ PA7.Locked=true
|
||||
PA7.Signal=GPXTI7
|
||||
PA9.Mode=I2C
|
||||
PA9.Signal=I2C1_SCL
|
||||
PB1.GPIOParameters=GPIO_Label
|
||||
PB1.GPIOParameters=GPIO_PuPd,GPIO_Label
|
||||
PB1.GPIO_Label=SW_C
|
||||
PB1.GPIO_PuPd=GPIO_PULLUP
|
||||
PB1.Locked=true
|
||||
PB1.Signal=GPXTI1
|
||||
PB1.Signal=GPIO_Input
|
||||
PF0-OSC_IN.GPIOParameters=GPIO_Label
|
||||
PF0-OSC_IN.GPIO_Label=tack_A
|
||||
PF0-OSC_IN.Locked=true
|
||||
@@ -116,8 +117,6 @@ RCC.SYSCLKFreq_VALUE=48000000
|
||||
RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
|
||||
RCC.TimSysFreq_Value=48000000
|
||||
RCC.USART1Freq_Value=48000000
|
||||
SH.GPXTI1.0=GPIO_EXTI1
|
||||
SH.GPXTI1.ConfNb=1
|
||||
SH.GPXTI6.0=GPIO_EXTI6
|
||||
SH.GPXTI6.ConfNb=1
|
||||
SH.GPXTI7.0=GPIO_EXTI7
|
||||
@@ -131,3 +130,4 @@ VP_SYS_VS_Systick.Signal=SYS_VS_Systick
|
||||
VP_TIM14_VS_ClockSourceINT.Mode=Enable_Timer
|
||||
VP_TIM14_VS_ClockSourceINT.Signal=TIM14_VS_ClockSourceINT
|
||||
board=custom
|
||||
isbadioc=false
|
||||
|
||||
Reference in New Issue
Block a user