Initial sync implementation
Implemented system sync with crank and cam state and simple error handling
This commit is contained in:
@@ -160,7 +160,10 @@ int main(void)
|
||||
HAL_Init();
|
||||
|
||||
/* USER CODE BEGIN Init */
|
||||
state_g.sync = SYNC_NOT_OK;
|
||||
state_g.sync_state = SYNC_NOT_OK;
|
||||
state_g.crank_state = CYCLE_UNKNOWN;
|
||||
state_g.cam_state = CAM_IDLE;
|
||||
state_g.cam_miss_ctr = 0;
|
||||
/* USER CODE END Init */
|
||||
|
||||
/* Configure the system clock */
|
||||
@@ -359,7 +362,7 @@ static void MX_TIM2_Init(void)
|
||||
sConfigIC.ICPolarity = TIM_INPUTCHANNELPOLARITY_FALLING;
|
||||
sConfigIC.ICSelection = TIM_ICSELECTION_DIRECTTI;
|
||||
sConfigIC.ICPrescaler = TIM_ICPSC_DIV1;
|
||||
sConfigIC.ICFilter = 0;
|
||||
sConfigIC.ICFilter = 10;
|
||||
if (HAL_TIM_IC_ConfigChannel(&htim2, &sConfigIC, TIM_CHANNEL_1) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
|
||||
Reference in New Issue
Block a user