.

Dependencies:   mbed EthernetInterface mbed-rtos

Fork of Bootloader_K64F by Erik -

Committer:
Sissors
Date:
Sun Apr 24 12:46:10 2016 +0000
Revision:
9:56ed3a56ecc3
Parent:
8:00cefe0d59ed
v1.0, seems to be stable

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Sissors 0:9396d3376435 1 #include "mbed.h"
Sissors 7:4ab0430d06e3 2 #include "bootloader.h"
Sissors 1:782a3ddc329e 3
Sissors 9:56ed3a56ecc3 4 DigitalIn sw(PTA4);
Sissors 9:56ed3a56ecc3 5 DigitalOut LED(LED_BLUE);
Sissors 9:56ed3a56ecc3 6
Sissors 1:782a3ddc329e 7 int main()
Sissors 7:4ab0430d06e3 8 {
Sissors 9:56ed3a56ecc3 9 printf("Hello :)\r\n");
Sissors 8:00cefe0d59ed 10
Sissors 9:56ed3a56ecc3 11 //Blink LED, and when SW3 is pressed go to bootloader
Sissors 9:56ed3a56ecc3 12 //I don't know atm if the bootloader would work from interrupt context
Sissors 9:56ed3a56ecc3 13 while (1) {
Sissors 9:56ed3a56ecc3 14 LED = !LED;
Sissors 9:56ed3a56ecc3 15 wait(0.25);
Sissors 9:56ed3a56ecc3 16 if (sw == 0) {
Sissors 9:56ed3a56ecc3 17 printf("Entering bootloader\r\n");
Sissors 9:56ed3a56ecc3 18 write_flash();
Sissors 9:56ed3a56ecc3 19 }
Sissors 9:56ed3a56ecc3 20 }
Sissors 1:782a3ddc329e 21 }
Sissors 7:4ab0430d06e3 22
Sissors 7:4ab0430d06e3 23