SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions about processor boards have here!
User avatar
By zkrough
#239483
I am trying to modify the Sparkfun Single Pair Ethernet Drivers to support multiple ADIN1110 chips at the same time. Currently, I am working on the boardsupport.c/.h files. My question is how I could modify the boardsupport files to support multiple ADIN1110s. Following my design, each ADIN1110 will have its own INT, RESET and CS pins connected to the Artemis' GPIO. I am just trying to figure out how to modify the boardsupport file to differentiate when a function is called for either the first or second ADIN1110. For example, here is some code from the boardsupport.c file that attached interrupts to the driver. However, since the two ADIN1110s will use their own interrupt pins, I need to figure out how to differentiate the two in the driver.
Code: Select all
// Register the SPI callback, in the driver the following macro is used:
// extern uint32_t HAL_SPI_Register_Callback(ADI_CB const *pfCallback, void *const pCBParam);
uint32_t BSP_spi2_register_callback(ADI_CB const *pfCallback, void *const pCBParam)
{
    SPICallback = (ADI_CB)pfCallback;
    SPICallbackParam = pCBParam ;
    return 0;
}

// Register the callback for the interrupt pin, in the driver the following macro is used:
// extern uint32_t HAL_INT_N_Register_Callback(ADI_CB const *pfCallback, void *const pCBParam);
uint32_t BSP_RegisterIRQCallback(ADI_CB const* intCallback, void* hDevice)
{
    GPIOIntCallback = (ADI_CB)intCallback;
    GPIOIntCallbackParam = hDevice;

    attachInterrupt(interrupt_pin, BSP_IRQCallback, FALLING);
    return 0;
}

//Outside of mbed cores, we just call the callback within the ISR
void BSP_IRQCallback()
{
    if (GPIOIntCallback)
    {
        (*GPIOIntCallback)(GPIOIntCallbackParam1, 0, NULL);
    }
}
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum