some doc added
This commit is contained in:
parent
836296b3af
commit
3c19e0f9eb
@ -50,7 +50,7 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform a regular send operation using Linux iotcl. This is public so it can be used
|
* Perform a regular send operation using Linux iotcl. This is public so it can be used
|
||||||
* in the user callback if special handling is only necessary for certain commands.
|
* in functions like a user callback if special handling is only necessary for certain commands.
|
||||||
* @param spiCookie
|
* @param spiCookie
|
||||||
* @param sendData
|
* @param sendData
|
||||||
* @param sendLen
|
* @param sendLen
|
||||||
|
@ -12,18 +12,19 @@ SpiCookie::SpiCookie(address_t spiAddress, std::string spiDev, const size_t maxS
|
|||||||
SpiCookie(spiAddress, gpio::NO_GPIO, spiDev, maxSize, spiMode, spiSpeed) {
|
SpiCookie(spiAddress, gpio::NO_GPIO, spiDev, maxSize, spiMode, spiSpeed) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SpiCookie::SpiCookie(address_t spiAddress, gpioId_t chipSelect, std::string spiDev, const size_t maxSize,
|
SpiCookie::SpiCookie(address_t spiAddress, gpioId_t chipSelect, std::string spiDev,
|
||||||
spi::SpiModes spiMode, uint32_t spiSpeed, spi::send_callback_function_t callback, void *args):
|
const size_t maxSize, spi::SpiModes spiMode, uint32_t spiSpeed,
|
||||||
|
spi::send_callback_function_t callback, void *args):
|
||||||
SpiCookie(spi::SpiComIfModes::CALLBACK, spiAddress, chipSelect, spiDev, maxSize,
|
SpiCookie(spi::SpiComIfModes::CALLBACK, spiAddress, chipSelect, spiDev, maxSize,
|
||||||
spiMode, spiSpeed, callback, args) {
|
spiMode, spiSpeed, callback, args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SpiCookie::SpiCookie(spi::SpiComIfModes comIfMode, address_t spiAddress, gpioId_t chipSelect,
|
SpiCookie::SpiCookie(spi::SpiComIfModes comIfMode, address_t spiAddress, gpioId_t chipSelect,
|
||||||
std::string spiDev, const size_t maxSize, spi::SpiModes spiMode, uint32_t spiSpeed,
|
std::string spiDev, const size_t maxSize, spi::SpiModes spiMode, uint32_t spiSpeed,
|
||||||
spi::send_callback_function_t callback, void* args): spiAddress(spiAddress),
|
spi::send_callback_function_t callback, void* args):
|
||||||
chipSelectPin(chipSelect), spiDevice(spiDev), comIfMode(comIfMode),
|
spiAddress(spiAddress), chipSelectPin(chipSelect), spiDevice(spiDev),
|
||||||
maxSize(maxSize), spiMode(spiMode), spiSpeed(spiSpeed), sendCallback(callback),
|
comIfMode(comIfMode), maxSize(maxSize), spiMode(spiMode), spiSpeed(spiSpeed),
|
||||||
callbackArgs(args) {
|
sendCallback(callback), callbackArgs(args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
spi::SpiComIfModes SpiCookie::getComIfMode() const {
|
spi::SpiComIfModes SpiCookie::getComIfMode() const {
|
||||||
|
@ -6,6 +6,17 @@
|
|||||||
#include <fsfw_hal/common/gpio/gpioDefinitions.h>
|
#include <fsfw_hal/common/gpio/gpioDefinitions.h>
|
||||||
#include <linux/spi/spidev.h>
|
#include <linux/spi/spidev.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This cookie class is passed to the SPI communication interface
|
||||||
|
* @details
|
||||||
|
* This cookie contains device specific properties like speed and SPI mode or the SPI transfer
|
||||||
|
* struct required by the Linux SPI driver. It also contains a handle to a GPIO interface
|
||||||
|
* to perform slave select switching when necessary.
|
||||||
|
*
|
||||||
|
* The user can specify gpio::NO_GPIO as the GPIO ID or use a custom send callback to meet
|
||||||
|
* special requirements like expander slave select switching (e.g. GPIO or I2C expander)
|
||||||
|
* or special timing related requirements.
|
||||||
|
*/
|
||||||
class SpiCookie: public CookieIF {
|
class SpiCookie: public CookieIF {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@ -32,8 +43,14 @@ public:
|
|||||||
* function here or by using the setter function #setCallbackMode
|
* function here or by using the setter function #setCallbackMode
|
||||||
*/
|
*/
|
||||||
SpiCookie(address_t spiAddress, gpioId_t chipSelect, std::string spiDev, const size_t maxSize,
|
SpiCookie(address_t spiAddress, gpioId_t chipSelect, std::string spiDev, const size_t maxSize,
|
||||||
spi::SpiModes spiMode, uint32_t spiSpeed, spi::send_callback_function_t callback, void *args);
|
spi::SpiModes spiMode, uint32_t spiSpeed, spi::send_callback_function_t callback,
|
||||||
|
void *args);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the callback function
|
||||||
|
* @param callback
|
||||||
|
* @param args
|
||||||
|
*/
|
||||||
void getCallback(spi::send_callback_function_t* callback, void** args);
|
void getCallback(spi::send_callback_function_t* callback, void** args);
|
||||||
|
|
||||||
address_t getSpiAddress() const;
|
address_t getSpiAddress() const;
|
||||||
@ -48,6 +65,12 @@ public:
|
|||||||
/** Enables changing the SPI mode at run-time */
|
/** Enables changing the SPI mode at run-time */
|
||||||
void setSpiMode(spi::SpiModes newMode);
|
void setSpiMode(spi::SpiModes newMode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the SPI to callback mode and assigns the user supplied callback and an argument
|
||||||
|
* passed to the callback.
|
||||||
|
* @param callback
|
||||||
|
* @param args
|
||||||
|
*/
|
||||||
void setCallbackMode(spi::send_callback_function_t callback, void* args);
|
void setCallbackMode(spi::send_callback_function_t callback, void* args);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user