Compare commits

..

2 Commits

2 changed files with 32 additions and 20 deletions

View File

@ -31,15 +31,15 @@ x GPIODEN -- GPIO Digital Enable -- 0x00011111 >> 0x1F
register uint32_t x = ZERO_DEF;
GPIO_PORTF_DATA_R = 0x4;
// 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;
// }
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,7 +47,6 @@ x GPIODEN -- GPIO Digital Enable -- 0x00011111 >> 0x1F
{
x++;
counter_loop();
GPIO_PORTF_DATA_R ^= 0x2;
}
}
@ -61,7 +60,7 @@ void GPIO_PORTF_Init(void)
void counter_loop (void)
{
uint32_t count = 0xFFFFFF;
register uint32_t count=10;
while(count>0)
count--;

View File

@ -10,12 +10,14 @@ 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);
@ -24,13 +26,20 @@ int main(void)
void SW2_Handler(void)
{
//Start with some nops and then try some dela
//GPIO_PORTF_ICR_R = 0x11;
if(GPIO_PORTF_MIS_R & 0x01)
{
//PIN0 (SW2) pressed
GPIO_PORTF_DATA_R |= 0x8;
//GPIO_PORTF_DATA_R ^= 0x2;
global_counter ++;
//GPIO_PORTF_ICR_R = 0x10;
GPIO_PORTF_ICR_R = 0x10;
__asm(" DSB");
}
else if (GPIO_PORTF_MIS_R & 0x10)
{
GPIO_PORTF_DATA_R &= ~0x8;
}
GPIO_PORTF_ICR_R = 0x11;
__asm(" nop");
}
@ -61,6 +70,10 @@ 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;
@ -79,11 +92,11 @@ void GPIO_PORTF_Init(void)
//GPIOIEV -- Interropt Event --> 0 for falling edge --> 0x00
GPIO_PORTF_IEV_R = 0x0;
//GPIOICR -- Interript clear -- must be cleared by writing 1 to corresponding bit --> 0xff
//GPIOICR -- INterrpt 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 = 0x10;
GPIO_PORTF_IM_R = 0x11;
//GPIORIS -- Raw Int Status
//GPIOMIS -- Masked Int Status