Skip to content

Commit

Permalink
comply with code format
Browse files Browse the repository at this point in the history
  • Loading branch information
houkhouk committed May 23, 2024
1 parent 8ec6581 commit b546ef0
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 35 deletions.
10 changes: 5 additions & 5 deletions network/robus_network/HAL/ESP32/robus_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,11 +413,11 @@ static void RobusHAL_TimeoutInit(void)
_CRITICAL void RobusHAL_ResetTimeout(uint16_t nbrbit)
{
uint64_t arr_val, diff, cnt_val;
timer_get_alarm_value(ROBUS_TIMER_GROUP, ROBUS_TIMER, &arr_val) // Get actual timeout value
timer_get_counter_value(ROBUS_TIMER_GROUP, ROBUS_TIMER, &cnt_val); // Get counter value
diff = arr_val- cnt_val; // Compute remaining time before timeout
timer_get_alarm_value(ROBUS_TIMER_GROUP, ROBUS_TIMER, &arr_val); // Get actual timeout value
timer_get_counter_value(ROBUS_TIMER_GROUP, ROBUS_TIMER, &cnt_val); // Get counter value
diff = arr_val - cnt_val; // Compute remaining time before timeout

if(diff < DEFAULT_TIMEOUT)
if (diff < DEFAULT_TIMEOUT)
{
// disable Counter
timer_hal_set_counter_enable(&timeout_hal_context, TIMER_PAUSE);
Expand All @@ -428,7 +428,7 @@ _CRITICAL void RobusHAL_ResetTimeout(uint16_t nbrbit)
timer_hal_set_counter_value(&timeout_hal_context, 0);
}

if(nbrbit != 0 && nbrbit != DEFAULT_TIMEOUT)
if (nbrbit != 0 && nbrbit != DEFAULT_TIMEOUT)
{
// Reset counter
timer_hal_set_alarm_value(&timeout_hal_context, nbrbit);
Expand Down
15 changes: 9 additions & 6 deletions network/robus_network/HAL/STM32F0/robus_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,22 +395,25 @@ _CRITICAL void RobusHAL_ResetTimeout(uint16_t nbrbit)
*/

uint32_t arr_val, diff;
arr_val = LL_TIM_ReadReg(ROBUS_TIMER, ARR); // Get actual timeout value
diff = arr_val-LL_TIM_ReadReg(ROBUS_TIMER, CNT); // Compute remaining time before timeout
arr_val = LL_TIM_ReadReg(ROBUS_TIMER, ARR); // Get actual timeout value
diff = arr_val - LL_TIM_ReadReg(ROBUS_TIMER, CNT); // Compute remaining time before timeout

if(diff < DEFAULT_TIMEOUT){
if (diff < DEFAULT_TIMEOUT)
{
LL_TIM_DisableCounter(ROBUS_TIMER);
NVIC_ClearPendingIRQ(ROBUS_TIMER_IRQ); // Clear IT pending NVIC
LL_TIM_ClearFlag_UPDATE(ROBUS_TIMER);

LL_TIM_SetAutoReload(ROBUS_TIMER, DEFAULT_TIMEOUT);
LL_TIM_SetCounter(ROBUS_TIMER, 0);
}
if(nbrbit != 0 && nbrbit != DEFAULT_TIMEOUT){
if (nbrbit != 0 && nbrbit != DEFAULT_TIMEOUT)
{
LL_TIM_SetAutoReload(ROBUS_TIMER, nbrbit); // reload value
LL_TIM_SetCounter(ROBUS_TIMER, 0); // Reset counter
LL_TIM_SetCounter(ROBUS_TIMER, 0); // Reset counter
}
if(nbrbit != 0){
if (nbrbit != 0)
{
LL_TIM_EnableCounter(ROBUS_TIMER);
}
}
Expand Down
15 changes: 9 additions & 6 deletions network/robus_network/HAL/STM32F4/robus_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,22 +399,25 @@ _CRITICAL void RobusHAL_ResetTimeout(uint16_t nbrbit)
*/

uint32_t arr_val, diff;
arr_val = LL_TIM_ReadReg(ROBUS_TIMER, ARR); // Get actual timeout value
diff = arr_val-LL_TIM_ReadReg(ROBUS_TIMER, CNT); // Compute remaining time before timeout
arr_val = LL_TIM_ReadReg(ROBUS_TIMER, ARR); // Get actual timeout value
diff = arr_val - LL_TIM_ReadReg(ROBUS_TIMER, CNT); // Compute remaining time before timeout

if(diff < DEFAULT_TIMEOUT){
if (diff < DEFAULT_TIMEOUT)
{
LL_TIM_DisableCounter(ROBUS_TIMER);
NVIC_ClearPendingIRQ(ROBUS_TIMER_IRQ); // Clear IT pending NVIC
LL_TIM_ClearFlag_UPDATE(ROBUS_TIMER);

LL_TIM_SetAutoReload(ROBUS_TIMER, DEFAULT_TIMEOUT);
LL_TIM_SetCounter(ROBUS_TIMER, 0);
}
if(nbrbit != 0 && nbrbit != DEFAULT_TIMEOUT){
if (nbrbit != 0 && nbrbit != DEFAULT_TIMEOUT)
{
LL_TIM_SetAutoReload(ROBUS_TIMER, nbrbit); // reload value
LL_TIM_SetCounter(ROBUS_TIMER, 0); // Reset counter
LL_TIM_SetCounter(ROBUS_TIMER, 0); // Reset counter
}
if(nbrbit != 0){
if (nbrbit != 0)
{
LL_TIM_EnableCounter(ROBUS_TIMER);
}
}
Expand Down
15 changes: 9 additions & 6 deletions network/robus_network/HAL/STM32G4/robus_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,22 +396,25 @@ _CRITICAL void RobusHAL_ResetTimeout(uint16_t nbrbit)
*/

uint32_t arr_val, diff;
arr_val = LL_TIM_ReadReg(ROBUS_TIMER, ARR); // Get actual timeout value
diff = arr_val-LL_TIM_ReadReg(ROBUS_TIMER, CNT); // Compute remaining time before timeout
arr_val = LL_TIM_ReadReg(ROBUS_TIMER, ARR); // Get actual timeout value
diff = arr_val - LL_TIM_ReadReg(ROBUS_TIMER, CNT); // Compute remaining time before timeout

if(diff < DEFAULT_TIMEOUT){
if (diff < DEFAULT_TIMEOUT)
{
LL_TIM_DisableCounter(ROBUS_TIMER);
NVIC_ClearPendingIRQ(ROBUS_TIMER_IRQ); // Clear IT pending NVIC
LL_TIM_ClearFlag_UPDATE(ROBUS_TIMER);

LL_TIM_SetAutoReload(ROBUS_TIMER, DEFAULT_TIMEOUT);
LL_TIM_SetCounter(ROBUS_TIMER, 0);
}
if(nbrbit != 0 && nbrbit != DEFAULT_TIMEOUT){
if (nbrbit != 0 && nbrbit != DEFAULT_TIMEOUT)
{
LL_TIM_SetAutoReload(ROBUS_TIMER, nbrbit); // reload value
LL_TIM_SetCounter(ROBUS_TIMER, 0); // Reset counter
LL_TIM_SetCounter(ROBUS_TIMER, 0); // Reset counter
}
if(nbrbit != 0){
if (nbrbit != 0)
{
LL_TIM_EnableCounter(ROBUS_TIMER);
}
}
Expand Down
15 changes: 9 additions & 6 deletions network/robus_network/HAL/STM32L0/robus_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,22 +394,25 @@ _CRITICAL void RobusHAL_ResetTimeout(uint16_t nbrbit)
*/

uint32_t arr_val, diff;
arr_val = LL_TIM_ReadReg(ROBUS_TIMER, ARR); // Get actual timeout value
diff = arr_val-LL_TIM_ReadReg(ROBUS_TIMER, CNT); // Compute remaining time before timeout
arr_val = LL_TIM_ReadReg(ROBUS_TIMER, ARR); // Get actual timeout value
diff = arr_val - LL_TIM_ReadReg(ROBUS_TIMER, CNT); // Compute remaining time before timeout

if(diff < DEFAULT_TIMEOUT){
if (diff < DEFAULT_TIMEOUT)
{
LL_TIM_DisableCounter(ROBUS_TIMER);
NVIC_ClearPendingIRQ(ROBUS_TIMER_IRQ); // Clear IT pending NVIC
LL_TIM_ClearFlag_UPDATE(ROBUS_TIMER);

LL_TIM_SetAutoReload(ROBUS_TIMER, DEFAULT_TIMEOUT);
LL_TIM_SetCounter(ROBUS_TIMER, 0);
}
if(nbrbit != 0 && nbrbit != DEFAULT_TIMEOUT){
if (nbrbit != 0 && nbrbit != DEFAULT_TIMEOUT)
{
LL_TIM_SetAutoReload(ROBUS_TIMER, nbrbit); // reload value
LL_TIM_SetCounter(ROBUS_TIMER, 0); // Reset counter
LL_TIM_SetCounter(ROBUS_TIMER, 0); // Reset counter
}
if(nbrbit != 0){
if (nbrbit != 0)
{
LL_TIM_EnableCounter(ROBUS_TIMER);
}
}
Expand Down
15 changes: 9 additions & 6 deletions network/robus_network/HAL/STM32L4/robus_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,22 +395,25 @@ _CRITICAL void RobusHAL_ResetTimeout(uint16_t nbrbit)
An IRQ can then be generated when reaching 0. This way diff = counter_value.
*/
uint32_t arr_val, diff;
arr_val = LL_TIM_ReadReg(ROBUS_TIMER, ARR); // Get actual timeout value
diff = arr_val-LL_TIM_ReadReg(ROBUS_TIMER, CNT); // Compute remaining time before timeout
arr_val = LL_TIM_ReadReg(ROBUS_TIMER, ARR); // Get actual timeout value
diff = arr_val - LL_TIM_ReadReg(ROBUS_TIMER, CNT); // Compute remaining time before timeout

if(diff < DEFAULT_TIMEOUT){
if (diff < DEFAULT_TIMEOUT)
{
LL_TIM_DisableCounter(ROBUS_TIMER);
NVIC_ClearPendingIRQ(ROBUS_TIMER_IRQ); // Clear IT pending NVIC
LL_TIM_ClearFlag_UPDATE(ROBUS_TIMER);

LL_TIM_SetAutoReload(ROBUS_TIMER, DEFAULT_TIMEOUT);
LL_TIM_SetCounter(ROBUS_TIMER, 0);
}
if(nbrbit != 0 && nbrbit != DEFAULT_TIMEOUT){
if (nbrbit != 0 && nbrbit != DEFAULT_TIMEOUT)
{
LL_TIM_SetAutoReload(ROBUS_TIMER, nbrbit); // reload value
LL_TIM_SetCounter(ROBUS_TIMER, 0); // Reset counter
LL_TIM_SetCounter(ROBUS_TIMER, 0); // Reset counter
}
if(nbrbit != 0){
if (nbrbit != 0)
{
LL_TIM_EnableCounter(ROBUS_TIMER);
}
}
Expand Down

0 comments on commit b546ef0

Please sign in to comment.