Compare commits
	
		
			1 Commits
		
	
	
		
			master
			...
			GPIO_ISR_D
		
	
	| Author | SHA1 | Date | 
|---|---|---|
| 
							
							
								
									
								
								 | 
						85a2491634 | 
							
								
								
									
										19
									
								
								Blink/main.c
								
								
								
								
							
							
						
						
									
										19
									
								
								Blink/main.c
								
								
								
								
							| 
						 | 
				
			
			@ -31,15 +31,15 @@ x   GPIODEN -- GPIO Digital Enable -- 0x00011111 >> 0x1F
 | 
			
		|||
    register uint32_t x = ZERO_DEF;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    GPIO_PORTF_DATA_R = 0xE;
 | 
			
		||||
    while(1)
 | 
			
		||||
    {
 | 
			
		||||
        GPIO_PORTF_DATA_R = 0x0;
 | 
			
		||||
        GPIO_PORTF_DATA_R = 0x2;
 | 
			
		||||
    GPIO_PORTF_DATA_R = 0x4;
 | 
			
		||||
        GPIO_PORTF_DATA_R = 0x8;
 | 
			
		||||
        GPIO_PORTF_DATA_R = 0xE;
 | 
			
		||||
    }
 | 
			
		||||
//    while(1)
 | 
			
		||||
//    {
 | 
			
		||||
//        GPIO_PORTF_DATA_R = 0x0;
 | 
			
		||||
//        GPIO_PORTF_DATA_R = 0x2;
 | 
			
		||||
//        GPIO_PORTF_DATA_R = 0x4;
 | 
			
		||||
//        GPIO_PORTF_DATA_R = 0x8;
 | 
			
		||||
//        GPIO_PORTF_DATA_R = 0xE;
 | 
			
		||||
//    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -47,6 +47,7 @@ x   GPIODEN -- GPIO Digital Enable -- 0x00011111 >> 0x1F
 | 
			
		|||
    {
 | 
			
		||||
        x++;
 | 
			
		||||
        counter_loop();
 | 
			
		||||
        GPIO_PORTF_DATA_R ^= 0x2;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -60,7 +61,7 @@ void GPIO_PORTF_Init(void)
 | 
			
		|||
 | 
			
		||||
void counter_loop (void)
 | 
			
		||||
{
 | 
			
		||||
    register uint32_t count=10;
 | 
			
		||||
    uint32_t count = 0xFFFFFF;
 | 
			
		||||
    while(count>0)
 | 
			
		||||
        count--;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,14 +10,12 @@ void SystickHandler(void);
 | 
			
		|||
void Systick_Init(void);
 | 
			
		||||
 | 
			
		||||
volatile uint32_t systick_count = 1;
 | 
			
		||||
 | 
			
		||||
volatile uint32_t global_counter = 0;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int main(void)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    GPIO_PORTF_Init();
 | 
			
		||||
    //Systick_Init();
 | 
			
		||||
     while(1);
 | 
			
		||||
| 
						 | 
				
			
			@ -26,20 +24,13 @@ int main(void)
 | 
			
		|||
 | 
			
		||||
void SW2_Handler(void)
 | 
			
		||||
{
 | 
			
		||||
    //GPIO_PORTF_ICR_R = 0x11;
 | 
			
		||||
    if(GPIO_PORTF_MIS_R & 0x01)
 | 
			
		||||
    {
 | 
			
		||||
        //PIN0 (SW2) pressed
 | 
			
		||||
        GPIO_PORTF_DATA_R |=  0x8;
 | 
			
		||||
    //Start with some nops and then try some dela
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
    else if (GPIO_PORTF_MIS_R & 0x10)
 | 
			
		||||
    {
 | 
			
		||||
        GPIO_PORTF_DATA_R &= ~0x8;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    GPIO_PORTF_ICR_R = 0x11;
 | 
			
		||||
    __asm(" nop");
 | 
			
		||||
    //GPIO_PORTF_DATA_R ^= 0x2;
 | 
			
		||||
    global_counter ++;
 | 
			
		||||
    //GPIO_PORTF_ICR_R = 0x10;
 | 
			
		||||
    GPIO_PORTF_ICR_R = 0x10;
 | 
			
		||||
    __asm(" DSB");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -70,10 +61,6 @@ void GPIO_PORTF_Init(void)
 | 
			
		|||
    //Need to enable interrupt on SW1
 | 
			
		||||
 | 
			
		||||
    SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOF;
 | 
			
		||||
 | 
			
		||||
    GPIO_PORTF_LOCK_R = 0x4C4F434B;     /* unlock commit register */
 | 
			
		||||
    GPIO_PORTF_CR_R = 0xFF;             /* make PORTF0 configurable */
 | 
			
		||||
 | 
			
		||||
    GPIO_PORTF_DEN_R  = 0x1F;
 | 
			
		||||
    GPIO_PORTF_PUR_R  = 0x11;
 | 
			
		||||
    GPIO_PORTF_DIR_R  = 0x0E;
 | 
			
		||||
| 
						 | 
				
			
			@ -92,11 +79,11 @@ void GPIO_PORTF_Init(void)
 | 
			
		|||
    //GPIOIEV -- Interropt Event  --> 0 for falling edge      --> 0x00
 | 
			
		||||
    GPIO_PORTF_IEV_R = 0x0;
 | 
			
		||||
 | 
			
		||||
    //GPIOICR -- INterrpt clear -- must be cleared by writing 1 to corresponding bit --> 0xff
 | 
			
		||||
    //GPIOICR -- Interript clear -- must be cleared by writing 1 to corresponding bit --> 0xff
 | 
			
		||||
    GPIO_PORTF_ICR_R = 0xff;
 | 
			
		||||
 | 
			
		||||
    //GPIOIM -- Interrupt Mask    --> 1 for unmasked (enabled)--> 0x01
 | 
			
		||||
    GPIO_PORTF_IM_R = 0x11;
 | 
			
		||||
    GPIO_PORTF_IM_R = 0x10;
 | 
			
		||||
 | 
			
		||||
    //GPIORIS -- Raw Int Status
 | 
			
		||||
    //GPIOMIS -- Masked Int Status
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue