eive-obsw/bsp_q7s/spiCallbacks/rwSpiCallback.h

31 lines
1.2 KiB
C

#ifndef BSP_Q7S_RW_SPI_CALLBACK_H_
#define BSP_Q7S_RW_SPI_CALLBACK_H_
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <fsfw_hal/linux/spi/SpiComIF.h>
/**
* @brief This is the callback function to send commands to the nano avionics reaction wheels and
* receive the replies.
*
* @details The data to sent are additionally encoded according to the HDLC framing defined in the
* datasheet of the reaction wheels:
* https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/
* Arbeitsdaten/08_Used%20Components/Nanoavionics_Reactionwheels&fileid=181622
* Each command entails exactly one reply which will also be read in and decoded by this
* function.
*/
ReturnValue_t rwSpiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sendData,
size_t sendLen, void* args);
/**
* @brief This function closes a spi session. Pulls the chip select to high an releases the
* mutex.
* @param gpioId Gpio ID of chip select
* @param gpioIF Pointer to gpio interface to drive the chip select
* @param mutex The spi mutex
*/
void closeSpi(gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex);
#endif /* BSP_Q7S_RW_SPI_CALLBACK_H_ */