2022-10-25 00:21:40 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SCSI Target Emulator RaSCSI Reloaded
|
|
|
|
// for Raspberry Pi
|
|
|
|
//
|
|
|
|
// Copyright (C) 2022 akuker
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "hal/gpiobus_factory.h"
|
2022-11-09 07:40:26 +00:00
|
|
|
#include "hal/gpiobus.h"
|
2022-10-25 00:21:40 +00:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
2022-11-09 07:40:26 +00:00
|
|
|
unique_ptr<BUS> GPIOBUS_Factory::Create(BUS::mode_e mode)
|
2022-10-25 00:21:40 +00:00
|
|
|
{
|
2022-11-09 07:40:26 +00:00
|
|
|
// TODO Make the factory a friend of GPIOBUS and make the GPIOBUS constructor private
|
|
|
|
// so that clients cannot use it anymore but have to use the factory.
|
|
|
|
// Also make Init() private.
|
|
|
|
if (auto bus = make_unique<GPIOBUS>(); bus->Init(mode)) {
|
|
|
|
bus->Reset();
|
|
|
|
|
|
|
|
return bus;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
2022-10-25 00:21:40 +00:00
|
|
|
}
|