STM32L4xx_HAL_Driver  1.14.0
LPTIM Start-Stop operation functions

Start-Stop operation functions. More...

Functions

HAL_StatusTypeDef HAL_LPTIM_PWM_Start (LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse)
 Start the LPTIM PWM generation. More...
 
HAL_StatusTypeDef HAL_LPTIM_PWM_Stop (LPTIM_HandleTypeDef *hlptim)
 Stop the LPTIM PWM generation. More...
 
HAL_StatusTypeDef HAL_LPTIM_PWM_Start_IT (LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse)
 Start the LPTIM PWM generation in interrupt mode. More...
 
HAL_StatusTypeDef HAL_LPTIM_PWM_Stop_IT (LPTIM_HandleTypeDef *hlptim)
 Stop the LPTIM PWM generation in interrupt mode. More...
 
HAL_StatusTypeDef HAL_LPTIM_OnePulse_Start (LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse)
 Start the LPTIM One pulse generation. More...
 
HAL_StatusTypeDef HAL_LPTIM_OnePulse_Stop (LPTIM_HandleTypeDef *hlptim)
 Stop the LPTIM One pulse generation. More...
 
HAL_StatusTypeDef HAL_LPTIM_OnePulse_Start_IT (LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse)
 Start the LPTIM One pulse generation in interrupt mode. More...
 
HAL_StatusTypeDef HAL_LPTIM_OnePulse_Stop_IT (LPTIM_HandleTypeDef *hlptim)
 Stop the LPTIM One pulse generation in interrupt mode. More...
 
HAL_StatusTypeDef HAL_LPTIM_SetOnce_Start (LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse)
 Start the LPTIM in Set once mode. More...
 
HAL_StatusTypeDef HAL_LPTIM_SetOnce_Stop (LPTIM_HandleTypeDef *hlptim)
 Stop the LPTIM Set once mode. More...
 
HAL_StatusTypeDef HAL_LPTIM_SetOnce_Start_IT (LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse)
 Start the LPTIM Set once mode in interrupt mode. More...
 
HAL_StatusTypeDef HAL_LPTIM_SetOnce_Stop_IT (LPTIM_HandleTypeDef *hlptim)
 Stop the LPTIM Set once mode in interrupt mode. More...
 
HAL_StatusTypeDef HAL_LPTIM_Encoder_Start (LPTIM_HandleTypeDef *hlptim, uint32_t Period)
 Start the Encoder interface. More...
 
HAL_StatusTypeDef HAL_LPTIM_Encoder_Stop (LPTIM_HandleTypeDef *hlptim)
 Stop the Encoder interface. More...
 
HAL_StatusTypeDef HAL_LPTIM_Encoder_Start_IT (LPTIM_HandleTypeDef *hlptim, uint32_t Period)
 Start the Encoder interface in interrupt mode. More...
 
HAL_StatusTypeDef HAL_LPTIM_Encoder_Stop_IT (LPTIM_HandleTypeDef *hlptim)
 Stop the Encoder interface in interrupt mode. More...
 
HAL_StatusTypeDef HAL_LPTIM_TimeOut_Start (LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Timeout)
 Start the Timeout function. More...
 
HAL_StatusTypeDef HAL_LPTIM_TimeOut_Stop (LPTIM_HandleTypeDef *hlptim)
 Stop the Timeout function. More...
 
HAL_StatusTypeDef HAL_LPTIM_TimeOut_Start_IT (LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Timeout)
 Start the Timeout function in interrupt mode. More...
 
HAL_StatusTypeDef HAL_LPTIM_TimeOut_Stop_IT (LPTIM_HandleTypeDef *hlptim)
 Stop the Timeout function in interrupt mode. More...
 
HAL_StatusTypeDef HAL_LPTIM_Counter_Start (LPTIM_HandleTypeDef *hlptim, uint32_t Period)
 Start the Counter mode. More...
 
HAL_StatusTypeDef HAL_LPTIM_Counter_Stop (LPTIM_HandleTypeDef *hlptim)
 Stop the Counter mode. More...
 
HAL_StatusTypeDef HAL_LPTIM_Counter_Start_IT (LPTIM_HandleTypeDef *hlptim, uint32_t Period)
 Start the Counter mode in interrupt mode. More...
 
HAL_StatusTypeDef HAL_LPTIM_Counter_Stop_IT (LPTIM_HandleTypeDef *hlptim)
 Stop the Counter mode in interrupt mode. More...
 

Detailed Description

Start-Stop operation functions.

  ==============================================================================
                ##### LPTIM Start Stop operation functions #####
  ==============================================================================
    [..]  This section provides functions allowing to:
      (+) Start the PWM mode.
      (+) Stop the PWM mode.
      (+) Start the One pulse mode.
      (+) Stop the One pulse mode.
      (+) Start the Set once mode.
      (+) Stop the Set once mode.
      (+) Start the Encoder mode.
      (+) Stop the Encoder mode.
      (+) Start the Timeout mode.
      (+) Stop the Timeout mode.
      (+) Start the Counter mode.
      (+) Stop the Counter mode.

Function Documentation

◆ HAL_LPTIM_Counter_Start()

HAL_StatusTypeDef HAL_LPTIM_Counter_Start ( LPTIM_HandleTypeDef hlptim,
uint32_t  Period 
)

Start the Counter mode.

Parameters
hlptimLPTIM handle
PeriodSpecifies the Autoreload value. This parameter must be a value between 0x0000 and 0xFFFF.
Return values
HALstatus

Definition at line 1362 of file stm32l4xx_hal_lptim.c.

1363 {
1364  /* Check the parameters */
1365  assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
1366  assert_param(IS_LPTIM_PERIOD(Period));
1367 
1368  /* Set the LPTIM state */
1369  hlptim->State = HAL_LPTIM_STATE_BUSY;
1370 
1371  /* If clock source is not ULPTIM clock and counter source is external, then it must not be prescaled */
1372  if ((hlptim->Init.Clock.Source != LPTIM_CLOCKSOURCE_ULPTIM) && (hlptim->Init.CounterSource == LPTIM_COUNTERSOURCE_EXTERNAL))
1373  {
1374  /* Check if clock is prescaled */
1375  assert_param(IS_LPTIM_CLOCK_PRESCALERDIV1(hlptim->Init.Clock.Prescaler));
1376  /* Set clock prescaler to 0 */
1377  hlptim->Instance->CFGR &= ~LPTIM_CFGR_PRESC;
1378  }
1379 
1380  /* Enable the Peripheral */
1381  __HAL_LPTIM_ENABLE(hlptim);
1382 
1383  /* Load the period value in the autoreload register */
1384  __HAL_LPTIM_AUTORELOAD_SET(hlptim, Period);
1385 
1386 #if defined(LPTIM_RCR_REP)
1387  /* Load the repetition value in the repetition counter */
1388  if (hlptim->Init.RepetitionCounter != 0)
1389  {
1390  __HAL_LPTIM_REPETITIONCOUNTER_SET(hlptim, hlptim->Init.RepetitionCounter);
1391  }
1392 #endif
1393 
1394  /* Start timer in continuous mode */
1395  __HAL_LPTIM_START_CONTINUOUS(hlptim);
1396 
1397  /* Change the TIM state*/
1398  hlptim->State = HAL_LPTIM_STATE_READY;
1399 
1400  /* Return function status */
1401  return HAL_OK;
1402 }
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_LPTIM_Counter_Start_IT()

HAL_StatusTypeDef HAL_LPTIM_Counter_Start_IT ( LPTIM_HandleTypeDef hlptim,
uint32_t  Period 
)

Start the Counter mode in interrupt mode.

Parameters
hlptimLPTIM handle
PeriodSpecifies the Autoreload value. This parameter must be a value between 0x0000 and 0xFFFF.
Return values
HALstatus

Definition at line 1434 of file stm32l4xx_hal_lptim.c.

1435 {
1436  /* Check the parameters */
1437  assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
1438  assert_param(IS_LPTIM_PERIOD(Period));
1439 
1440  /* Set the LPTIM state */
1441  hlptim->State = HAL_LPTIM_STATE_BUSY;
1442 
1443  /* Enable EXTI Line interrupt on the LPTIM Wake-up Timer */
1444  __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_IT();
1445 
1446  /* If clock source is not ULPTIM clock and counter source is external, then it must not be prescaled */
1447  if ((hlptim->Init.Clock.Source != LPTIM_CLOCKSOURCE_ULPTIM) && (hlptim->Init.CounterSource == LPTIM_COUNTERSOURCE_EXTERNAL))
1448  {
1449  /* Check if clock is prescaled */
1450  assert_param(IS_LPTIM_CLOCK_PRESCALERDIV1(hlptim->Init.Clock.Prescaler));
1451  /* Set clock prescaler to 0 */
1452  hlptim->Instance->CFGR &= ~LPTIM_CFGR_PRESC;
1453  }
1454 
1455  /* Enable Autoreload write complete interrupt */
1456  __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_ARROK);
1457 
1458  /* Enable Autoreload match interrupt */
1459  __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_ARRM);
1460 
1461 #if defined(LPTIM_RCR_REP)
1462  /* Enable the update event and the repetition register update OK interrupts */
1463  if ((hlptim->Init.RepetitionCounter) != 0)
1464  {
1465  __HAL_LPTIM_ENABLE_IT(hlptim, (LPTIM_IT_UPDATE | LPTIM_IT_REPOK));
1466  }
1467 #endif
1468 
1469  /* Enable the Peripheral */
1470  __HAL_LPTIM_ENABLE(hlptim);
1471 
1472  /* Load the period value in the autoreload register */
1473  __HAL_LPTIM_AUTORELOAD_SET(hlptim, Period);
1474 
1475  #if defined(LPTIM_RCR_REP)
1476  /* Load the repetition value in the repetition counter */
1477  if (hlptim->Init.RepetitionCounter != 0)
1478  {
1479  __HAL_LPTIM_REPETITIONCOUNTER_SET(hlptim, hlptim->Init.RepetitionCounter);
1480  }
1481 #endif
1482 
1483  /* Start timer in continuous mode */
1484  __HAL_LPTIM_START_CONTINUOUS(hlptim);
1485 
1486  /* Change the TIM state*/
1487  hlptim->State = HAL_LPTIM_STATE_READY;
1488 
1489  /* Return function status */
1490  return HAL_OK;
1491 }
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_LPTIM_Counter_Stop()

HAL_StatusTypeDef HAL_LPTIM_Counter_Stop ( LPTIM_HandleTypeDef hlptim)

Stop the Counter mode.

Parameters
hlptimLPTIM handle
Return values
HALstatus

Definition at line 1409 of file stm32l4xx_hal_lptim.c.

1410 {
1411  /* Check the parameters */
1412  assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
1413 
1414  /* Set the LPTIM state */
1415  hlptim->State = HAL_LPTIM_STATE_BUSY;
1416 
1417  /* Disable the Peripheral */
1418  __HAL_LPTIM_DISABLE(hlptim);
1419 
1420  /* Change the TIM state*/
1421  hlptim->State = HAL_LPTIM_STATE_READY;
1422 
1423  /* Return function status */
1424  return HAL_OK;
1425 }
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_LPTIM_Counter_Stop_IT()

HAL_StatusTypeDef HAL_LPTIM_Counter_Stop_IT ( LPTIM_HandleTypeDef hlptim)

Stop the Counter mode in interrupt mode.

Parameters
hlptimLPTIM handle
Return values
HALstatus

Definition at line 1498 of file stm32l4xx_hal_lptim.c.

1499 {
1500  /* Check the parameters */
1501  assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
1502 
1503  /* Set the LPTIM state */
1504  hlptim->State = HAL_LPTIM_STATE_BUSY;
1505 
1506  /* Disable EXTI Line interrupt on the LPTIM Wake-up Timer */
1507  __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_IT();
1508 
1509  /* Disable the Peripheral */
1510  __HAL_LPTIM_DISABLE(hlptim);
1511 
1512  /* Disable Autoreload write complete interrupt */
1513  __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_ARROK);
1514 
1515  /* Disable Autoreload match interrupt */
1516  __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_ARRM);
1517 
1518 #if defined(LPTIM_RCR_REP)
1519  /* Disable the update event and the repetition register update OK interrupts */
1520  if ((hlptim->Init.RepetitionCounter) != 0)
1521  {
1522  __HAL_LPTIM_DISABLE_IT(hlptim, (LPTIM_IT_UPDATE | LPTIM_IT_REPOK));
1523  }
1524 #endif
1525 
1526  /* Change the TIM state*/
1527  hlptim->State = HAL_LPTIM_STATE_READY;
1528 
1529  /* Return function status */
1530  return HAL_OK;
1531 }
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_LPTIM_Encoder_Start()

HAL_StatusTypeDef HAL_LPTIM_Encoder_Start ( LPTIM_HandleTypeDef hlptim,
uint32_t  Period 
)

Start the Encoder interface.

Parameters
hlptimLPTIM handle
PeriodSpecifies the Autoreload value. This parameter must be a value between 0x0000 and 0xFFFF.
Return values
HALstatus

Definition at line 1043 of file stm32l4xx_hal_lptim.c.

1044 {
1045  uint32_t tmpcfgr;
1046 
1047  /* Check the parameters */
1048  assert_param(IS_LPTIM_ENCODER_INTERFACE_INSTANCE(hlptim->Instance));
1049  assert_param(IS_LPTIM_PERIOD(Period));
1050  assert_param(hlptim->Init.Clock.Source == LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC);
1051  assert_param(hlptim->Init.Clock.Prescaler == LPTIM_PRESCALER_DIV1);
1052  assert_param(IS_LPTIM_CLOCK_POLARITY(hlptim->Init.UltraLowPowerClock.Polarity));
1053 
1054  /* Set the LPTIM state */
1055  hlptim->State = HAL_LPTIM_STATE_BUSY;
1056 
1057  /* Get the LPTIMx CFGR value */
1058  tmpcfgr = hlptim->Instance->CFGR;
1059 
1060  /* Clear CKPOL bits */
1061  tmpcfgr &= (uint32_t)(~LPTIM_CFGR_CKPOL);
1062 
1063  /* Set Input polarity */
1064  tmpcfgr |= hlptim->Init.UltraLowPowerClock.Polarity;
1065 
1066  /* Write to LPTIMx CFGR */
1067  hlptim->Instance->CFGR = tmpcfgr;
1068 
1069  /* Set ENC bit to enable the encoder interface */
1070  hlptim->Instance->CFGR |= LPTIM_CFGR_ENC;
1071 
1072  /* Enable the Peripheral */
1073  __HAL_LPTIM_ENABLE(hlptim);
1074 
1075  /* Load the period value in the autoreload register */
1076  __HAL_LPTIM_AUTORELOAD_SET(hlptim, Period);
1077 
1078  /* Start timer in continuous mode */
1079  __HAL_LPTIM_START_CONTINUOUS(hlptim);
1080 
1081  /* Change the TIM state*/
1082  hlptim->State = HAL_LPTIM_STATE_READY;
1083 
1084  /* Return function status */
1085  return HAL_OK;
1086 }
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_LPTIM_Encoder_Start_IT()

HAL_StatusTypeDef HAL_LPTIM_Encoder_Start_IT ( LPTIM_HandleTypeDef hlptim,
uint32_t  Period 
)

Start the Encoder interface in interrupt mode.

Parameters
hlptimLPTIM handle
PeriodSpecifies the Autoreload value. This parameter must be a value between 0x0000 and 0xFFFF.
Return values
HALstatus

Definition at line 1121 of file stm32l4xx_hal_lptim.c.

1122 {
1123  uint32_t tmpcfgr;
1124 
1125  /* Check the parameters */
1126  assert_param(IS_LPTIM_ENCODER_INTERFACE_INSTANCE(hlptim->Instance));
1127  assert_param(IS_LPTIM_PERIOD(Period));
1128  assert_param(hlptim->Init.Clock.Source == LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC);
1129  assert_param(hlptim->Init.Clock.Prescaler == LPTIM_PRESCALER_DIV1);
1130  assert_param(IS_LPTIM_CLOCK_POLARITY(hlptim->Init.UltraLowPowerClock.Polarity));
1131 
1132  /* Set the LPTIM state */
1133  hlptim->State = HAL_LPTIM_STATE_BUSY;
1134 
1135  /* Configure edge sensitivity for encoder mode */
1136  /* Get the LPTIMx CFGR value */
1137  tmpcfgr = hlptim->Instance->CFGR;
1138 
1139  /* Clear CKPOL bits */
1140  tmpcfgr &= (uint32_t)(~LPTIM_CFGR_CKPOL);
1141 
1142  /* Set Input polarity */
1143  tmpcfgr |= hlptim->Init.UltraLowPowerClock.Polarity;
1144 
1145  /* Write to LPTIMx CFGR */
1146  hlptim->Instance->CFGR = tmpcfgr;
1147 
1148  /* Set ENC bit to enable the encoder interface */
1149  hlptim->Instance->CFGR |= LPTIM_CFGR_ENC;
1150 
1151  /* Enable "switch to down direction" interrupt */
1152  __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_DOWN);
1153 
1154  /* Enable "switch to up direction" interrupt */
1155  __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_UP);
1156 
1157  /* Enable the Peripheral */
1158  __HAL_LPTIM_ENABLE(hlptim);
1159 
1160  /* Load the period value in the autoreload register */
1161  __HAL_LPTIM_AUTORELOAD_SET(hlptim, Period);
1162 
1163  /* Start timer in continuous mode */
1164  __HAL_LPTIM_START_CONTINUOUS(hlptim);
1165 
1166  /* Change the TIM state*/
1167  hlptim->State = HAL_LPTIM_STATE_READY;
1168 
1169  /* Return function status */
1170  return HAL_OK;
1171 }
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_LPTIM_Encoder_Stop()

HAL_StatusTypeDef HAL_LPTIM_Encoder_Stop ( LPTIM_HandleTypeDef hlptim)

Stop the Encoder interface.

Parameters
hlptimLPTIM handle
Return values
HALstatus

Definition at line 1093 of file stm32l4xx_hal_lptim.c.

1094 {
1095  /* Check the parameters */
1096  assert_param(IS_LPTIM_ENCODER_INTERFACE_INSTANCE(hlptim->Instance));
1097 
1098  /* Set the LPTIM state */
1099  hlptim->State = HAL_LPTIM_STATE_BUSY;
1100 
1101  /* Disable the Peripheral */
1102  __HAL_LPTIM_DISABLE(hlptim);
1103 
1104  /* Reset ENC bit to disable the encoder interface */
1105  hlptim->Instance->CFGR &= ~LPTIM_CFGR_ENC;
1106 
1107  /* Change the TIM state*/
1108  hlptim->State = HAL_LPTIM_STATE_READY;
1109 
1110  /* Return function status */
1111  return HAL_OK;
1112 }
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_LPTIM_Encoder_Stop_IT()

HAL_StatusTypeDef HAL_LPTIM_Encoder_Stop_IT ( LPTIM_HandleTypeDef hlptim)

Stop the Encoder interface in interrupt mode.

Parameters
hlptimLPTIM handle
Return values
HALstatus

Definition at line 1178 of file stm32l4xx_hal_lptim.c.

1179 {
1180  /* Check the parameters */
1181  assert_param(IS_LPTIM_ENCODER_INTERFACE_INSTANCE(hlptim->Instance));
1182 
1183  /* Set the LPTIM state */
1184  hlptim->State = HAL_LPTIM_STATE_BUSY;
1185 
1186  /* Disable the Peripheral */
1187  __HAL_LPTIM_DISABLE(hlptim);
1188 
1189  /* Reset ENC bit to disable the encoder interface */
1190  hlptim->Instance->CFGR &= ~LPTIM_CFGR_ENC;
1191 
1192  /* Disable "switch to down direction" interrupt */
1193  __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_DOWN);
1194 
1195  /* Disable "switch to up direction" interrupt */
1196  __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_UP);
1197 
1198  /* Change the TIM state*/
1199  hlptim->State = HAL_LPTIM_STATE_READY;
1200 
1201  /* Return function status */
1202  return HAL_OK;
1203 }
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_LPTIM_OnePulse_Start()

HAL_StatusTypeDef HAL_LPTIM_OnePulse_Start ( LPTIM_HandleTypeDef hlptim,
uint32_t  Period,
uint32_t  Pulse 
)

Start the LPTIM One pulse generation.

Parameters
hlptimLPTIM handle
PeriodSpecifies the Autoreload value. This parameter must be a value between 0x0000 and 0xFFFF.
PulseSpecifies the compare value. This parameter must be a value between 0x0000 and 0xFFFF.
Return values
HALstatus

Definition at line 649 of file stm32l4xx_hal_lptim.c.

650 {
651  /* Check the parameters */
652  assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
653  assert_param(IS_LPTIM_PERIOD(Period));
654  assert_param(IS_LPTIM_PULSE(Pulse));
655 
656  /* Set the LPTIM state */
657  hlptim->State = HAL_LPTIM_STATE_BUSY;
658 
659  /* Reset WAVE bit to set one pulse mode */
660  hlptim->Instance->CFGR &= ~LPTIM_CFGR_WAVE;
661 
662  /* Enable the Peripheral */
663  __HAL_LPTIM_ENABLE(hlptim);
664 
665  /* Load the period value in the autoreload register */
666  __HAL_LPTIM_AUTORELOAD_SET(hlptim, Period);
667 
668  /* Load the pulse value in the compare register */
669  __HAL_LPTIM_COMPARE_SET(hlptim, Pulse);
670 
671  /* Start timer in single (one shot) mode */
672  __HAL_LPTIM_START_SINGLE(hlptim);
673 
674 #if defined(LPTIM_RCR_REP)
675  /* Load the repetition value in the repetition counter */
676  if (hlptim->Init.RepetitionCounter != 0)
677  {
678  __HAL_LPTIM_REPETITIONCOUNTER_SET(hlptim, hlptim->Init.RepetitionCounter);
679  }
680 #endif
681 
682  /* Change the TIM state*/
683  hlptim->State = HAL_LPTIM_STATE_READY;
684 
685  /* Return function status */
686  return HAL_OK;
687 }
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_LPTIM_OnePulse_Start_IT()

HAL_StatusTypeDef HAL_LPTIM_OnePulse_Start_IT ( LPTIM_HandleTypeDef hlptim,
uint32_t  Period,
uint32_t  Pulse 
)

Start the LPTIM One pulse generation in interrupt mode.

Parameters
hlptimLPTIM handle
PeriodSpecifies the Autoreload value. This parameter must be a value between 0x0000 and 0xFFFF.
PulseSpecifies the compare value. This parameter must be a value between 0x0000 and 0xFFFF.
Return values
HALstatus

Definition at line 721 of file stm32l4xx_hal_lptim.c.

722 {
723  /* Check the parameters */
724  assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
725  assert_param(IS_LPTIM_PERIOD(Period));
726  assert_param(IS_LPTIM_PULSE(Pulse));
727 
728  /* Set the LPTIM state */
729  hlptim->State = HAL_LPTIM_STATE_BUSY;
730 
731  /* Reset WAVE bit to set one pulse mode */
732  hlptim->Instance->CFGR &= ~LPTIM_CFGR_WAVE;
733 
734  /* Enable Autoreload write complete interrupt */
735  __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_ARROK);
736 
737  /* Enable Compare write complete interrupt */
738  __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_CMPOK);
739 
740  /* Enable Autoreload match interrupt */
741  __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_ARRM);
742 
743  /* Enable Compare match interrupt */
744  __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_CMPM);
745 
746  /* If external trigger source is used, then enable external trigger interrupt */
747  if ((hlptim->Init.Trigger.Source) != LPTIM_TRIGSOURCE_SOFTWARE)
748  {
749  /* Enable external trigger interrupt */
750  __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_EXTTRIG);
751  }
752 
753 #if defined(LPTIM_RCR_REP)
754  /* Enable the update event and the repetition register update OK interrupts */
755  if ((hlptim->Init.RepetitionCounter) != 0)
756  {
757  __HAL_LPTIM_ENABLE_IT(hlptim, (LPTIM_IT_UPDATE | LPTIM_IT_REPOK));
758  }
759 #endif
760 
761  /* Enable the Peripheral */
762  __HAL_LPTIM_ENABLE(hlptim);
763 
764  /* Load the period value in the autoreload register */
765  __HAL_LPTIM_AUTORELOAD_SET(hlptim, Period);
766 
767  /* Load the pulse value in the compare register */
768  __HAL_LPTIM_COMPARE_SET(hlptim, Pulse);
769 
770 #if defined(LPTIM_RCR_REP)
771  /* Load the repetition value in the repetition counter */
772  if (hlptim->Init.RepetitionCounter != 0)
773  {
774  __HAL_LPTIM_REPETITIONCOUNTER_SET(hlptim, hlptim->Init.RepetitionCounter);
775  }
776 #endif
777 
778  /* Start timer in continuous mode */
779  __HAL_LPTIM_START_SINGLE(hlptim);
780 
781  /* Change the TIM state*/
782  hlptim->State = HAL_LPTIM_STATE_READY;
783 
784  /* Return function status */
785  return HAL_OK;
786 }
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_LPTIM_OnePulse_Stop()

HAL_StatusTypeDef HAL_LPTIM_OnePulse_Stop ( LPTIM_HandleTypeDef hlptim)

Stop the LPTIM One pulse generation.

Parameters
hlptimLPTIM handle
Return values
HALstatus

Definition at line 694 of file stm32l4xx_hal_lptim.c.

695 {
696  /* Check the parameters */
697  assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
698 
699  /* Set the LPTIM state */
700  hlptim->State = HAL_LPTIM_STATE_BUSY;
701 
702  /* Disable the Peripheral */
703  __HAL_LPTIM_DISABLE(hlptim);
704 
705  /* Change the TIM state*/
706  hlptim->State = HAL_LPTIM_STATE_READY;
707 
708  /* Return function status */
709  return HAL_OK;
710 }
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_LPTIM_OnePulse_Stop_IT()

HAL_StatusTypeDef HAL_LPTIM_OnePulse_Stop_IT ( LPTIM_HandleTypeDef hlptim)

Stop the LPTIM One pulse generation in interrupt mode.

Parameters
hlptimLPTIM handle
Return values
HALstatus

Definition at line 793 of file stm32l4xx_hal_lptim.c.

794 {
795  /* Check the parameters */
796  assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
797 
798  /* Set the LPTIM state */
799  hlptim->State = HAL_LPTIM_STATE_BUSY;
800 
801  /* Disable the Peripheral */
802  __HAL_LPTIM_DISABLE(hlptim);
803 
804  /* Disable Autoreload write complete interrupt */
805  __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_ARROK);
806 
807  /* Disable Compare write complete interrupt */
808  __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_CMPOK);
809 
810  /* Disable Autoreload match interrupt */
811  __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_ARRM);
812 
813  /* Disable Compare match interrupt */
814  __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_CMPM);
815 
816  /* If external trigger source is used, then disable external trigger interrupt */
817  if ((hlptim->Init.Trigger.Source) != LPTIM_TRIGSOURCE_SOFTWARE)
818  {
819  /* Disable external trigger interrupt */
820  __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_EXTTRIG);
821  }
822 
823 #if defined(LPTIM_RCR_REP)
824  /* Disable the update event and the repetition register update OK interrupts */
825  if ((hlptim->Init.RepetitionCounter) != 0)
826  {
827  __HAL_LPTIM_DISABLE_IT(hlptim, (LPTIM_IT_UPDATE | LPTIM_IT_REPOK));
828  }
829 #endif
830 
831  /* Change the TIM state*/
832  hlptim->State = HAL_LPTIM_STATE_READY;
833 
834  /* Return function status */
835  return HAL_OK;
836 }
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_LPTIM_PWM_Start()

HAL_StatusTypeDef HAL_LPTIM_PWM_Start ( LPTIM_HandleTypeDef hlptim,
uint32_t  Period,
uint32_t  Pulse 
)

Start the LPTIM PWM generation.

Parameters
hlptimLPTIM handle
PeriodSpecifies the Autoreload value. This parameter must be a value between 0x0000 and 0xFFFF.
PulseSpecifies the compare value. This parameter must be a value between 0x0000 and 0xFFFF.
Return values
HALstatus

Definition at line 451 of file stm32l4xx_hal_lptim.c.

452 {
453  /* Check the parameters */
454  assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
455  assert_param(IS_LPTIM_PERIOD(Period));
456  assert_param(IS_LPTIM_PULSE(Pulse));
457 
458  /* Set the LPTIM state */
459  hlptim->State = HAL_LPTIM_STATE_BUSY;
460 
461  /* Reset WAVE bit to set PWM mode */
462  hlptim->Instance->CFGR &= ~LPTIM_CFGR_WAVE;
463 
464  /* Enable the Peripheral */
465  __HAL_LPTIM_ENABLE(hlptim);
466 
467  /* Load the period value in the autoreload register */
468  __HAL_LPTIM_AUTORELOAD_SET(hlptim, Period);
469 
470  /* Load the pulse value in the compare register */
471  __HAL_LPTIM_COMPARE_SET(hlptim, Pulse);
472 
473 #if defined(LPTIM_RCR_REP)
474  /* Load the repetition value in the repetition counter */
475  if (hlptim->Init.RepetitionCounter != 0)
476  {
477  __HAL_LPTIM_REPETITIONCOUNTER_SET(hlptim, hlptim->Init.RepetitionCounter);
478  }
479 #endif
480 
481  /* Start timer in continuous mode */
482  __HAL_LPTIM_START_CONTINUOUS(hlptim);
483 
484  /* Change the TIM state*/
485  hlptim->State = HAL_LPTIM_STATE_READY;
486 
487  /* Return function status */
488  return HAL_OK;
489 }
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_LPTIM_PWM_Start_IT()

HAL_StatusTypeDef HAL_LPTIM_PWM_Start_IT ( LPTIM_HandleTypeDef hlptim,
uint32_t  Period,
uint32_t  Pulse 
)

Start the LPTIM PWM generation in interrupt mode.

Parameters
hlptimLPTIM handle
PeriodSpecifies the Autoreload value. This parameter must be a value between 0x0000 and 0xFFFF
PulseSpecifies the compare value. This parameter must be a value between 0x0000 and 0xFFFF
Return values
HALstatus

Definition at line 523 of file stm32l4xx_hal_lptim.c.

524 {
525  /* Check the parameters */
526  assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
527  assert_param(IS_LPTIM_PERIOD(Period));
528  assert_param(IS_LPTIM_PULSE(Pulse));
529 
530  /* Set the LPTIM state */
531  hlptim->State = HAL_LPTIM_STATE_BUSY;
532 
533  /* Reset WAVE bit to set PWM mode */
534  hlptim->Instance->CFGR &= ~LPTIM_CFGR_WAVE;
535 
536  /* Enable Autoreload write complete interrupt */
537  __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_ARROK);
538 
539  /* Enable Compare write complete interrupt */
540  __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_CMPOK);
541 
542  /* Enable Autoreload match interrupt */
543  __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_ARRM);
544 
545  /* Enable Compare match interrupt */
546  __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_CMPM);
547 
548  /* If external trigger source is used, then enable external trigger interrupt */
549  if ((hlptim->Init.Trigger.Source) != LPTIM_TRIGSOURCE_SOFTWARE)
550  {
551  /* Enable external trigger interrupt */
552  __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_EXTTRIG);
553  }
554 
555 #if defined(LPTIM_RCR_REP)
556  /* Enable the update event and the repetition register update OK interrupts */
557  if ((hlptim->Init.RepetitionCounter) != 0)
558  {
559  __HAL_LPTIM_ENABLE_IT(hlptim, (LPTIM_IT_UPDATE | LPTIM_IT_REPOK));
560  }
561 #endif
562 
563  /* Enable the Peripheral */
564  __HAL_LPTIM_ENABLE(hlptim);
565 
566  /* Load the period value in the autoreload register */
567  __HAL_LPTIM_AUTORELOAD_SET(hlptim, Period);
568 
569  /* Load the pulse value in the compare register */
570  __HAL_LPTIM_COMPARE_SET(hlptim, Pulse);
571 
572 #if defined(LPTIM_RCR_REP)
573  /* Load the repetition value in the repetition counter */
574  if (hlptim->Init.RepetitionCounter != 0)
575  {
576  __HAL_LPTIM_REPETITIONCOUNTER_SET(hlptim, hlptim->Init.RepetitionCounter);
577  }
578 #endif
579 
580  /* Start timer in continuous mode */
581  __HAL_LPTIM_START_CONTINUOUS(hlptim);
582 
583  /* Change the TIM state*/
584  hlptim->State = HAL_LPTIM_STATE_READY;
585 
586  /* Return function status */
587  return HAL_OK;
588 }
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_LPTIM_PWM_Stop()

HAL_StatusTypeDef HAL_LPTIM_PWM_Stop ( LPTIM_HandleTypeDef hlptim)

Stop the LPTIM PWM generation.

Parameters
hlptimLPTIM handle
Return values
HALstatus

Definition at line 496 of file stm32l4xx_hal_lptim.c.

497 {
498  /* Check the parameters */
499  assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
500 
501  /* Set the LPTIM state */
502  hlptim->State = HAL_LPTIM_STATE_BUSY;
503 
504  /* Disable the Peripheral */
505  __HAL_LPTIM_DISABLE(hlptim);
506 
507  /* Change the TIM state*/
508  hlptim->State = HAL_LPTIM_STATE_READY;
509 
510  /* Return function status */
511  return HAL_OK;
512 }
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_LPTIM_PWM_Stop_IT()

HAL_StatusTypeDef HAL_LPTIM_PWM_Stop_IT ( LPTIM_HandleTypeDef hlptim)

Stop the LPTIM PWM generation in interrupt mode.

Parameters
hlptimLPTIM handle
Return values
HALstatus

Definition at line 595 of file stm32l4xx_hal_lptim.c.

596 {
597  /* Check the parameters */
598  assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
599 
600  /* Set the LPTIM state */
601  hlptim->State = HAL_LPTIM_STATE_BUSY;
602 
603  /* Disable the Peripheral */
604  __HAL_LPTIM_DISABLE(hlptim);
605 
606  /* Disable Autoreload write complete interrupt */
607  __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_ARROK);
608 
609  /* Disable Compare write complete interrupt */
610  __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_CMPOK);
611 
612  /* Disable Autoreload match interrupt */
613  __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_ARRM);
614 
615  /* Disable Compare match interrupt */
616  __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_CMPM);
617 
618  /* If external trigger source is used, then disable external trigger interrupt */
619  if ((hlptim->Init.Trigger.Source) != LPTIM_TRIGSOURCE_SOFTWARE)
620  {
621  /* Disable external trigger interrupt */
622  __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_EXTTRIG);
623  }
624 
625 #if defined(LPTIM_RCR_REP)
626  /* Disable the update event and the repetition register update OK interrupts */
627  if ((hlptim->Init.RepetitionCounter) != 0)
628  {
629  __HAL_LPTIM_DISABLE_IT(hlptim, (LPTIM_IT_UPDATE | LPTIM_IT_REPOK));
630  }
631 #endif
632 
633  /* Change the TIM state*/
634  hlptim->State = HAL_LPTIM_STATE_READY;
635 
636  /* Return function status */
637  return HAL_OK;
638 }
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_LPTIM_SetOnce_Start()

HAL_StatusTypeDef HAL_LPTIM_SetOnce_Start ( LPTIM_HandleTypeDef hlptim,
uint32_t  Period,
uint32_t  Pulse 
)

Start the LPTIM in Set once mode.

Parameters
hlptimLPTIM handle
PeriodSpecifies the Autoreload value. This parameter must be a value between 0x0000 and 0xFFFF.
PulseSpecifies the compare value. This parameter must be a value between 0x0000 and 0xFFFF.
Return values
HALstatus

Definition at line 847 of file stm32l4xx_hal_lptim.c.

848 {
849  /* Check the parameters */
850  assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
851  assert_param(IS_LPTIM_PERIOD(Period));
852  assert_param(IS_LPTIM_PULSE(Pulse));
853 
854  /* Set the LPTIM state */
855  hlptim->State = HAL_LPTIM_STATE_BUSY;
856 
857  /* Set WAVE bit to enable the set once mode */
858  hlptim->Instance->CFGR |= LPTIM_CFGR_WAVE;
859 
860  /* Enable the Peripheral */
861  __HAL_LPTIM_ENABLE(hlptim);
862 
863  /* Load the period value in the autoreload register */
864  __HAL_LPTIM_AUTORELOAD_SET(hlptim, Period);
865 
866  /* Load the pulse value in the compare register */
867  __HAL_LPTIM_COMPARE_SET(hlptim, Pulse);
868 
869 #if defined(LPTIM_RCR_REP)
870  /* Load the repetition value in the repetition counter */
871  if (hlptim->Init.RepetitionCounter != 0)
872  {
873  __HAL_LPTIM_REPETITIONCOUNTER_SET(hlptim, hlptim->Init.RepetitionCounter);
874  }
875 #endif
876 
877  /* Start timer in continuous mode */
878  __HAL_LPTIM_START_SINGLE(hlptim);
879 
880  /* Change the TIM state*/
881  hlptim->State = HAL_LPTIM_STATE_READY;
882 
883  /* Return function status */
884  return HAL_OK;
885 }
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_LPTIM_SetOnce_Start_IT()

HAL_StatusTypeDef HAL_LPTIM_SetOnce_Start_IT ( LPTIM_HandleTypeDef hlptim,
uint32_t  Period,
uint32_t  Pulse 
)

Start the LPTIM Set once mode in interrupt mode.

Parameters
hlptimLPTIM handle
PeriodSpecifies the Autoreload value. This parameter must be a value between 0x0000 and 0xFFFF.
PulseSpecifies the compare value. This parameter must be a value between 0x0000 and 0xFFFF.
Return values
HALstatus

Definition at line 919 of file stm32l4xx_hal_lptim.c.

920 {
921  /* Check the parameters */
922  assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
923  assert_param(IS_LPTIM_PERIOD(Period));
924  assert_param(IS_LPTIM_PULSE(Pulse));
925 
926  /* Set the LPTIM state */
927  hlptim->State = HAL_LPTIM_STATE_BUSY;
928 
929  /* Set WAVE bit to enable the set once mode */
930  hlptim->Instance->CFGR |= LPTIM_CFGR_WAVE;
931 
932  /* Enable Autoreload write complete interrupt */
933  __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_ARROK);
934 
935  /* Enable Compare write complete interrupt */
936  __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_CMPOK);
937 
938  /* Enable Autoreload match interrupt */
939  __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_ARRM);
940 
941  /* Enable Compare match interrupt */
942  __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_CMPM);
943 
944  /* If external trigger source is used, then enable external trigger interrupt */
945  if ((hlptim->Init.Trigger.Source) != LPTIM_TRIGSOURCE_SOFTWARE)
946  {
947  /* Enable external trigger interrupt */
948  __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_EXTTRIG);
949  }
950 
951 #if defined(LPTIM_RCR_REP)
952  /* Enable the update event and the repetition register update OK interrupts */
953  if ((hlptim->Init.RepetitionCounter) != 0)
954  {
955  __HAL_LPTIM_ENABLE_IT(hlptim, (LPTIM_IT_UPDATE | LPTIM_IT_REPOK));
956  }
957 #endif
958 
959  /* Enable the Peripheral */
960  __HAL_LPTIM_ENABLE(hlptim);
961 
962  /* Load the period value in the autoreload register */
963  __HAL_LPTIM_AUTORELOAD_SET(hlptim, Period);
964 
965  /* Load the pulse value in the compare register */
966  __HAL_LPTIM_COMPARE_SET(hlptim, Pulse);
967 
968 #if defined(LPTIM_RCR_REP)
969  /* Load the repetition value in the repetition counter */
970  if (hlptim->Init.RepetitionCounter != 0)
971  {
972  __HAL_LPTIM_REPETITIONCOUNTER_SET(hlptim, hlptim->Init.RepetitionCounter);
973  }
974 #endif
975 
976  /* Start timer in continuous mode */
977  __HAL_LPTIM_START_SINGLE(hlptim);
978 
979  /* Change the TIM state*/
980  hlptim->State = HAL_LPTIM_STATE_READY;
981 
982  /* Return function status */
983  return HAL_OK;
984 }
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_LPTIM_SetOnce_Stop()

HAL_StatusTypeDef HAL_LPTIM_SetOnce_Stop ( LPTIM_HandleTypeDef hlptim)

Stop the LPTIM Set once mode.

Parameters
hlptimLPTIM handle
Return values
HALstatus

Definition at line 892 of file stm32l4xx_hal_lptim.c.

893 {
894  /* Check the parameters */
895  assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
896 
897  /* Set the LPTIM state */
898  hlptim->State = HAL_LPTIM_STATE_BUSY;
899 
900  /* Disable the Peripheral */
901  __HAL_LPTIM_DISABLE(hlptim);
902 
903  /* Change the TIM state*/
904  hlptim->State = HAL_LPTIM_STATE_READY;
905 
906  /* Return function status */
907  return HAL_OK;
908 }
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_LPTIM_SetOnce_Stop_IT()

HAL_StatusTypeDef HAL_LPTIM_SetOnce_Stop_IT ( LPTIM_HandleTypeDef hlptim)

Stop the LPTIM Set once mode in interrupt mode.

Parameters
hlptimLPTIM handle
Return values
HALstatus

Definition at line 991 of file stm32l4xx_hal_lptim.c.

992 {
993  /* Check the parameters */
994  assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
995 
996  /* Set the LPTIM state */
997  hlptim->State = HAL_LPTIM_STATE_BUSY;
998 
999  /* Disable the Peripheral */
1000  __HAL_LPTIM_DISABLE(hlptim);
1001 
1002  /* Disable Autoreload write complete interrupt */
1003  __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_ARROK);
1004 
1005  /* Disable Compare write complete interrupt */
1006  __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_CMPOK);
1007 
1008  /* Disable Autoreload match interrupt */
1009  __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_ARRM);
1010 
1011  /* Disable Compare match interrupt */
1012  __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_CMPM);
1013 
1014  /* If external trigger source is used, then disable external trigger interrupt */
1015  if ((hlptim->Init.Trigger.Source) != LPTIM_TRIGSOURCE_SOFTWARE)
1016  {
1017  /* Disable external trigger interrupt */
1018  __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_EXTTRIG);
1019  }
1020 
1021 #if defined(LPTIM_RCR_REP)
1022  /* Disable the update event and the repetition register update OK interrupts */
1023  if ((hlptim->Init.RepetitionCounter) != 0)
1024  {
1025  __HAL_LPTIM_DISABLE_IT(hlptim, (LPTIM_IT_UPDATE | LPTIM_IT_REPOK));
1026  }
1027 #endif
1028 
1029  /* Change the TIM state*/
1030  hlptim->State = HAL_LPTIM_STATE_READY;
1031 
1032  /* Return function status */
1033  return HAL_OK;
1034 }
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_LPTIM_TimeOut_Start()

HAL_StatusTypeDef HAL_LPTIM_TimeOut_Start ( LPTIM_HandleTypeDef hlptim,
uint32_t  Period,
uint32_t  Timeout 
)

Start the Timeout function.

Note
The first trigger event will start the timer, any successive trigger event will reset the counter and the timer restarts.
Parameters
hlptimLPTIM handle
PeriodSpecifies the Autoreload value. This parameter must be a value between 0x0000 and 0xFFFF.
TimeoutSpecifies the TimeOut value to reset the counter. This parameter must be a value between 0x0000 and 0xFFFF.
Return values
HALstatus

Definition at line 1216 of file stm32l4xx_hal_lptim.c.

1217 {
1218  /* Check the parameters */
1219  assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
1220  assert_param(IS_LPTIM_PERIOD(Period));
1221  assert_param(IS_LPTIM_PULSE(Timeout));
1222 
1223  /* Set the LPTIM state */
1224  hlptim->State = HAL_LPTIM_STATE_BUSY;
1225 
1226  /* Set TIMOUT bit to enable the timeout function */
1227  hlptim->Instance->CFGR |= LPTIM_CFGR_TIMOUT;
1228 
1229  /* Enable the Peripheral */
1230  __HAL_LPTIM_ENABLE(hlptim);
1231 
1232  /* Load the period value in the autoreload register */
1233  __HAL_LPTIM_AUTORELOAD_SET(hlptim, Period);
1234 
1235  /* Load the Timeout value in the compare register */
1236  __HAL_LPTIM_COMPARE_SET(hlptim, Timeout);
1237 
1238  /* Start timer in continuous mode */
1239  __HAL_LPTIM_START_CONTINUOUS(hlptim);
1240 
1241  /* Change the TIM state*/
1242  hlptim->State = HAL_LPTIM_STATE_READY;
1243 
1244  /* Return function status */
1245  return HAL_OK;
1246 }
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_LPTIM_TimeOut_Start_IT()

HAL_StatusTypeDef HAL_LPTIM_TimeOut_Start_IT ( LPTIM_HandleTypeDef hlptim,
uint32_t  Period,
uint32_t  Timeout 
)

Start the Timeout function in interrupt mode.

Note
The first trigger event will start the timer, any successive trigger event will reset the counter and the timer restarts.
Parameters
hlptimLPTIM handle
PeriodSpecifies the Autoreload value. This parameter must be a value between 0x0000 and 0xFFFF.
TimeoutSpecifies the TimeOut value to reset the counter. This parameter must be a value between 0x0000 and 0xFFFF.
Return values
HALstatus

Definition at line 1285 of file stm32l4xx_hal_lptim.c.

1286 {
1287  /* Check the parameters */
1288  assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
1289  assert_param(IS_LPTIM_PERIOD(Period));
1290  assert_param(IS_LPTIM_PULSE(Timeout));
1291 
1292  /* Set the LPTIM state */
1293  hlptim->State = HAL_LPTIM_STATE_BUSY;
1294 
1295  /* Enable EXTI Line interrupt on the LPTIM Wake-up Timer */
1296  __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_IT();
1297 
1298  /* Set TIMOUT bit to enable the timeout function */
1299  hlptim->Instance->CFGR |= LPTIM_CFGR_TIMOUT;
1300 
1301  /* Enable Compare match interrupt */
1302  __HAL_LPTIM_ENABLE_IT(hlptim, LPTIM_IT_CMPM);
1303 
1304  /* Enable the Peripheral */
1305  __HAL_LPTIM_ENABLE(hlptim);
1306 
1307  /* Load the period value in the autoreload register */
1308  __HAL_LPTIM_AUTORELOAD_SET(hlptim, Period);
1309 
1310  /* Load the Timeout value in the compare register */
1311  __HAL_LPTIM_COMPARE_SET(hlptim, Timeout);
1312 
1313  /* Start timer in continuous mode */
1314  __HAL_LPTIM_START_CONTINUOUS(hlptim);
1315 
1316  /* Change the TIM state*/
1317  hlptim->State = HAL_LPTIM_STATE_READY;
1318 
1319  /* Return function status */
1320  return HAL_OK;
1321 }
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_LPTIM_TimeOut_Stop()

HAL_StatusTypeDef HAL_LPTIM_TimeOut_Stop ( LPTIM_HandleTypeDef hlptim)

Stop the Timeout function.

Parameters
hlptimLPTIM handle
Return values
HALstatus

Definition at line 1253 of file stm32l4xx_hal_lptim.c.

1254 {
1255  /* Check the parameters */
1256  assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
1257 
1258  /* Set the LPTIM state */
1259  hlptim->State = HAL_LPTIM_STATE_BUSY;
1260 
1261  /* Disable the Peripheral */
1262  __HAL_LPTIM_DISABLE(hlptim);
1263 
1264  /* Reset TIMOUT bit to enable the timeout function */
1265  hlptim->Instance->CFGR &= ~LPTIM_CFGR_TIMOUT;
1266 
1267  /* Change the TIM state*/
1268  hlptim->State = HAL_LPTIM_STATE_READY;
1269 
1270  /* Return function status */
1271  return HAL_OK;
1272 }
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_LPTIM_TimeOut_Stop_IT()

HAL_StatusTypeDef HAL_LPTIM_TimeOut_Stop_IT ( LPTIM_HandleTypeDef hlptim)

Stop the Timeout function in interrupt mode.

Parameters
hlptimLPTIM handle
Return values
HALstatus

Definition at line 1328 of file stm32l4xx_hal_lptim.c.

1329 {
1330  /* Check the parameters */
1331  assert_param(IS_LPTIM_INSTANCE(hlptim->Instance));
1332 
1333  /* Set the LPTIM state */
1334  hlptim->State = HAL_LPTIM_STATE_BUSY;
1335 
1336  /* Disable EXTI Line interrupt on the LPTIM Wake-up Timer */
1337  __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_IT();
1338 
1339  /* Disable the Peripheral */
1340  __HAL_LPTIM_DISABLE(hlptim);
1341 
1342  /* Reset TIMOUT bit to enable the timeout function */
1343  hlptim->Instance->CFGR &= ~LPTIM_CFGR_TIMOUT;
1344 
1345  /* Disable Compare match interrupt */
1346  __HAL_LPTIM_DISABLE_IT(hlptim, LPTIM_IT_CMPM);
1347 
1348  /* Change the TIM state*/
1349  hlptim->State = HAL_LPTIM_STATE_READY;
1350 
1351  /* Return function status */
1352  return HAL_OK;
1353 }
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))