2021-04-01 16:21:24 +02:00
|
|
|
#include "gpioCallbacks.h"
|
2021-09-20 17:47:29 +02:00
|
|
|
#include "busConf.h"
|
2021-04-01 16:21:24 +02:00
|
|
|
#include <devices/gpioIds.h>
|
|
|
|
|
2021-08-03 15:58:01 +02:00
|
|
|
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
|
|
|
|
#include <fsfw_hal/common/gpio/GpioCookie.h>
|
2021-03-13 14:42:30 +01:00
|
|
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace gpioCallbacks {
|
|
|
|
|
|
|
|
GpioIF* gpioComInterface;
|
|
|
|
|
2021-05-03 11:59:33 +02:00
|
|
|
void initSpiCsDecoder(GpioIF* gpioComIF) {
|
2021-03-13 14:42:30 +01:00
|
|
|
|
|
|
|
ReturnValue_t result;
|
|
|
|
|
|
|
|
if (gpioComIF == nullptr) {
|
2021-05-03 11:59:33 +02:00
|
|
|
sif::debug << "initSpiCsDecoder: Invalid gpioComIF" << std::endl;
|
2021-03-13 14:42:30 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gpioComInterface = gpioComIF;
|
|
|
|
|
|
|
|
GpioCookie* spiMuxGpios = new GpioCookie;
|
2021-05-02 13:48:39 +02:00
|
|
|
|
2021-09-25 10:49:03 +02:00
|
|
|
GpiodRegularByLineName* spiMuxBit = nullptr;
|
2021-05-02 13:48:39 +02:00
|
|
|
/** Setting mux bit 1 to low will disable IC21 on the interface board */
|
2021-09-25 10:49:03 +02:00
|
|
|
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_1_PIN, "SPI Mux Bit 1",
|
2021-12-09 13:43:28 +01:00
|
|
|
gpio::DIR_OUT, gpio::HIGH);
|
2021-09-21 17:31:55 +02:00
|
|
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit);
|
2021-05-02 13:48:39 +02:00
|
|
|
/** Setting mux bit 2 to low disables IC1 on the TCS board */
|
2021-12-09 13:43:28 +01:00
|
|
|
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_2_PIN, "SPI Mux Bit 2",
|
|
|
|
gpio::DIR_OUT, gpio::HIGH);
|
2021-09-21 17:31:55 +02:00
|
|
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit);
|
2021-05-02 13:48:39 +02:00
|
|
|
/** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */
|
2021-12-09 13:43:28 +01:00
|
|
|
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_3_PIN, "SPI Mux Bit 3",
|
|
|
|
gpio::DIR_OUT, gpio::LOW);
|
2021-09-21 17:31:55 +02:00
|
|
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit);
|
2021-10-29 19:13:48 +02:00
|
|
|
|
|
|
|
// spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_1_PIN, "SPI Mux Bit 1",
|
|
|
|
// gpio::OUT, gpio::LOW);
|
|
|
|
// spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit);
|
|
|
|
// /** Setting mux bit 2 to low disables IC1 on the TCS board */
|
|
|
|
// spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_2_PIN, "SPI Mux Bit 2", gpio::OUT, gpio::HIGH);
|
|
|
|
// spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit);
|
|
|
|
// /** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */
|
|
|
|
// spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_3_PIN, "SPI Mux Bit 3", gpio::OUT, gpio::LOW);
|
|
|
|
// spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit);
|
|
|
|
|
2021-05-02 13:48:39 +02:00
|
|
|
/** The following gpios can take arbitrary initial values */
|
2021-12-09 13:43:28 +01:00
|
|
|
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_4_PIN, "SPI Mux Bit 4",
|
|
|
|
gpio::DIR_OUT, gpio::LOW);
|
2021-09-21 17:31:55 +02:00
|
|
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit);
|
2021-12-09 13:43:28 +01:00
|
|
|
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_5_PIN, "SPI Mux Bit 5",
|
|
|
|
gpio::DIR_OUT, gpio::LOW);
|
2021-09-21 17:31:55 +02:00
|
|
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit);
|
2021-12-09 13:43:28 +01:00
|
|
|
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_6_PIN, "SPI Mux Bit 6",
|
|
|
|
gpio::DIR_OUT, gpio::LOW);
|
2021-09-21 17:31:55 +02:00
|
|
|
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_6, spiMuxBit);
|
2021-09-25 10:49:03 +02:00
|
|
|
GpiodRegularByLineName* enRwDecoder = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_CS,
|
2021-12-09 13:43:28 +01:00
|
|
|
"EN_RW_CS", gpio::DIR_OUT, gpio::HIGH);
|
2021-06-21 17:15:19 +02:00
|
|
|
spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder);
|
2021-03-13 14:42:30 +01:00
|
|
|
|
|
|
|
result = gpioComInterface->addGpios(spiMuxGpios);
|
|
|
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
2021-06-21 17:15:19 +02:00
|
|
|
sif::error << "initSpiCsDecoder: Failed to add mux bit gpios to gpioComIF" << std::endl;
|
2021-03-13 14:42:30 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-27 10:51:47 +02:00
|
|
|
void spiCsDecoderCallback(gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Levels value,
|
2021-03-13 14:42:30 +01:00
|
|
|
void* args) {
|
|
|
|
|
|
|
|
if (gpioComInterface == nullptr) {
|
2021-05-07 18:48:42 +02:00
|
|
|
sif::debug << "spiCsDecoderCallback: No gpioComIF specified. Call initSpiCsDecoder "
|
2021-03-13 14:42:30 +01:00
|
|
|
<< "to specify gpioComIF" << std::endl;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-05-07 18:48:42 +02:00
|
|
|
/* Reading is not supported by the callback function */
|
2021-03-13 14:42:30 +01:00
|
|
|
if (gpioOp == gpio::GpioOperation::READ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-09-27 10:51:47 +02:00
|
|
|
if (value == gpio::HIGH) {
|
2021-10-29 19:13:48 +02:00
|
|
|
switch (gpioId) {
|
|
|
|
case(gpioIds::RTD_IC_3): {
|
|
|
|
disableDecoderTcsIc1();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::RTD_IC_4): {
|
|
|
|
disableDecoderTcsIc1();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::RTD_IC_5): {
|
|
|
|
disableDecoderTcsIc1();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::RTD_IC_6): {
|
|
|
|
disableDecoderTcsIc1();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::RTD_IC_7): {
|
|
|
|
disableDecoderTcsIc1();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::RTD_IC_8): {
|
|
|
|
disableDecoderTcsIc1();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::RTD_IC_9): {
|
|
|
|
disableDecoderTcsIc1();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::RTD_IC_10): {
|
|
|
|
disableDecoderTcsIc1();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::RTD_IC_11): {
|
|
|
|
disableDecoderTcsIc2();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::RTD_IC_12): {
|
|
|
|
disableDecoderTcsIc2();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::RTD_IC_13): {
|
|
|
|
disableDecoderTcsIc2();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::RTD_IC_14): {
|
|
|
|
disableDecoderTcsIc2();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::RTD_IC_15): {
|
|
|
|
disableDecoderTcsIc2();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::RTD_IC_16): {
|
|
|
|
disableDecoderTcsIc2();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::RTD_IC_17): {
|
|
|
|
disableDecoderTcsIc2();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::RTD_IC_18): {
|
|
|
|
disableDecoderTcsIc2();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_1): {
|
|
|
|
disableDecoderInterfaceBoardIc1();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_2): {
|
|
|
|
disableDecoderInterfaceBoardIc1();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_3): {
|
|
|
|
disableDecoderInterfaceBoardIc2();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_4): {
|
|
|
|
disableDecoderInterfaceBoardIc2();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_5): {
|
|
|
|
disableDecoderInterfaceBoardIc2();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_6): {
|
|
|
|
disableDecoderInterfaceBoardIc1();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_7): {
|
|
|
|
disableDecoderInterfaceBoardIc1();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_8): {
|
|
|
|
disableDecoderInterfaceBoardIc2();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_9): {
|
|
|
|
disableDecoderInterfaceBoardIc1();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_10): {
|
|
|
|
disableDecoderInterfaceBoardIc1();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_11): {
|
|
|
|
disableDecoderInterfaceBoardIc2();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_12): {
|
|
|
|
disableDecoderInterfaceBoardIc2();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_13): {
|
|
|
|
disableDecoderInterfaceBoardIc1();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_RW1): {
|
|
|
|
disableRwDecoder();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_RW2): {
|
|
|
|
disableRwDecoder();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_RW3): {
|
|
|
|
disableRwDecoder();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_RW4): {
|
|
|
|
disableRwDecoder();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
|
|
|
|
}
|
2021-03-13 14:42:30 +01:00
|
|
|
}
|
2021-09-27 10:51:47 +02:00
|
|
|
else if (value == gpio::LOW) {
|
2021-03-13 14:42:30 +01:00
|
|
|
switch (gpioId) {
|
2021-10-13 15:42:55 +02:00
|
|
|
case(gpioIds::RTD_IC_3): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY7();
|
2021-05-02 13:48:39 +02:00
|
|
|
enableDecoderTcsIc1();
|
2021-03-13 14:42:30 +01:00
|
|
|
break;
|
|
|
|
}
|
2021-10-13 15:42:55 +02:00
|
|
|
case(gpioIds::RTD_IC_4): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY6();
|
2021-05-02 13:48:39 +02:00
|
|
|
enableDecoderTcsIc1();
|
2021-03-13 14:42:30 +01:00
|
|
|
break;
|
|
|
|
}
|
2021-10-13 15:42:55 +02:00
|
|
|
case(gpioIds::RTD_IC_5): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY5();
|
2021-05-02 13:48:39 +02:00
|
|
|
enableDecoderTcsIc1();
|
2021-03-13 14:42:30 +01:00
|
|
|
break;
|
|
|
|
}
|
2021-10-13 15:42:55 +02:00
|
|
|
case(gpioIds::RTD_IC_6): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY4();
|
2021-05-02 13:48:39 +02:00
|
|
|
enableDecoderTcsIc1();
|
2021-03-13 14:42:30 +01:00
|
|
|
break;
|
|
|
|
}
|
2021-10-13 15:42:55 +02:00
|
|
|
case(gpioIds::RTD_IC_7): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY3();
|
2021-05-02 13:48:39 +02:00
|
|
|
enableDecoderTcsIc1();
|
2021-03-13 14:42:30 +01:00
|
|
|
break;
|
|
|
|
}
|
2021-10-13 15:42:55 +02:00
|
|
|
case(gpioIds::RTD_IC_8): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY2();
|
2021-05-02 13:48:39 +02:00
|
|
|
enableDecoderTcsIc1();
|
2021-03-13 14:42:30 +01:00
|
|
|
break;
|
|
|
|
}
|
2021-10-13 15:42:55 +02:00
|
|
|
case(gpioIds::RTD_IC_9): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY1();
|
2021-05-02 13:48:39 +02:00
|
|
|
enableDecoderTcsIc1();
|
2021-03-13 14:42:30 +01:00
|
|
|
break;
|
|
|
|
}
|
2021-10-13 15:42:55 +02:00
|
|
|
case(gpioIds::RTD_IC_10): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY0();
|
2021-05-02 13:48:39 +02:00
|
|
|
enableDecoderTcsIc1();
|
2021-03-13 14:42:30 +01:00
|
|
|
break;
|
|
|
|
}
|
2021-10-13 15:42:55 +02:00
|
|
|
case(gpioIds::RTD_IC_11): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY7();
|
2021-05-02 13:48:39 +02:00
|
|
|
enableDecoderTcsIc2();
|
2021-03-13 14:42:30 +01:00
|
|
|
break;
|
|
|
|
}
|
2021-10-13 15:42:55 +02:00
|
|
|
case(gpioIds::RTD_IC_12): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY6();
|
2021-05-02 13:48:39 +02:00
|
|
|
enableDecoderTcsIc2();
|
2021-03-13 14:42:30 +01:00
|
|
|
break;
|
|
|
|
}
|
2021-10-13 15:42:55 +02:00
|
|
|
case(gpioIds::RTD_IC_13): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY5();
|
2021-05-02 13:48:39 +02:00
|
|
|
enableDecoderTcsIc2();
|
2021-03-13 14:42:30 +01:00
|
|
|
break;
|
|
|
|
}
|
2021-10-13 15:42:55 +02:00
|
|
|
case(gpioIds::RTD_IC_14): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY4();
|
2021-05-02 13:48:39 +02:00
|
|
|
enableDecoderTcsIc2();
|
2021-03-13 14:42:30 +01:00
|
|
|
break;
|
|
|
|
}
|
2021-10-13 15:42:55 +02:00
|
|
|
case(gpioIds::RTD_IC_15): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY3();
|
2021-05-02 13:48:39 +02:00
|
|
|
enableDecoderTcsIc2();
|
2021-03-13 14:42:30 +01:00
|
|
|
break;
|
|
|
|
}
|
2021-10-13 15:42:55 +02:00
|
|
|
case(gpioIds::RTD_IC_16): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY2();
|
2021-05-02 13:48:39 +02:00
|
|
|
enableDecoderTcsIc2();
|
2021-03-13 14:42:30 +01:00
|
|
|
break;
|
|
|
|
}
|
2021-10-13 15:42:55 +02:00
|
|
|
case(gpioIds::RTD_IC_17): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY1();
|
2021-05-02 13:48:39 +02:00
|
|
|
enableDecoderTcsIc2();
|
2021-03-13 14:42:30 +01:00
|
|
|
break;
|
|
|
|
}
|
2021-10-13 15:42:55 +02:00
|
|
|
case(gpioIds::RTD_IC_18): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY0();
|
2021-05-02 13:48:39 +02:00
|
|
|
enableDecoderTcsIc2();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_1): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY0();
|
2021-05-07 18:48:42 +02:00
|
|
|
enableDecoderInterfaceBoardIc1();
|
2021-05-02 13:48:39 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_2): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY1();
|
2021-05-07 18:48:42 +02:00
|
|
|
enableDecoderInterfaceBoardIc1();
|
2021-05-03 11:59:33 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_3): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY0();
|
2021-05-07 18:48:42 +02:00
|
|
|
enableDecoderInterfaceBoardIc2();
|
2021-05-03 11:59:33 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_4): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY1();
|
2021-05-07 18:48:42 +02:00
|
|
|
enableDecoderInterfaceBoardIc2();
|
2021-05-03 11:59:33 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_5): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY2();
|
2021-05-07 18:48:42 +02:00
|
|
|
enableDecoderInterfaceBoardIc2();
|
2021-05-03 11:59:33 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_6): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY2();
|
2021-05-07 18:48:42 +02:00
|
|
|
enableDecoderInterfaceBoardIc1();
|
2021-05-03 11:59:33 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_7): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY3();
|
2021-05-07 18:48:42 +02:00
|
|
|
enableDecoderInterfaceBoardIc1();
|
2021-05-03 11:59:33 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_8): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY3();
|
2021-05-07 18:48:42 +02:00
|
|
|
enableDecoderInterfaceBoardIc2();
|
2021-05-03 11:59:33 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_9): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY4();
|
2021-05-07 18:48:42 +02:00
|
|
|
enableDecoderInterfaceBoardIc1();
|
2021-05-03 11:59:33 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_10): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY5();
|
2021-05-07 18:48:42 +02:00
|
|
|
enableDecoderInterfaceBoardIc1();
|
2021-05-03 11:59:33 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_11): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY4();
|
2021-05-07 18:48:42 +02:00
|
|
|
enableDecoderInterfaceBoardIc2();
|
2021-05-03 11:59:33 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_12): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY5();
|
2021-05-07 18:48:42 +02:00
|
|
|
enableDecoderInterfaceBoardIc2();
|
2021-05-03 11:59:33 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case(gpioIds::CS_SUS_13): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY6();
|
2021-05-07 18:48:42 +02:00
|
|
|
enableDecoderInterfaceBoardIc1();
|
2021-03-13 14:42:30 +01:00
|
|
|
break;
|
|
|
|
}
|
2021-06-24 12:04:36 +02:00
|
|
|
case(gpioIds::CS_RW1): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY0();
|
2021-06-21 17:15:19 +02:00
|
|
|
enableRwDecoder();
|
|
|
|
break;
|
|
|
|
}
|
2021-06-24 12:04:36 +02:00
|
|
|
case(gpioIds::CS_RW2): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY1();
|
2021-06-21 17:15:19 +02:00
|
|
|
enableRwDecoder();
|
|
|
|
break;
|
|
|
|
}
|
2021-06-24 12:04:36 +02:00
|
|
|
case(gpioIds::CS_RW3): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY2();
|
2021-06-21 17:15:19 +02:00
|
|
|
enableRwDecoder();
|
|
|
|
break;
|
|
|
|
}
|
2021-06-24 12:04:36 +02:00
|
|
|
case(gpioIds::CS_RW4): {
|
2021-10-29 19:13:48 +02:00
|
|
|
selectY3();
|
2021-06-21 17:15:19 +02:00
|
|
|
enableRwDecoder();
|
|
|
|
break;
|
|
|
|
}
|
2021-03-13 14:42:30 +01:00
|
|
|
default:
|
2021-05-03 11:59:33 +02:00
|
|
|
sif::debug << "spiCsDecoderCallback: Invalid gpio id " << gpioId << std::endl;
|
2021-03-13 14:42:30 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2021-05-03 11:59:33 +02:00
|
|
|
sif::debug << "spiCsDecoderCallback: Invalid value. Must be 0 or 1" << std::endl;
|
2021-03-13 14:42:30 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-02 13:48:39 +02:00
|
|
|
void enableDecoderTcsIc1() {
|
2021-05-03 11:59:33 +02:00
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
|
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
|
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
2021-05-02 13:48:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void enableDecoderTcsIc2() {
|
2021-10-29 19:13:48 +02:00
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
|
2021-05-03 11:59:33 +02:00
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
|
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
|
2021-05-02 13:48:39 +02:00
|
|
|
}
|
|
|
|
|
2021-05-07 18:48:42 +02:00
|
|
|
void enableDecoderInterfaceBoardIc1() {
|
2021-05-02 13:48:39 +02:00
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
|
|
|
}
|
|
|
|
|
2021-05-07 18:48:42 +02:00
|
|
|
void enableDecoderInterfaceBoardIc2() {
|
2021-05-03 11:59:33 +02:00
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
2021-10-29 19:13:48 +02:00
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
|
2021-05-03 11:59:33 +02:00
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_3);
|
2021-10-29 19:13:48 +02:00
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
2021-05-02 13:48:39 +02:00
|
|
|
}
|
|
|
|
|
2021-10-29 19:13:48 +02:00
|
|
|
void disableDecoderTcsIc1() {
|
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
|
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
|
|
|
}
|
|
|
|
|
|
|
|
void disableDecoderTcsIc2() {
|
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
2021-06-21 17:15:19 +02:00
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
2021-10-29 19:13:48 +02:00
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void disableDecoderInterfaceBoardIc1() {
|
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
|
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
|
|
|
}
|
|
|
|
|
|
|
|
void disableDecoderInterfaceBoardIc2() {
|
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_1);
|
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_2);
|
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
|
|
|
}
|
|
|
|
|
|
|
|
void enableRwDecoder() {
|
|
|
|
gpioComInterface->pullHigh(gpioIds::EN_RW_CS);
|
|
|
|
}
|
|
|
|
|
|
|
|
void disableRwDecoder() {
|
|
|
|
gpioComInterface->pullLow(gpioIds::EN_RW_CS);
|
2021-06-21 17:15:19 +02:00
|
|
|
}
|
|
|
|
|
2021-05-02 13:48:39 +02:00
|
|
|
void selectY0() {
|
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
|
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
|
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6);
|
|
|
|
}
|
|
|
|
|
|
|
|
void selectY1() {
|
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
|
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
|
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6);
|
|
|
|
}
|
|
|
|
|
|
|
|
void selectY2() {
|
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
|
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
|
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6);
|
|
|
|
}
|
|
|
|
|
|
|
|
void selectY3() {
|
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
|
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
|
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_6);
|
|
|
|
}
|
|
|
|
|
|
|
|
void selectY4() {
|
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
|
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
|
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
|
|
|
|
}
|
|
|
|
|
|
|
|
void selectY5() {
|
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
|
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_5);
|
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
|
|
|
|
}
|
|
|
|
|
|
|
|
void selectY6() {
|
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_4);
|
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
|
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
|
|
|
|
}
|
|
|
|
|
|
|
|
void selectY7() {
|
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_4);
|
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_5);
|
|
|
|
gpioComInterface->pullHigh(gpioIds::SPI_MUX_BIT_6);
|
|
|
|
}
|
|
|
|
|
2021-05-07 18:48:42 +02:00
|
|
|
void disableAllDecoder() {
|
2021-10-29 19:13:48 +02:00
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_3);
|
2021-05-07 18:48:42 +02:00
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_1);
|
|
|
|
gpioComInterface->pullLow(gpioIds::SPI_MUX_BIT_2);
|
2021-06-21 17:15:19 +02:00
|
|
|
gpioComInterface->pullLow(gpioIds::EN_RW_CS);
|
2021-05-07 18:48:42 +02:00
|
|
|
}
|
|
|
|
|
2021-03-13 14:42:30 +01:00
|
|
|
}
|