Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
- {
- if (__HAL_TIM_GET_IT_SOURCE(&htim15, TIM_IT_UPDATE) != RESET)
- {
- static uint8_t one_occur = 0;
- static uint8_t break_bits_counter = 0;
- if (break_bits_counter == 0)
- one_occur = 0;
- break_bits_counter++;
- if (HAL_GPIO_ReadPin(USART2_RX_GPIO_Port, USART2_RX_Pin) == GPIO_PIN_SET &&
- (break_bits_counter < DMX_BREAK_TIME))
- {
- HAL_TIM_Base_Stop_IT(&htim15);
- one_occur = 1;
- break_bits_counter = 0;
- }
- if (break_bits_counter >= DMX_BREAK_TIME && (one_occur == 0))
- {
- uart_active_start = false;
- HAL_UART_Receive_IT(&huart2, DMXframe.RecBuf, SERIAL_LENGTH);
- break_bits_counter = 0;
- HAL_TIM_Base_Stop_IT(&htim15);
- }
- __HAL_TIM_CLEAR_IT(&htim15, TIM_IT_UPDATE);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement