embeddedmicrocontrollergpiotexas-instruments

Is it possible to pass parameters to a GPIO interrupt on a CC1310 (or similar TI devices) using the TI SDK


I need to pass a parameter (like an SPI handle for example) to a GPIO ISR (on a CC1310 or similar, using the TI SDK v4.20.XX. This version is not a requirment, just my current version, updating the SDK would be a viable option.).

This is possible in SPI ISRs via a

void      *arg;         /*!< Argument to be passed to the callback function */

parameter in the SPI_Transaction struct. The transaction struct containing the custom argument then gets passed to the ISR (along with the SPI handle).

typedef void (*SPI_CallbackFxn) (SPI_Handle handle, SPI_Transaction *transaction);

The typedef for the GPIO ISR looks like this:

typedef void (*GPIO_CallbackFxn)(uint_least8_t index);

index is just the ID of the pin which triggered the interrupt. Is it just not possible to pass custom parameters (without unreasonable effort like rewriting the SDK) or did I miss something somewhere?

If this is not possible, how do I get something like a device handle to the ISR??


Solution

  • Turns out, that in the v4.20.XX version of the SDK that I had installed, this is not possible (via SDK).

    Later versions of the SDK added

    void GPIO_setUserArg(uint_least8_t index, void *arg);
    void *GPIO_getUserArg(uint_least8_t index);
    

    functions to pass arbitrary arguments. They seem to be available from v5.XX onwards.