📄 stm32f10x_it_rtc.c
字号:
/* Reset the CNF flag to exit from the Configuration Mode */
RTC->CRL &= (u16)0xFFEF;
#ifdef USE_POLL_ON_RTOFF
/* Wait until last write operation on RTC registers has finished */
/* Loop until RTOFF flag is set */
while ((RTC->CRL & RTC_FLAG_RTOFF) == (u16)RESET)
{
}
#endif
/* All Segment lines = 0 ( all SegmentsLines_LQD_Port pins = 0 ) */
SegmentsLines_LQD_Port->ODR = (u16)~ALL_SEGMENT_LINES;
#ifdef USE_LCD_REF_PD_878
SegmentsLines_HQD_Port->ODR = (u16)~ALL_SEGMENT_LINES;
#endif
/* All Common lines = 0 */
CommonLines_Port->ODR &= ~ALL_COMMON_LINES;
/* Configure all Common lines on CommonLines port pins as Out_PP */
CommonLines_Port->PinsConfig |= ALL_COMMON_LINES_PP;
if(EnableTask2_3 == TRUE) /* If Task 2 has been executed previously (before Task 1) then prepare */
{ /* the RTC interrupt to execute Task 3 in the next interrupt */
/* Next interrupt will execute Task 3 and avoid it to execute Task 2 */
EnableTask2_3 = FALSE;
}
else /* If Task 3 has been executed previously (before Task 1) then prepare */
{ /* the RTC interrupt to execute Task 2 in the next interrupt */
/* Next interrupt will execute Task 2 and avoid it to execute Task 3 */
EnableTask2_3 = TRUE;
}
/* Avoid next interrupt to execute Task 1, so the interrupt will execute Task 2 or Task 3 */
EnableTask1 = FALSE;
}
else
{
if(EnableTask2_3 == TRUE) /*------------- Task 2 --------------*/
{
/* Reset RTC Counter */
/* Set the CNF flag to enter in the Configuration Mode */
RTC->CRL |= (u16)0x0010;
/* Set RTC COUNTER MSB word to 0 */
RTC->CNTH = 0x0;
/* Set RTC COUNTER LSB word to 0 */
RTC->CNTL = 0x0;
/* Reset the CNF flag to exit from the Configuration Mode */
RTC->CRL &= (u16)0xFFEF;
#ifdef USE_POLL_ON_RTOFF
/* Wait until last write operation on RTC registers has finished */
/* Loop until RTOFF flag is set */
while ((RTC->CRL & RTC_FLAG_RTOFF) == (u16)RESET)
{
}
#endif
/* Set the next occuring time of alarm interrupt */
/* Set the CNF flag to enter in the Configuration Mode */
RTC->CRL |= (u16)0x0010;
/* Set the ALARM MSB word */
RTC->ALRH = PulseValueForContrastHigh;
/* Set the ALARM LSB word */
RTC->ALRL = PulseValueForContrastLow;
/* Reset the CNF flag to exit from the Configuration Mode */
RTC->CRL &= (u16)0xFFEF;
#ifdef USE_POLL_ON_RTOFF
/* Wait until last write operation on RTC registers has finished */
/* Loop until RTOFF flag is set */
while ((RTC->CRL & RTC_FLAG_RTOFF) == (u16)RESET)
{
}
#endif
/* Segment_lines[lcdcr] to be turned on are loaded with the value 1 otherwise 0 */
SegmentsLines_LQD_Port->ODR = SegmentsValues_Lower_Quarter_Digits[lcdcr];
#ifdef USE_LCD_REF_PD_878
SegmentsLines_HQD_Port->ODR = SegmentsValues_Higher_Quarter_Digits[lcdcr];
#endif
/* Common_line[lcdcr] is set to low */
CommonLines_Port->BRR = CommonLine[lcdcr];
/* Other Common lines set to Vdd/2 */
CommonLines_Port->PinsConfig &= CommonLine_VDD_2[lcdcr];
/* Set Common_line[lcdcr] out push pull */
CommonLines_Port->PinsConfig |= CommonLine_OUT_PP[lcdcr];
/* Next interrupt will execute Task 1 */
EnableTask1 = TRUE;
}
else /*------------- Task 3 -------------*/
{
/* Reset RTC Counter */
/* Set the CNF flag to enter in the Configuration Mode */
RTC->CRL |= (u16)0x0010;
/* Set RTC COUNTER MSB word */
RTC->CNTH = 0x0;
/* Set RTC COUNTER LSB word */
RTC->CNTL = 0x0;
/* Reset the CNF flag to exit from the Configuration Mode */
RTC->CRL &= (u16)0xFFEF;
#ifdef USE_POLL_ON_RTOFF
/* Wait until last write operation on RTC registers has finished */
/* Loop until RTOFF flag is set */
while ((RTC->CRL & RTC_FLAG_RTOFF) == (u16)RESET)
{
}
#endif
/* Set the next occuring time of alarm interrupt */
/* Set the CNF flag to enter in the Configuration Mode */
RTC->CRL |= (u16)0x0010;
/* Set the ALARM MSB word */
RTC->ALRH = PulseValueForContrastHigh;
/* Set the ALARM LSB word */
RTC->ALRL = PulseValueForContrastLow;
/* Reset the CNF flag to exit from the Configuration Mode */
RTC->CRL &= (u16)0xFFEF;
#ifdef USE_POLL_ON_RTOFF
/* Wait until last write operation on RTC registers has finished */
/* Loop until RTOFF flag is set */
while ((RTC->CRL & RTC_FLAG_RTOFF) == (u16)RESET)
{
}
#endif
/* Segment_lines[lcdcr] values are inverted */
SegmentsLines_LQD_Port->ODR = ~SegmentsValues_Lower_Quarter_Digits[lcdcr];
#ifdef USE_LCD_REF_PD_878
SegmentsLines_HQD_Port->ODR = ~SegmentsValues_Higher_Quarter_Digits[lcdcr];
#endif
/* Common_line[lcdcr] is set to high */
CommonLines_Port->BSRR = CommonLine[lcdcr];
/* Other Common lines set to Vdd/2 */
CommonLines_Port->PinsConfig &= CommonLine_VDD_2[lcdcr];
/* Other Common lines out push pull */
CommonLines_Port->PinsConfig |= CommonLine_OUT_PP[lcdcr];
/* Next interrupt will execute Task 1 */
EnableTask1 = TRUE;
lcdcr++;
if(lcdcr>3)
{
lcdcr = 0;
}
}
}
}
/*******************************************************************************
* Function Name : USBWakeUp_IRQHandler
* Description : This function handles USB WakeUp interrupt request.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void USBWakeUp_IRQHandler(void)
{
}
/*******************************************************************************
* Function Name : TIM8_BRK_IRQHandler
* Description : This function handles TIM8 Break interrupt request.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void TIM8_BRK_IRQHandler(void)
{
}
/*******************************************************************************
* Function Name : TIM8_UP_IRQHandler
* Description : This function handles TIM8 overflow and update interrupt
* request.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void TIM8_UP_IRQHandler(void)
{
}
/*******************************************************************************
* Function Name : TIM8_TRG_COM_IRQHandler
* Description : This function handles TIM8 Trigger and commutation interrupts
* requests.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void TIM8_TRG_COM_IRQHandler(void)
{
}
/*******************************************************************************
* Function Name : TIM8_CC_IRQHandler
* Description : This function handles TIM8 capture compare interrupt request.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void TIM8_CC_IRQHandler(void)
{
}
/*******************************************************************************
* Function Name : ADC3_IRQHandler
* Description : This function handles ADC3 global interrupt request.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void ADC3_IRQHandler(void)
{
}
/*******************************************************************************
* Function Name : FSMC_IRQHandler
* Description : This function handles FSMC global interrupt request.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void FSMC_IRQHandler(void)
{
}
/*******************************************************************************
* Function Name : SDIO_IRQHandler
* Description : This function handles SDIO global interrupt request.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void SDIO_IRQHandler(void)
{
}
/*******************************************************************************
* Function Name : TIM5_IRQHandler
* Description : This function handles TIM5 global interrupt request.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void TIM5_IRQHandler(void)
{
}
/*******************************************************************************
* Function Name : SPI3_IRQHandler
* Description : This function handles SPI3 global interrupt request.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void SPI3_IRQHandler(void)
{
}
/*******************************************************************************
* Function Name : UART4_IRQHandler
* Description : This function handles UART4 global interrupt request.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void UART4_IRQHandler(void)
{
}
/*******************************************************************************
* Function Name : UART5_IRQHandler
* Description : This function handles UART5 global interrupt request.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void UART5_IRQHandler(void)
{
}
/*******************************************************************************
* Function Name : TIM6_IRQHandler
* Description : This function handles TIM6 global interrupt request.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void TIM6_IRQHandler(void)
{
}
/*******************************************************************************
* Function Name : TIM7_IRQHandler
* Description : This function handles TIM7 global interrupt request.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void TIM7_IRQHandler(void)
{
}
/*******************************************************************************
* Function Name : DMA2_Channel1_IRQHandler
* Description : This function handles DMA2 Channel 1 interrupt request.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void DMA2_Channel1_IRQHandler(void)
{
}
/*******************************************************************************
* Function Name : DMA2_Channel2_IRQHandler
* Description : This function handles DMA2 Channel 2 interrupt request.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void DMA2_Channel2_IRQHandler(void)
{
}
/*******************************************************************************
* Function Name : DMA2_Channel3_IRQHandler
* Description : This function handles DMA2 Channel 3 interrupt request.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void DMA2_Channel3_IRQHandler(void)
{
}
/*******************************************************************************
* Function Name : DMA2_Channel4_5_IRQHandler
* Description : This function handles DMA2 Channel 4 and DMA2 Channel 5
* interrupt request.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void DMA2_Channel4_5_IRQHandler(void)
{
}
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -