I am not sure the best way to do this in the FreeRTOS/PIC32MX795H world. I want to check a pin and set a pin every 500 microseconds. I looked at xTimerPendFunctionCallFromISR() but I am not sure how it works. I have 2 FreeRTOS books, Using the FreeRTOS Kernel and FreeRTOS User Manual and I don’t see anything about how to integrate this into my project. What is the best practices for this?
If that is all you want to do, and the interrupt service routine is not
interacting the the kernel at all, then I would suggest configuring a
peripheral timer on the PIC32 to generate an interrupt ever 500us and
install a handler for the interrupt that does the necessary as quickly
as possible. Provided you are not interacting with the kernel you can
set the priority of the interrupt above
configMAX_SYSCALL_INTERRUPT_PRIORITY to ensure it never gets disabled by
the kernel https://www.freertos.org/port_PIC32_MIPS_MK4.html#ConfigAndUsage
Configure it on a separate timer as a normal interrupt in any software
project. This does not have to run via FreeRTOS. In case you need to
interact with RTOS related stuff, you can do so with the xxxFromISR()
family of functions.