Merge branch '基站测距' into ALPHAV1
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | |
| | | <component_viewer schemaVersion="0.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="Component_Viewer.xsd"> |
| | | |
| | | <component name="EventRecorderStub" version="1.0.0"/> <!--name and version of the component--> |
| | | <events> |
| | | </events> |
| | | |
| | | </component_viewer> |
| | |
| | | |
| | | NVIC_Init(&NVIC_InitStructure); |
| | | } |
| | | //?????3????? |
| | | //???????APB1?2?,?APB1?36M |
| | | //arr:?????? |
| | | //psc:?????? |
| | | //?????????3! |
| | | void TIM3_Int_Init(void) |
| | | { |
| | | TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; |
| | | NVIC_InitTypeDef NVIC_InitStructure; |
| | | |
| | | RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE); //???? |
| | | |
| | | //???TIM3??? |
| | | TIM_TimeBaseStructure.TIM_Period = 1000-1; //??????????????????????????? |
| | | TIM_TimeBaseStructure.TIM_Prescaler =72-1; //??????TIMx??????????? |
| | | TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1; //??????:TDTS = Tck_tim |
| | | TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; //TIM?????? |
| | | TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure); //??????????TIMx??????? |
| | | |
| | | TIM_ITConfig(TIM3,TIM_IT_Update,ENABLE ); //?????TIM3??,?????? |
| | | |
| | | //?????NVIC?? |
| | | NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQn; //TIM3?? |
| | | NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; //?????0? |
| | | NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; //????3? |
| | | NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //IRQ????? |
| | | NVIC_Init(&NVIC_InitStructure); //???NVIC??? |
| | | |
| | | |
| | | TIM_Cmd(TIM3, ENABLE); //??TIMx |
| | | } |
| | | //???3?????? |
| | | int Systick_Init(void) |
| | | { |
| | | int time_retry = 500; |
| | |
| | | void delay_us(uint32_t nTimer); |
| | | void delay_ms(uint32_t nTimer); |
| | | void RTC_Configuration(uint16_t interval); |
| | | void TIM3_Int_Init(void); |
| | | int RCC_Configuration(void); |
| | | #endif |
| | |
| | | volatile uint8_t m_bEUARTTxEn = 0; //使è½åé |
| | | |
| | | void (*Usart1ParseDataCallback)(uint8_t); |
| | | |
| | | void Usart1InitVariables(void) |
| | | { |
| | | m_EUART_TxFrm_FreeFrmLen = EUART_TX_FRM_SIZE-1; |
| | |
| | | GPIO_Init(EU_RX_GPIO, &GPIO_InitStructure); |
| | | |
| | | GPIO_InitStructure.GPIO_Pin = EU_TX_PIN; |
| | | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; //Txæ¨æ½å¤ç¨è¾åº |
| | | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; //Txæ¨æ½å¤ç¨è¾åº GPIO_Mode_AF_PP |
| | | GPIO_Init(EU_TX_GPIO, &GPIO_InitStructure); |
| | | |
| | | GPIO_InitStructure.GPIO_Pin = EU_485_PIN; |
| | | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //Txæ¨æ½å¤ç¨è¾åº GPIO_Mode_AF_PP |
| | | GPIO_Init(EU_485_GPIO, &GPIO_InitStructure); |
| | | OUT485_DISABLE; |
| | | #ifdef UART_GPIO_REMAP_ENABLE |
| | | GPIO_PinRemapConfig(UART_GPIO_REMAP, ENABLE); |
| | | #endif |
| | |
| | | while( m_EUART_DMA_RXPtr != DMACnt && MaxDataLen > 0) |
| | | { |
| | | Usart1ParseDataCallback(m_EUART_DMA_RXBuf[m_EUART_DMA_RXPtr]); |
| | | delay_us(10); |
| | | m_EUART_DMA_RXPtr++; |
| | | if( m_EUART_DMA_RXPtr >= EUART_RX_BUF_SIZE ) |
| | | { |
| | |
| | | { |
| | | if(m_bEUARTTxEn) |
| | | { |
| | | OUT485_DISABLE; |
| | | m_bEUARTTxEn = 0; |
| | | // temp32 = GPIOC->CRH; //C10æ¬ç©ºè¾å
¥ |
| | | // temp32 &= ~(0x00000000F<<8); |
| | |
| | | m_bEUARTCheckingSend = 0; |
| | | return; |
| | | } |
| | | OUT485_ENABLE; |
| | | if(!m_bEUARTTxEn) |
| | | { |
| | | m_bEUARTTxEn = 1; |
| | |
| | | // temp32 |= (0x000000009<<8); |
| | | // GPIOC->CRH = temp32;// */ |
| | | } |
| | | |
| | | //åéä¸ä¸ªåèæ°æ® |
| | | EXT_UART->DR = m_EUART_TxFrames[m_EUART_TxFrm_Tail].buf[s_count]; |
| | | s_count++; |
| | |
| | | |
| | | #include "stm32f10x.h" |
| | | |
| | | #define EU_485_PIN GPIO_Pin_7 |
| | | #define EU_485_GPIO GPIOB |
| | | #define OUT485_ENABLE GPIO_WriteBit(EU_485_GPIO, EU_485_PIN, Bit_SET); |
| | | #define OUT485_DISABLE GPIO_WriteBit(EU_485_GPIO, EU_485_PIN, Bit_RESET); |
| | | |
| | | //#define UART_GPIO_REMAP_ENABLE |
| | | #ifdef UART_GPIO_REMAP_ENABLE |
| | | #define UART_GPIO_REMAP GPIO_Remap_USART1 |
| | |
| | | #define FINAL_MSG_FINAL_TX_TS_IDX 18 |
| | | #define FINAL_MSG_TS_LEN 4 |
| | | |
| | | #define SYNC_SEQ_IDX 5 |
| | | |
| | | #define GROUP_ID_IDX 0 |
| | | #define ANCHOR_ID_IDX 1 |
| | | #define TAG_ID_IDX 5 |
| | |
| | | #define BUTTON_IDX 16 |
| | | #define SEQUENCE_IDX 17 |
| | | //respose |
| | | #define TIMECORRE 14 |
| | | #define ANCTIMEMS 14 |
| | | #define ANCTIMEUS 16 |
| | | |
| | | #define POLL 0x01 |
| | | #define RESPONSE 0x02 |
| | | #define FINAL 0x03 |
| | | #define SYNC 0x04 |
| | | |
| | | /*------------------------------------ Variables ------------------------------------------*/ |
| | | /* Default communication configuration. We use here EVK1000's default mode (mode 3). */ |
| | |
| | | |
| | | /* Frames used in the ranging process. See NOTE 2 below. */ |
| | | static uint8_t tx_poll_msg[20] = {0}; |
| | | static uint8_t tx_sync_msg[14] = {0}; |
| | | //static uint8_t rx_resp_msg[] = {0x41, 0x88, 0, 0xCA, 0xDE, 'V', 'E', 'W', 'A', 0x10, 0x02, 0, 0, 0, 0}; |
| | | static uint8_t tx_final_msg[] = {0x41, 0x88, 0, 0xCA, 0xDE, 'W', 'A', 'V', 'E', 0x23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| | | |
| | | //static uint8_t rx_poll_msg[] = {0x00, 0x88, 0, 0xCA, 0xDE, 'W', 'A', 'V', 'E', 0x21, 0, 0}; |
| | | static uint8_t tx_resp_msg[18] = {0}; |
| | | static uint8_t tx_resp_msg[20] = {0}; |
| | | //static uint8_t rx_final_msg[] = {0x41, 0x88, 0, 0xCA, 0xDE, 'W', 'A', 'V', 'E', 0x23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| | | |
| | | /* Frame sequence number, incremented after each transmission. */ |
| | |
| | | tx_poll_msg[MESSAGE_TYPE_IDX]=POLL; |
| | | tx_resp_msg[MESSAGE_TYPE_IDX]=RESPONSE; |
| | | tx_final_msg[MESSAGE_TYPE_IDX]=FINAL; |
| | | tx_sync_msg[MESSAGE_TYPE_IDX]=SYNC; |
| | | |
| | | memcpy(&tx_poll_msg[TAG_ID_IDX], &dev_id, 4); |
| | | memcpy(&tx_final_msg[TAG_ID_IDX], &dev_id, 4); |
| | | memcpy(&tx_resp_msg[ANCHOR_ID_IDX], &dev_id, 4); |
| | | |
| | | memcpy(&tx_sync_msg[ANCHOR_ID_IDX], &dev_id, 4); |
| | | } |
| | | uint16_t Checksum_u16(uint8_t* pdata, uint32_t len) |
| | | { |
| | |
| | | dwt_configuresleep(0x940, 0x7); |
| | | dwt_entersleep(); |
| | | } |
| | | extern uint8_t g_start_send_flag; |
| | | u8 g_start_sync_flag; |
| | | void SyncPoll(u8 sync_seq) |
| | | { |
| | | g_start_sync_flag=1; |
| | | dwt_forcetrxoff(); |
| | | tx_sync_msg[SYNC_SEQ_IDX]=sync_seq; |
| | | dwt_writetxdata(sizeof(tx_sync_msg), tx_sync_msg, 0);//å°Pollå
æ°æ®ä¼ ç»DW1000ï¼å°å¨å¼å¯åéæ¶ä¼ åºå» |
| | | dwt_writetxfctrl(sizeof(tx_sync_msg), 0);//设置è¶
宽带åéæ°æ®é¿åº¦ |
| | | dwt_starttx(DWT_START_TX_IMMEDIATE); |
| | | } |
| | | uint16_t g_Resttimer; |
| | | uint8_t result; |
| | | u8 tag_succ_times=0; |
| | | int32_t hex_dist; |
| | | u16 checksum; |
| | | int8_t tag_delaytime; |
| | | extern uint16_t sync_timer; |
| | | u16 tmp_time; |
| | | void Tag_App(void)//å鿍¡å¼(TAGæ ç¾) |
| | | { |
| | | uint32_t frame_len; |
| | | uint32_t final_tx_time; |
| | | u32 start_poll; |
| | | u8 i; |
| | | u8 i,getsync_flag=0; |
| | | //LED0_ON; |
| | | dwt_forcetrxoff(); |
| | | g_Resttimer=0; |
| | |
| | | tx_poll_msg[BATTARY_IDX] = Get_Battary(); |
| | | tx_poll_msg[BUTTON_IDX] = !READ_KEY0; |
| | | tx_poll_msg[SEQUENCE_IDX] = frame_seq_nb++; |
| | | |
| | | GPIO_WriteBit(GPIOA, GPIO_Pin_9, Bit_RESET); |
| | | for(i=0;i<g_com_map[MAX_REPORT_ANC_NUM];i++) |
| | | { |
| | | /* Write frame data to DW1000 and prepare transmission. See NOTE 7 below. */ |
| | |
| | | poll_tx_ts = get_tx_timestamp_u64(); //è·å¾POLLåéæ¶é´T1 |
| | | resp_rx_ts = get_rx_timestamp_u64(); //è·å¾RESPONSEæ¥æ¶æ¶é´T4 |
| | | |
| | | if(i==0) |
| | | if(getsync_flag==0) |
| | | { |
| | | tag_delaytime=rx_buffer[TIMECORRE]; |
| | | if(tag_delaytime>g_com_map[COM_INTERVAL]/2) |
| | | getsync_flag=1; |
| | | memcpy(&sync_timer,&rx_buffer[ANCTIMEMS],2); |
| | | memcpy(&tmp_time,&rx_buffer[ANCTIMEUS],2); |
| | | tmp_time=tmp_time+450; |
| | | if(tmp_time>999) |
| | | { |
| | | tag_delaytime=tag_delaytime-g_com_map[COM_INTERVAL]; |
| | | tmp_time-=999; |
| | | sync_timer++; |
| | | if(sync_timer>=1010) |
| | | {sync_timer=0;} |
| | | } |
| | | TIM3->CNT=tmp_time; |
| | | } |
| | | |
| | | memcpy(&anchor_dist_last_frm[0], &rx_buffer[DIST_IDX], 4); |
| | | memcpy(&tx_final_msg[ANCHOR_ID_IDX], &rx_buffer[ANCHOR_ID_IDX], 4); |
| | | /* Compute final message transmission time. See NOTE 9 below. */ |
| | |
| | | usart_send[4] = frame_seq_nb;//æ°æ®æ®µé¿åº¦ |
| | | memcpy(&usart_send[5],&dev_id,2); |
| | | memcpy(&usart_send[7],&rx_buffer[ANCHOR_ID_IDX],2); |
| | | hex_dist = anchor_dist_last_frm[0];; |
| | | hex_dist = anchor_dist_last_frm[0]+(int16_t)g_com_map[DIST_OFFSET]; |
| | | memcpy(&usart_send[9],&hex_dist,4); |
| | | usart_send[13] = battary; |
| | | usart_send[14] = button; |
| | |
| | | |
| | | } |
| | | int8_t correction_time; |
| | | extern uint8_t g_start_send_flag; |
| | | extern uint8_t sync_seq; |
| | | |
| | | void Anchor_App(void) |
| | | { |
| | | uint32_t frame_len; |
| | |
| | | dwt_rxenable(0);//æå¼æ¥æ¶ |
| | | |
| | | /* Poll for reception of a frame or error/timeout. See NOTE 7 below. */ |
| | | while (!((status_reg = dwt_read32bitreg(SYS_STATUS_ID)) & (SYS_STATUS_RXFCG | SYS_STATUS_ALL_RX_ERR))&&!g_start_send_flag)//䏿æ¥è¯¢è¯çç¶æç´å°æ¥æ¶æåæè
åºç°é误 |
| | | while (!((status_reg = dwt_read32bitreg(SYS_STATUS_ID)) & (SYS_STATUS_RXFCG | SYS_STATUS_ALL_RX_ERR))&&!g_start_send_flag&&!g_start_sync_flag)//䏿æ¥è¯¢è¯çç¶æç´å°æ¥æ¶æåæè
åºç°é误 |
| | | { |
| | | IdleTask(); |
| | | g_Resttimer=0; |
| | |
| | | |
| | | if (rx_buffer[MESSAGE_TYPE_IDX] == POLL&&(anchor_type == rx_buffer[ANC_TYPE_IDX])) //夿æ¯å¦æ¯pollå
æ°æ® |
| | | { |
| | | correction_time=tag_timer-tag_id_recv*3; |
| | | if(correction_time == g_com_map[COM_INTERVAL]) |
| | | correction_time = 0; |
| | | tx_resp_msg[TIMECORRE] = correction_time; |
| | | tmp_time=TIM3->CNT; |
| | | memcpy(&tx_resp_msg[ANCTIMEMS],&sync_timer,2); |
| | | memcpy(&tx_resp_msg[ANCTIMEUS],&tmp_time,2); |
| | | |
| | | // if(correction_time>10) |
| | | // {correction_time++;} |
| | | |
| | |
| | | /* Clear RX error events in the DW1000 status register. */ |
| | | dwt_write32bitreg(SYS_STATUS_ID, SYS_STATUS_ALL_RX_ERR); |
| | | } |
| | | }else if(rx_buffer[MESSAGE_TYPE_IDX] == SYNC) |
| | | { |
| | | if(rx_buffer[SYNC_SEQ_IDX]<sync_seq) |
| | | // if(rx_buffer[SYNC_SEQ_IDX]==2) |
| | | { |
| | | sync_seq=rx_buffer[SYNC_SEQ_IDX]+1; |
| | | TIM3->CNT = sync_seq*325%1000+15; |
| | | sync_timer = sync_seq*325/1000; |
| | | SyncPoll(sync_seq); |
| | | } |
| | | } |
| | | } |
| | | else |
| | |
| | | if(g_com_map[0] != 0x55AA) |
| | | { |
| | | g_com_map[0] = 0x55AA; |
| | | g_com_map[VERSION] = 0x0101; |
| | | g_com_map[DEV_ID] =0x04;//DEFAULT_DEV_ID; //é»è®¤è®¾å¤ID |
| | | |
| | | g_com_map[COM_INTERVAL]=50; |
| | | g_com_map[MAX_REPORT_ANC_NUM]=2; |
| | | g_com_map[MIN_REPORT_ANC_NUM]=2; |
| | | g_com_map[DIST_OFFSET]=-26; |
| | | g_com_map[DIST_OFFSET]=-40; |
| | | #ifdef WORK_MODE_TAG |
| | | g_com_map[DEV_ROLE] =0x1; |
| | | g_com_map[DEV_ROLE] =0x1; //æ ç¾ |
| | | #else |
| | | g_com_map[DEV_ROLE] =0x0; |
| | | g_com_map[DEV_ROLE] =0x0; //åºç« |
| | | #endif |
| | | g_com_map[ANC_POLL]=0; |
| | | g_com_map[ALARM_DEV] = 1; |
| | |
| | | //SystemInit(); |
| | | NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x5000); |
| | | Nvic_Init(); |
| | | Systick_Init(); |
| | | // Systick_Init(); |
| | | TIM3_Int_Init(); |
| | | Led_Init(); |
| | | Beep_Init(); |
| | | DW_GPIO_Init(); |
| | |
| | | checksum = Checksum_u16(&hbsend[2],12); |
| | | memcpy(&hbsend[14],&checksum,2); |
| | | } |
| | | u16 tyncpoll_time; |
| | | void Program_Init(void) |
| | | {uint16_t i; |
| | | Usart1ParseDataCallback = UsartParseDataHandler; |
| | |
| | | //deca_sleep(1000); |
| | | HeartBeatInit(); |
| | | dev_id = g_com_map[DEV_ID]; |
| | | // g_com_map[DEV_ROLE]=1; |
| | | // g_com_map[DEV_ID]=1; |
| | | // g_com_map[COM_INTERVAL]=10; |
| | | OUT485_ENABLE; |
| | | g_com_map[VERSION] = 0x0104; |
| | | if(g_com_map[DEV_ROLE]) |
| | | { |
| | | tyncpoll_time=g_com_map[DEV_ID]*g_com_map[MAX_REPORT_ANC_NUM]*4/3; |
| | | printf("æ ç¾ID: %d .\r\n",dev_id); |
| | | printf("é讯é´é: %d ms.\r\n",g_com_map[COM_INTERVAL]); |
| | | printf("忬¡é讯åºç«æ°é: %d个.\r\n",g_com_map[MAX_REPORT_ANC_NUM]); |
| | | }else{ |
| | | |
| | | anchor_type = dev_id%g_com_map[MAX_REPORT_ANC_NUM]; |
| | | printf("åºç«ID: %x .\r\n",dev_id); |
| | | printf("åºç«ç±»å: %c .\r\n",anchor_type+0x41); |
| | | printf("忬¡é讯åºç«æ°é: %d个.\r\n",g_com_map[MAX_REPORT_ANC_NUM]); |
| | | } |
| | | OUT485_DISABLE; |
| | | // printf("DEVICE PAIRID: %d .\r\n",g_com_map[PAIR_ID]); |
| | | // printf("DEVICE ALARM DISTANCE: 1.%d 2.%d 3.%d .\r\n",g_com_map[ALARM_DISTANCE1],g_com_map[ALARM_DISTANCE2],g_com_map[ALARM_DISTANCE3]); |
| | | |
| | |
| | | { |
| | | UART_PushFrame(hbsend,16); |
| | | } |
| | | u16 heartbeat_timer,poll_timer; |
| | | extern u8 g_start_sync_flag; |
| | | u16 heartbeat_timer,poll_timer,sync_timer; |
| | | void IdleTask(void) |
| | | { |
| | | g_start_sync_flag=0; |
| | | UART_CheckReceive(); |
| | | UART_CheckSend(); |
| | | if(heartbeat_timer>1000) |
| | |
| | | if(g_com_map[HEARTBEAT]&&g_com_map[DEV_ROLE]==0) |
| | | HeatBeat(); |
| | | } |
| | | if(poll_timer>=g_com_map[COM_INTERVAL]-tag_delaytime) |
| | | { |
| | | poll_timer=0; |
| | | if(g_com_map[ANC_POLL]||g_com_map[DEV_ROLE]) |
| | | { |
| | | if(g_com_map[DEV_ROLE]==0) |
| | | {int8_t correction_time; |
| | | correction_time=tag_timer-g_com_map[DEV_ID]*3; |
| | | tag_delaytime=correction_time; |
| | | if(tag_delaytime>g_com_map[COM_INTERVAL]/2) |
| | | { |
| | | tag_delaytime=tag_delaytime-g_com_map[COM_INTERVAL]; |
| | | } |
| | | } |
| | | g_start_send_flag=1; |
| | | } |
| | | |
| | | } |
| | | if(g_com_map[CNT_UPDATE]==1) |
| | | { |
| | | uint32_t result = 0; |
| | |
| | | RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); |
| | | usart_send[0]=0x55; |
| | | usart_send[1]=0xAA; |
| | | |
| | | while(1) |
| | | { |
| | | IdleTask(); |
| | |
| | | #include "beep_logic_app.h" |
| | | #include "led.h" |
| | | #include "Usart.h" |
| | | #include "dw_app.h" |
| | | /* Tick timer count. */ |
| | | volatile uint32_t time32_incr; |
| | | uint8_t tt=0; |
| | | uint8_t g_start_send_flag = 0; |
| | | uint8_t g_start_send_flag = 0,sync_seq=0; |
| | | uint16_t sysscal; |
| | | u16 tag_recv_timer, tag_timer; |
| | | extern uint16_t g_Resttimer,heartbeat_timer; |
| | | extern uint16_t g_Resttimer,heartbeat_timer,sync_timer; |
| | | extern uint8_t g_pairstart; |
| | | |
| | | void SysTick_Handler(void) |
| | | u16 timer3; |
| | | extern u16 tyncpoll_time; |
| | | void TIM3_IRQHandler(void) //TIM3?? |
| | | { |
| | | if (TIM_GetITStatus(TIM3, TIM_IT_Update) != RESET) //??TIM3???????? |
| | | { |
| | | TIM_ClearITPendingBit(TIM3, TIM_IT_Update ); //??TIMx?????? |
| | | time32_incr++; |
| | | g_UWB_com_interval++; |
| | | heartbeat_timer++; |
| | |
| | | NVIC_SystemReset(); |
| | | } |
| | | |
| | | // if(g_UWB_com_interval > 1000) |
| | | // { |
| | | // dis_after_filter = DEFAULT_DISTANCE; |
| | | // } |
| | | //#ifdef WORK_MODE_ANCHOR |
| | | if(!g_com_map[DEV_ROLE]) |
| | | {tag_recv_timer++; |
| | | |
| | | sync_timer++; |
| | | |
| | | if(!g_com_map[DEV_ROLE]) //åºç« |
| | | { |
| | | tag_recv_timer++; |
| | | TagDistClear(); |
| | | //if(g_pairstart!=1) |
| | | main_logic(); |
| | | if(sync_timer==10) |
| | | { |
| | | GPIO_WriteBit(GPIOA, GPIO_Pin_9, Bit_SET); |
| | | }else{ |
| | | GPIO_WriteBit(GPIOA, GPIO_Pin_9, Bit_RESET); |
| | | } |
| | | //#endif |
| | | if(sync_timer>500&&dev_id!=0) |
| | | { |
| | | sync_seq=0xff; |
| | | } |
| | | if(sync_timer>=1010) |
| | | { |
| | | sync_timer=0; |
| | | if(dev_id==0) |
| | | { |
| | | SyncPoll(0); |
| | | } |
| | | } |
| | | }else{ //æ ç¾åæ¥å¤ç |
| | | if(sync_timer>=1010) |
| | | {sync_timer=0;} |
| | | if((sync_timer-10)%g_com_map[COM_INTERVAL]==tyncpoll_time) |
| | | { |
| | | GPIO_WriteBit(GPIOA, GPIO_Pin_9, Bit_SET); |
| | | } |
| | | if((sync_timer-10)%g_com_map[COM_INTERVAL]==tyncpoll_time) |
| | | { |
| | | g_start_send_flag=1; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | void SysTick_Handler(void) |
| | | { |
| | | |
| | | |
| | | } |
| | | |