Other Parts Discussed in Thread: CC2650
Tool/software: Code Composer Studio
Hi,
I am using interrupt and I2C function (for Accelerometer) together.
Interrupt is working fine, but when I enable I2c function it stops working. I am wondering whats wrong with it.
I am writing some part of code for understanding
/// ************************* I2C Code ************************* ///
#define Board_SDA IOID_9
#define Board_SCL IOID_10
static PIN_Config SBP_configTable[] ={
Button_Input | PIN_INPUT_EN | PIN_PULLUP | PIN_HYSTERESIS,
Board_SDA | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
Board_SCL | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
PIN_TERMINATE
};
static I2C_Handle SbpI2cHandle;
static I2C_Params SbpI2cParams;
I2C_Params_init(&SbpI2cParams);
SbpI2cHandle = I2C_open(CC2650_I2C0, &SbpI2cParams);
if(!SbpI2cHandle){
//code will come here if i2c is pins are not opened
}
/// ************************* Interrupt Code ************************* ///
#define Button_Input IOID_14
static void buttonHwiFxn(PIN_Handle hPin, PIN_Id pinId){
// set event in SBP task to process outside of hwi context
events |= SBP_BTN_EVT;
// Wake up the application.
Semaphore_post(sem);
}
PIN_registerIntCb(hSbpPins, buttonHwiFxn);
// Configure interrupt
PIN_setConfig(hSbpPins, PIN_BM_IRQ, Button_Input | PIN_IRQ_POSEDGE);
// Enable wakeup
PIN_setConfig(hSbpPins, PINCC26XX_BM_WAKEUP, Button_Input |PINCC26XX_WAKEUP_POSEDGE);
if (events & SBP_BTN_EVT){
events &= ~SBP_BTN_EVT; //clear event
//Blink LED
}