meier/ReactionWheelHandler #51

Merged
muellerr merged 37 commits from meier/ReactionWheelHandler into develop 2021-07-05 15:40:42 +02:00
4 changed files with 30 additions and 15 deletions
Showing only changes of commit 88181d8fb4 - Show all commits

View File

@ -552,18 +552,18 @@ void ObjectFactory::produce(void* args){
new PlocHandler(objects::PLOC_HANDLER, objects::UART_COM_IF, plocUartCookie); new PlocHandler(objects::PLOC_HANDLER, objects::UART_COM_IF, plocUartCookie);
GpioCookie* gpioCookieRw = new GpioCookie; GpioCookie* gpioCookieRw = new GpioCookie;
GpioCallback* csRw1 = new GpioCallback(std::string("Chip select reaction wheel 1"), gpio::OUT, GpioCallback* enRw1 = new GpioCallback(std::string("Chip select reaction wheel 1"), gpio::OUT,
1, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); 1, &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::EN_RW1, csRw1); gpioCookieRw->addGpio(gpioIds::EN_RW1, enRw1);
GpioCallback* csRw2 = new GpioCallback(std::string("Chip select reaction wheel 2"), gpio::OUT, GpioCallback* enRw2 = new GpioCallback(std::string("Chip select reaction wheel 2"), gpio::OUT,
1, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); 1, &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::EN_RW2, csRw2); gpioCookieRw->addGpio(gpioIds::EN_RW2, enRw2);
GpioCallback* csRw3 = new GpioCallback(std::string("Chip select reaction wheel 3"), gpio::OUT, GpioCallback* enRw3 = new GpioCallback(std::string("Chip select reaction wheel 3"), gpio::OUT,
1, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); 1, &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::EN_RW3, csRw3); gpioCookieRw->addGpio(gpioIds::EN_RW3, enRw3);
GpioCallback* csRw4 = new GpioCallback(std::string("Chip select reaction wheel 4"), gpio::OUT, GpioCallback* enRw4 = new GpioCallback(std::string("Chip select reaction wheel 4"), gpio::OUT,
1, &gpioCallbacks::spiCsDecoderCallback, gpioComIF); 1, &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::EN_RW4, csRw4); gpioCookieRw->addGpio(gpioIds::EN_RW4, enRw4);
gpioComIF->addGpios(gpioCookieRw); gpioComIF->addGpios(gpioCookieRw);

View File

@ -46,7 +46,7 @@ void initSpiCsDecoder(GpioIF* gpioComIF) {
std::string("SPI Mux Bit 6"), gpio::OUT, 0); std::string("SPI Mux Bit 6"), gpio::OUT, 0);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_6, spiMuxBit6); spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_6, spiMuxBit6);
GpiodRegular* enRwDecoder = new GpiodRegular(std::string("gpiochip5"), 17, GpiodRegular* enRwDecoder = new GpiodRegular(std::string("gpiochip5"), 17,
std::string("EN_RW_CS"), gpio::OUT, 0); std::string("EN_RW_CS"), gpio::OUT, 1);
spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder); spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder);
result = gpioComInterface->addGpios(spiMuxGpios); result = gpioComInterface->addGpios(spiMuxGpios);

View File

@ -4,11 +4,15 @@
#include <fsfw/globalfunctions/CRC.h> #include <fsfw/globalfunctions/CRC.h>
#include <fsfw/datapool/PoolReadGuard.h> #include <fsfw/datapool/PoolReadGuard.h>
RwHandler::RwHandler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie) : RwHandler::RwHandler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie,
DeviceHandlerBase(objectId, comIF, comCookie), temperatureSet(this), statusSet(this) { LinuxLibgpioIF* gpioComIF, gpioId_t enableGpio) :
if (comCookie == NULL) { DeviceHandlerBase(objectId, comIF, comCookie), temperatureSet(this), statusSet(this) {
sif::error << "RwHandler: Invalid com cookie" << std::endl; if (comCookie == NULL) {
} sif::error << "RwHandler: Invalid com cookie" << std::endl;
}
if (gpioComIF == NULL) {
sif::error << "RwHandler: Invalid gpio communication interface" << std::endl;
}
} }
RwHandler::~RwHandler() { RwHandler::~RwHandler() {

View File

@ -18,7 +18,18 @@
class RwHandler: public DeviceHandlerBase { class RwHandler: public DeviceHandlerBase {
public: public:
RwHandler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie); /**
* @brief Constructor
*
* @param objectId
* @param comIF
* @param comCookie
* @param gpioComIF Pointer to gpio communication interface
* @param enablePin GPIO connected to the enable pin of the reaction wheels. Must be pulled
* to high to enable the device.
*/
RwHandler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie,
LinuxLibgpioIF* gpioComIF, gpioId_t enableGpio);
virtual ~RwHandler(); virtual ~RwHandler();
static const uint8_t INTERFACE_ID = CLASS_ID::RW_HANDLER; static const uint8_t INTERFACE_ID = CLASS_ID::RW_HANDLER;