| | |
| | | bat_percent=Get_Battary(); |
| | | if(HAL_GPIO_ReadPin(INPUT_5V_GPIO_Port,INPUT_5V_Pin)) |
| | | { |
| | | nomove_count = 0; |
| | | //nomove_count = 0; |
| | | if(state5v==0) |
| | | { |
| | | state5v=1; |
| | |
| | | hardware_pici= STMFLASH_ReadHalfWord(FLASH_HARDWARE_VERSION_MAP+2); |
| | | hardware_type= STMFLASH_ReadHalfWord(FLASH_HARDWARE_VERSION_MAP+4); |
| | | //deca_sleep(1000); |
| | | g_com_map[VERSION] = 0x0221; |
| | | g_com_map[VERSION] = 0x0224; |
| | | |
| | | // g_com_map[DEV_ID]=0x7; |
| | | g_com_map[DEV_ID]=0x3496; |
| | | g_com_map[IMU_ENABLE]=0; |
| | | #ifdef DEBUG_MODE |
| | | // g_com_map[DEV_ROLE]=1; |
| | | // g_com_map[DEV_ID]=0x4009; |
| | |
| | | // g_com_map[IMU_ENABLE]=0; |
| | | // g_com_map[COM_INTERVAL]=1000; |
| | | active_flag = g_com_map[ACTIVE_INDEX]; |
| | | active_flag = 1; |
| | | if(active_flag==0) |
| | | { |
| | | g_com_map[COM_INTERVAL]=1000; |
| | |
| | | GPIO_InitTypeDef GPIO_InitStruct = {0}; |
| | | //hardware_type=2; |
| | | if(hardware_type == 0) |
| | | hardware_type = 2; |
| | | hardware_type = 1; |
| | | switch(hardware_type) |
| | | { |
| | | case 1: |
| | | |
| | | HAL_GPIO_WritePin(GPIOB, MOTOR_Pin, GPIO_PIN_SET); |
| | | GPIO_InitStruct.Pin = MOTOR_Pin; |
| | | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; |
| | | GPIO_InitStruct.Pull = GPIO_NOPULL; |
| | | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; |
| | | HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
| | | HAL_GPIO_WritePin(GPIOB, MOTOR_Pin, GPIO_PIN_SET); |
| | | GPIO_InitStruct.Pin = MOTOR_Pin; |
| | | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; |
| | | GPIO_InitStruct.Pull = GPIO_NOPULL; |
| | | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; |
| | | HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
| | | break; |
| | | case 2: |
| | | MX_TIM2_Init(); |
| | |
| | | /* Initialize all configured peripherals */ |
| | | MX_GPIO_Init(); |
| | | MX_LPTIM1_Init(); |
| | | MX_DMA_Init(); |
| | | MX_DMA_Init(); |
| | | MX_USART1_UART_Init(); |
| | | MX_SPI1_Init(); |
| | | MX_ADC_Init(); |
| | |
| | | key_keeptime+=1/(float)tag_frequency; |
| | | if(key_keeptime>=KEY_KEEPRESET_TIME) |
| | | { |
| | | SCB->AIRCR = 0X05FA0000|(unsigned int)0x04; |
| | | // SCB->AIRCR = 0X05FA0000|(unsigned int)0x04; |
| | | } |
| | | }else{ |
| | | key_keeptime=0; |