Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 3:9a3c6c16dc25, committed 2019-09-12
- Comitter:
- noutram
- Date:
- Thu Sep 12 13:56:16 2019 +0000
- Parent:
- 2:59ca1165c370
- Commit message:
- 2019
Changed in this revision
--- a/main.cpp Tue Oct 10 15:13:26 2017 +0000
+++ b/main.cpp Thu Sep 12 13:56:16 2019 +0000
@@ -4,23 +4,34 @@
// However, pressing and releasing the switch can result in spurious falling edges
// which trigger the routine
+//Uncomment this if you want to use the onboard LEDs and Blue Switch on a F429ZI
+//#define USEONBOARD
+
//Declare functions
void sw1FallingEdge();
//Global Objects
+#ifdef USEONBOARD
+DigitalOut red_led(LED3);
+DigitalOut green_led(LED1);
+InterruptIn sw1(USER_BUTTON);
+#else
DigitalOut red_led(D7);
DigitalOut green_led(D5);
-InterruptIn sw1(D4);
+InterruptIn sw1(D4);
+#endif
//Interrupt service routine for a rising edge (press)
void sw1FallingEdge() {
red_led = !red_led; //Toggle the LED
}
+Serial pc(USBTX, USBRX);
+
//Main - only has to initialise and sleep
int main() {
- //Initial logging message
- puts("START");
+
+ pc.set_blocking(true);
red_led = 0;
green_led = 1;
@@ -34,7 +45,10 @@
sleep();
//You can ONLY reach this point if an ISR wakes the CPU
- puts("ISR just woke the MPU");
+ green_led = !green_led;
+
+ //Any use of the serial port will produce a series of interrupts
+ //pc.puts("Ping!\n\r");
} //end while
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Thu Sep 12 13:56:16 2019 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#1bf6b20df9d3cd5f29f001ffc6f0d0fcbbb96118
--- a/mbed.bld Tue Oct 10 15:13:26 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/a97add6d7e64 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_app.json Thu Sep 12 13:56:16 2019 +0000
@@ -0,0 +1,3 @@
+{
+ "requires": ["bare-metal"]
+}
\ No newline at end of file