PS2摇杆调试差一点成功
This commit is contained in:
parent
c20d561d0c
commit
ef7970e342
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -28,7 +28,7 @@
|
|||
<TargetOption>
|
||||
<CLKADS>12000000</CLKADS>
|
||||
<OPTTT>
|
||||
<gFlags>0</gFlags>
|
||||
<gFlags>1</gFlags>
|
||||
<BeepAtEnd>1</BeepAtEnd>
|
||||
<RunSim>0</RunSim>
|
||||
<RunTarget>1</RunTarget>
|
||||
|
@ -77,7 +77,7 @@
|
|||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>1</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>0</CpuCode>
|
||||
<CpuCode>18</CpuCode>
|
||||
<DebugOpt>
|
||||
<uSim>0</uSim>
|
||||
<uTrg>1</uTrg>
|
||||
|
@ -103,7 +103,7 @@
|
|||
<bEvRecOn>1</bEvRecOn>
|
||||
<bSchkAxf>0</bSchkAxf>
|
||||
<bTchkAxf>0</bTchkAxf>
|
||||
<nTsel>0</nTsel>
|
||||
<nTsel>3</nTsel>
|
||||
<sDll></sDll>
|
||||
<sDllPa></sDllPa>
|
||||
<sDlgDll></sDlgDll>
|
||||
|
@ -114,9 +114,14 @@
|
|||
<tDlgDll></tDlgDll>
|
||||
<tDlgPa></tDlgPa>
|
||||
<tIfile></tIfile>
|
||||
<pMon>BIN\UL2CM3.DLL</pMon>
|
||||
<pMon>BIN\CMSIS_AGDI.dll</pMon>
|
||||
</DebugOpt>
|
||||
<TargetDriverDllRegistry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>CMSIS_AGDI</Key>
|
||||
<Name>-X"Any" -UAny -O206 -S9 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_512.FLM -FS08000000 -FL080000 -FP0($$Device:STM32F103VE$Flash\STM32F10x_512.FLM)</Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>UL2CM3</Key>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<TargetCommonOption>
|
||||
<Device>STM32F103VE</Device>
|
||||
<Vendor>STMicroelectronics</Vendor>
|
||||
<PackID>Keil.STM32F1xx_DFP.2.1.0</PackID>
|
||||
<PackID>Keil.STM32F1xx_DFP.2.0.0</PackID>
|
||||
<PackURL>http://www.keil.com/pack/</PackURL>
|
||||
<Cpu>IRAM(0x20000000,0x10000) IROM(0x08000000,0x80000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "bsp_led.h"
|
||||
#include "bsp_TiMbase.h"
|
||||
#include "bsp_PS2.h"
|
||||
#include "bsp_led.h"
|
||||
|
||||
|
||||
|
||||
|
@ -91,6 +92,11 @@ static void Setting_do(uint8_t CurSetItem, int8_t Operation)
|
|||
default :
|
||||
break;
|
||||
}
|
||||
rt_kprintf("TriggerValue: %d\n",TriggerValue);
|
||||
rt_kprintf("TriggerMode: %d\n",TriggerMode);
|
||||
rt_kprintf("Sampling_mode: %d\n",Sampling_mode);
|
||||
rt_kprintf("TimePerDiv_Oder: %d\n",TimePerDiv_Oder);
|
||||
rt_kprintf("\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -140,16 +146,17 @@ void Setting(void* parameter)
|
|||
rt_err_t queue_status = RT_EOK;
|
||||
uint8_t setting_data = 5;//暂存消息队列的消息
|
||||
int8_t CurSetItem = 0;
|
||||
uint8_t sending_data = 1;
|
||||
uint8_t key_start_scan = 1;
|
||||
while(1)
|
||||
{
|
||||
queue_status = rt_mq_recv(setting_data_queue, &setting_data, sizeof(setting_data), RT_WAITING_FOREVER);
|
||||
if(queue_status == RT_EOK && setting_data == 0)//进入设置状态
|
||||
{
|
||||
LED2_ON;
|
||||
setting_data = 5;//使setting_data处于非有效值范围,为退出设置做准备
|
||||
while(setting_data != 0)//再次按下SW时退出设置
|
||||
{
|
||||
queue_status = rt_mq_send(key_scan_queue, &sending_data, sizeof(sending_data));//发送消息,开始扫描键盘
|
||||
queue_status = rt_mq_send(key_scan_queue, &key_start_scan, sizeof(key_start_scan));//发送消息,开始扫描键盘
|
||||
queue_status = rt_mq_recv(setting_data_queue, &setting_data, sizeof(setting_data), 500);//五秒钟无操作则退出设置
|
||||
if(queue_status == RT_EOK)
|
||||
{
|
||||
|
@ -184,6 +191,7 @@ void Setting(void* parameter)
|
|||
}
|
||||
}
|
||||
}
|
||||
LED2_OFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -200,18 +208,18 @@ void Key_Scan(void* parameter)
|
|||
queue_status = rt_mq_recv(key_scan_queue, &recv_data, sizeof(recv_data), RT_WAITING_FOREVER);
|
||||
if(queue_status == RT_EOK && recv_data == 1)
|
||||
{
|
||||
setting_data = Read_X_Data();
|
||||
if(setting_data == 1)
|
||||
setting_data = Read_Y_Data();
|
||||
if(setting_data < 5)
|
||||
setting_data = 1;
|
||||
else if(setting_data == 0)
|
||||
else if(setting_data > 240)
|
||||
setting_data = 2;
|
||||
|
||||
setting_data = Read_Y_Data();
|
||||
if(setting_data == 1)
|
||||
setting_data = Read_X_Data();
|
||||
if(setting_data < 5)
|
||||
setting_data = 3;
|
||||
else if(setting_data == 0)
|
||||
else if(setting_data > 240)
|
||||
setting_data = 4;
|
||||
|
||||
//需设置等待按键按下
|
||||
rt_kprintf("key data: %d",setting_data);
|
||||
rt_mq_send(setting_data_queue, &setting_data, sizeof(setting_data));
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ void rt_hw_board_init()
|
|||
LED_GPIO_Config();
|
||||
USART_Config();
|
||||
ADCx_Init();
|
||||
EXTI_Key_Config();
|
||||
//EXTI_Key_Config();
|
||||
PS2_Key_Config();
|
||||
BASIC_TIM_Init();
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "OSC.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include "bsp_led.h"
|
||||
|
||||
|
||||
volatile uint32_t Time_us = 0; // us 计时变量
|
||||
|
@ -41,11 +40,10 @@ void BASIC_TIM_IRQHandler (void)
|
|||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void EXTI2_IRQnHandler(void)
|
||||
void EXTI2_IRQHandler(void)
|
||||
{
|
||||
if(EXTI_GetITStatus(EXTI_Line2) != RESET)
|
||||
{
|
||||
LED1_ON;
|
||||
rt_interrupt_enter();
|
||||
rt_mq_send(setting_data_queue,
|
||||
&setting_data_set,
|
||||
|
|
Loading…
Reference in New Issue