/******************************************************************************* * Function Name: main ******************************************************************************** * * Summary: * The main code starts boot loader. * * Parameters: * None. * * Return: * None. * *******************************************************************************/ int main() { /* Start Boot loader */ Bootloader_Start(); /* Code will never be executed here */ for(;;) { } }
int main() { /* Short-circuit EN and VDD to start bootloader */ EN_Write(0); if(EN_Read() != 0u) { Bootloader_SET_RUN_TYPE(Bootloader_START_BTLDR); } else { Bootloader_SET_RUN_TYPE(Bootloader_START_APP); } Bootloader_Start(); }
int main() { CyGlobalIntEnable; // button pulls low. Not pressed - no bootloader. //if (1u == CyPins_ReadPin(Pins_Button)) //{ // Bootloader_Exit(Bootloader_EXIT_TO_BTLDB); //} Bootloader_Start(); // Never reached. for(;;) { } }
int main() { uint8 counter = 0; /* Enable global interrupts*/ CyGlobalIntEnable; /* Check if the switch is pressed during power up */ if(Boot_P0_7_Read() == 0) { for(counter = 0; counter <= SWITCH_PRESS_TIMEOUT; counter++) { /* Delay for 1ms */ //CyDelay(1); CyDelay(2); /* If the switch is released before specified time, do not enter the * bootloader */ if(Boot_P0_7_Read() != 0) break; } if(counter > SWITCH_PRESS_TIMEOUT) { /* If the switch was pressed for more than 100 millisecond counter * value will be 100. If so, set the flash run type as bootloader to * wait for a bootload operation */ Bootloader_SET_RUN_TYPE (Bootloader_START_BTLDR); } } /*Indicate that you have entered the bootloader mode.*/ PWM_Start(); /* Start the Bootloader */ Bootloader_Start(); /* The “Bootloader_Start()” API will either wait for a bootload operation or * will launch the application depending on whether or not the API * "Bootloader_SET_RUN_TYPE(Bootloader_START_BTLDR)" was called because of the * switch being pressed during power up */ for(;;) { } }