Skip to content

Instantly share code, notes, and snippets.

@Arachnid
Created December 21, 2013 13:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Arachnid/8069116 to your computer and use it in GitHub Desktop.
Save Arachnid/8069116 to your computer and use it in GitHub Desktop.
Recovery mode bootloader
void main()
{
int i;
if(Bootloader_GET_RUN_TYPE == Bootloader_START_BTLDR)
Bootloader_Start();
for(i = 0; i < 2000; i++) {
uint8 status = Button_Read();
if(status)
break;
CyDelay(1);
}
if(i == 2000) {
// Time expired, start bootloader
Bootloader_SET_RUN_TYPE(Bootloader_START_BTLDR);
} else {
// Button released, reset
Bootloader_SET_RUN_TYPE(Bootloader_START_APP);
}
Bootloader_Start();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment