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.cpp
- Revision:
- 0:716b93ab9a58
- Child:
- 1:c125f4e65df7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Oct 29 20:56:20 2021 +0000 @@ -0,0 +1,50 @@ +#include "gpio.h" +#include "led1.h" +#include "main_Lec9.h" //Mort: including main_Lec9.h +#include "mbed.h" +#include "hardware_timer.h" + +Serial pc(USBTX, USBRX); + + +int main(void) +{ + //uint32_t i,j; + uint16_t countervalue; + uint16_t checkvalue; + + //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 Output Compare: + InitGPIOBPin0asOutputCompare(); + TMR3CH3OutputCompare(); + + //This is for Input Capture: + InitGPIOCPin6asInputCapture(); + TMR3CH1GPIOCPin6asInputCapture(); + + 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); +}