meier/ReactionWheelHandler #51
@ -551,9 +551,19 @@ 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;
|
||||||
GpiodRegular* rw1ChipSelect = new GpiodRegular(std::string("gpiochip5"), 7,
|
GpioCallback* csRw1 = new GpioCallback(std::string("Chip select reaction wheel 1"), gpio::OUT,
|
||||||
std::string("Chip Select RW 1"), gpio::OUT, 1);
|
1, &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
||||||
gpioCookieRw->addGpio(gpioIds::RW1, rw1ChipSelect);
|
gpioCookieRw->addGpio(gpioIds::EN_RW1, csRw1);
|
||||||
|
GpioCallback* csRw2 = new GpioCallback(std::string("Chip select reaction wheel 2"), gpio::OUT,
|
||||||
|
1, &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
||||||
|
gpioCookieRw->addGpio(gpioIds::EN_RW2, csRw2);
|
||||||
|
GpioCallback* csRw3 = new GpioCallback(std::string("Chip select reaction wheel 3"), gpio::OUT,
|
||||||
|
1, &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
||||||
|
gpioCookieRw->addGpio(gpioIds::EN_RW3, csRw3);
|
||||||
|
GpioCallback* csRw4 = new GpioCallback(std::string("Chip select reaction wheel 4"), gpio::OUT,
|
||||||
|
1, &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
||||||
|
gpioCookieRw->addGpio(gpioIds::EN_RW4, csRw4);
|
||||||
|
|
||||||
gpioComIF->addGpios(gpioCookieRw);
|
gpioComIF->addGpios(gpioCookieRw);
|
||||||
|
|
||||||
auto rw1SpiCookie = new SpiCookie(addresses::RW1, gpioIds::RW1, "/dev/spidev2.0",
|
auto rw1SpiCookie = new SpiCookie(addresses::RW1, gpioIds::RW1, "/dev/spidev2.0",
|
||||||
|
@ -45,11 +45,13 @@ void initSpiCsDecoder(GpioIF* gpioComIF) {
|
|||||||
GpiodRegular* spiMuxBit6 = new GpiodRegular(std::string("gpiochip7"), 18,
|
GpiodRegular* spiMuxBit6 = new GpiodRegular(std::string("gpiochip7"), 18,
|
||||||
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,
|
||||||
|
std::string("EN_RW_CS"), gpio::OUT, 0);
|
||||||
|
spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder);
|
||||||
|
|
||||||
result = gpioComInterface->addGpios(spiMuxGpios);
|
result = gpioComInterface->addGpios(spiMuxGpios);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
sif::error << "initSpiCsDecoder: Failed to add mux bit gpios to gpioComIF"
|
sif::error << "initSpiCsDecoder: Failed to add mux bit gpios to gpioComIF" << std::endl;
|
||||||
<< std::endl;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -218,6 +220,26 @@ void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, int value
|
|||||||
selectY6();
|
selectY6();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case(gpioIds::EN_RW1): {
|
||||||
|
enableRwDecoder();
|
||||||
|
selectY0();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::EN_RW2): {
|
||||||
|
enableRwDecoder();
|
||||||
|
selectY1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::EN_RW3): {
|
||||||
|
enableRwDecoder();
|
||||||
|
selectY3();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(gpioIds::EN_RW4): {
|
||||||
|
enableRwDecoder();
|
||||||
|
selectY4();
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
|
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
|
||||||
}
|
}
|
||||||
@ -251,6 +273,13 @@ void enableDecoderInterfaceBoardIc2() {
|
|||||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void enableRwDecoder() {
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
||||||
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
||||||
|
gpioComInterface->pullHigh(gpioIds::EN_RW_CS);
|
||||||
|
}
|
||||||
|
|
||||||
void selectY0() {
|
void selectY0() {
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
|
||||||
@ -303,6 +332,7 @@ void disableAllDecoder() {
|
|||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
||||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
||||||
|
gpioComInterface->pullLow(gpioIds::EN_RW_CS);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,11 @@ namespace gpioCallbacks {
|
|||||||
*/
|
*/
|
||||||
void enableDecoderInterfaceBoardIc2();
|
void enableDecoderInterfaceBoardIc2();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the reaction wheel chip select decoder (IC3).
|
||||||
|
*/
|
||||||
|
void enableRwDecoder();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function disables all decoder.
|
* @brief This function disables all decoder.
|
||||||
*/
|
*/
|
||||||
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
|||||||
Subproject commit d700fb551c85393b58a3ada96fbd3f807217d14b
|
Subproject commit cae69d540097acba46bffa47fd7afc6a8a19bd15
|
2
fsfw_hal
2
fsfw_hal
@ -1 +1 @@
|
|||||||
Subproject commit ae322d981bd1ed8411a058ba6b4dc185f00a12f3
|
Subproject commit 8fe5d0afa0857025d9dee3c6f266c2503a22c517
|
@ -70,10 +70,11 @@ namespace gpioIds {
|
|||||||
PAPB_BUSY_N,
|
PAPB_BUSY_N,
|
||||||
PAPB_EMPTY,
|
PAPB_EMPTY,
|
||||||
|
|
||||||
RW1,
|
EN_RW1,
|
||||||
RW2,
|
EN_RW2,
|
||||||
RW3,
|
EN_RW3,
|
||||||
RW4
|
EN_RW4,
|
||||||
|
EN_RW_CS
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user