Hi, I'm not sure if this is what you're looking for, but I declare these as globals before any tasks or main() in my main.c:
and then, I put this inside of the start of each function where I'm going to use the sensor in question.
As an example..
You could also declare the first lines at the start of your function also but I believe you'll be unlikely to need to change them, so why not just put them in once..
Here's a task that uses the light sensor as an example of the sensor being used..