diff --git a/nametag8_CH592/StdPeriphDriver/CH59x_clk.c b/nametag8_CH592/StdPeriphDriver/CH59x_clk.c index fe053b8..b588663 100644 --- a/nametag8_CH592/StdPeriphDriver/CH59x_clk.c +++ b/nametag8_CH592/StdPeriphDriver/CH59x_clk.c @@ -15,9 +15,11 @@ /********************************************************************* * @fn LClk32K_Select * - * @brief 32K 低频时钟来源 + * @brief 32K Low Frequency clock source select * - * @param hc - 选择32K使用内部还是外部 + * @param hc - Use internal or external 32K oscillator + * Clk32K_LSI - Internal + * Clk32K_LSE - External * * @return none */ @@ -43,10 +45,10 @@ void LClk32K_Select(LClk32KTypeDef hc) /********************************************************************* * @fn LClk32K_Cfg * - * @brief 32K 低频时钟电源配置 + * @brief 32K Low Frequency clock power * - * @param hc - 选择内部32K还是外部32K - * @param s - 是否打开电源 + * @param hc - Clock Selection + * @param s - Power ENABLE/DISABLE * * @return none */ @@ -85,7 +87,7 @@ void LClk32K_Cfg(LClk32KTypeDef hc, FunctionalState s) /********************************************************************* * @fn HSECFG_Current * - * @brief HSE晶体 偏置电流配置 + * @brief HSE Bias Current configuration * * @param c - 75%,100%,125%,150% * @@ -106,7 +108,7 @@ void HSECFG_Current(HSECurrentTypeDef c) /********************************************************************* * @fn HSECFG_Capacitance * - * @brief HSE晶体 负载电容配置 + * @brief HSE Load Capacitor configuration * * @param c - refer to HSECapTypeDef * @@ -127,7 +129,7 @@ void HSECFG_Capacitance(HSECapTypeDef c) /********************************************************************* * @fn LSECFG_Current * - * @brief LSE晶体 偏置电流配置 + * @brief LSE Bias Current configuration * * @param c - 70%,100%,140%,200% * @@ -148,7 +150,7 @@ void LSECFG_Current(LSECurrentTypeDef c) /********************************************************************* * @fn LSECFG_Capacitance * - * @brief LSE晶体 负载电容配置 + * @brief LSE Load Capacitor configuration * * @param c - refer to LSECapTypeDef * @@ -169,11 +171,12 @@ void LSECFG_Capacitance(LSECapTypeDef c) /********************************************************************* * @fn Calibration_LSI * - * @brief 校准内部32K时钟 + * @brief Calibrate 32K LSI clock from HSE * - * @param cali_Lv - 校准等级选择 Level_32 :2.4ms 1000ppm (32M 主频) 1100ppm (60M 主频) - * Level_64 :4.4ms 800ppm (32M 主频) 1000ppm (60M 主频) - * Level_128 :8.4ms 600ppm (32M 主频) 800ppm (60M 主频) + * @param cali_Lv - Calibration Level Selection + * Level_32 :2.4ms 1000ppm (32M HSE), 1100ppm (60M HSE) + * Level_64 :4.4ms 800ppm (32M HSE), 1000ppm (60M HSE) + * Level_128 :8.4ms 600ppm (32M HSE), 800ppm (60M HSE) * * @return none */ @@ -197,7 +200,7 @@ void Calibration_LSI(Cali_LevelTypeDef cali_Lv) while(1) { - // 粗调 + // coarse adjustment sys_safe_access_enable(); R8_OSC_CAL_CTRL &= ~RB_OSC_CNT_TOTAL; R8_OSC_CAL_CTRL |= 1; @@ -253,7 +256,7 @@ void Calibration_LSI(Cali_LevelTypeDef cali_Lv) sys_safe_access_disable(); } - // 细调 + // fine adjustment // 配置细调参数后,丢弃2次捕获值(软件行为)上判断已有一次,这里只留一次 sys_safe_access_enable(); R8_OSC_CAL_CTRL &= ~RB_OSC_CNT_TOTAL; @@ -354,14 +357,14 @@ void Calibration_LSI(Cali_LevelTypeDef cali_Lv) /********************************************************************* * @fn RTCInitTime * - * @brief RTC时钟初始化当前时间 + * @brief RTC Clock initialize with time and date * - * @param y - 配置年,MAX_Y = BEGYEAR + 44 - * @param mon - 配置月,MAX_MON = 12 - * @param d - 配置日,MAX_D = 31 - * @param h - 配置小时,MAX_H = 23 - * @param m - 配置分钟,MAX_M = 59 - * @param s - 配置秒,MAX_S = 59 + * @param y - year, MAX_Y = BEGYEAR + 44 + * @param mon - month, MAX_MON = 12 + * @param d - day, MAX_D = 31 + * @param h - hour, MAX_H = 23 + * @param m - minute, MAX_M = 59 + * @param s - second, MAX_S = 59 * * @return none */ @@ -420,14 +423,14 @@ void RTC_InitTime(uint16_t y, uint16_t mon, uint16_t d, uint16_t h, uint16_t m, /********************************************************************* * @fn RTC_GetTime * - * @brief 获取当前时间 + * @brief Get the current time and date from RTC * - * @param py - 获取到的年,MAX_Y = BEGYEAR + 44 - * @param pmon - 获取到的月,MAX_MON = 12 - * @param pd - 获取到的日,MAX_D = 31 - * @param ph - 获取到的小时,MAX_H = 23 - * @param pm - 获取到的分钟,MAX_M = 59 - * @param ps - 获取到的秒,MAX_S = 59 + * @param py - year, MAX_Y = BEGYEAR + 44 + * @param pmon - month, MAX_MON = 12 + * @param pd - day, MAX_D = 31 + * @param ph - hour, MAX_H = 23 + * @param pm - minute, MAX_M = 59 + * @param ps - second, MAX_S = 59 * * @return none */ @@ -465,9 +468,9 @@ void RTC_GetTime(uint16_t *py, uint16_t *pmon, uint16_t *pd, uint16_t *ph, uint1 /********************************************************************* * @fn RTC_SetCycle32k * - * @brief 基于LSE/LSI时钟,配置当前RTC 周期数 + * @brief Based on LSI/LSE clock, configure the number of cycles for RTC * - * @param cyc - 配置周期计数初值,MAX_CYC = 0xA8BFFFFF = 2831155199 + * @param cyc - cycle count, MAX_CYC = 0xA8BFFFFF = 2831155199 * * @return none */ @@ -489,11 +492,11 @@ void RTC_SetCycle32k(uint32_t cyc) /********************************************************************* * @fn RTC_GetCycle32k * - * @brief 基于LSE/LSI时钟,获取当前RTC 周期数 + * @brief Get the current number of cycles for RTC based on LSI/LSE clock * * @param none * - * @return 当前周期数,MAX_CYC = 0xA8BFFFFF = 2831155199 + * @return cycle count, MAX_CYC = 0xA8BFFFFF = 2831155199 */ uint32_t RTC_GetCycle32k(void) { @@ -509,7 +512,7 @@ uint32_t RTC_GetCycle32k(void) /********************************************************************* * @fn RTC_TMRFunCfg * - * @brief RTC定时模式配置(注意定时基准固定为32768Hz) + * @brief RTC Timer configuration (timebase is fixed to 32768Hz) * * @param t - refer to RTC_TMRCycTypeDef * @@ -528,7 +531,7 @@ void RTC_TMRFunCfg(RTC_TMRCycTypeDef t) /********************************************************************* * @fn RTC_TRIGFunCfg * - * @brief RTC时间触发模式配置 + * @brief RTC Timer Trigger configuration * * @param cyc - 相对当前时间的触发间隔时间,基于LSE/LSI时钟周期数 * @@ -580,11 +583,11 @@ void RTC_ModeFunDisable(RTC_MODETypeDef m) /********************************************************************* * @fn RTC_GetITFlag * - * @brief 获取RTC中断标志 + * @brief Get RTC interrupt flags * * @param f - refer to RTC_EVENTTypeDef * - * @return 中断标志状态 + * @return Interrupt flag status */ uint8_t RTC_GetITFlag(RTC_EVENTTypeDef f) { @@ -601,7 +604,7 @@ uint8_t RTC_GetITFlag(RTC_EVENTTypeDef f) /********************************************************************* * @fn RTC_ClearITFlag * - * @brief 清除RTC中断标志 + * @brief Clear RTC interrupt flags * * @param f - refer to RTC_EVENTTypeDef * diff --git a/nametag8_CH592/StdPeriphDriver/CH59x_flash.c b/nametag8_CH592/StdPeriphDriver/CH59x_flash.c index a8caab8..770dc28 100644 --- a/nametag8_CH592/StdPeriphDriver/CH59x_flash.c +++ b/nametag8_CH592/StdPeriphDriver/CH59x_flash.c @@ -10,6 +10,16 @@ * microcontroller manufactured by Nanjing Qinheng Microelectronics. *******************************************************************************/ +/* + * true's notes: + * + * flash is practically undocumented. + * + * R8_FLASH_CTRL - 0x51 flash on, no waitstates? + * 0x51 flash on, unknown waitstates? + * 0x04 flash off + */ + #include "CH59x_common.h" /* RESET_EN */ @@ -56,7 +66,7 @@ void FLASH_ROM_READ(uint32_t StartAddr, void *Buffer, uint32_t len) * @brief Configure User Option Byte.需在调用用户配置字生效函数后生效,且每次烧录后只能修改一次 * (使用该函数,必须使用官方提供的.S文件,同时调用该函数后,两次上电后,两线调试接口默认关闭) * - * @param RESET_EN - 外部复位引脚使能 + * @param RESET_EN - External reset pin enable * @param BOOT_PIN - ENABLE-使用默认boot脚-PB22,DISABLE-使用boot脚-PB11 * @param UART_NO_KEY_EN - 串口免按键下载使能 * @param FLASHProt_Size - 写保护大小(单位4K) @@ -173,7 +183,7 @@ void UserOptionByte_Active(void) * * @param Buffer - Pointer to the buffer where data should be stored, Must be aligned to 4 bytes. * - * @return 0-SUCCESS (!0)-FAILURE + * @return none */ void GET_UNIQUE_ID(uint8_t *Buffer) { diff --git a/nametag8_CH592/StdPeriphDriver/CH59x_gpio.c b/nametag8_CH592/StdPeriphDriver/CH59x_gpio.c index 0f1fdbd..1b4131f 100644 --- a/nametag8_CH592/StdPeriphDriver/CH59x_gpio.c +++ b/nametag8_CH592/StdPeriphDriver/CH59x_gpio.c @@ -15,10 +15,10 @@ /********************************************************************* * @fn GPIOA_ModeCfg * - * @brief GPIOA端口引脚模式配置 + * @brief GPIOA Port Pin Mode configuration * * @param pin - PA0-PA15 - * @param mode - 输入输出类型 + * @param mode - GPIO input / output mode * * @return none */ @@ -62,10 +62,10 @@ void GPIOA_ModeCfg(uint32_t pin, GPIOModeTypeDef mode) /********************************************************************* * @fn GPIOB_ModeCfg * - * @brief GPIOB端口引脚模式配置 + * @brief GPIOB Port Pin Mode configuration * * @param pin - PB0-PB23 - * @param mode - 输入输出类型 + * @param mode - GPIO input / output mode * * @return none */ @@ -109,10 +109,10 @@ void GPIOB_ModeCfg(uint32_t pin, GPIOModeTypeDef mode) /********************************************************************* * @fn GPIOA_ITModeCfg * - * @brief GPIOA引脚中断模式配置 + * @brief GPIOA interrupt configuration * * @param pin - PA0-PA15 - * @param mode - 触发类型 + * @param mode - Interrupt Trigger type (edge, level) * * @return none */ @@ -120,22 +120,22 @@ void GPIOA_ITModeCfg(uint32_t pin, GPIOITModeTpDef mode) { switch(mode) { - case GPIO_ITMode_LowLevel: // 低电平触发 + case GPIO_ITMode_LowLevel: R16_PA_INT_MODE &= ~pin; R32_PA_CLR |= pin; break; - case GPIO_ITMode_HighLevel: // 高电平触发 + case GPIO_ITMode_HighLevel: R16_PA_INT_MODE &= ~pin; R32_PA_OUT |= pin; break; - case GPIO_ITMode_FallEdge: // 下降沿触发 + case GPIO_ITMode_FallEdge: R16_PA_INT_MODE |= pin; R32_PA_CLR |= pin; break; - case GPIO_ITMode_RiseEdge: // 上升沿触发 + case GPIO_ITMode_RiseEdge: R16_PA_INT_MODE |= pin; R32_PA_OUT |= pin; break; @@ -150,10 +150,10 @@ void GPIOA_ITModeCfg(uint32_t pin, GPIOITModeTpDef mode) /********************************************************************* * @fn GPIOB_ITModeCfg * - * @brief GPIOB引脚中断模式配置 + * @brief GPIOB interrupt configuration * * @param pin - PB0-PB23 - * @param mode - 触发类型 + * @param mode - Interrupt Trigger type (edge, level) * * @return none */ @@ -162,22 +162,22 @@ void GPIOB_ITModeCfg(uint32_t pin, GPIOITModeTpDef mode) uint32_t Pin = pin | ((pin & (GPIO_Pin_22 | GPIO_Pin_23)) >> 14); switch(mode) { - case GPIO_ITMode_LowLevel: // 低电平触发 + case GPIO_ITMode_LowLevel: R16_PB_INT_MODE &= ~Pin; R32_PB_CLR |= pin; break; - case GPIO_ITMode_HighLevel: // 高电平触发 + case GPIO_ITMode_HighLevel: R16_PB_INT_MODE &= ~Pin; R32_PB_OUT |= pin; break; - case GPIO_ITMode_FallEdge: // 下降沿触发 + case GPIO_ITMode_FallEdge: R16_PB_INT_MODE |= Pin; R32_PB_CLR |= pin; break; - case GPIO_ITMode_RiseEdge: // 上升沿触发 + case GPIO_ITMode_RiseEdge: R16_PB_INT_MODE |= Pin; R32_PB_OUT |= pin; break; @@ -192,17 +192,17 @@ void GPIOB_ITModeCfg(uint32_t pin, GPIOITModeTpDef mode) /********************************************************************* * @fn GPIOPinRemap * - * @brief 外设功能引脚映射 + * @brief GPIO Pin Peripheral Function Remapping * - * @param s - 是否使能映射 + * @param s - Enable / Disable remap * @param perph - RB_RF_ANT_SW_EN - RF antenna switch control output on PA4/PA5/PA12/PA13/PA14/PA15 * RB_PIN_U0_INV - RXD0/RXD0_/TXD0/TXD0_ invert input/output * RB_PIN_INTX - INTX: INT24/INT25 PB8/PB9 -> INT24_/INT25_ PB22/PB23 * RB_PIN_MODEM - MODEM: PA6/PA7 -> PB12/PB13 - * RB_PIN_I2C - I2C: PB14/PB15 -> PB14/PB15 + * RB_PIN_I2C - I2C: PB14/PB15 -> PB14/PB15 (no remap possible) * RB_PIN_PWMX - PWMX: PA12/PA13 -> PA6/PA7 * RB_PIN_SPI0 - SPI0: PA12/PA13/PA14/PA15 -> PB12/PB13/PB14/PB15 - * RB_PIN_UART3 - UART3: PA4/PA5 -> PA4/PA5 + * RB_PIN_UART3 - UART3: PA4/PA5 -> PA4/PA5 (no remap possible) * RB_PIN_UART2 - UART2: PB22/PB23 -> PA6/PA7 * RB_PIN_UART1 - UART1: PA8/PA9 -> PB12/PB13 * RB_PIN_UART0 - UART0: PB4/PB7 -> PA15/PA14 @@ -228,25 +228,25 @@ void GPIOPinRemap(FunctionalState s, uint16_t perph) /********************************************************************* * @fn GPIOAGPPCfg * - * @brief 模拟外设GPIO引脚功能控制 + * @brief GPIO Analog Pin Peripheral Function configuration * - * @param s - ENABLE - 打开模拟外设功能,关闭数字功能 - * DISABLE - 启用数字功能,关闭模拟外设功能 - * @param perph - RB_PIN_ADC8_9_IE - ADC/TKEY 9/8通道 - * RB_PIN_ADC6_7_IE - ADC/TKEY 7/6通道 - * RB_PIN_ADC10_IE - ADC/TKEY 10通道 - * RB_PIN_ADC11_IE - ADC/TKEY 11 通道 - * RB_PIN_USB2_DP_PU - USB2 U2D+引脚内部上拉电阻 + * @param s - ENABLE - Turn on analog, disable digital functions + * DISABLE - Turn off analog, enable digital functions + * @param perph - RB_PIN_ADC8_9_IE - ADC/TKEY 9/8 + * RB_PIN_ADC6_7_IE - ADC/TKEY 7/6 + * RB_PIN_ADC10_IE - ADC/TKEY 10 + * RB_PIN_ADC11_IE - ADC/TKEY 11 + * RB_PIN_USB2_DP_PU - USB2 U2D+ internal pullup * RB_PIN_USB2_IE - USB2引脚 - * RB_PIN_USB_DP_PU - USB UD+引脚内部上拉电阻 + * RB_PIN_USB_DP_PU - USB UD+ internal pullup * RB_PIN_USB_IE - USB 引脚 - * RB_PIN_ADC0_IE - ADC/TKEY 0 通道 - * RB_PIN_ADC1_IE - ADC/TKEY 1 通道 - * RB_PIN_ADC12_IE - ADC/TKEY 12 通道 - * RB_PIN_ADC13_IE - ADC/TKEY 13 通道 - * RB_PIN_XT32K_IE - 32KHz晶振LSE引脚 - * RB_PIN_ADC2_3_IE - ADC/TKEY 2/3 通道 - * RB_PIN_ADC4_5_IE - ADC/TKEY 4/5 通道 + * RB_PIN_ADC0_IE - ADC/TKEY 0 + * RB_PIN_ADC1_IE - ADC/TKEY 1 + * RB_PIN_ADC12_IE - ADC/TKEY 12 + * RB_PIN_ADC13_IE - ADC/TKEY 13 + * RB_PIN_XT32K_IE - 32KHz LSE + * RB_PIN_ADC2_3_IE - ADC/TKEY 2/3 + * RB_PIN_ADC4_5_IE - ADC/TKEY 4/5 * * @return none */ diff --git a/nametag8_CH592/StdPeriphDriver/CH59x_pwr.c b/nametag8_CH592/StdPeriphDriver/CH59x_pwr.c index 0183448..9121ceb 100644 --- a/nametag8_CH592/StdPeriphDriver/CH59x_pwr.c +++ b/nametag8_CH592/StdPeriphDriver/CH59x_pwr.c @@ -15,9 +15,9 @@ /********************************************************************* * @fn PWR_DCDCCfg * - * @brief 启用内部DC/DC电源,用于节约系统功耗 + * @brief Enable DC/DC converter, to reduce power consumption * - * @param s - 是否打开DCDC电源 + * @param s - ENABLE or DISABLE the DC/DC converter * * @return none */ @@ -30,7 +30,7 @@ void PWR_DCDCCfg(FunctionalState s) { adj &= ~RB_DCDC_CHARGE; - plan &= ~(RB_PWR_DCDC_EN | RB_PWR_DCDC_PRE); // 旁路 DC/DC + plan &= ~(RB_PWR_DCDC_EN | RB_PWR_DCDC_PRE); // bypass DC/DC sys_safe_access_enable(); R16_AUX_POWER_ADJ = adj; R16_POWER_PLAN = plan; @@ -88,10 +88,10 @@ void PWR_UnitModCfg(FunctionalState s, uint8_t unit) /********************************************************************* * @fn PWR_PeriphClkCfg * - * @brief 外设时钟控制位 + * @brief Peripheral clock control * - * @param s - 是否打开对应外设时钟 - * @param perph - please refer to Peripher CLK control bit define + * @param s - ENABLE or DISABLE peripheral clock + * @param perph - please refer to Peripheral CLK control bit define * * @return none */ @@ -182,9 +182,9 @@ void PWR_PeriphWakeUpCfg(FunctionalState s, uint8_t perph, WakeUP_ModeypeDef mod /********************************************************************* * @fn PowerMonitor * - * @brief 电源监控 + * @brief Battery Monitoring * - * @param s - 是否打开此功能 + * @param s - ENABLE or DISABLE * @param vl - refer to VolM_LevelypeDef * * @return none @@ -238,7 +238,7 @@ __HIGH_CODE void LowPower_Idle(void) { FLASH_ROM_SW_RESET(); - R8_FLASH_CTRL = 0x04; //flash关闭 + R8_FLASH_CTRL = 0x04; // disable flash PFIC->SCTLR &= ~(1 << 2); // sleep __WFI(); @@ -261,14 +261,14 @@ void LowPower_Halt(void) uint8_t x32Kpw, x32Mpw; FLASH_ROM_SW_RESET(); - R8_FLASH_CTRL = 0x04; //flash关闭 + R8_FLASH_CTRL = 0x04; // disable flash x32Kpw = R8_XT32K_TUNE; x32Mpw = R8_XT32M_TUNE; - x32Mpw = (x32Mpw & 0xfc) | 0x03; // 150%额定电流 - x32Kpw = (x32Kpw & 0xfc) | 0x01; // LSE驱动电流降低到额定电流 + x32Mpw = (x32Mpw & 0xfc) | 0x03; // 150% current + x32Kpw = (x32Kpw & 0xfc) | 0x01; // LSE drive current reduced to normal sys_safe_access_enable(); - R8_BAT_DET_CTRL = 0; // 关闭电压监控 + R8_BAT_DET_CTRL = 0; // disable battery voltage monitoring sys_safe_access_disable(); sys_safe_access_enable(); R8_XT32K_TUNE = x32Kpw; @@ -292,11 +292,11 @@ void LowPower_Halt(void) * Description : 低功耗-Sleep模式。 注意当主频为80M时,睡眠唤醒中断不可调用flash内代码,且退出此函数前需要加上30us延迟。 * Input : rm: - RB_PWR_RAM2K - 2K retention SRAM 供电 - RB_PWR_RAM24K - 24K main SRAM 供电 - RB_PWR_EXTEND - USB 和 BLE 单元保留区域供电 - RB_PWR_XROM - FlashROM 供电 - NULL - 以上单元都断电 + RB_PWR_RAM2K - 2K retention SRAM is powered + RB_PWR_RAM24K - 24K main SRAM is powered + RB_PWR_EXTEND - USB & BLE 单元保留区域供电 + RB_PWR_XROM - FlashROM is powered + NULL - All above peripherals are powered off * Return : None *******************************************************************************/ __HIGH_CODE @@ -310,11 +310,11 @@ void LowPower_Sleep(uint16_t rm) x32Kpw = R8_XT32K_TUNE; x32Mpw = R8_XT32M_TUNE; - x32Mpw = (x32Mpw & 0xfc) | 0x03; // 150%额定电流 - x32Kpw = (x32Kpw & 0xfc) | 0x01; // LSE驱动电流降低到额定电流 + x32Mpw = (x32Mpw & 0xfc) | 0x03; // 150% current + x32Kpw = (x32Kpw & 0xfc) | 0x01; // LSE drive current reduced to normal sys_safe_access_enable(); - R8_BAT_DET_CTRL = 0; // 关闭电压监控 + R8_BAT_DET_CTRL = 0; // disable battery voltage monitoring sys_safe_access_disable(); sys_safe_access_enable(); R8_XT32K_TUNE = x32Kpw; @@ -379,11 +379,11 @@ void LowPower_Shutdown(uint16_t rm) FLASH_ROM_SW_RESET(); x32Kpw = R8_XT32K_TUNE; x32Mpw = R8_XT32M_TUNE; - x32Mpw = (x32Mpw & 0xfc) | 0x03; // 150%额定电流 - x32Kpw = (x32Kpw & 0xfc) | 0x01; // LSE驱动电流降低到额定电流 + x32Mpw = (x32Mpw & 0xfc) | 0x03; // 150% current + x32Kpw = (x32Kpw & 0xfc) | 0x01; // LSE drive current reduced to normal sys_safe_access_enable(); - R8_BAT_DET_CTRL = 0; // 关闭电压监控 + R8_BAT_DET_CTRL = 0; // disable battery voltage monitoring sys_safe_access_disable(); sys_safe_access_enable(); R8_XT32K_TUNE = x32Kpw; diff --git a/nametag8_CH592/StdPeriphDriver/CH59x_sys.c b/nametag8_CH592/StdPeriphDriver/CH59x_sys.c index 9f72958..ebcc507 100644 --- a/nametag8_CH592/StdPeriphDriver/CH59x_sys.c +++ b/nametag8_CH592/StdPeriphDriver/CH59x_sys.c @@ -15,9 +15,9 @@ /********************************************************************* * @fn SetSysClock * - * @brief 配置系统运行时钟 + * @brief Configure main system clock * - * @param sc - 系统时钟源选择 refer to SYS_CLKTypeDef + * @param sc - System clock source selection (refer to SYS_CLKTypeDef) * * @return none */ @@ -70,7 +70,7 @@ void SetSysClock(SYS_CLKTypeDef sc) /********************************************************************* * @fn GetSysClock * - * @brief 获取当前系统时钟 + * @brief Get main system clock configuration * * @param none * @@ -82,15 +82,15 @@ uint32_t GetSysClock(void) rev = R32_CLK_SYS_CFG & 0xff; if((rev & 0x40) == (0 << 6)) - { // 32M进行分频 + { // 32M HSE division return (32000000 / (rev & 0x1f)); } else if((rev & RB_CLK_SYS_MOD) == (1 << 6)) - { // PLL进行分频 + { // 480M PLL division return (480000000 / (rev & 0x1f)); } else - { // 32K做主频 + { // 32KHz return (32000); } } @@ -119,7 +119,7 @@ uint8_t SYS_GetInfoSta(SYS_InfoStaTypeDef i) /********************************************************************* * @fn SYS_ResetExecute * - * @brief 执行系统软件复位 + * @brief Perform a software reset * * @param none * @@ -137,9 +137,9 @@ void SYS_ResetExecute(void) /********************************************************************* * @fn SYS_DisableAllIrq * - * @brief 关闭所有中断,并保留当前中断值 + * @brief Disable all interrupts, get current interrupt values * - * @param pirqv - 当前保留中断值 + * @param pirqv - Save old interrupt values * * @return none */ @@ -153,9 +153,9 @@ void SYS_DisableAllIrq(uint32_t *pirqv) /********************************************************************* * @fn SYS_RecoverIrq * - * @brief 恢复之前关闭的中断值 + * @brief Restore all interrupts from previously stored values * - * @param irq_status - 当前保留中断值 + * @param irq_status - Old interrupt values to restore * * @return none */ @@ -168,11 +168,11 @@ void SYS_RecoverIrq(uint32_t irq_status) /********************************************************************* * @fn SYS_GetSysTickCnt * - * @brief 获取当前系统(SYSTICK)计数值 + * @brief Get the current SysTick count * * @param none * - * @return 当前计数值 + * @return Current SysTick count */ uint32_t SYS_GetSysTickCnt(void) { @@ -255,7 +255,7 @@ void WWDG_ClearFlag(void) /********************************************************************* * @fn HardFault_Handler * - * @brief 硬件错误中断,进入后执行复位,复位类型为上电复位 + * @brief Resets with a power-on reset on a hardware error * * @param none *