Rajath Ravi / Mbed 2 deprecated ravi_blinkycode

Dependencies:   mbed

main_Lec9.cpp

Committer:
rajathr
Date:
2021-10-23
Revision:
0:34ee385f4d2d

File content as of revision 0:34ee385f4d2d:

#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);    
}