master
ThinkPad-T460P 2020-09-07 18:50:29 +08:00
parent cfab7191b5
commit 4e8401861f
3 changed files with 15 additions and 14 deletions

View File

@ -112,7 +112,7 @@ void NaviKit_var_init();
//power state machine switch function //power state machine switch function
void enter_isp_state(); void enter_isp_state();
void enter_runing_state(); void enter_runing_state();
void enter_shutdown_state(); void enter_shutdown_state(uint8_t timeout = 0);
void enter_sleep_state(); void enter_sleep_state();
void enter_dfu_state(); void enter_dfu_state();

View File

@ -479,7 +479,7 @@ void StartStateSwitchTask(void *argument)
{ {
case shutdown: case shutdown:
{//only from running state {//only from running state
if(NaviKit.sys.sta == running) if((NaviKit.sys.sta == running))// && (NaviKit.som.shutdown_req == true)
enter_shutdown_state(); enter_shutdown_state();
}break; }break;
case running: case running:

View File

@ -52,18 +52,18 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{ {
if(GPIO_Pin == SOM_SHUTDOWN_REQ_Pin) if(GPIO_Pin == SOM_SHUTDOWN_REQ_Pin)
{ {
if(HAL_GPIO_ReadPin(SOM_SHUTDOWN_REQ_GPIO_Port, SOM_SHUTDOWN_REQ_Pin)==GPIO_PIN_SET)
{//Rising edge trigger
// NaviKit.som.shutdown_req = true;
}
if(HAL_GPIO_ReadPin(SOM_SHUTDOWN_REQ_GPIO_Port, SOM_SHUTDOWN_REQ_Pin)==GPIO_PIN_RESET) if(HAL_GPIO_ReadPin(SOM_SHUTDOWN_REQ_GPIO_Port, SOM_SHUTDOWN_REQ_Pin)==GPIO_PIN_RESET)
{//falling edge trigger {//falling edge trigger
// NaviKit.som.shutdown_req = false;
if(NaviKit.sys.sta == running) if(NaviKit.sys.sta == running)
{ {//if jetson nano shutdown output low,the power_en should be set low less than 10us
HAL_GPIO_WritePin(SOM_POWER_EN_GPIO_Port ,SOM_POWER_EN_Pin, GPIO_PIN_RESET);
NaviKit.sys.next_sta = shutdown; NaviKit.sys.next_sta = shutdown;
printf("som request to shutdown");
} }
NaviKit.som.shutdown_req = true;
}
else{//Rising edge trigger
NaviKit.som.shutdown_req = false;
} }
} }
@ -129,8 +129,8 @@ void enter_isp_state()
} }
} }
//timeout:the time of wait
void enter_shutdown_state() void enter_shutdown_state(uint8_t timeout)
{ {
printf("Enter to shutdown state\n"); printf("Enter to shutdown state\n");
Beep(50); Beep(50);
@ -165,6 +165,7 @@ void enter_shutdown_state()
HAL_GPIO_WritePin(PMB_PS_ON_GPIO_Port ,PMB_PS_ON_Pin, GPIO_PIN_RESET); osDelay(100); HAL_GPIO_WritePin(PMB_PS_ON_GPIO_Port ,PMB_PS_ON_Pin, GPIO_PIN_RESET); osDelay(100);
} }
void enter_sleep_state() void enter_sleep_state()
{ {
printf("Enter to sleep state \n"); printf("Enter to sleep state \n");