pc13번 언급이 있어서 확인해보니 RTC_OUT / RTC_TAMPER로 설정이 가능하다.
Tamper를 활성화 하면 RTC_OUT 에서 RTC Output on the Tamper pin이 사용 불가능해진다.
Tamper는 인터럽트가 있는걸 봐서는.. 일종의 input 으로 설정되나보다.
rtc_Tamper를 rtc out으로 쓰지 않으면, 기본으로 tamper는 disble 되는 듯
stm32f1xx_hal_rtc.c
*** Tamper configuration *** ============================ [..] (+) Enable the RTC Tamper and configure the Tamper Level using the HAL_RTCEx_SetTamper() function. You can configure RTC Tamper with interrupt mode using HAL_RTCEx_SetTamper_IT() function. (+) The TAMPER1 alternate function can be mapped to PC13
/** * @brief Initializes the RTC peripheral * @param hrtc pointer to a RTC_HandleTypeDef structure that contains * the configuration information for RTC. * @retval HAL status */ HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc) { /* Set Initialization mode */ if (RTC_EnterInitMode(hrtc) != HAL_OK) { /* Set RTC state */ hrtc->State = HAL_RTC_STATE_ERROR;
if (hrtc->Init.OutPut != RTC_OUTPUTSOURCE_NONE) { /* Disable the selected Tamper pin */ CLEAR_BIT(BKP->CR, BKP_CR_TPE); }
/* Set the signal which will be routed to RTC Tamper pin*/ MODIFY_REG(BKP->RTCCR, (BKP_RTCCR_CCO | BKP_RTCCR_ASOE | BKP_RTCCR_ASOS), hrtc->Init.OutPut); } }
stm32f1xx_hal_rtc.h
/** @defgroup RTC_output_source_to_output_on_the_Tamper_pin Output source to output on the Tamper pin * @{ */
#define RTC_OUTPUTSOURCE_NONE 0x00000000U /*!< No output on the TAMPER pin */ #define RTC_OUTPUTSOURCE_CALIBCLOCK BKP_RTCCR_CCO /*!< RTC clock with a frequency divided by 64 on the TAMPER pin */ #define RTC_OUTPUTSOURCE_ALARM BKP_RTCCR_ASOE /*!< Alarm pulse signal on the TAMPER pin */ #define RTC_OUTPUTSOURCE_SECOND (BKP_RTCCR_ASOS | BKP_RTCCR_ASOE) /*!< Second pulse signal on the TAMPER pin */
/** Initialize RTC Only */ hrtc.Instance = RTC; hrtc.Init.AsynchPrediv = RTC_AUTO_1_SECOND; hrtc.Init.OutPut = RTC_OUTPUTSOURCE_ALARM; if (HAL_RTC_Init(&hrtc) != HAL_OK) { Error_Handler(); } /* USER CODE BEGIN RTC_Init 2 */
/* USER CODE END RTC_Init 2 */
}
HAL_RTC_MspInit()을 통해
stm32f1xx_hal_rtc.c
(+) To write to the RTC Backup Data registers, use the HAL_RTCEx_BKUPWrite() function. (+) To read the RTC Backup Data registers, use the HAL_RTCEx_BKUPRead() function.
/** * @brief Initializes the RTC peripheral * @param hrtc pointer to a RTC_HandleTypeDef structure that contains * the configuration information for RTC. * @retval HAL status */ HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc) { uint32_t prescaler = 0U; /* Check input parameters */ if (hrtc == NULL) { return HAL_ERROR; }
/* Check the parameters */ assert_param(IS_RTC_ALL_INSTANCE(hrtc->Instance)); assert_param(IS_RTC_CALIB_OUTPUT(hrtc->Init.OutPut)); assert_param(IS_RTC_ASYNCH_PREDIV(hrtc->Init.AsynchPrediv));
#if (USE_HAL_RTC_REGISTER_CALLBACKS == 1) #else if (hrtc->State == HAL_RTC_STATE_RESET) { /* Allocate lock resource and initialize it */ hrtc->Lock = HAL_UNLOCKED;
/** * @brief Initializes the RTC MSP. * @param hrtc pointer to a RTC_HandleTypeDef structure that contains * the configuration information for RTC. * @retval None */ __weak void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc) { /* Prevent unused argument(s) compilation warning */ UNUSED(hrtc); /* NOTE : This function Should not be modified, when the callback is needed, the HAL_RTC_MspInit could be implemented in the user file */ }
백업 레지스터에 접근할수 있도록 풀어준다. Core/Src/stm32f1xx_hal_msp.c
/** * @brief RTC MSP Initialization * This function configures the hardware resources used in this example * @param hrtc: RTC handle pointer * @retval None */ void HAL_RTC_MspInit(RTC_HandleTypeDef* hrtc) { if(hrtc->Instance==RTC) { /* USER CODE BEGIN RTC_MspInit 0 */
/* USER CODE END RTC_MspInit 0 */ HAL_PWR_EnableBkUpAccess(); /* Enable BKP CLK enable for backup registers */ __HAL_RCC_BKP_CLK_ENABLE(); /* Peripheral clock enable */ __HAL_RCC_RTC_ENABLE(); /* USER CODE BEGIN RTC_MspInit 1 */
/* USER CODE END RTC_MspInit 1 */
}
}
CR_DBP_BB 라는 레지스터에 활성화 해주는것 코드 느낌. 무슨 레지스터인지 따라가긴 귀찮으니 패스
stm32f1xx_hal_pwr.c
/** * @brief Enables access to the backup domain (RTC registers, RTC * backup data registers ). * @note If the HSE divided by 128 is used as the RTC clock, the * Backup Domain Access should be kept enabled. * @retval None */ void HAL_PWR_EnableBkUpAccess(void) { /* Enable access to RTC and backup registers */ *(__IO uint32_t *) CR_DBP_BB = (uint32_t)ENABLE; }
/** * @brief Disables access to the backup domain (RTC registers, RTC * backup data registers). * @note If the HSE divided by 128 is used as the RTC clock, the * Backup Domain Access should be kept enabled. * @retval None */ void HAL_PWR_DisableBkUpAccess(void) { /* Disable access to RTC and backup registers */ *(__IO uint32_t *) CR_DBP_BB = (uint32_t)DISABLE; }
아무튼 백업레지스터 접근이 허용되면
HAL_RTCEx_BKUPWrite() 를 통해 쓰고
HAL_RTCEx_BKUPRead() 를 통해 읽을 수 있다.
stm32f1xx_hal_rtc_ex.c
/** * @brief Writes a data in a specified RTC Backup data register. * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains * the configuration information for RTC. * @param BackupRegister: RTC Backup data Register number. * This parameter can be: RTC_BKP_DRx where x can be from 1 to 10 (or 42) to * specify the register (depending devices). * @param Data: Data to be written in the specified RTC Backup data register. * @retval None */ void HAL_RTCEx_BKUPWrite(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister, uint32_t Data) { uint32_t tmp = 0U;
/** * @brief Reads data from the specified RTC Backup data Register. * @param hrtc: pointer to a RTC_HandleTypeDef structure that contains * the configuration information for RTC. * @param BackupRegister: RTC Backup data Register number. * This parameter can be: RTC_BKP_DRx where x can be from 1 to 10 (or 42) to * specify the register (depending devices). * @retval Read value */ uint32_t HAL_RTCEx_BKUPRead(RTC_HandleTypeDef *hrtc, uint32_t BackupRegister) { uint32_t backupregister = 0U; uint32_t pvalue = 0U;
1.9 Backup registers RTC_BKPxR, where x=0 to n backup registers (80 bytes), are reset when a tamper detection event occurs. These registers are powered-on by VBAT when VDD is switched off, so that they are not reset by a system reset, and their contents remain valid when the device operates in low-power mode. Note: The number “n” of backup registers depends on the product. Please refer to Table 15: Advanced RTC features.
#include <curses.h> int border(chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br); int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br); int box(WINDOW *win, chtype verch, chtype horch); int hline(chtype ch, int n); int whline(WINDOW *win, chtype ch, int n); int vline(chtype ch, int n); int wvline(WINDOW *win, chtype ch, int n); int mvhline(int y, int x, chtype ch, int n); int mvwhline(WINDOW *, int y, int x, chtype ch, int n); int mvvline(int y, int x, chtype ch, int n); int mvwvline(WINDOW *, int y, int x, chtype ch, int n);
WINDOW *newwin(int nlines, int ncols, int begin_y, int begin_x); int delwin(WINDOW *win); int mvwin(WINDOW *win, int y, int x); WINDOW *subwin(WINDOW *orig, int nlines, int ncols, int begin_y, int begin_x); WINDOW *derwin(WINDOW *orig, int nlines, int ncols, int begin_y, int begin_x); int mvderwin(WINDOW *win, int par_y, int par_x); WINDOW *dupwin(WINDOW *win); void wsyncup(WINDOW *win); int syncok(WINDOW *win, bool bf); void wcursyncup(WINDOW *win); void wsyncdown(WINDOW *win);
Stress demo Overview A stress test for LVGL. It contains a lot of object creation, deletion, animations, styles usage, and so on. It can be used if there is any memory curruption during heavy usage or any memory leaks.
Printer demo with LVGL embedded GUI library
Run the demo In lv_ex_conf.h set LV_USE_DEMO_STRESS 1 In lv_conf.h enable all the widgets (LV_USE_BTN 1) and the animations (LV_USE_ANIMATION 1) After lv_init() and initializing the drivers call lv_demo_stress()
/** * @file lv_ex_conf.h * */ /* * COPY THIS FILE AS lv_ex_conf.h */
#if 0 /*Set it to "1" to enable the content*/
#ifndef LV_EX_CONF_H #define LV_EX_CONF_H
/******************* * GENERAL SETTING *******************/ #define LV_EX_PRINTF 0 /*Enable printf-ing data in demoes and examples*/ #define LV_EX_KEYBOARD 0 /*Add PC keyboard support to some examples (`lv_drivers` repository is required)*/ #define LV_EX_MOUSEWHEEL 0 /*Add 'encoder' (mouse wheel) support to some examples (`lv_drivers` repository is required)*/