save before making change in spicomif
This commit is contained in:
@ -156,16 +156,12 @@ void ObjectFactory::produce(){
|
||||
gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, chipSelectRadSensor);
|
||||
gpioComIF->addGpios(gpioCookieRadSensor);
|
||||
|
||||
// SpiCookie* spiCookieRadSensor = new SpiCookie(addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR,
|
||||
// std::string("/dev/spidev2.0"), RAD_SENSOR::READ_SIZE, spi::DEFAULT_MAX_1227_MODE,
|
||||
// spi::DEFAULT_MAX_1227_SPEED);
|
||||
SpiCookie* spiCookieRadSensor = new SpiCookie(addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR,
|
||||
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
|
||||
std::string("/dev/spidev2.0"), RAD_SENSOR::READ_SIZE, spi::DEFAULT_MAX_1227_MODE,
|
||||
spi::DEFAULT_MAX_1227_SPEED);
|
||||
// RadiationSensorHandler* radSensor = new RadiationSensorHandler(objects::RAD_SENSOR,
|
||||
// objects::SPI_COM_IF, spiCookieRadSensor);
|
||||
// (void) radSensor;
|
||||
// radSensor->setStartUpImmediately();
|
||||
RadiationSensorHandler* radSensor = new RadiationSensorHandler(objects::RAD_SENSOR,
|
||||
objects::SPI_COM_IF, spiCookieRadSensor);
|
||||
(void) radSensor;
|
||||
|
||||
GpioCookie* gpioCookieSus = new GpioCookie();
|
||||
|
||||
@ -251,33 +247,45 @@ void ObjectFactory::produce(){
|
||||
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
|
||||
spi::DEFAULT_MAX_1227_SPEED);
|
||||
|
||||
SusHandler* sus1 = new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus1);
|
||||
SusHandler* sus1 = new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus1, gpioComIF,
|
||||
gpioIds::CS_SUS_1);
|
||||
// sus1->setStartUpImmediately();
|
||||
(void) sus1;
|
||||
|
||||
SusHandler* sus2 = new SusHandler(objects::SUS_2, objects::SPI_COM_IF, spiCookieSus2);
|
||||
// sus2->setStartUpImmediately();
|
||||
SusHandler* sus2 = new SusHandler(objects::SUS_2, objects::SPI_COM_IF, spiCookieSus2, gpioComIF,
|
||||
gpioIds::CS_SUS_2);
|
||||
sus2->setStartUpImmediately();
|
||||
(void) sus2;
|
||||
|
||||
SusHandler* sus3 = new SusHandler(objects::SUS_3, objects::SPI_COM_IF, spiCookieSus3);
|
||||
SusHandler* sus3 = new SusHandler(objects::SUS_3, objects::SPI_COM_IF, spiCookieSus3, gpioComIF,
|
||||
gpioIds::CS_SUS_3);
|
||||
sus3->setStartUpImmediately();
|
||||
(void) sus3;
|
||||
|
||||
new SusHandler(objects::SUS_4, objects::SPI_COM_IF, spiCookieSus4);
|
||||
new SusHandler(objects::SUS_5, objects::SPI_COM_IF, spiCookieSus5);
|
||||
new SusHandler(objects::SUS_6, objects::SPI_COM_IF, spiCookieSus6);
|
||||
new SusHandler(objects::SUS_7, objects::SPI_COM_IF, spiCookieSus7);
|
||||
SusHandler* sus8 = new SusHandler(objects::SUS_8, objects::SPI_COM_IF, spiCookieSus8);
|
||||
// sus8->setStartUpImmediately();
|
||||
(void) sus8;
|
||||
new SusHandler(objects::SUS_4, objects::SPI_COM_IF, spiCookieSus4, gpioComIF,
|
||||
gpioIds::CS_SUS_4);
|
||||
new SusHandler(objects::SUS_5, objects::SPI_COM_IF, spiCookieSus5, gpioComIF,
|
||||
gpioIds::CS_SUS_5);
|
||||
new SusHandler(objects::SUS_6, objects::SPI_COM_IF, spiCookieSus6, gpioComIF,
|
||||
gpioIds::CS_SUS_6);
|
||||
new SusHandler(objects::SUS_7, objects::SPI_COM_IF, spiCookieSus7, gpioComIF,
|
||||
gpioIds::CS_SUS_7);
|
||||
SusHandler* sus8 = new SusHandler(objects::SUS_8, objects::SPI_COM_IF, spiCookieSus8, gpioComIF,
|
||||
gpioIds::CS_SUS_8);
|
||||
sus8->setStartUpImmediately();
|
||||
|
||||
new SusHandler(objects::SUS_9, objects::SPI_COM_IF, spiCookieSus9);
|
||||
new SusHandler(objects::SUS_10, objects::SPI_COM_IF, spiCookieSus10);
|
||||
SusHandler* sus11 = new SusHandler(objects::SUS_11, objects::SPI_COM_IF, spiCookieRadSensor);
|
||||
new SusHandler(objects::SUS_9, objects::SPI_COM_IF, spiCookieSus9, gpioComIF,
|
||||
gpioIds::CS_SUS_9);
|
||||
new SusHandler(objects::SUS_10, objects::SPI_COM_IF, spiCookieSus10, gpioComIF,
|
||||
gpioIds::CS_SUS_10);
|
||||
SusHandler* sus11 = new SusHandler(objects::SUS_11, objects::SPI_COM_IF, spiCookieSus11,
|
||||
gpioComIF, gpioIds::CS_SUS_11);
|
||||
sus11->setStartUpImmediately();
|
||||
|
||||
new SusHandler(objects::SUS_12, objects::SPI_COM_IF, spiCookieSus12);
|
||||
new SusHandler(objects::SUS_13, objects::SPI_COM_IF, spiCookieSus13);
|
||||
new SusHandler(objects::SUS_12, objects::SPI_COM_IF, spiCookieSus12, gpioComIF,
|
||||
gpioIds::CS_SUS_12);
|
||||
new SusHandler(objects::SUS_13, objects::SPI_COM_IF, spiCookieSus13, gpioComIF,
|
||||
gpioIds::CS_SUS_13);
|
||||
|
||||
#if OBSW_ADD_ACS_BOARD == 1
|
||||
GpioCookie* gpioCookieAcsBoard = new GpioCookie();
|
||||
@ -592,7 +600,8 @@ void ObjectFactory::produce(){
|
||||
std::string("/dev/spidev1.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
|
||||
spi::DEFAULT_MAX_1227_SPEED);
|
||||
|
||||
SusHandler* sus1 = new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus);
|
||||
SusHandler* sus1 = new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus, gpioComIF,
|
||||
gpioIds::CS_SUS_1);
|
||||
sus1->setStartUpImmediately();
|
||||
#endif
|
||||
|
||||
|
@ -58,19 +58,18 @@ void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, int value
|
||||
void* args) {
|
||||
|
||||
if (gpioComInterface == nullptr) {
|
||||
sif::debug << "tcsBoardDecoderCallback: No gpioComIF specified. Call initTcsBoardDecoder "
|
||||
sif::debug << "spiCsDecoderCallback: No gpioComIF specified. Call initSpiCsDecoder "
|
||||
<< "to specify gpioComIF" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Read is not supported by the callback function */
|
||||
/* Reading is not supported by the callback function */
|
||||
if (gpioOp == gpio::GpioOperation::READ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (value == 1) {
|
||||
/* This will pull all 16 decoder outputs to high */
|
||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
||||
disableAllDecoder();
|
||||
}
|
||||
else if (value == 0) {
|
||||
switch (gpioId) {
|
||||
@ -155,70 +154,70 @@ void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, int value
|
||||
break;
|
||||
}
|
||||
case(gpioIds::CS_SUS_1): {
|
||||
enableDecoderInterfaceBoardIc21();
|
||||
enableDecoderInterfaceBoardIc1();
|
||||
selectY0();
|
||||
break;
|
||||
}
|
||||
case(gpioIds::CS_SUS_2): {
|
||||
enableDecoderInterfaceBoardIc21();
|
||||
enableDecoderInterfaceBoardIc1();
|
||||
selectY1();
|
||||
break;
|
||||
}
|
||||
case(gpioIds::CS_SUS_3): {
|
||||
enableDecoderInterfaceBoardIc21();
|
||||
selectY2();
|
||||
break;
|
||||
}
|
||||
case(gpioIds::CS_SUS_4): {
|
||||
enableDecoderInterfaceBoardIc21();
|
||||
selectY3();
|
||||
break;
|
||||
}
|
||||
case(gpioIds::CS_SUS_5): {
|
||||
enableDecoderInterfaceBoardIc21();
|
||||
selectY4();
|
||||
break;
|
||||
}
|
||||
case(gpioIds::CS_SUS_6): {
|
||||
enableDecoderInterfaceBoardIc21();
|
||||
selectY5();
|
||||
break;
|
||||
}
|
||||
case(gpioIds::CS_SUS_7): {
|
||||
enableDecoderInterfaceBoardIc21();
|
||||
selectY6();
|
||||
break;
|
||||
}
|
||||
case(gpioIds::CS_SUS_8): {
|
||||
enableDecoderInterfaceBoardIc22();
|
||||
enableDecoderInterfaceBoardIc2();
|
||||
selectY0();
|
||||
break;
|
||||
}
|
||||
case(gpioIds::CS_SUS_9): {
|
||||
enableDecoderInterfaceBoardIc22();
|
||||
case(gpioIds::CS_SUS_4): {
|
||||
enableDecoderInterfaceBoardIc2();
|
||||
selectY1();
|
||||
break;
|
||||
}
|
||||
case(gpioIds::CS_SUS_10): {
|
||||
enableDecoderInterfaceBoardIc22();
|
||||
case(gpioIds::CS_SUS_5): {
|
||||
enableDecoderInterfaceBoardIc2();
|
||||
selectY2();
|
||||
break;
|
||||
}
|
||||
case(gpioIds::CS_SUS_11): {
|
||||
enableDecoderInterfaceBoardIc22();
|
||||
case(gpioIds::CS_SUS_6): {
|
||||
enableDecoderInterfaceBoardIc1();
|
||||
selectY2();
|
||||
break;
|
||||
}
|
||||
case(gpioIds::CS_SUS_7): {
|
||||
enableDecoderInterfaceBoardIc1();
|
||||
selectY3();
|
||||
break;
|
||||
}
|
||||
case(gpioIds::CS_SUS_12): {
|
||||
enableDecoderInterfaceBoardIc22();
|
||||
case(gpioIds::CS_SUS_8): {
|
||||
enableDecoderInterfaceBoardIc2();
|
||||
selectY3();
|
||||
break;
|
||||
}
|
||||
case(gpioIds::CS_SUS_9): {
|
||||
enableDecoderInterfaceBoardIc1();
|
||||
selectY4();
|
||||
break;
|
||||
}
|
||||
case(gpioIds::CS_SUS_13): {
|
||||
enableDecoderInterfaceBoardIc22();
|
||||
case(gpioIds::CS_SUS_10): {
|
||||
enableDecoderInterfaceBoardIc1();
|
||||
selectY5();
|
||||
break;
|
||||
}
|
||||
case(gpioIds::CS_SUS_11): {
|
||||
enableDecoderInterfaceBoardIc2();
|
||||
selectY4();
|
||||
break;
|
||||
}
|
||||
case(gpioIds::CS_SUS_12): {
|
||||
enableDecoderInterfaceBoardIc2();
|
||||
selectY5();
|
||||
break;
|
||||
}
|
||||
case(gpioIds::CS_SUS_13): {
|
||||
enableDecoderInterfaceBoardIc1();
|
||||
selectY6();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
|
||||
}
|
||||
@ -240,13 +239,13 @@ void enableDecoderTcsIc2() {
|
||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
|
||||
}
|
||||
|
||||
void enableDecoderInterfaceBoardIc21() {
|
||||
void enableDecoderInterfaceBoardIc1() {
|
||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
||||
}
|
||||
|
||||
void enableDecoderInterfaceBoardIc22() {
|
||||
void enableDecoderInterfaceBoardIc2() {
|
||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
|
||||
@ -300,4 +299,10 @@ void selectY7() {
|
||||
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
|
||||
}
|
||||
|
||||
void disableAllDecoder() {
|
||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
|
||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
||||
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,13 +35,18 @@ namespace gpioCallbacks {
|
||||
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
|
||||
* on the inteface board board which is named to IC21 in the schematic.
|
||||
*/
|
||||
void enableDecoderInterfaceBoardIc21();
|
||||
void enableDecoderInterfaceBoardIc1();
|
||||
|
||||
/**
|
||||
* @brief This function sets mux bits 1-3 to a state which will only enable the decoder
|
||||
* on the inteface board board which is named to IC22 in the schematic.
|
||||
*/
|
||||
void enableDecoderInterfaceBoardIc22();
|
||||
void enableDecoderInterfaceBoardIc2();
|
||||
|
||||
/**
|
||||
* @brief This function disables all decoder.
|
||||
*/
|
||||
void disableAllDecoder();
|
||||
|
||||
/** The following functions enable the appropriate channel of the currently enabled decoder */
|
||||
void selectY0();
|
||||
|
Reference in New Issue
Block a user