1 /** 2 ****************************************************************************** 3 * @file system_target.c 4 * @author Application Team 5 * @version V1.1.0 6 * @date 2019-10-28 7 * @brief system source file. 8 ****************************************************************************** 9 * @attention 10 * 11 ****************************************************************************** 12 */ 13 #include "target.h" 14 15 16 17 /** 18 * @brief Setup the microcontroller system 19 * @note This function should be used only after reset. 20 * @param None 21 * @retval None 22 */ SystemInit(void)23void SystemInit(void) 24 { 25 volatile uint32_t i; 26 uint32_t tmp[3]; 27 28 ANA->REG0 = 0x30; 29 ANA->REG4 = 0x04; 30 ANA->REG7 = 0x84; 31 ANA->REGA = 0x02; 32 while (ANA->ADCCTRL0 & ANA_ADCCTRL0_MTRIG); 33 ANA->ADCCTRL0 = 0x300000; 34 ANA->ADCCTRL1 = 0xC2; 35 ANA->ADCCTRL2 = 0x8014; 36 LCD->CTRL = 0x84; 37 38 tmp[0] = 0x599A599A; 39 tmp[1] = 0x78000000; 40 tmp[2] = 0x80000000; 41 RTC_WriteRegisters((uint32_t)&RTC->ADCUCALK, tmp, 3); 42 } 43 44 /** 45 * @brief Initializes registers. 46 * @param None 47 * @retval None 48 */ SystemUpdate(void)49void SystemUpdate(void) 50 { 51 uint32_t tmp[3]; 52 53 ANA->REG0 &= ~0xCE; 54 ANA->REG0 |= 0x30; 55 ANA->REG1 &= ~0x7F; 56 ANA->REG2 &= ~0xC0; 57 ANA->REG3 &= ~0x01; 58 ANA->REG4 |= 0x04; 59 ANA->REG4 &= ~0xFB; 60 ANA->REG5 &= ~0xB0; 61 ANA->REG6 &= ~0x3E; 62 ANA->REG7 |= 0x84; 63 ANA->REG7 &= ~0x7B; 64 ANA->REG8 &= ~0x0C; 65 ANA->REGA |= 0x02; 66 ANA->REGA &= ~0x7D; 67 68 tmp[0] = 0x599A599A; 69 tmp[1] = RTC->ADCMACTL; 70 tmp[1] &= ~0XFF080000; 71 tmp[1] |= 0x78000000; 72 tmp[2] = 0x80000000; 73 RTC_WriteRegisters((uint32_t)&RTC->ADCUCALK, tmp, 3); 74 } 75 76 /*********************************** END OF FILE ******************************/ 77