Переструктурирован проект, перенесена ветка тестирования modbus и чуть скомпрессированная библиотека dallas
This commit is contained in:
@@ -285,10 +285,13 @@ RS_StatusTypeDef RS_Abort(RS_HandleTypeDef *hRS, RS_AbortTypeDef AbortMode)
|
||||
{
|
||||
HAL_StatusTypeDef uart_res = 0;
|
||||
hRS->htim->Instance->CNT = 0;
|
||||
__HAL_TIM_CLEAR_IT(hRS->htim, TIM_IT_UPDATE);
|
||||
|
||||
|
||||
if(hRS->sRS_Timeout) // if timeout setted
|
||||
HAL_TIM_Base_Stop_IT(hRS->htim); // stop timeout
|
||||
{
|
||||
TIM14->DIER &= ~(TIM_IT_UPDATE);
|
||||
/* Disable the Peripheral */
|
||||
TIM14->CR1 &= ~(TIM_CR1_CEN);
|
||||
}
|
||||
|
||||
if((AbortMode&ABORT_RS) == 0x00)
|
||||
{
|
||||
@@ -410,7 +413,11 @@ RS_StatusTypeDef RS_UART_RxCpltCallback(RS_HandleTypeDef *hRS)
|
||||
RS_Set_RX_End(hRS);
|
||||
|
||||
if(hRS->sRS_Timeout) // if timeout setted
|
||||
HAL_TIM_Base_Stop_IT(hRS->htim); // stop timeout
|
||||
{
|
||||
TIM14->DIER &= ~(TIM_IT_UPDATE);
|
||||
/* Disable the Peripheral */
|
||||
TIM14->CR1 &= ~(TIM_CR1_CEN);
|
||||
}
|
||||
|
||||
// parse received data
|
||||
RS_RES = RS_Parse_Message(hRS, hRS->pMessagePtr, hRS->pBufferPtr); // parse message
|
||||
@@ -440,7 +447,11 @@ RS_StatusTypeDef RS_UART_RxCpltCallback(RS_HandleTypeDef *hRS)
|
||||
RS_Set_RX_End(hRS);
|
||||
|
||||
if(hRS->sRS_Timeout) // if timeout setted
|
||||
HAL_TIM_Base_Stop_IT(hRS->htim); // stop timeout
|
||||
{
|
||||
TIM14->DIER &= ~(TIM_IT_UPDATE);
|
||||
/* Disable the Peripheral */
|
||||
TIM14->CR1 &= ~(TIM_CR1_CEN);
|
||||
}
|
||||
|
||||
// parse received data
|
||||
RS_RES = RS_Parse_Message(hRS, hRS->pMessagePtr, hRS->pBufferPtr); // parse message
|
||||
@@ -493,7 +504,9 @@ void RS_UART_Handler(RS_HandleTypeDef *hRS)
|
||||
if(hRS->sRS_Timeout) // if timeout setted
|
||||
if((hRS->huart->RxXferCount+1 == hRS->huart->RxXferSize) && RS_Is_RX_Busy(hRS)) // if first byte is received and receive is active
|
||||
{
|
||||
HAL_TIM_Base_Start_IT(hRS->htim);
|
||||
TIM14->DIER |= (TIM_IT_UPDATE);
|
||||
/* Disable the Peripheral */
|
||||
TIM14->CR1 |= (TIM_CR1_CEN);
|
||||
RS_Set_RX_Active_Flags(hRS);
|
||||
}
|
||||
|
||||
@@ -528,8 +541,12 @@ void RS_UART_Handler(RS_HandleTypeDef *hRS)
|
||||
*/
|
||||
void RS_TIM_Handler(RS_HandleTypeDef *hRS)
|
||||
{
|
||||
HAL_TIM_IRQHandler(hRS->htim);
|
||||
HAL_TIM_Base_Stop_IT(hRS->htim);
|
||||
TIM14->SR = ~(TIM_IT_UPDATE);
|
||||
/* Disable the TIM Update interrupt */
|
||||
TIM14->DIER &= ~(TIM_IT_UPDATE);
|
||||
/* Disable the Peripheral */
|
||||
TIM14->CR1 &= ~(TIM_CR1_CEN);
|
||||
|
||||
RS_Abort(hRS, ABORT_RS);
|
||||
|
||||
RS_Handle_Receive_Start(hRS, hRS->pMessagePtr);
|
||||
|
||||
Reference in New Issue
Block a user