WEAK void mbed_die(void) { #ifndef EMUNO CyHalt(1); PWM_Start(); PWM_WriteCompare2(0); CyPins_SetPinDriveMode(SW_USER, CY_PINS_DM_RES_UP); Bootloadable_SET_RUN_TYPE(0); // do not force bootloader while(1) { PWM_WriteCompare1(16); CyDelay(250); PWM_WriteCompare1(64); if (CyPins_ReadPin(SW_USER) == 0) { CyDelay(200); // allow yser to release btn, to not go into bootloader CySoftwareReset(); } CyDelay(400); if (CyPins_ReadPin(SW_USER) == 0) { CyDelay(200); // allow yser to release btn, to not go into bootloader CySoftwareReset(); } } #endif }
/******************************************************************************* * Function Name: Bootloadable_Load ****************************************************************************//** * * \brief * Schedules the Bootloader/Launcher to be launched and then performs * a software reset to launch it * * \return * This method will never return. It will load a new application and reset * the device. * *******************************************************************************/ void Bootloadable_Load(void) { /* Schedule Bootloader to start after reset */ Bootloadable_SET_RUN_TYPE(Bootloadable_SCHEDULE_BTLDR); CySoftwareReset(); }