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.
Diff: main_Lec9.cpp
- Revision:
- 0:34ee385f4d2d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main_Lec9.cpp Sat Oct 23 05:49:09 2021 +0000
@@ -0,0 +1,74 @@
+#include "gpio.h"
+#include "led1.h"
+#include "main_Lec9.h" //Mort: including main_Lec9.h
+#include "mbed.h"
+#include "hardware_timer3.h"
+#include "interrupt.h"
+
+Serial pc(USBTX, USBRX);
+
+
+int main(void)
+{
+ uint32_t i,j;
+ //uint16_t countervalue;
+ //uint16_t checkvalue;
+
+ /* All of your init functions need to be here */
+
+ //This is for first LED function
+ //init_LED1(); //Calling the initialization function - To initialize PortB as its corresponding functionality //Mort: Do not need to say void here
+
+ //This is for Probelm 10 Exercises - START
+// //This is for Output Compare:
+// InitGPIOBPin0asOutputCompare();
+// TMR3CH3OutputCompare();
+//
+// //This is for Input Capture:
+// InitGPIOCPin6asInputCapture();
+// TMR3CH1GPIOCPin6asInputCapture();
+ //This is for Probelm 10 Exercises - END
+
+
+// //Exercise 11 PWM MODE - 1st Problem - START
+// //Initializing PortB Pin 0 as a Output Pin
+// InitGPIOBPin0asPWMMode1();
+// TMR3CH3OutputPWMMode1();
+// //Exercise 11 PWM MODE - 1st Problem - END
+
+// //Exercise 11 PWM MODE - 2nd Problem - START
+// //Initializing PortB Pin 0 as a Output Pin
+// InitPortBPin0asOutput();
+// initTimer3ToInterrupt();
+// //Exercise 11 PWM MODE - 2nd Problem - END
+
+ //Exercise 11 PWM MODE - 3rd Problem - START
+ //Initializing PortB Pin 0 as a Output Pin
+ enableEXTI6OnPortC();
+ //Exercise 11 PWM MODE - 3rd Problem - END
+
+
+ while(true)
+ {
+ //Create FOR Loop to have some delay between toggling
+ for(i=1; i<100; i++) //Mort: Your code was fine, just your delay was too large.
+ {
+ //pc.printf("hi hi hi \n");
+ j=j+1;
+ }
+ toggle_LED1(); //Function Call to toggle LED
+
+// countervalue = readCounterValueIfFlagIsSet();
+// if (countervalue > 0 & checkvalue != countervalue)
+// {
+// pc.printf("\nCounter Value is = %d", countervalue);
+// checkvalue = countervalue;
+ }
+ }
+}
+
+void debugPrint(uint32_t what)
+{
+ pc.printf("The value is %u\n",what);
+}
+
\ No newline at end of file