|
@@ -30,6 +30,7 @@
|
|
/* Includes ------------------------------------------------------------------*/
|
|
/* Includes ------------------------------------------------------------------*/
|
|
#include "stm8s_it.h"
|
|
#include "stm8s_it.h"
|
|
#include "led.h"
|
|
#include "led.h"
|
|
|
|
+#include "delay.h"
|
|
|
|
|
|
/** @addtogroup Template_Project
|
|
/** @addtogroup Template_Project
|
|
* @{
|
|
* @{
|
|
@@ -42,6 +43,7 @@
|
|
extern __IO uint16_t ConversionBuffer[64];
|
|
extern __IO uint16_t ConversionBuffer[64];
|
|
extern __IO uint8_t BufferIndex;
|
|
extern __IO uint8_t BufferIndex;
|
|
static uint8_t LedCnt = 0;
|
|
static uint8_t LedCnt = 0;
|
|
|
|
+static __IO uint16_t TimingDelay;
|
|
|
|
|
|
/* Private function prototypes -----------------------------------------------*/
|
|
/* Private function prototypes -----------------------------------------------*/
|
|
/* Private functions ---------------------------------------------------------*/
|
|
/* Private functions ---------------------------------------------------------*/
|
|
@@ -514,6 +516,11 @@ INTERRUPT_HANDLER(TIM6_UPD_OVF_TRG_IRQHandler, 23)
|
|
LedCnt = 0;
|
|
LedCnt = 0;
|
|
led_OutputValue();
|
|
led_OutputValue();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /* Decrements the TimingDelay variable */
|
|
|
|
+ if (TimingDelay > 0) {
|
|
|
|
+ TimingDelay --;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
#endif /* (STM8S903) || (STM8AF622x)*/
|
|
#endif /* (STM8S903) || (STM8AF622x)*/
|
|
|
|
|
|
@@ -533,5 +540,17 @@ INTERRUPT_HANDLER(EEPROM_EEC_IRQHandler, 24)
|
|
* @}
|
|
* @}
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * @brief Inserts a delay time.
|
|
|
|
+ * @param nTime: specifies the delay time length, in milliseconds.
|
|
|
|
+ * @retval None
|
|
|
|
+ */
|
|
|
|
+void Delay(__IO uint16_t nTime)
|
|
|
|
+{
|
|
|
|
+ TimingDelay = nTime;
|
|
|
|
+ while (TimingDelay != 0) {
|
|
|
|
+ wfi();
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
|
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|