macOS装机必备虚拟机软件,懂得都懂,商业版,可正常使用。
2023-04-24 08:02:05 306.51MB macos pd pd18 虚拟机
1
完整源代码: int main(void) { //while(1);// InitAllUserRam(); SysTick_Config(12000); TimeBaseInit(); InitOther(); IOinit(); IICMnit(); ADC_init(); wdt_init(1); #if TYPEC_DAC_CTRL DAC_Init(); #endif//TYPEC_DAC_CTRL // UART_Init(UART0,208); // DelayMCUtimer(10); // printf("reset=%d\t\n",TYPEC.State); DelayMCUtimer(10); setsrcpower(TYPEC_OUT_PD_MAX_WATT); changesrcpdo(); CC_Rule_Cfg(ROLE_UFP); USBAGetOffset(); while(1) { clr_wdt(70000); switch(MainRun.State) { case STATEMAINRUN_RESET: SleepPrePutOnDevice(); MainRun.Timer = 0; POWER.ADCen = 1; MainRun.State = STATEMAINRUN_INIT; break; case STATEMAINRUN_INIT: //if(TimeOut(&MainRun.Timer, 30) == 1) { MainRun.Timer = 0; MainRun.State = STATEMAINRUN_LOOP; } break; case STATEMAINRUN_LOOP: KEY.Flag = KeyCheck(u8KeyData); Timer0EventHandler(); ADCEventHandler(); if(TRUE == CheckDpdm3Mode())//某些快充时序高,要减少其他模块的消耗。 ContractLoop(); //PD协议 I2CreadAndWriteCtrl(); LowBatCtrl(); TYPECctrl(); MICROctrl(); USBA1ctrl(); USBA2ctrl(); DPDM12_ctrl(); ChargeCtrl(); DischargeCtrl(); CapacityCtrl(); NTCctrl(); DisplayCtrl(); OtherFuncCtrl(); //TestAndDebug(); if(StateKeepONtime(((1) //&&(1 == u8KeyData) &&(!Charge.Flag) &&(!Discharge.Flag) //&&(!Display.Mode) ), &MainRun.Timer, 3000)) { POWER.ADCen = 0; IICwrite.WriteAllTrig = 1; MainRun.State = STATEMAINRUN_SLEEP_READY; } break; case STATEMAINRUN_SLEEP_READY: I2CreadAndWriteCtrl(); if(TimeOut(&MainRun.Timer, 50)) { MainRun.Timer = 0; MainRun.State = STATEMAINRUN_SLEEP_READY1; } break; case STATEMAINRUN_SLEEP_READY1: if(TimeOut(&MainRun.Timer, 10)) { MainRun.Timer = 0; MainRun.State = STATEMAINRUN_SLEEP; } break; case STATEMAINRUN_SLEEP: SleepPrePutOffDevice(); MainRun.State = STATEMAINRUN_RESET; bre
2021-11-22 15:46:46 1.65MB PD18-60W移动电源开发包
1