I use the SW1 to change the Led. The problem with the line "GPIOIntRegister(GPIO_PORTF_BASE,&buttonisr);" . I try to correct it but i cannot.
First i think that i did not call the library, so i add many libraries.
CCS all way said that "buttonisr is undefined". May be this is very very basic question, but i still the be beginner!
This is my code:
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/pin_map.h"
#include "driverlib/gpio.h"
#include "driverlib/sysctl.h"
#include "driverlib/interrupt.h"
#include "driverlib/timer.h"
#include "driverlib/fpu.h"
#include "driverlib/uart.h"
#include "driverlib/debug.h"
#include "driverlib/rom.h"
#define RED GPIO_PIN_1
#define BLUE GPIO_PIN_2
#define GREEN GPIO_PIN_3
#define SW1 GPIO_PIN_4
#define SW2 GPIO_PIN_0
int main(void)
{
SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, RED|GREEN|BLUE);
GPIOPinWrite(GPIO_PORTF_BASE, RED|GREEN|BLUE, 0);
GPIODirModeSet(GPIO_PORTF_BASE, SW1, GPIO_DIR_MODE_IN);
GPIOPadConfigSet(GPIO_PORTF_BASE, SW1, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU);
GPIOIntTypeSet(GPIO_PORTF_BASE, SW1, GPIO_FALLING_EDGE);
GPIOIntRegister(GPIO_PORTF_BASE,&buttonisr); /// PROBLEM HERE!
GPIOIntEnable(GPIO_PORTF_BASE, SW1);
IntMasterEnable();
GPIOIntEnable(GPIO_PORTF_BASE,SW1);
}
//THE FUNCTION TO SERVE FOR THE MAIN
void buttonisr(void)
{
static int tick = RED;
GPIOIntClear(GPIO_PORTF_BASE, SW1);
GPIOPinWrite(GPIO_PORTF_BASE, RED|GREEN|BLUE, tick);
tick<<=1;
if(tick>GPIO_PIN_3)
tick=RED;
SysCtlDelay(SysCtlClockGet()/3);
}