meier/openGpioByName #101

Merged
muellerr merged 7 commits from meier/openGpioByName into develop 2021-09-27 10:01:20 +02:00
4 changed files with 33 additions and 16 deletions
Showing only changes of commit 3a606fdfc4 - Show all commits

View File

@ -400,7 +400,8 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI
std::stringstream consumer; std::stringstream consumer;
GpiodRegularByLineName* gpio = nullptr; GpiodRegularByLineName* gpio = nullptr;
consumer << "0x" << std::hex << objects::GYRO_0_ADIS_HANDLER; consumer << "0x" << std::hex << objects::GYRO_0_ADIS_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ADIS_CS, consumer.str(), gpio::OUT, gpio::HIGH); gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ADIS_CS, consumer.str(),
gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio);
consumer.str(""); consumer.str("");
@ -856,19 +857,31 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
auto rwHandler1 = new RwHandler(objects::RW1, objects::SPI_COM_IF, rw1SpiCookie, gpioComIF, auto rwHandler1 = new RwHandler(objects::RW1, objects::SPI_COM_IF, rw1SpiCookie, gpioComIF,
gpioIds::EN_RW1); gpioIds::EN_RW1);
#if OBSW_DEBUG_RW == 1
rwHandler1->setStartUpImmediately();
#endif
rw1SpiCookie->setCallbackArgs(rwHandler1); rw1SpiCookie->setCallbackArgs(rwHandler1);
rwHandler1->setStartUpImmediately(); rwHandler1->setStartUpImmediately();
auto rwHandler2 = new RwHandler(objects::RW2, objects::SPI_COM_IF, rw2SpiCookie, gpioComIF, auto rwHandler2 = new RwHandler(objects::RW2, objects::SPI_COM_IF, rw2SpiCookie, gpioComIF,
gpioIds::EN_RW2); gpioIds::EN_RW2);
#if OBSW_DEBUG_RW == 1
rwHandler2->setStartUpImmediately();
#endif
rw2SpiCookie->setCallbackArgs(rwHandler2); rw2SpiCookie->setCallbackArgs(rwHandler2);
auto rwHandler3 = new RwHandler(objects::RW3, objects::SPI_COM_IF, rw3SpiCookie, gpioComIF, auto rwHandler3 = new RwHandler(objects::RW3, objects::SPI_COM_IF, rw3SpiCookie, gpioComIF,
gpioIds::EN_RW3); gpioIds::EN_RW3);
#if OBSW_DEBUG_RW == 1
rwHandler3->setStartUpImmediately();
#endif
rw3SpiCookie->setCallbackArgs(rwHandler3); rw3SpiCookie->setCallbackArgs(rwHandler3);
auto rwHandler4 = new RwHandler(objects::RW4, objects::SPI_COM_IF, rw4SpiCookie, gpioComIF, auto rwHandler4 = new RwHandler(objects::RW4, objects::SPI_COM_IF, rw4SpiCookie, gpioComIF,
gpioIds::EN_RW4); gpioIds::EN_RW4);
#if OBSW_DEBUG_RW == 1
rwHandler4->setStartUpImmediately();
#endif
rw4SpiCookie->setCallbackArgs(rwHandler4); rw4SpiCookie->setCallbackArgs(rwHandler4);
} }

View File

@ -60,10 +60,8 @@ ReturnValue_t GPSHyperionHandler::buildCommandFromCommand(
PoolReadGuard pg(&gpsSet); PoolReadGuard pg(&gpsSet);
// Set HK entries invalid // Set HK entries invalid
gpsSet.setValidity(false, true); gpsSet.setValidity(false, true);
// The user needs to implement this. Don't touch states for now, the device should resetCallback(resetCallbackArgs);
// quickly reboot and send valid strings again. return HasActionsIF::EXECUTION_FINISHED;
actionHelper.finish(true, getCommanderQueueId(deviceCommand), deviceCommand);
return resetCallback(resetCallbackArgs);
} }
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
} }
@ -210,3 +208,7 @@ ReturnValue_t GPSHyperionHandler::initialize() {
// Enable reply immediately for now // Enable reply immediately for now
return updatePeriodicReply(true, GpsHyperion::GPS_REPLY); return updatePeriodicReply(true, GpsHyperion::GPS_REPLY);
} }
ReturnValue_t GPSHyperionHandler::acceptExternalDeviceCommands() {
return DeviceHandlerBase::acceptExternalDeviceCommands();
}

View File

@ -22,6 +22,7 @@ public:
using gpioResetFunction_t = ReturnValue_t (*) (void* args); using gpioResetFunction_t = ReturnValue_t (*) (void* args);
void setResetPinTriggerFunction(gpioResetFunction_t resetCallback, void*args); void setResetPinTriggerFunction(gpioResetFunction_t resetCallback, void*args);
ReturnValue_t acceptExternalDeviceCommands() override;
ReturnValue_t initialize() override; ReturnValue_t initialize() override;
protected: protected:

View File

@ -144,47 +144,48 @@ void RwHandler::fillCommandAndReplyMap() {
ReturnValue_t RwHandler::scanForReply(const uint8_t *start, size_t remainingSize, ReturnValue_t RwHandler::scanForReply(const uint8_t *start, size_t remainingSize,
DeviceCommandId_t *foundId, size_t *foundLen) { DeviceCommandId_t *foundId, size_t *foundLen) {
uint8_t replyByte = *start;
switch (*(start)) { switch (replyByte) {
case (static_cast<uint8_t>(RwDefinitions::GET_LAST_RESET_STATUS)): { case (RwDefinitions::GET_LAST_RESET_STATUS): {
*foundLen = RwDefinitions::SIZE_GET_RESET_STATUS; *foundLen = RwDefinitions::SIZE_GET_RESET_STATUS;
*foundId = RwDefinitions::GET_LAST_RESET_STATUS; *foundId = RwDefinitions::GET_LAST_RESET_STATUS;
break; break;
} }
case (static_cast<uint8_t>(RwDefinitions::CLEAR_LAST_RESET_STATUS)): { case (RwDefinitions::CLEAR_LAST_RESET_STATUS): {
*foundLen = RwDefinitions::SIZE_CLEAR_RESET_STATUS; *foundLen = RwDefinitions::SIZE_CLEAR_RESET_STATUS;
*foundId = RwDefinitions::CLEAR_LAST_RESET_STATUS; *foundId = RwDefinitions::CLEAR_LAST_RESET_STATUS;
break; break;
} }
case (static_cast<uint8_t>(RwDefinitions::GET_RW_STATUS)): { case (RwDefinitions::GET_RW_STATUS): {
*foundLen = RwDefinitions::SIZE_GET_RW_STATUS; *foundLen = RwDefinitions::SIZE_GET_RW_STATUS;
*foundId = RwDefinitions::GET_RW_STATUS; *foundId = RwDefinitions::GET_RW_STATUS;
break; break;
} }
case (static_cast<uint8_t>(RwDefinitions::INIT_RW_CONTROLLER)): { case (RwDefinitions::INIT_RW_CONTROLLER): {
*foundLen = RwDefinitions::SIZE_INIT_RW; *foundLen = RwDefinitions::SIZE_INIT_RW;
*foundId = RwDefinitions::INIT_RW_CONTROLLER; *foundId = RwDefinitions::INIT_RW_CONTROLLER;
break; break;
} }
case (static_cast<uint8_t>(RwDefinitions::SET_SPEED)): { case (RwDefinitions::SET_SPEED): {
*foundLen = RwDefinitions::SIZE_SET_SPEED_REPLY; *foundLen = RwDefinitions::SIZE_SET_SPEED_REPLY;
*foundId = RwDefinitions::SET_SPEED; *foundId = RwDefinitions::SET_SPEED;
break; break;
} }
case (static_cast<uint8_t>(RwDefinitions::GET_TEMPERATURE)): { case (RwDefinitions::GET_TEMPERATURE): {
*foundLen = RwDefinitions::SIZE_GET_TEMPERATURE_REPLY; *foundLen = RwDefinitions::SIZE_GET_TEMPERATURE_REPLY;
*foundId = RwDefinitions::GET_TEMPERATURE; *foundId = RwDefinitions::GET_TEMPERATURE;
break; break;
} }
case (static_cast<uint8_t>(RwDefinitions::GET_TM)): { case (RwDefinitions::GET_TM): {
*foundLen = RwDefinitions::SIZE_GET_TELEMETRY_REPLY; *foundLen = RwDefinitions::SIZE_GET_TELEMETRY_REPLY;
*foundId = RwDefinitions::GET_TM; *foundId = RwDefinitions::GET_TM;
break; break;
} }
default: { default: {
sif::debug << "RwHandler::scanForReply: Reply contains invalid command code" << std::endl; sif::warning << "RwHandler::scanForReply: Reply contains invalid command code" <<
std::endl;
*foundLen = remainingSize;
return RETURN_FAILED; return RETURN_FAILED;
break;
} }
} }