2018-06-23 08:40 PM
The tamper level detection configuration shown below
void init_BspTamper()
{RTC_TamperTypeDef stamperstructure; RtcHandle.Instance = RTC; RtcHandle.Init.HourFormat = RTC_HOURFORMAT_24; RtcHandle.Init.AsynchPrediv = RTC_ASYNCH_PREDIV; RtcHandle.Init.SynchPrediv = RTC_SYNCH_PREDIV; RtcHandle.Init.OutPut = RTC_OUTPUT_DISABLE; RtcHandle.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH; RtcHandle.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN; if (HAL_RTC_Init(&RtcHandle) != HAL_OK) { /* Initialization Error */ //Error_Handler(); } //Configure RTC Tamper stamperstructure.Tamper = RTC_TAMPER_1;stamperstructure.Trigger = RTC_TAMPERTRIGGER_LOWLEVEL;
stamperstructure.Filter = RTC_TAMPERFILTER_2SAMPLE;//å®šä¹‰é‡‡æ ·æ¬¡æ•° stamperstructure.SamplingFrequency = RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256; stamperstructure.PrechargeDuration = RTC_TAMPERPRECHARGEDURATION_1RTCCLK;1RTCCLK=30us stamperstructure.TamperPullUp = RTC_TAMPER_PULLUP_ENABLE; stamperstructure.TimeStampOnTamperDetection = RTC_TIMESTAMPONTAMPERDETECTION_DISABLE; stamperstructure.NoErase = RTC_TAMPER_ERASE_BACKUP_ENABLE; stamperstructure.MaskFlag = RTC_TAMPERMASK_FLAG_DISABLE; stamperstructure.Interrupt = RTC_TAMPER1_INTERRUPT; //HAL_StatusTypeDef HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper) //// if (HAL_RTCEx_SetTamper_IT(&RtcHandle, &stamperstructure) != HAL_OK)// {// /* Initialization Error */// //Error_Handler();// }}see from the code in HAL_RTCEx_SetTamper_IT(RTC_HandleTypeDef *hrtc, RTC_TamperTypeDef* sTamper) function,it seems that the level detetion can't use the tamper interrupt , because in the function it enabled the exti rising edge(__HAL_RTC_TAMPER_TIMESTAMP_EXTI_ENABLE_RISING_EDGE();).
so ,if tamper level detection doesn't use the interrupt, how to get the event occured information.
should i use tamper event polling function (HAL_RTCEx_PollForTamper1Event) to check if the tamper has occured. but i don't know if i use the polling function ,do i need to configure the EXTI?